Code Monkey home page Code Monkey logo

Comments (3)

arthurt avatar arthurt commented on June 22, 2024 1

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.

evpobr avatar evpobr commented on June 22, 2024

Hi @sammlapp

from libsndfile.

evpobr avatar evpobr commented on June 22, 2024

https://github.com/libsndfile/libsndfile/blob/c81375f070f3c6764969a738eacded64f53a076e/docs/command.md#sfc_set_bitrate_mode

from libsndfile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.