cardioception.devices.tone_player.TonePlayer#
- class cardioception.devices.tone_player.TonePlayer(freq=1000.0, duration=0.03, ramp=0.005, volume=0.5, vib_freq=50.0, vib_duration=0.05, vib_volume=1.0, device=None, clock=None)[source]#
Tones and vibration bursts at scheduled times, through PsychPortAudio.
One stereo output at latency class 1, kept running for the whole session (a master stream with two slaves), so starts are sample-accurate and the Windows audio endpoint never has to wake up. The tone plays on the left channel, the vibration burst on the right one, so the exteroceptive task can drive a tactor through an amplifier from the same jack. Tone and vibration can overlap in time.
schedule()andpoll_onsets()take and return times onclock(the LSL clock by default); the offset toGetSecsis measured once at start.- Parameters
- freq, duration, ramp, volume
The tone: Hz, seconds, seconds of raised-cosine ramp at each end, amplitude 0 to 1.
- vib_freq, vib_duration, vib_volume
The vibration burst, likewise (same ramp).
- device
PsychPortAudio output device index; the system default if omitted.
- clock
The clock of
whenand of the reported onsets.
- __init__(freq=1000.0, duration=0.03, ramp=0.005, volume=0.5, vib_freq=50.0, vib_duration=0.05, vib_volume=1.0, device=None, clock=None)[source]#
Methods
__init__([freq, duration, ramp, volume, ...])close()Stop and release the audio device.
poll_onsets()(handle, onset)of the sounds that have finished since the last call.schedule(when[, kind])Play
kindatwhen(clock seconds).stop_all()Stop everything playing or waiting.
Attributes
busyTrue while any scheduled sound has not yet reported its onset.