Skip to content

Commit

Permalink
Fix audio channel mixing in new slurp code
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Sep 28, 2024
1 parent 74dfd21 commit f59f085
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion whisper.cpp/slurp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "slurp.h"
#include "miniaudio.h"
#include "llamafile/log.h"
#include <math.h>

static int get_audio_file_channels(const char *fname) {
ma_decoder decoder;
Expand Down Expand Up @@ -96,7 +97,7 @@ bool slurp_audio_file(const char *fname,
for (int i = 0; i < got; ++i) {
float left = frames[i*2+0];
float right = frames[i*2+1];
pcmf32.push_back(left + right);
pcmf32.push_back(sqrtf((left*left + right*right) / 2));
pcmf32s[0].push_back(left);
pcmf32s[1].push_back(right);
}
Expand Down

0 comments on commit f59f085

Please sign in to comment.