reiz.audio

Creating and managing auditory stimuli

During import, a basic library will be created. By default, it contains the following set of auditory stimuli: start, beep. These stimuli can be addressed by dot.notation from reiz.audio.library, for example like reiz.audio.library.beep

Building blocks for auditory stimuli

class Message(message='Silence is golden', language='de')[source]

Text-to-Speech Audio Stimulus

If reiz was installed with [tts] as extra, this class will use pyttsx3 to generate auditory stimuli on demand. If pyttsx3 is not found, there will be only silence when creating an audio.Message.

class Hertz(duration_in_ms=500, frequency=440, volume=1)[source]

instantiate a sine wave with ramp-up and ramp-down period of volume

Parameters
  • duration_in_ms (float) – duration of the sound in ms

  • frequency (int) – frequency in Hz

  • volume (float) – relative volume

class AudioFile(filepath)[source]

instantiate a sound object from a wav-file

Parameters

filepath (str) – path to the wav-file

class Noise(duration_in_ms=500, kind='white', volume=1)[source]

instantiate a noise wave

Parameters
  • duration_in_ms (float) – duration of the sound in ms

  • kind (str) – either “white” or “brown”

  • volume (float) – relative volume

Create libraries of auditory stimuli

libConf(x)

Dict[str, Dict[str, Any], a dictionary of types and respective keywords arguments

library = namespace(start='Message', beep='Hertz')

a library of auditory stimuli

make_library(settings={'Hertz': {'beep': {'duration_in_ms': 1000}}, 'Message': {'start': {'message': 'start'}}}, failraise=False)[source]

create a library of auditory stimuli from a dictionary of arguments

Parameters
  • settings (NewType()(libConf, Dict[str, Dict[str, Any]])) – a dictionary of types with kwargs appropriate to the respective type as dictionary

  • failraise (bool) – raise an exception if a key is not recognized. defaults to False

Returns

a library of instances of stimuli which can be adressed in dot.notation

Return type

library

read_folder(path=None)[source]

create an audio library from path

Return type

SimpleNamespace