sound#

class perceptivo.types.sound.Audio_Config(fs: int = 44100)#

Bases: object

Base class for audio configuration

Params:

fs (int): Sampling rate in Hz, default 44100

fs: int = 44100#
class perceptivo.types.sound.Jackd_Config(fs: int = 44100, bin: pathlib.Path = <factory>, priority: int = 75, driver: str = 'alsa', device_name: typing.Union[str, int] = 'hw:sndrpihifiberry', nperiods: int = 3, period: int = 1024, playback_only: bool = True, outchannels: list = <factory>)#

Bases: perceptivo.types.sound.Audio_Config

Configure the jackd daemon used by the sound server, see https://linux.die.net/man/1/jackd

Params:

bin (pathlib.Path): Path to the jackd binary priority (int): Priority to run the process (higher is better), default 75 driver (str): Driver to use, default ‘alsa’ device_name (str, int): Device to use in alsa’s parlance, default ‘hw:sndrpihifiberry’.

Also accepts ints for use with coreaudio

nperiods (int): Number of periods per buffer cycle, default 3 period (int): size of period, default 1024 samples. launch_str (str): launch string with arguments compiled from the other arguments

bin: pathlib.Path#
priority: int = 75#
driver: str = 'alsa'#
device_name: Union[str, int] = 'hw:sndrpihifiberry'#
nperiods: int = 3#
period: int = 1024#
playback_only: bool = True#
outchannels: list#
property launch_str: str#
class perceptivo.types.sound.Sound(*, frequency: float, amplitude: float, duration: float = 0.5, sound_type: Literal['Gammatone'] = 'Gammatone', timestamp: datetime.datetime = None, jack_client: JackClient = None, uuid: str = None)#

Bases: pydantic.main.BaseModel

Parameterization of an abstract probe sound

Parameters
  • frequency (float) – Frequency in Hz

  • amplitude (float) – Amplitude in dbSPL

  • duration (float) – Duration of sound in seconds

Variables

~Sound.uuid (str) – Unique UUID to identify sounds

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

frequency: float#
amplitude: float#
duration: float#
sound_type: Literal['Gammatone']#
timestamp: Optional[datetime.datetime]#
jack_client: Optional[JackClient]#
uuid: str#
class Config#

Bases: object

arbitrary_types_allowed: bool = True#
stamp_time()#

Record the time that the sound is played in Sound.timestamp

property sound_kwargs: dict#

Sound kwargs that the sound class accepts

(ie. filtering out sound_type and others the sound class doesn’t take)

Returns

dict of arguments

property sound_class: autopilot.stim.sound.base.Sound#

The sound class that corresponds to the sound_type retrieved from the perceptivo.sound.sounds module.

Returns

autopilot.stim.sound.sounds.Jack_Sound - The sound class!