Skip to main content

Psychopy sound analysis and generation scripts

Project description

psychosnd

version number: 0.0.12 author: Gavin Cooper

Overview

Psychopy sound analysis and generation scripts.

It contains a thin wrapper on the csv module to open a Psychopy csv data file and provide an interface similar to the prespy library.

Two command-line tools are provided:

  • psych-scla — analyses the latency between port triggers and recorded sounds, relying on the sound card latency analyser in the prespy library.
  • psych-gensnd — generates stereo .wav tone files suitable for use in PsychoPy experiments, with configurable frequency, duration, amplitude, ramp times, and channel routing.

Installation / Usage

To install use pip:

$ pip install psychosnd

Or with uv:

$ uv tool install psychosnd

psych-scla

Analyse the difference in sound presentation times between a sound recording and a PsychoPy log file:

$ psych-scla <soundfile> <logfile>

For the full procedure see the write up in the prespy documentation here.

For all available options:

$ psych-scla --help

psych-gensnd

Generate .wav tone files from the command line. Durations are given in milliseconds:

$ psych-gensnd 30 60 --frequency 1000

This produces 1000Hz30ms.wav and 1000Hz60ms.wav — stereo 16-bit PCM files at 48 kHz with 5 ms raised-cosine ramps applied by default.

The output filename pattern, sample rate, amplitude, bit depth, and sound type (normal, phase-shifted, interaural time delay, single-ear) are all configurable:

$ psych-gensnd 50 100 -f 440 -r 44100 --type sing --ear left
$ psych-gensnd 30 --output "{freq}Hz_{dur}ms_ild.wav"

For all available options:

$ psych-gensnd --help

Contributing

See CONTRIBUTING.md for development setup instructions and the release process.

Example

Generate a set of tones at 1000 Hz for two durations, then analyse a recording:

$ psych-gensnd 30 60 --frequency 1000
$ psych-scla recording.wav experiment_log.csv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psychosnd-0.0.13.tar.gz (334.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psychosnd-0.0.13-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file psychosnd-0.0.13.tar.gz.

File metadata

  • Download URL: psychosnd-0.0.13.tar.gz
  • Upload date:
  • Size: 334.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for psychosnd-0.0.13.tar.gz
Algorithm Hash digest
SHA256 0ae21cc126a3374955ee91e7ced42c552d009f8337549eda9bb930a7fc1976d1
MD5 39876e659620b40d21c12bee417a4798
BLAKE2b-256 f5dccd80143e64475a8a1f6e5d334b3ff1673cccfa22c1fd7d805af62ad9b567

See more details on using hashes here.

File details

Details for the file psychosnd-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: psychosnd-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for psychosnd-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 ffd57dee9fbd98b39ca07f0ba83b1cdf7ebed8789756b5011676d60731823b71
MD5 315d8ab70805a9303faf316b5885fa97
BLAKE2b-256 ccfbc6e922ef71822f566ae3a65cec423f960aa0196ae76e44f04ace6929b95c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page