Skip to content

Explain --format mp3 #49

Closed Answered by nazdridoy
atefgithub asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @atefgithub, great question! I totally understand why you'd ask, as sf.write itself doesn't natively encode formats like MP3.

But yes, the script does produce actual, properly encoded MP3 files, not just renamed ones!

Here's how it works:

  1. soundfile talks to libsndfile: The Python soundfile library, imported as sf, is actually a wrapper around the powerful C library called libsndfile.
  2. libsndfile delegates: libsndfile is smart. While it handles many formats itself, it can also delegate encoding/decoding for certain formats (like MP3) to other libraries installed on your system.
  3. Filename is the key: When you call sf.write(output_file, ...) and output_file ends with .mp3, libsndfile sees…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nazdridoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants