Markers#
This section demonstrates how to create an LSL (Lab Streaming Layer) stream with markers using the BrainAccess Board library.
For this example to work:
Ensure that the BrainAccess Board is running and the device is properly connected.
Run the example code provided below.
Open the BrainAccess Board application and connect the Marker stream:
Go to the Configuration tab.
Select Lab Streaming Layer (LSL) in the “Select Source” dropdown menu.
Choose the marker stream and press Connect.
View the markers in the viewer application.
Example: Creating a Marker Stream#
import time
import brainaccess_board as bb
# Create an LSL stream with markers
stim = bb.stimulation_connect(name="BrainAccessMarkers")
# Check if there are consumers for the stream
number = 0
print("Markers will not be sent until Markers LSL stream is connected to BrainAccess Board.")
while True:
if stim.have_consumers():
# Send a marker
stim.annotate(str(number))
print(f"Sent marker: {number}")
number += 1
time.sleep(1)
Description#
Creating the LSL Stream: The function
stimulation_connect()
establishes an LSL stream with the specified name (BrainAccessMarkers in this example).Checking Consumers: The method
have_consumers()
checks if any applications are currently receiving data from this stream.Sending Markers: The method
annotate()
sends a marker (str(number) in the example code) to the stream.
Use this setup to send markers in real-time for event tracking in experiments.