rchanrussell / rpi_audio_looper_c

An audio looper for the Raspberry Pi, in C, UART interface
https://rschanrussell.wordpress.com/projects/raspberry-pi-audio-looper/
12 stars 1 forks source link

Wrong value for limiting the mix down sum #4

Open mm1711 opened 2 years ago

mm1711 commented 2 years ago

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).

rchanrussell commented 2 years ago

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.