# 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()
# 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
Raw data
{
"_id": null,
"home_page": "https://github.com/flexrobotics/roboflex_audio_alsa",
"name": "roboflex.audio-sdl",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "sdl,sdl2,audio,robotics,middleware,flexbuffers,python,c++,c++20",
"author": "Colin Prepscius",
"author_email": "colinprepscius@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/88/a6/9e760849e893ab835d586c4951bca30281bc685cd7dc1e74e0c78483a369/roboflex.audio_sdl-0.1.8.tar.gz",
"platform": null,
"description": "# roboflex.audio_sdl\n\nSupport for reading audio data using Simple Directmedia Layer.\n\n## System dependencies\n\nRequires SDL to be installed. More than likely, it already is installed in your distro. But if not:\n\n apt-get install libsdl2-dev\n\n # or maybe on mac:\n\n brew install sdl2\n\n## pip install\n\n pip install roboflex.audio_sdl\n\n## Import\n\n import roboflex.audio_sdl as ras\n\n## Nodes\n\nThere is only one: **AudioSensor**\n\n # all parameters optional: below are the defaults\n audio_sensor = ras.AudioSensor(\n capture_id = -1,\n channels = 1,\n sampling_rate = 48000,\n capture_samples = 512,\n format = ras.BitDepth.F32,\n name = \"AudioSensor\",\n data_key = \"data\",\n debug = False,\n )\n\n # must be started (like all sensors)!\n audio_sensor.start()\n\n # you can get the realized channels and sampling rate (might be different from what you requested):\n audio_sensor.sample_rate\n audio_sensor.channels\n\n # you can print the available detected devices, through a static method\n ras.AudioSensor.show_devices()\n\nThis 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>.\n\n\n## Other\n\nAvailable BitDepths:\n\n # wrapped from SDL_AudioFormat: https://wiki.libsdl.org/SDL2/SDL_AudioFormat\n\n enum ras.BitDepth:\n S8,\n U8,\n S16LSB,\n S16MSB,\n S16SYS,\n S16,\n U16LSB,\n U16MSB,\n U16SYS,\n U16,\n S32LSB,\n S32MSB,\n S32SYS,\n S32,\n F32LSB,\n F32MSB,\n F32SYS,\n F32\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Roboflex Audio input library using Simple Directmedia Layer (SDL2)",
"version": "0.1.8",
"project_urls": {
"Homepage": "https://github.com/flexrobotics/roboflex_audio_alsa"
},
"split_keywords": [
"sdl",
"sdl2",
"audio",
"robotics",
"middleware",
"flexbuffers",
"python",
"c++",
"c++20"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88a69e760849e893ab835d586c4951bca30281bc685cd7dc1e74e0c78483a369",
"md5": "5621b60822b8aa4a54f5a0294ead309e",
"sha256": "b477e32329a0c492a17282f9b54465daa09ac95ab529ed77fe4ac57ffae213e0"
},
"downloads": -1,
"filename": "roboflex.audio_sdl-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "5621b60822b8aa4a54f5a0294ead309e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9620,
"upload_time": "2023-12-05T19:27:16",
"upload_time_iso_8601": "2023-12-05T19:27:16.271198Z",
"url": "https://files.pythonhosted.org/packages/88/a6/9e760849e893ab835d586c4951bca30281bc685cd7dc1e74e0c78483a369/roboflex.audio_sdl-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-05 19:27:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flexrobotics",
"github_project": "roboflex_audio_alsa",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "roboflex.audio-sdl"
}