rchanrussell / rpi_audio_looper_c

An audio looper for the Raspberry Pi, in C, UART interface

Home Page:https://rschanrussell.wordpress.com/projects/raspberry-pi-audio-looper/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong value for limiting the mix down sum

mm1711 opened this issue · comments

In mixdown.c the constant MAX_SAMPLE_VALUE is used to limit the sum of the track buffer and new in buffer values.
With the definition of MAX_SAMPLE_VALUE as UINT16_MAX this cannot work.
JACK delivers the audio samples as floating point numbers in the range of -1.0 to +1.0. So you should limit the sum to 1.0 (0dbFS) or 0,7071 (-3dBFS).

Thank you for your input. I recently looked up how to best manage summing channels with minimal clipping. I am working on a re-write. mixer.c was updated but untested, as I have a LOT of work ahead of me. Debugging the master branch is too cumbersome, so I am slowly re-writing everything, hopefully improving it.