stimuli.audio.Noise¶
- class stimuli.audio.Noise(volume, sample_rate=44100, duration=1, color='white')¶
Colored noise stimulus.
- Parameters:
- volume
float
|tuple
If an int or a float is provided, the sound will use only one channel (mono). If a 2-length tuple is provided, the sound will use 2 channels (stereo). The volume of each channel is given between 0 and 100. For stereo, the volume is given as (L, R).
- sample_rate
float
Sampling frequency of the sound. The default is 44100 Hz.
- duration
float
Duration of the sound. The default is 1 second.
- color
str
The noise color. Available colors are:
'white'
,'pink'
,'blue'
,'violet'
and'brown'
.
- volume
Attributes
The noise color.
Sound's duration [seconds].
Number of samples.
Sound's sampling rate [Hz].
Sound's signal.
Times array.
Sound's volume(s) [AU].
Window applied to the signal.
Methods
copy
([deep])Copy the sound.
play
([blocking])Play the sound.
save
(fname[, overwrite])Save a sound signal into a .wav file.
stop
()Stop the sounds played on the active audio stream.
- copy(deep=True)¶
Copy the sound.
- Parameters:
- deep
bool
If
True
,deepcopy()
is used instead ofcopy()
.
- deep
- play(blocking=False)¶
Play the sound.
This function creates and terminates an audio stream.
- Parameters:
- blocking
bool
If True, playing the sounds blocks the interpreter.
- blocking
- save(fname, overwrite=False)¶
Save a sound signal into a .wav file.
The saving is handled by
scipy.io.wavfile.write()
.
- stop()¶
Stop the sounds played on the active audio stream.
- property color¶
The noise color.
- property duration¶
Sound’s duration [seconds].
- property n_samples¶
Number of samples.
- property sample_rate¶
Sound’s sampling rate [Hz].
- property signal¶
Sound’s signal.
- property times¶
Times array.
- property volume¶
Sound’s volume(s) [AU].
- property window¶
Window applied to the signal.