Muse SDK and DLL to use directly from Delphi


#1

Is there information on the DLL used by Muse to access them directly (all calls to the DLL’s and parameters).
We use Delphi 6 for the development and like to work directly with the DLL’s so we can get the data from the 4-7 channels directly into our program.


#2

Hi there HvM,

Currently the SDK just provides tools for streaming Muse data over OSC (https://sites.google.com/a/interaxon.ca/muse-developer-site/sdk-setup). So if Delphi has OSC support, then you can receive the OSC messages in your Delphi program and go from there.

When LibMuse is released, you will have access to the DLL files and should be able to use them natively in Delphi. LibMuse will likely see its first release some time early in the new year, so stay tuned to the developer site for updates.


#3

Hi Tom,

We can read from ASC and getting information start in the background hidden the muse-io.exe and getting data from it but we get this data from it:
/muse/version
/muse/config
/muse/acc
/muse/acc
/muse/eeg
/muse/eeg/quantization
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/eeg
/muse/acc
/muse/drlref
/muse/acc
/muse/acc
/muse/acc
/muse/eeg
etc…

We start with this parameter for the muse-io.exe --preset 12 --50hz --dsp --device Muse --osc-eeg-urls osc.tcp://localhost:4444/dsp/eeg

What are we missing out on?


#4

When you use the oscdump tool in the command prompt, do you also see the data presented this way? Try using oscdump to confirm the messages getting sent to your program are properly formed. Note that you won’t be able to run your program and oscdump at the same time listening to the same port, so either you will have to only run one of them, or modify your command to muse-io to send data to two different ports, e.g.

muse-io.exe --preset 12 --50hz --dsp --device Muse --osc-eeg-urls osc.tcp://localhost:4444/dsp/eeg,osc.tcp://localhost:4445/dsp/eeg

Those are the message paths, it just looks like the actual data following them is missing. It’s possible that the code you are using to parse the messages is not accessing the data but just the path. Can you post a snippet of that code here or check if that’s the case?


#5

You can also use MusePlayer instead of oscdump, I should say, e.g.

muse-player.exe -l 4444

#6

Ok have solved the problem with encoding all fields, and not only the raw stream.
This is the output file snap from the recording, from the Delphi 6 code we wrote and started muse-io with the following.
muse-io.exe --preset 12 --50hz --device Muse --osc osc.udp://localhost:5000 --osc-eeg-urls osc.udp://localhost:5000/dsp/eeg --lsl-eeg EEG

Now we need to sort out the information and use only what we need from it.
It there a way to tell use the real sensor data like this.

/muse/eeg/quantization integer 128
/muse/eeg single 230.297241210938 sensor ?
/dsp/eeg single 230.297241210938 sensor ?
/muse/eeg single 1493.64221191406 sensor ?
/dsp/eeg single 1493.64221191406 sensor ?
/muse/eeg single 1682.81494140625 sensor ?
/dsp/eeg single 1682.81494140625 sensor ?
/muse/eeg single 630.027465820313 sensor ?
/dsp/eeg single 630.027465820313 sensor ?
/muse/eeg single 419.470001220703 sensor ?
/dsp/eeg single 419.470001220703 sensor ?

And can we also get the frequencies from the sensors?
We like to get the frequency, amplitude, and uV from the sensors.

Please let me know if this is possible to get from the muse EEG.


#7

Hey,

The values for the [B]/muse/eeg[/B] path are in uV already. For frequency information you have a few options. For each channel (i.e. sensor) there are OSC paths for Alpha, Beta, Delta, etc. as well as ones for the raw FFT coefficients. See here for more info: https://sites.google.com/a/interaxon.ca/muse-developer-site/museio/osc-paths/osc-paths---v3-6-0

The latest version of MuseIO should send these messages out by default. If you’re using an older version (which it seems you may be doing) you will need to include the --dsp option.

Is there a reason that you are the the --osc and the --osc-eeg-urls options to send duplicate EEG data to the same port with two different paths? As you can see in the output you’ve posted, /dsp/eeg and /muse/eeg contain the same values.


#8

Is this the correct output?

Address /muse/config string {“mac_addr”:“00066668655D”,“serial_number”:“1160-HQRM-655D”,“preset”:“14”,“filters_enabled”:true,“notch_frequency_hz”:60,“battery_data_enabled”:true,“compression_enabled”:true,“eeg_sample_frequency_hz”:3520,“eeg_output_frequency_hz”:220,“eeg_channel_count”:4,“eeg_samples_bitwidth”:10,“eeg_channel_layout”:"TP9 FP1 FP2 TP10 ",“eeg_downsample”:16,“afe_gain”:1961,“battery_percent_remaining”:28,“battery_millivolts”:3773,“eeg_units”:“EEG_MICROVOLTS”,“acc_units”:“ACC_GFORCE”,“eeg_conversion_factor”:1.644980342484907,“drlref_conversion_factor”:3225.806451612903,“acc_conversion_factor”:3.906256109482,“acc_sample_frequency_hz”:50,“drlref_sample_frequency_hz”:10,“acc_data_enabled”:true,“drlref_data_enabled”:true,“error_data_enabled”:true}

Address /muse/version string {“hardware_version”:“16.0.0”,“firmware_headset_version”:“7.2.4”,“firmware_bootloader_version”:“7.2.4”,“firmware_type”:“Consumer”,“build_number”:44,“protocol_version”:2}
/muse/eeg single 835.650024414063
/muse/eeg/quantization integer 16
/muse/eeg single 967.248413085938
/muse/eeg single 914.609069824219
/muse/eeg single 783.010620117188
/muse/eeg single 783.010620117188
/muse/eeg single 914.609069824219
/muse/eeg single 940.928771972656
/muse/eeg single 835.650024414063
/muse/eeg single 730.371276855469
/muse/eeg single 835.650024414063
/muse/eeg single 940.928771972656
/muse/eeg single 888.289367675781
/muse/elements/alpha_relative single NAN
/muse/elements/beta_relative single NAN
/muse/elements/delta_relative single NAN
/muse/elements/gamma_relative single NAN
/muse/elements/theta_relative single NAN
/muse/elements/horseshoe single 4
/muse/elements/is_good integer 0
/muse/elements/blink integer 0
/muse/elements/jaw_clench integer 0
/muse/elements/touching_forehead integer 1
/muse/elements/experimental/concentration single 0.0834999978542328
/muse/elements/experimental/mellow single 0.0834999978542328
/muse/elements/raw_fft0 single -11.3490076065063
/muse/elements/raw_fft1 single -36.1557998657227
/muse/elements/raw_fft2 single -34.6260185241699
/muse/elements/raw_fft3 single -15.1432619094849
/muse/elements/low_freqs_absolute single 0
/muse/elements/alpha_absolute single 0
/muse/elements/beta_absolute single 0
/muse/elements/delta_absolute single 0
/muse/elements/gamma_absolute single 0
/muse/elements/theta_absolute single 0
/muse/elements/alpha_session_score single 1
/muse/elements/beta_session_score single 1
/muse/elements/delta_session_score single 1
/muse/elements/gamma_session_score single 1
/muse/elements/theta_session_score single 1
/muse/eeg single 756.690979003906
/muse/eeg single 756.690979003906
/muse/eeg single 914.609069824219
/muse/eeg single 914.609069824219
/muse/drlref single 1645161.25
/muse/eeg single 783.010620117188
/muse/eeg/quantization integer 16

Or do I have it wrong, I can read this via de muse-io.exe --preset 12 --50hz --device Muse --osc osc.udp://localhost:5000

Why is the raw_fft0 single -11.3490076065063 and not 11.3490076065063
and I cannot see the pattern in the /muse/eeg single, somtimes 10 in the row and then 2 and then 6 or any number in the rows of /muse/eeg single

It is not clear to me how to get this [B]Four channel (10bits): ffff[/B]

  • Position 1: Left Ear(TP9), Range: 0.0 - 1682.0 in microvolts
  • Position 2: Left Forehead(FP1), Range: 0.0 - 1682.0 in microvolts
  • Position 3: Right Forehead(FP2), Range: 0.0 - 1682.0 in microvolts
  • Position 4: Right Ear(TP10), Range: 0.0 - 1682.0 in microvolts

I can see /muse/elements/raw_fft0 to 3 but how to connect the microvolts to it I have no Idee.

Please any help will do.

Thanks


#9

Hi HvM,

Your muse-io command looks fine. The problem must be in how you are parsing the OSC messages. It looks like you are only accessing the first value in the payload of each packet. For instance, /muse/eeg should contain four floats as described in the documentation. Furthermore, the /muse/elements/raw_fft0 message should contain 129 elements, not just one.

Please try using muse-player and compare the output of your program to it. The command [I]muse-player.exe -l 5000[/I] should work for receiving and printing out messages received on port 5000.

The raw FFT data is sometimes negative because it is the log value of the Power Spectral Density (PSD) at a given frequency. So if the PSD is less than one, the log value of it will be negative.

The FFT data is not in microvolts. It is measured in log(uV^2/Hz). Only the time domain EEG data is in microvolts.