Petal Docs
Search…
Receive an OSC Stream

Receiving an OSC Stream (UDP)

OSC, or Open Sound Protocol, is a protocol that provides typed fields for high frequency streams. It can be used to stream or ingest device EEG data. To receive an OSC stream, you can also use some of the example scripts in the getting started repo.
In order to get around byte-based precision limitations of OSC data types, our data streams all have the following formatted prefix:
  • int: sample ID
  • int: unix timestamp (whole number)
  • float: unix timestamp (decimal)
  • int: LSL timestamp (whole number)
  • float: LSL timestamp (decimal)

Raw Data Stream Topics & Format

‚ÄčTelemetry (topic: /PetalStream/telemetry):
  • float: battery level
  • float: temperature
  • float: fuel gauge voltage
EEG (topic: /PetalStream/eeg):
  • float: channel 1
  • float: channel 2
  • float: channel 3
  • float: channel 4
Acceleration and Gyroscope (topics: /PetalStream/acceleration and /PetalStream/gyroscope):
  • float: x
  • float: y
  • float: z
PPG (Experimental, Muse S only, topic: /PetalStream/ppg):
  • float: ambient
  • float: IR
  • float: red
connection_status (/PetalStream/connection_status):
  • int: connected (0 or 1)
Example python snippet for decoding an OSC stream:
1
def print_petal_stream_handler(unused_addr, *args):
2
sample_id = args[0]
3
unix_ts = args[1] + args[2]
4
lsl_ts = args[3] + args[4]
5
data = args[5:]
6
print(
7
f'sample_id: {sample_id}, unix_ts: {unix_ts}, '
8
f'lsl_ts: {lsl_ts}, data: {data}'
9
)
Copied!
Last modified 3mo ago