stimuli.audio.Sound¶
- class stimuli.audio.Sound(fname)¶
Auditory stimulus loaded from a file.
Attributes
Sound's duration [seconds].
The sound's original file name.
Number of samples.
Sound's sampling rate [Hz].
Sound's signal.
Times array.
Right-edge of the signal crop [seconds].
Left-edge of the signal crop [seconds].
Sound's volume(s) [AU].
Window applied to the signal.
Methods
copy
([deep])Copy the sound.
crop
([tmin, tmax])Crop the sound between
tmin
andtmax
.play
([blocking])Play the sound.
reset
()Reset the signal to the original loaded signal.
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
- crop(tmin=None, tmax=None)¶
Crop the sound between
tmin
andtmax
.- Parameters:
Notes
The time-based selection selects the samples in the closed interval
[tmin, tmax]
.
- 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
- reset()¶
Reset the signal to the original loaded signal.
- 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 duration¶
Sound’s duration [seconds].
- property fname¶
The sound’s original file name.
- property n_samples¶
Number of samples.
- property sample_rate¶
Sound’s sampling rate [Hz].
- property signal¶
Sound’s signal.
- property times¶
Times array.
- property tmax¶
Right-edge of the signal crop [seconds].
- property tmin¶
Left-edge of the signal crop [seconds].
- property volume¶
Sound’s volume(s) [AU].
- property window¶
Window applied to the signal.