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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roboflex_audio_sdl-0.1.10.tar.gz.
File metadata
- Download URL: roboflex_audio_sdl-0.1.10.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d274b8f354c05c09b9b58066a8cb7211fba691c0af6896a104e57b33db0efaf4
|
|
| MD5 |
03afd13707978e57ed2d264265793d75
|
|
| BLAKE2b-256 |
9daf88f0c4a81747e6e244448a91ead9e8b7fdcc7d7cf9b2742f7afb56789d5d
|
File details
Details for the file roboflex_audio_sdl-0.1.10-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: roboflex_audio_sdl-0.1.10-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7162db109960f1757a12ee4a365cfd7cdc3a7ab8ddd975cc4b5860d7dc6a89af
|
|
| MD5 |
82da6f1c171cce376bce9847e5511fcc
|
|
| BLAKE2b-256 |
2b768e49e3bca8947de362d671aea5681ad2f6f9808b3f02304905b34e0c9920
|