Forums
Deliver clicks at given rate Analog Output Module - Printable Version

+- Forums (https://sanworks.io/forum)
+-- Forum: Bpod (https://sanworks.io/forum/forumdisplay.php?fid=1)
+--- Forum: Software (https://sanworks.io/forum/forumdisplay.php?fid=6)
+--- Thread: Deliver clicks at given rate Analog Output Module (/showthread.php?tid=568)



Deliver clicks at given rate Analog Output Module - veronica - 04-26-2019

Hi,

I would like to deliver auditory clicks at a given rate using the Bpod Analog Output Module. Is this possible? Which firmware would I need to use for the module and is there any documentation on how to implement the delivery of the stimulus? 

Thanks a lot!
Veronica


RE: Deliver clicks at given rate Analog Output Module - Josh - 04-26-2019

Hi Veronica,


With its default WavePlayer firmware, the analog output module can play waveforms you program into it in advance.

To create a waveform of clicks in MATLAB, you'd do the following (assuming your sampling rate is 50kHz)

MyWave = zeros(1,500000);

This will play 0V at each of 50,000 samples per second, lasting for 10 seconds.

Then, at each position where you want to play a click, change two samples from [0 0] to:
[1 -1]

So two clicks 100 microseconds apart would look like:

...0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, 0, 0, 0... 

Once you have the waveform you want, you can load it to the WavePlayer with the loadWaveform() method. Assuming you initialized the WavePlayer as 'W', it would be:

W.loadWaveform(3, MyWave); % Load the waveform as Wave# 3

Then, you can trigger it from the MATLAB command line with:
W.Play(1:4, 3); % Play waveform 3 on channels 1-4

Please let us know if this works for you!

Best,

-Josh