Skip to content

Commit

Permalink
Fix audio normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Sep 14, 2024
1 parent 94aeae4 commit c5618cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SpessaSynth",
"version": "3.20.17",
"version": "3.20.18",
"type": "module",
"scripts": {
"start": "node src/website/server/server.js"
Expand Down
4 changes: 2 additions & 2 deletions src/spessasynth_lib/utils/buffer_to_wav.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export function audioBufferToWav(audioBuffer, normalizeAudio = true, channelOffs
for (let i = 0; i < length; i++)
{
// interleave both channels
const sample1 = Math.min(1, Math.max(-1, channel1Data[i])) * multiplier;
const sample2 = Math.min(1, Math.max(-1,channel2Data[i])) * multiplier;
const sample1 = Math.min(32767, Math.max(-37268, channel1Data[i] * multiplier));
const sample2 = Math.min(32767, Math.max(-37268, channel2Data[i] * multiplier));

// convert to 16-bit
wavData[offset++] = sample1 & 0xff;
Expand Down
Loading

0 comments on commit c5618cf

Please sign in to comment.