https://github.com/sangoma/sndfile
Simple CFFI wrapper around the C sndfile API
https://github.com/sangoma/sndfile
cffi libsndfile python python3
Last synced: 5 months ago
JSON representation
Simple CFFI wrapper around the C sndfile API
- Host: GitHub
- URL: https://github.com/sangoma/sndfile
- Owner: sangoma
- License: other
- Created: 2018-04-10T21:49:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T21:55:43.000Z (almost 8 years ago)
- Last Synced: 2024-05-17T00:01:49.515Z (about 2 years ago)
- Topics: cffi, libsndfile, python, python3
- Language: Python
- Size: 22.5 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=======
sndfile
=======
Work in progress simple CFFI wrapper around the C ``libsndfile`` API.
Currently only implements a simple interface for reading frames from
supported audio files into Python's ``array.array``.
Example
-------
A simple example that loads an audio file, prints some statistics, and
dumps out all the frames as 32bit integers.
.. code:: python
SAMPLES = pathlib.Path("my-audio-sample-dir")
with sndfile.open(SAMPLES / "my-sample.flac", "r") as sample:
print("frames: {}".format(sample.frames))
print("format: major={0[0]}, minor={0[1]}".format(sample.format))
print("samplerate: {}".format(sample.samplerate))
print("channels: {}".format(sample.channels))
print("sections: {}".format(sample.sections))
print(sample.read_frames("l"))