pliers.stimuli.AudioStim

class pliers.stimuli.AudioStim(filename=None, onset=None, sampling_rate=None, url=None, clip=None, order=None)[source]

Bases: Stim

Represents an audio clip.

Parameters
  • filename (str) – Path to audio file.

  • onset (float) – Optional onset of the audio file (in seconds) with respect to some more general context or timeline the user wishes to keep track of.

  • sampling_rate (int) – Sampling rate of clip, in hertz.

  • url (str) – Optional url to read contents from.

  • clip (AudioFileClip) – Optional moviepy AudioFileClip to initialize from.

  • order (int) – Optional sequential index of the AudioStim within some containing context.

__init__(filename=None, onset=None, sampling_rate=None, url=None, clip=None, order=None)[source]
get_filename()

Return the source filename of the current Stim.

static get_sampling_rate(filename)[source]

Use moviepy/FFMPEG to get the sampling rate

property history

Return stimulus history.

save(path)[source]

Save clip data to file.

Parameters

path (str) – Filename to save audio data to.