Skip to content

Commit f59f085

Browse files
committed
Fix audio channel mixing in new slurp code
1 parent 74dfd21 commit f59f085

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

whisper.cpp/slurp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "slurp.h"
55
#include "miniaudio.h"
66
#include "llamafile/log.h"
7+
#include <math.h>
78

89
static int get_audio_file_channels(const char *fname) {
910
ma_decoder decoder;
@@ -96,7 +97,7 @@ bool slurp_audio_file(const char *fname,
9697
for (int i = 0; i < got; ++i) {
9798
float left = frames[i*2+0];
9899
float right = frames[i*2+1];
99-
pcmf32.push_back(left + right);
100+
pcmf32.push_back(sqrtf((left*left + right*right) / 2));
100101
pcmf32s[0].push_back(left);
101102
pcmf32s[1].push_back(right);
102103
}

0 commit comments

Comments
 (0)