Skip to main content

OpenSesame Plug-in: Audio Low Latency

An OpenSesame plug-in for playing and recording audio files with low latency.

Copyright, 2022, Bob Rosbag

About

The main goal of this plug-in is to play and record audio with minimal and predictable latencies to achieve a high accuracy and precision. The 'PyAlsaAudio' package which uses the Linux ALSA audio system provided the best results within Python. 'PortAudio' and 'sounddevice' are cross-platform and work on both Windows as Linux.

This plug-in consist of playback and recording items as well as foreground as background (multi-threaded) items. Both playback and recording have their own init item. These should be placed at the beginning of an experiment.

Difference between foreground and background:

  • Foreground items play/record until the file ends or the set duration has passed.
  • Background items consist of a 'start', 'wait' and 'stop' item. These are fully multi-threaded. After the start of the playback/recording, the item will immediately advance to the next item. When it reaches the 'stop' or 'wait' item, it will stop the audio or wait until the file ends or duration has passed.

Seven items for playback:

  • Play Init initialization of the playback audio device, this should be placed at the beginning of an experiment.

Foreground:

  • Play starts the playback of audio, it will play the entire audio file or will stop after the set duration has passed before continuing to the next item in the experiment.

Background:

  • Play Start starts the playback of audio, it will directly advance to the next item in the experiment.

  • Play Wait waits until the thread from 'Play Start' is finished (end of audio or surpassing the duration) before advancing to the next item in the experiment.

  • Play Stop sends a stop signal to the 'Play Start' thread to stop immediately and checks if the thread has finished.

  • Play Pause pauses playback of audio.

  • Play Resume resumes playback of audio.

Seven items for recording:

  • Record Init initialization of the playback audio device, this should be placed at the beginning of an experiment.

Foreground:

  • Record starts the recording of audio, it will record for the set duration before continuing to the next item in the experiment.

Background:

  • Record Start starts the recording of audio, it will directly advance to the next item in the experiment.

  • Record Wait waits until the thread from 'Record Start' is finished (surpassing the duration) before advancing to the next item in the experiment.

  • Record Stop sends a stop signal to the 'Record Start' thread to stop immediately and checks if the thread has finished.

  • Record Pause pauses recording of audio.

  • Record Resume resumes recording of audio.

Timestamps can be found in the log file by the name: time_stimulus_onset_[item_name]

Known bugs:

  • Recording with the PyAudio module does not seem to work at the moment

License

This software is distributed under the terms of the GNU General Public License 3. The full license should be included in the file COPYING, or can be obtained from:

This plug-in contains works of others. Icons are derivatives of the Faience icon theme, Faenza icon theme and Papirus icon theme.

Documentation

Installation instructions and documentation on OpenSesame are available on the documentation website:

Metadata

Release files for opensesame-plugin-audio-low-latency 11.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensesame-plugin-audio-low-latency 11.0.1
File Size Uploaded
opensesame_plugin_audio_low_latency-11.0.1.tar.gz 121.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opensesame-plugin-audio-low-latency 11.0.1
File Interpreter ABI Platform
opensesame_plugin_audio_low_latency-11.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 293.8 kB

Release files / opensesame_plugin_audio_low_latency-11.0.1.tar.gz

Download URL opensesame_plugin_audio_low_latency-11.0.1.tar.gz
Size 121.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bb95b477685460a0570c071303d3a1788a927326f3c90505b21683d1bff4ce85
BLAKE2b-256 checksum
How to use checksums
a55ebba35fe1b65b892d25e45d5b3a0acdeb5ff789629fedea269761e2bd83d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / opensesame_plugin_audio_low_latency-11.0.1-py3-none-any.whl

Download URL opensesame_plugin_audio_low_latency-11.0.1-py3-none-any.whl
Size 172.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97842499996930ad304ef5f02d00e14517731a3b37098a1bdc1b24ca7f3095f2
BLAKE2b-256 checksum
How to use checksums
36b91e2f0fbfbdef29381b75879a7c0d4493e6c2554fb230e84dd36cf904a499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

11.0.1 This release

2 release files

10.9.1

2 release files

10.9.0

2 release files

10.7.0

2 release files

10.6.2

2 release files

10.6.1

2 release files

10.6.0

2 release files

10.5.0

2 release files

10.4.0

2 release files

10.2.0

2 release files

10.0.2

2 release files

10.0.1

2 release files

10.0.0

2 release files

9.3.0

2 release files

9.2.0

2 release files

9.1.0

2 release files

9.0.0

2 release files

8.9.2

2 release files

8.9.0

2 release files

8.8.0

2 release files

8.7.0

2 release files

8.6.0

2 release files

8.5.0

2 release files

8.4.0

2 release files

8.3.0

2 release files

8.2.0

2 release files

8.0.2

2 release files

8.0.1

2 release files

8.0.0

2 release files

7.0.0

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.3.0

2 release files

5.2.0

2 release files

5.1.0

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page