-
Notifications
You must be signed in to change notification settings - Fork 132
Tutorial 1: Getting started with LSL (single stream)
In this tutorial you get to know the basic building blocks of LSL. You will open an LSL stream of the microphone of your computer, save it to a xdf file using the LabRecorder and load the resulting file data into MATLAB.
For this tutorial you need
- A Windows Computer with a microphone
- MATLAB (for visualization and data import)
- The LSL MATLAB Viewer (for visualizing the stream)
- The LSL MATLAB Importer (for loading the data into MATLAB)
- The LSL LabRecorder version 12.2b (for data acquisition )
- The LSL AudioCaptureWin App (for streaming the microphone input)
The LSL App can be downloaded from the ftp as .zip files.
Make sure that you have connected a microphone to your computer and that it is selected as the "default recording device" (you should be able to set this in your Control Panel).
- Start AudioCaptureWin.exe
- You should see a window like the following.
* Click the "Link" button to link the app to the lab network. If successful, the button should turn into "Unlink". If a firewall complains, allow the app to connect to the network.
* You should now have a stream on your lab network that has type "Audio" and its name is "AudioCaptureWin". Note that you cannot close the app while it is linked.
* You just created your first LSL stream that captures the microphone of your PC.
-
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