Audio🔗
The audio module provides classes for generating standard audio stimuli and for loading existing files.
Sound generation🔗
Standard sounds can be generated like noise, amplitude modulated sounds or pure tones.
|
Colored noise stimulus. |
|
Amplitude modulated sound. |
|
Pure tone stimulus at a given frequency. |
Example usage:
from stimuli.audio import Noise
sound = Noise(color="pink", volume=50, duration=1)
sound.play(when=0.2) # schedule in 200 ms
Sound files🔗
For more complex stimuli, the sounds can be loaded from files.
|
Auditory stimulus loaded from a file. |
Example usage:
from stimuli.audio import Sound
sound = Sound("path/to/sound.wav")
sound.play(when=0.2) # schedule in 200 ms
Backend🔗
The audio module uses the sounddevice library with a callback function to play the sounds.
|
Sounddevice backend for audio playback. |