Skip to content

Tutorial 1: Getting started with LSL (single stream)

mgbleichner edited this page Dec 21, 2016 · 22 revisions

In this tutorial you get to know the basic building blocks of LSL.

For this tutorial you need

The LSL App can be downloaded from the ftp as .zip files.


  • Start AudioCaptureWin.exe

    • Press ‘Link’.
    • You just created your first LSL stream that captures the inbuilt microphone.
  • Start MATLAB (we use here Version 12) and change to the directory MATLAB viewer

    • Run the vis_stream.m script: type ‘vis_stream’
    • Select the AudioCaptureWin Stream, press ‘OK’
    • You now see two line for the incoming microphone input. By default The arrow keys allow you the change the figure’s Y -axis (i.e. amplitude, up arrow, down arrow) and the X-axis (i.e. time, left arrow right arrow)
  • Start LabRecorder.exe. The [LabRecorder] (https://github.com/sccn/labstreaminglayer/wiki/LabRecorder.wiki) stores all datastreams into a single .xdf file.

    • You should see the AudioCaptureStream
    • You select which streams you want to record from by checking the check boxes next to them.
    • The entry in "Storage Location" shows you the file name (or file name template) where your recording will be stored. You can change this by clicking the browse button.
    • If this string contains any occurrence of %n, it will be replaced by the value in the "Experiment Number“ field. When you start the recorder or load a configuration file, this field will be set automatically to the lowest number for which no directory exists yet
    • If the string contains any occurrence of %b, it will be substituted by the selected string under "Current experiment block".
    • If the respective directory does not yet exist, it will be created automatically (except if you do not have the permissions to create it). If the file that you are trying to record to already exists, the existing file will be renamed (the string _oldX will be appended where X is the lowest number that is not yet occupied by another existing file). This way, it is impossible to accidentally overwrite data.
    • Record data for some seconds while you are speaking into the microphone
    • When you are done recording click the “Stop” button.
  • In MATLAB change to the directory of MATLAB Importer

    • Load the xdf file you just recorded: data=load_xdf(‘C:\yourfilepath\’)
    • Familiarize yourself with the data structure
    • The structure holds all recorded LSL streams ( in this case only one)
      • .info contains all meta information about the stream
      • .time_stamps contains the timing information
      • .time_series contains the data
      • Visualize the data with the corresponding time axis  
Clone this wiki locally