{"id":35221775,"url":"https://github.com/irmen/pyminiaudio","last_synced_at":"2026-04-18T01:11:39.517Z","repository":{"id":41508601,"uuid":"194569959","full_name":"irmen/pyminiaudio","owner":"irmen","description":"python interface to the miniaudio audio playback, recording, decoding and conversion library","archived":false,"fork":false,"pushed_at":"2026-03-24T20:55:14.000Z","size":5413,"stargazers_count":175,"open_issues_count":8,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-03-26T01:31:45.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irmen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-06-30T23:14:07.000Z","updated_at":"2026-03-24T20:55:18.000Z","dependencies_parsed_at":"2024-06-18T15:32:31.060Z","dependency_job_id":"5801aeb7-3572-4838-bd06-4fdd7e5e4f23","html_url":"https://github.com/irmen/pyminiaudio","commit_stats":{"total_commits":188,"total_committers":4,"mean_commits":47.0,"dds":0.03191489361702127,"last_synced_commit":"9851563bceb5024879f2d13345dc71750e675bb6"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/irmen/pyminiaudio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyminiaudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyminiaudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyminiaudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyminiaudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irmen","download_url":"https://codeload.github.com/irmen/pyminiaudio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyminiaudio/sbom","scorecard":{"id":494456,"data":{"date":"2025-08-11","repo":{"name":"github.com/irmen/pyminiaudio","commit":"601d03ceb6f7c3886aa295d0b4459424732f1547"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/wheelbuilder.yml:1","Warn: no topLevel permission defined: .github/workflows/wheeltest.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheelbuilder.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheelbuilder.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheeltest.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheeltest.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheeltest.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheeltest.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheeltest.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheeltest.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheeltest.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/irmen/pyminiaudio/wheeltest.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:39","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/wheelbuilder.yml:64"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-43017 / GHSA-qwmp-2cf2-g9g6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T20:07:00.293Z","repository_id":41508601,"created_at":"2025-08-19T20:07:00.293Z","updated_at":"2025-08-19T20:07:00.293Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31952275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"ssl_error","status_checked_at":"2026-04-18T00:39:20.671Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-30T00:09:34.386Z","updated_at":"2026-04-18T01:11:39.498Z","avatar_url":"https://github.com/irmen.png","language":"C","funding_links":[],"categories":["Playback \u0026 Services"],"sub_categories":["Text-to-Speech"],"readme":"[![Latest Version](https://img.shields.io/pypi/v/miniaudio.svg)](https://pypi.python.org/pypi/miniaudio/)\n\n\n# Python miniaudio\n\nMultiplatform audio playback, recording, decoding and sample format conversion for\nLinux (including Raspberri Pi), Windows, Mac and others.\n\nInstallation for most users: via [Pypi](https://pypi.org/project/miniaudio/), Raspberri Pi builds via [PiWheels](https://www.piwheels.org/project/miniaudio/).\n\n\nThis is a Pythonic interface to the cross-platform [miniaudio](https://github.com/dr-soft/miniaudio/) C library:\n\n- audio operations run in the background\n- python bindings for most of the functions offered in the miniaudio library:\n  - reading and decoding audio files\n  - getting audio file properties (such as duration, number of channels, sample rate)\n  - converting sample formats and frequencies\n  - streaming large audio files\n  - audio playback\n  - audio recording\n- decoders for wav, flac, vorbis and mp3\n- Audio file and Icecast internet radio streaming\n- Python enums instead of just some integers for special values\n- several classes to represent the main functions of the library\n- generators for the Audio playback and recording\n- sample data is usually in the form of a Python ``array`` with appropriately sized elements\n  depending on the sample width (rather than a raw block of bytes)\n- TODO: filters, waveform generators?\n\n\n*Requires Python 3.10 or newer.  Also works on pypy3 (because it uses cffi).*\n\n*The miniaudio C library version is 0.11.25.*\n\nSoftware license for these Python bindings, miniaudio and the decoders: MIT\n\n## Synthesizer, modplayer?\n\nIf you like this library you may also be interested in my [software FM synthesizer](https://pypi.org/project/synthplayer/)\nor my [mod player](https://pypi.org/project/libxmplite/) which uses libxmp.\n\n\n## Examples\n\n### Basic audio file playback with info\n\n```python\nimport miniaudio\n\n# Get file info\ninfo = miniaudio.get_file_info(\"samples/music.mp3\")\nprint(f\"Playing: {info.nchannels} channels, {info.sample_rate} Hz, {info.duration:.1f}s\")\n\n# Stream and play\nstream = miniaudio.stream_file(\"samples/music.mp3\")\nwith miniaudio.PlaybackDevice() as device:\n    device.start(stream)\n    input(\"Playing... press Enter to stop\")\n```\n\n### Decode and convert audio file\n\n```python\nimport miniaudio\n\n# Decode audio file to float32\nsound = miniaudio.decode_file(\"music.mp3\", miniaudio.SampleFormat.FLOAT32)\nprint(f\"Decoded: {sound.nchannels} ch, {sound.sample_rate} Hz, {sound.num_frames} frames\")\n\n# Convert to different format and sample rate\nconverted = miniaudio.convert_frames(\n    sound.sample_format, sound.nchannels, sound.sample_rate,\n    sound.samples.tobytes(),\n    miniaudio.SampleFormat.SIGNED16, sound.nchannels, 22050\n)\n\n# Write to WAV file\nminiaudio.wav_write_file(\"output.wav\", miniaudio.DecodedSoundFile(\n    \"output.wav\", sound.nchannels, 22050, miniaudio.SampleFormat.SIGNED16,\n    converted\n))\nprint(\"Written to output.wav\")\n```\n\n### Playback of an unsupported file format\n\nThis example uses ffmpeg as an external tool to decode an audio file in a format\nthat miniaudio itself can't decode (m4a/aac in this case):\n\n```python\nimport subprocess\nimport miniaudio\n\nchannels = 2\nsample_rate = 44100\nsample_width = 2  # 16 bit pcm\nfilename = \"samples/music.m4a\"  # AAC encoded audio file\n\ndef stream_pcm(source):\n    required_frames = yield b\"\"  # generator initialization\n    while True:\n        required_bytes = required_frames * channels * sample_width\n        sample_data = source.read(required_bytes)\n        if not sample_data:\n            break\n        print(\".\", end=\"\", flush=True)\n        required_frames = yield sample_data\n\nwith miniaudio.PlaybackDevice(output_format=miniaudio.SampleFormat.SIGNED16,\n                              nchannels=channels, sample_rate=sample_rate) as device:\n    ffmpeg = subprocess.Popen([\"ffmpeg\", \"-v\", \"fatal\", \"-hide_banner\", \"-nostdin\",\n                               \"-i\", filename, \"-f\", \"s16le\", \"-acodec\", \"pcm_s16le\",\n                               \"-ac\", str(channels), \"-ar\", str(sample_rate), \"-\"],\n                              stdin=None, stdout=subprocess.PIPE)\n    stream = stream_pcm(ffmpeg.stdout)\n    next(stream)  # start the generator\n    device.start(stream)\n    input(\"Audio file playing in the background. Enter to stop playback: \")\n    ffmpeg.terminate()\n```\n\n## API\n\n### Note: everything below is automatically generated from comments in the source code files. Do not edit in this readme directly.\n\n\n*enum class*  ``Backend``\n names:  ``WASAPI`` ``DSOUND`` ``WINMM`` ``COREAUDIO`` ``SNDIO`` ``AUDIO4`` ``OSS`` ``PULSEAUDIO`` ``ALSA`` ``JACK`` ``AAUDIO`` ``OPENSL`` ``WEBAUDIO`` ``CUSTOM`` ``NULL``\n\u003e Operating system audio backend to use (only a subset will be available)\n\n\n*enum class*  ``ChannelMixMode``\n names:  ``RECTANGULAR`` ``SIMPLE`` ``CUSTOMWEIGHTS``\n\u003e How to mix channels when converting\n\n\n*enum class*  ``DeviceType``\n names:  ``PLAYBACK`` ``CAPTURE`` ``DUPLEX``\n\u003e Type of audio device\n\n\n*enum class*  ``DitherMode``\n names:  ``NONE`` ``RECTANGLE`` ``TRIANGLE``\n\u003e How to dither when converting\n\n\n*enum class*  ``FileFormat``\n names:  ``UNKNOWN`` ``WAV`` ``FLAC`` ``MP3`` ``VORBIS``\n\u003e Audio file format\n\n\n*enum class*  ``SampleFormat``\n names:  ``UNKNOWN`` ``UNSIGNED8`` ``SIGNED16`` ``SIGNED24`` ``SIGNED32`` ``FLOAT32``\n\u003e Sample format in memory\n\n\n*enum class*  ``SeekOrigin``\n names:  ``START`` ``CURRENT`` ``END``\n\u003e How to seek() in a source\n\n\n*enum class*  ``ThreadPriority``\n names:  ``IDLE`` ``LOWEST`` ``LOW`` ``NORMAL`` ``HIGH`` ``HIGHEST`` ``REALTIME``\n\u003e The priority of the worker thread (default=HIGHEST)\n\n\n*function*  ``convert_frames  (from_fmt: miniaudio.SampleFormat, from_numchannels: int, from_samplerate: int, sourcedata: bytes, to_fmt: miniaudio.SampleFormat, to_numchannels: int, to_samplerate: int) -\u003e bytearray``\n\u003e Convert audio frames in source sample format with a certain number of channels, to another sample\nformat and possibly down/upmixing the number of channels as well.\n\n\n*function*  ``convert_sample_format  (from_fmt: miniaudio.SampleFormat, sourcedata: bytes, to_fmt: miniaudio.SampleFormat, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e) -\u003e bytearray``\n\u003e Convert a raw buffer of pcm samples to another sample format. The result is returned as another\nraw pcm sample buffer\n\n\n*function*  ``decode  (data: bytes, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e) -\u003e miniaudio.DecodedSoundFile``\n\u003e Convenience function to decode any supported audio file in memory to raw PCM samples in your\nchosen format.\n\n\n*function*  ``decode_file  (filename: str, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e) -\u003e miniaudio.DecodedSoundFile``\n\u003e Convenience function to decode any supported audio file to raw PCM samples in your chosen format.\n\n\n*function*  ``flac_get_file_info  (filename: str) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio file (flac format).\n\n\n*function*  ``flac_get_info  (data: bytes) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio data (flac format).\n\n\n*function*  ``flac_read_f32  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio file. Resulting sample format is 32 bits float.\n\n\n*function*  ``flac_read_file_f32  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio file. Resulting sample format is 32 bits float.\n\n\n*function*  ``flac_read_file_s16  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio file. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``flac_read_file_s32  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio file. Resulting sample format is 32 bits signed integer.\n\n\n*function*  ``flac_read_s16  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio data. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``flac_read_s32  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole flac audio data. Resulting sample format is 32 bits signed integer.\n\n\n*function*  ``flac_stream_file  (filename: str, frames_to_read: int = 1024, seek_frame: int = 0) -\u003e Generator[array.array, NoneType, NoneType]``\n\u003e Streams the flac audio file as interleaved 16 bit signed integer sample arrays segments. This uses\na fixed chunk size and cannot be used as a generic miniaudio decoder input stream. Consider using\nstream_file() instead.\n\n\n*function*  ``get_enabled_backends  () -\u003e Set[miniaudio.Backend]``\n\u003e Returns the set of available backends by the compilation environment for the underlying miniaudio\nC library\n\n\n*function*  ``get_file_info  (filename: str) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio file.\n\n\n*function*  ``is_backend_enabled  (backend: miniaudio.Backend) -\u003e bool``\n\u003e Determines whether or not the given backend is available by the compilation environment for the\nunderlying miniaudio C library\n\n\n*function*  ``is_loopback_supported  (backend: miniaudio.Backend) -\u003e bool``\n\u003e Determines whether or not loopback mode is support by a backend.\n\n\n*function*  ``lib_version  () -\u003e str``\n\u003e Returns the version string of the underlying miniaudio C library\n\n\n*function*  ``mp3_get_file_info  (filename: str) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio file (mp3 format).\n\n\n*function*  ``mp3_get_info  (data: bytes) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio data (mp3 format).\n\n\n*function*  ``mp3_read_f32  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole mp3 audio data. Resulting sample format is 32 bits float.\n\n\n*function*  ``mp3_read_file_f32  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole mp3 audio file. Resulting sample format is 32 bits float.\n\n\n*function*  ``mp3_read_file_s16  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole mp3 audio file. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``mp3_read_s16  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole mp3 audio data. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``mp3_stream_file  (filename: str, frames_to_read: int = 1024, seek_frame: int = 0) -\u003e Generator[array.array, NoneType, NoneType]``\n\u003e Streams the mp3 audio file as interleaved 16 bit signed integer sample arrays segments. This uses\na fixed chunk size and cannot be used as a generic miniaudio decoder input stream. Consider using\nstream_file() instead.\n\n\n*function*  ``read_file  (filename: str, convert_to_16bit: bool = False) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole audio file. Miniaudio will attempt to return the sound data in exactly\nthe same format as in the file. Unless you set convert_convert_to_16bit to True, then the result is\nalways a 16 bit sample format.\n\n\n*function*  ``stream_any  (source: miniaudio.StreamableSource, source_format: miniaudio.FileFormat = \u003cFileFormat.UNKNOWN: 0\u003e, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, frames_to_read: int = 1024, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e, seek_frame: int = 0) -\u003e Generator[array.array, int, NoneType]``\n\u003e Convenience function that returns a generator to decode and stream any source of encoded audio\ndata (such as a network stream). Stream result is chunks of raw PCM samples in the chosen format. If\nyou send() a number into the generator rather than just using next() on it, you'll get that given\nnumber of frames, instead of the default configured amount. This is particularly useful to plug this\nstream into an audio device callback that wants a variable number of frames per call.\n\n\n*function*  ``stream_file  (filename: str, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, frames_to_read: int = 1024, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e, seek_frame: int = 0) -\u003e Generator[array.array, int, NoneType]``\n\u003e Convenience generator function to decode and stream any supported audio file as chunks of raw PCM\nsamples in the chosen format. If you send() a number into the generator rather than just using\nnext() on it, you'll get that given number of frames, instead of the default configured amount. This\nis particularly useful to plug this stream into an audio device callback that wants a variable\nnumber of frames per call.\n\n\n*function*  ``stream_memory  (data: bytes, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, frames_to_read: int = 1024, dither: miniaudio.DitherMode = \u003cDitherMode.NONE: 0\u003e) -\u003e Generator[array.array, int, NoneType]``\n\u003e Convenience generator function to decode and stream any supported audio file in memory as chunks\nof raw PCM samples in the chosen format. If you send() a number into the generator rather than just\nusing next() on it, you'll get that given number of frames, instead of the default configured\namount. This is particularly useful to plug this stream into an audio device callback that wants a\nvariable number of frames per call.\n\n\n*function*  ``stream_raw_pcm_memory  (pcmdata: array.array | memoryview | bytes, nchannels: int, sample_width: int, frames_to_read: int = 4096) -\u003e Generator[bytes | array.array, int, NoneType]``\n\u003e Convenience generator function to stream raw pcm audio data from memory. Usually you don't need to\nuse this as the library provides many other streaming options that work on much smaller, encoded,\naudio data. However, in the odd case that you only have already decoded raw pcm data you can use\nthis generator as a stream source.  The data can be provided in ``array`` type or ``bytes``,\n``memoryview`` or even a numpy array. Be sure to also specify the correct number of channels that\nthe audio data has, and the sample with in bytes.\n\n\n*function*  ``stream_with_callbacks  (sample_stream: Generator[bytes | array.array, int, NoneType], progress_callback: Callable[[int], NoneType] | None = None, frame_process_method: Callable[[bytes | array.array], bytes | array.array] | None = None, end_callback: Callable | None = None) -\u003e Generator[bytes | array.array, int, NoneType]``\n\u003e Convenience generator function to add callback and processing functionality to another stream. You\ncan specify : \u003e A callback function that gets called during play and takes an int for the number of\nframes played.  \u003e A function that can be used to process raw data frames before they are yielded\nback (takes an array.array or bytes, returns an array.array or bytes) *Note: if the processing\nmethod is slow it will result in audio glitchiness  \u003e A callback function that gets called when the\nstream ends playing.\n\n\n*function*  ``vorbis_get_file_info  (filename: str) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio file (vorbis format).\n\n\n*function*  ``vorbis_get_info  (data: bytes) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio data (vorbis format).\n\n\n*function*  ``vorbis_read  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole vorbis audio data. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``vorbis_read_file  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole vorbis audio file. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``vorbis_stream_file  (filename: str, seek_frame: int = 0) -\u003e Generator[array.array, NoneType, NoneType]``\n\u003e Streams the ogg vorbis audio file as interleaved 16 bit signed integer sample arrays segments.\nThis uses a variable unconfigurable chunk size and cannot be used as a generic miniaudio decoder\ninput stream. Consider using stream_file() instead.\n\n\n*function*  ``wav_get_file_info  (filename: str) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio file (wav format).\n\n\n*function*  ``wav_get_info  (data: bytes) -\u003e miniaudio.SoundFileInfo``\n\u003e Fetch some information about the audio data (wav format).\n\n\n*function*  ``wav_read_f32  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio data. Resulting sample format is 32 bits float.\n\n\n*function*  ``wav_read_file_f32  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio file. Resulting sample format is 32 bits float.\n\n\n*function*  ``wav_read_file_s16  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio file. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``wav_read_file_s32  (filename: str) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio file. Resulting sample format is 32 bits signed integer.\n\n\n*function*  ``wav_read_s16  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio data. Resulting sample format is 16 bits signed integer.\n\n\n*function*  ``wav_read_s32  (data: bytes) -\u003e miniaudio.DecodedSoundFile``\n\u003e Reads and decodes the whole wav audio data. Resulting sample format is 32 bits signed integer.\n\n\n*function*  ``wav_stream_file  (filename: str, frames_to_read: int = 1024, seek_frame: int = 0) -\u003e Generator[array.array, NoneType, NoneType]``\n\u003e Streams the WAV audio file as interleaved 16 bit signed integer sample arrays segments. This uses\na fixed chunk size and cannot be used as a generic miniaudio decoder input stream. Consider using\nstream_file() instead.\n\n\n*function*  ``wav_write_file  (filename: str, sound: miniaudio.DecodedSoundFile) ``\n\u003e Writes the pcm sound to a WAV file\n\n\n*function*  ``width_from_format  (sampleformat: miniaudio.SampleFormat) -\u003e int``\n\u003e returns the sample width in bytes, of the given sample format.\n\n\n*class*  ``CaptureDevice``\n\n``CaptureDevice  (self, input_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, buffersize_msec: int = 200, device_id: _cffi_backend._CDataBase | None = None, callback_periods: int = 0, backends: List[miniaudio.Backend] | None = None, thread_prio: miniaudio.ThreadPriority = \u003cThreadPriority.HIGHEST: 0\u003e, app_name: str = '') ``\n\u003e An audio device provided by miniaudio, for audio capture (recording).\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Halt playback or capture and close down the device. If you use the device as a context manager,\nit will be closed automatically.\n\n\u003e *method*  ``start  (self, callback_generator: Generator[NoneType, bytes | array.array, NoneType]) ``\n\u003e \u003e Start the audio device: capture (recording) begins. The recorded audio data is sent to the given\ncallback generator as raw bytes. (it should already be started before)\n\n\u003e *method*  ``stop  (self) ``\n\u003e \u003e Halt playback or capture.\n\n\n*class*  ``DecodeError``\n\n``DecodeError  (self, /, *args, **kwargs)``\n\u003e When something went wrong during decoding an audio file.\n\n\n*class*  ``DecodedSoundFile``\n\n``DecodedSoundFile  (self, name: str, nchannels: int, sample_rate: int, sample_format: miniaudio.SampleFormat, samples: array.array) ``\n\u003e Contains various properties and also the PCM frames of a fully decoded audio file.\n\n\n*class*  ``Devices``\n\n``Devices  (self, backends: List[miniaudio.Backend] | None = None) ``\n\u003e Query the audio playback and record devices that miniaudio provides\n\n\u003e *method*  ``get_captures  (self) -\u003e List[Dict[str, Any]]``\n\u003e \u003e Get a list of capture devices and some details about them\n\n\u003e *method*  ``get_playbacks  (self) -\u003e List[Dict[str, Any]]``\n\u003e \u003e Get a list of playback devices and some details about them\n\n\n*class*  ``DuplexStream``\n\n``DuplexStream  (self, playback_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, playback_channels: int = 2, capture_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, capture_channels: int = 2, sample_rate: int = 44100, buffersize_msec: int = 200, playback_device_id: _cffi_backend._CDataBase | None = None, capture_device_id: _cffi_backend._CDataBase | None = None, callback_periods: int = 0, backends: List[miniaudio.Backend] | None = None, thread_prio: miniaudio.ThreadPriority = \u003cThreadPriority.HIGHEST: 0\u003e, app_name: str = '') ``\n\u003e Joins a capture device and a playback device.\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Halt playback or capture and close down the device. If you use the device as a context manager,\nit will be closed automatically.\n\n\u003e *method*  ``start  (self, callback_generator: Generator[bytes | array.array, bytes | array.array, NoneType]) ``\n\u003e \u003e Start the audio device: playback and capture begin. The audio data for playback is provided by\nthe given callback generator, which is sent the recorded audio data at the same time. (it should\nalready be started before passing it in)\n\n\u003e *method*  ``stop  (self) ``\n\u003e \u003e Halt playback or capture.\n\n\n*class*  ``IceCastClient``\n\n``IceCastClient  (self, url: str, update_stream_title: Callable[[ForwardRef('IceCastClient'), str], NoneType] = None, ssl_context: 'ssl.SSLContext' = None) ``\n\u003e A simple client for IceCast audio streams as miniaudio streamable source. If the stream has Icy\nMetaData, the stream_title attribute will be updated with the actual title taken from the metadata.\nYou can also provide a callback to be called when a new stream title is available. The downloading\nof the data from the internet is done in a background thread and it tries to keep a (small) buffer\nfilled with available data to read. You can optionally provide a custom ssl.SSLContext in the\nssl_context parameter, if you need to change the way SSL connections are configured (certificates,\nchecks, etc).\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Stop the stream, aborting the background downloading.\n\n\u003e *method*  ``read  (self, num_bytes: int) -\u003e bytes``\n\u003e \u003e Read a chunk of data from the stream.\n\n\u003e *method*  ``seek  (self, offset: int, origin: miniaudio.SeekOrigin) -\u003e bool``\n\u003e \u003e Override this if the stream supports seeking. Note: seek support is sometimes not needed if you\ngive the file type to a decoder upfront. You can ignore this method then.\n\n\n*class*  ``MiniaudioError``\n\n``MiniaudioError  (self, /, *args, **kwargs)``\n\u003e When a miniaudio specific error occurs.\n\n\n*class*  ``PlaybackDevice``\n\n``PlaybackDevice  (self, output_format: miniaudio.SampleFormat = \u003cSampleFormat.SIGNED16: 2\u003e, nchannels: int = 2, sample_rate: int = 44100, buffersize_msec: int = 200, device_id: _cffi_backend._CDataBase | None = None, callback_periods: int = 0, backends: List[miniaudio.Backend] | None = None, thread_prio: miniaudio.ThreadPriority = \u003cThreadPriority.HIGHEST: 0\u003e, app_name: str = '') ``\n\u003e An audio device provided by miniaudio, for audio playback.\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Halt playback or capture and close down the device. If you use the device as a context manager,\nit will be closed automatically.\n\n\u003e *method*  ``start  (self, callback_generator: Generator[bytes | array.array, int, NoneType]) ``\n\u003e \u003e Start the audio device: playback begins. The audio data is provided by the given callback\ngenerator. The generator gets sent the required number of frames and should yield the sample data as\nraw bytes, a memoryview, an array.array, or as a numpy array with shape (numframes, numchannels).\nThe generator should already be started before passing it in.\n\n\u003e *method*  ``stop  (self) ``\n\u003e \u003e Halt playback or capture.\n\n\n*class*  ``SoundFileInfo``\n\n``SoundFileInfo  (self, name: str, file_format: miniaudio.FileFormat, nchannels: int, sample_rate: int, sample_format: miniaudio.SampleFormat, duration: float, num_frames: int, sub_format: int = None) ``\n\u003e Contains various properties of an audio file.\n\n\n*class*  ``StreamableSource``\n\n``StreamableSource  (self, /, *args, **kwargs)``\n\u003e Base class for streams of audio data bytes. Can be used as a contextmanager, to properly call\nclose().\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Override this to properly close the stream and free resources.\n\n\u003e *method*  ``read  (self, num_bytes: int) -\u003e bytes | memoryview``\n\u003e \u003e override this to provide data bytes to the consumer of the stream\n\n\u003e *method*  ``seek  (self, offset: int, origin: miniaudio.SeekOrigin) -\u003e bool``\n\u003e \u003e Override this if the stream supports seeking. Note: seek support is sometimes not needed if you\ngive the file type to a decoder upfront. You can ignore this method then.\n\n\n*class*  ``WavFileReadStream``\n\n``WavFileReadStream  (self, pcm_sample_gen: Generator[bytes | array.array, int, NoneType], sample_rate: int, nchannels: int, output_format: miniaudio.SampleFormat, max_frames: int = 0) ``\n\u003e An IO stream that reads as a .wav file, and which gets its pcm samples from the provided producer\n\n\u003e *method*  ``close  (self) ``\n\u003e \u003e Close the file\n\n\u003e *method*  ``read  (self, amount: int = 9223372036854775807) -\u003e bytes | None``\n\u003e \u003e Read up to the given amount of bytes from the file.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firmen%2Fpyminiaudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firmen%2Fpyminiaudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firmen%2Fpyminiaudio/lists"}