mirror of
https://github.com/xdsopl/robot36.git
synced 2026-01-01 22:19:59 +01:00
continue decoding, even if volume too low
it's amazing but one bit is actually enough to decode at 44100Hz
This commit is contained in:
parent
7c6689f126
commit
14a5c7b185
|
|
@ -249,10 +249,8 @@ void decode(int samples) {
|
|||
for (int sample = 0; sample < samples; ++sample, ++buffer_pos) {
|
||||
int amp = audio_buffer[sample];
|
||||
float avg_pow = filter(&avg_power, amp * amp);
|
||||
float avg_amp = min(sqrt(2.0f * avg_pow), 32767.0f);
|
||||
float avg_amp = clamp(sqrt(2.0f * avg_pow), 1.0f, 32767.0f);
|
||||
*volume = avg_amp / 32767.0f;
|
||||
if (avg_amp < 16.0f)
|
||||
continue;
|
||||
float norm_amp = (127 * amp) / avg_amp;
|
||||
|
||||
spectrum_analyzer(norm_amp);
|
||||
|
|
|
|||
Loading…
Reference in a new issue