simonw / ospeak

CLI tool for running text through OpenAI Text to speech
Apache License 2.0
162 stars 10 forks source link

Significantly improve audio quality when exporting to mp3 #7

Closed mikolysz closed 10 months ago

mikolysz commented 12 months ago

By default, ffmpeg uses 32k as its bitrate when exporting to mp3. This is the lowest possible setting and results in bad audio quality.

This PR explicitly sets the bitrate to use when the export format is mp3. We use 160k, which is an unusual choice, but this is what we receive from the API.

There's still going to be some quality loss due to the fact that we decode the audio from mp3 and then encode it back again, but that loss is much less significant than what we had before, and might not even be perceptible.

solus-hq commented 11 months ago

@simonw Hello! Is it possible to accept this PR and have a newer version installable via pipx? =)