expyriment.stimuli.Audio

class expyriment.stimuli.Audio(filename)

A class implementing a general auditory stimulus.

Notes

See also

  • expyriment.control.start_audiosystem
  • expyriment.control.stop_audiosystem
  • expyriment.control.audiosystem_is_busy
  • expyriment.control.audiosystem_wait_end

Methods

__init__(filename)

Create an audio stimulus.

Parameters :

filename : str

the filename

copy()

Copy the stimulus.

Returns :

copy: stimulus.Audio :

Returned copy will NOT be is_preloaded!

filename

Getter for filename

id

Getter for id.

is_preloaded

Getter for is_preloaded

logging

Getter for logging.

play(loops=0, maxtime=0, fade_ms=0)

Play the audio stimulus.

The function returns immediately after the sound started to play. A pygame.mixer.Channel object is returned.

Parameters :

loops : int, optional

how often to repeat (-1 = forever) (default = 0)

maxtime : int

stop after given amount of milliseconds (default = 0)

fade_ms : int, optional

fade in time in milliseconds (default = 0)

preload()

Preload stimulus to memory.

present()

Presents the sound.

The function is identical to Audio.play(loops=0, maxtime=0, fade_ms=0) and returns also immediately after the sound started to play.

Notes

See Audio.play for more information.

set_logging(onoff)

Set logging of this object on or off

Parameters :

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

stop()

Stop the audio stimulus

unload()

Unload stimulus from memory.

This removes the reference to the object in memory. It is up to the garbage collector to actually remove it from memory.

Previous topic

expyriment.stimuli.extras.VisualMask

Next topic

expyriment.stimuli.BlankScreen

This Page