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 python development libraries, and numpy. To compile the c++, we suggest a virtual python environment with numpy installed.

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()

# you can get the realized channels and sampling rate (might be different from what you requested):
audio_sensor.sample_rate
audio_sensor.channels

# you can print the available detected devices, through a static method
ras.AudioSensor.show_devices()

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.9.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

roboflex_audio_sdl-0.1.9-cp311-cp311-macosx_15_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file roboflex_audio_sdl-0.1.9.tar.gz.

File metadata

  • Download URL: roboflex_audio_sdl-0.1.9.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for roboflex_audio_sdl-0.1.9.tar.gz
Algorithm Hash digest
SHA256 6c8a7a4b0e9350f6e67695b15ecb6e044474cac76aadf639ee0292519d3316d7
MD5 be387f214dda0871644971c4a8cfb235
BLAKE2b-256 ffdaed5c403d6d00ae5b3127519c181908a633cc953e30e92ab94986e7ceda24

See more details on using hashes here.

File details

Details for the file roboflex_audio_sdl-0.1.9-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for roboflex_audio_sdl-0.1.9-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ff78c2f6c9e6c3b0ea66addfc353ce8c92796ae281d75e895d6a230443f07cc1
MD5 895fbd4a5e78f0b5c592c2ecff29ded0
BLAKE2b-256 89e3cc39766e18718e7e45517393b63fcadfd46a4e6e76983089e6677933ee4d

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