Skip to content

sangoma/sndfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

About

Simple CFFI wrapper around the C sndfile API

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published