Sound#

The psychos.sound module provides functionality for reproducing sound stimuli (synthetic or from .wav files) during experiments. It builds upon pyglet.media to manage sound playback efficiently.

Sounds#

Functions and classes to create sound stimuli for playback during experiments.

psychos.sound.load_sound(filename[, file, ...])

Load a Source from disk, or an opened file.

psychos.sound.Sawtooth(duration[, ...])

Sawtooth wave generator.

psychos.sound.Silence(duration[, frequency, ...])

Silence generator.

psychos.sound.Sine(duration[, frequency, ...])

Sine wave generator.

psychos.sound.Square(duration[, frequency, ...])

Square wave generator.

psychos.sound.Triangle(duration[, ...])

Triangle wave generator.

psychos.sound.WhiteNoise(duration[, ...])

White noise generator.

Envelopes#

Classes to create envelopes for controlling sound volume dynamics over time.

psychos.sound.Envelope()

Base class for SynthesisSource amplitude envelopes.

psychos.sound.FlatEnvelope([amplitude])

A flat envelope, providing basic amplitude setting.

psychos.sound.LinearDecayEnvelope([peak])

A linearly decaying envelope.

psychos.sound.TremoloEnvelope(depth, rate[, ...])

A tremolo envelope, for modulation amplitude.

Player#

Pyglet classes for advanced sound management, such as grouping multiple sounds for simultaneous playback or continuous streaming scenarios.

psychos.sound.Player()

High-level sound and video player.

psychos.sound.PlayerGroup(players)

Group of players that can be played and paused simultaneously.

psychos.sound.StaticSource(source)

A source that has been completely decoded in memory.

psychos.sound.StreamingSource()

A source that is decoded as it is being played.

Compatibility Troubleshooting#

All sound functionalities in Psychos rely on the pyglet implementation, which attempts to locate a compatible audio driver on your system. If you encounter issues with sound playback or compatibility, consult the Pyglet media documentation for guidance on installing or troubleshooting compatible audio drivers.

The default settings typically work well for most platforms (Linux, macOS, Windows).