Skip to main content

Roboflex Audio input library using Simple Directmedia Layer (SDL2)

Project description

roboflex.audio_sdl

Support for reading audio data using Simple Directmedia Layer.

System dependencies

Requires SDL to be installed. More than likely, it already is installed in your distro. But if not:

apt-get install libsdl2-dev

# or maybe on mac:

brew install sdl2

pip install

pip install roboflex.audio_sdl

Import

import roboflex.audio_sdl as ras

Nodes

There is only one: AudioSensor

# all parameters optional: below are the defaults
audio_sensor = ras.AudioSensor(
    capture_id = -1,
    channels = 1,
    sampling_rate = 48000,
    capture_samples = 512,
    format = ras.BitDepth.F32,
    name = "AudioSensor",
    data_key = "data",
    debug = False,
)

# must be started (like all sensors)!
audio_sensor.start()

This sensor publishes a TensorMessage, with the audio data encoded into a tensor of shape (C, S), where C is num channels, and S is capture_samples, under the key <data_key>.

Other

Available BitDepths:

# wrapped from SDL_AudioFormat: https://wiki.libsdl.org/SDL2/SDL_AudioFormat

enum ras.BitDepth:
    S8,
    U8,
    S16LSB,
    S16MSB,
    S16SYS,
    S16,
    U16LSB,
    U16MSB,
    U16SYS,
    U16,
    S32LSB,
    S32MSB,
    S32SYS,
    S32,
    F32LSB,
    F32MSB,
    F32SYS,
    F32

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

roboflex.audio_sdl-0.1.5.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file roboflex.audio_sdl-0.1.5.tar.gz.

File metadata

  • Download URL: roboflex.audio_sdl-0.1.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for roboflex.audio_sdl-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5699b9d7ae7ba472b3a0a09828322d0700e16284425b598b440b30c79b1bb3b8
MD5 262e7f0b33bb026263daa3dca405a502
BLAKE2b-256 1443c3e1ec2b9128bf561c72590b32a5fffa3939fa00367aed0d6be09e6ddacd

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