expyfun.stimuli.play_sound#

expyfun.stimuli.play_sound(sound, fs=None, norm=True, wait=False, backend='auto')[source]#

Play a sound

Parameters:
soundarray

1D or 2D array of sound values.

fsint | None

Sample rate. If None, the sample rate will be inferred from the sound file (if sound is array, it is assumed to be 44100).

normbool

If True, normalize sound to between -1 and +1.

waitbool

If True, wait until the sound completes to return control.

backendstr

The backend to use.

Returns:
sndinstance of SoundPlayer

The object playing sound. Can use “stop” to stop playback. Note that the sound player will be cleared/deleted once the sound finishes playing.

Examples using expyfun.stimuli.play_sound#

Generate sample stimuli

Generate sample stimuli

Generate more advanced auditory stimuli

Generate more advanced auditory stimuli

Generate texture stimuli

Generate texture stimuli

Generate vocoded stimuli

Generate vocoded stimuli