Comments (3)
Hi @sammlapp . To expand on @evpobr 's comment, yes both bitrate mode and bit rate value are configurable using sf_command()
.
Sample rate mode can be changed using SFC_SET_BITRATE_MODE
- Default is variable (constant quality), but average and constant bitrate are also supported for MP3.
Sample rate value can be changed indirectly using SFC_SET_COMPRESSION_LEVEL
(https://github.com/libsndfile/libsndfile/blob/c81375f070f3c6764969a738eacded64f53a076e/docs/command.md#sfc_set_compression_level). (The comment in the documentation about only supporting Voribs/Flac should be updated)
For setting the compression, pass a value between 0.0 (max bitrate, min compression) and 1.0 (min bitrate, max compression). How the value is interpreted depends on the bitrate mode.
For VBR, it translates to lame_set_VBR_qaulity()
. 0.0 -> 0.0 (highest quality), 1.0 -> 10.0 (lowest quality)
I'd recommend using VBR and just tweaking the quality as required. This is similar to other lossy formats.
For ABR and CBR, it translates to [0.0, 1.0] to the bitrate values of [highest bitrate possible, lowest bitrate possible]. The possible bitrates depending on the MPEG spec version.
For 32000Hz and higher (MPEG 1.0), [0.0, 1.0] -> [320kbps, 32kbps]
For 16000Hz up to 32000Hz (MPEG 2.0), [0.0, 1.0] -> [160kbps, 8kbps]
For under 16000Hz (MPEG "2.5") [0.0, 1.0] -> [64kbps, 8kbps]
(See https://github.com/libsndfile/libsndfile/blob/master/src/mpeg_l3_encode.c#L194)
You can retrieve the current bitrate using sf_get_byterate()
, multiplying the result by 8.
from libsndfile.
Hi @sammlapp
from libsndfile.
from libsndfile.
Related Issues (20)
- Libsndfile OGG Page Issue? HOT 3
- libsndfile SF_INFO struct frames field contains wrong value for mp3 file HOT 1
- libsndfile links libmp3lame using an absolute path on macOS HOT 5
- Broken AUTOGEN_SCRIPT path HOT 1
- Segmentation fault at sf_open when using SndfileHandle HOT 1
- sndfile-convert always normalizes files that exceed the `-1..+1` range HOT 1
- convert 44.1kHz wav to 48kHz opus, the pitch becomes higher HOT 2
- unused variable in ima_adpcm.c HOT 2
- No rule to make target `src/test_endswap.c' HOT 1
- An use-of-uninitialized-value bug in psf_fwrite.c
- Heap-buffer-overflow in sndfile.c
- Memory leak bug in sf_open() HOT 2
- Multiple use-of-uninitialized-value bugs
- unused variable in multi_file_test.c HOT 1
- Capture libmpg123 warnings HOT 1
- Re-Raising the Necessity of Using Smart Pointers for the C++ Wrapper
- Stack overflow probabilistically occurs when the function `sf_writef_short` of `libsndfile_64bit.dll` is called using the Python library `soundfile` HOT 1
- Use of deprecated github actions generates CI warning
- Truncation of sample chunk data in command_test.c
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsndfile.