Skip to content

Commit

Permalink
always write loops
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Dec 21, 2024
1 parent c93727f commit bd4d697
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 39 deletions.
22 changes: 15 additions & 7 deletions src/website/js/manager/export_audio.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { closeNotification, showNotification } from "../notification/notification.js";
import { Synthetizer } from "../../../spessasynth_lib/synthetizer/synthetizer.js";
import { formatTime } from "../../../spessasynth_lib/utils/other.js";
import { consoleColors, formatTime } from "../../../spessasynth_lib/utils/other.js";
import { audioBufferToWav } from "../../../spessasynth_lib/utils/buffer_to_wav.js";
import { ANIMATION_REFLOW_TIME } from "../utils/animation_utils.js";
import { MIDIticksToSeconds } from "../../../spessasynth_lib/midi_parser/basic_midi.js";
import { SpessaSynthInfo } from "../../../spessasynth_lib/utils/loggin.js";

const RENDER_AUDIO_TIME_INTERVAL = 1000;

Expand Down Expand Up @@ -92,7 +93,11 @@ export async function _doExportAudioData(normalizeAudio = true, sampleRate = 441
snapshot.effectsConfig = effects;
try
{
synth = new Synthetizer(offline.destination, soundfont, false, {
synth = new Synthetizer(
offline.destination,
soundfont,
false,
{
parsedMIDI: parsedMid,
snapshot: snapshot,
oneOutput: separateChannels,
Expand Down Expand Up @@ -152,11 +157,14 @@ export async function _doExportAudioData(normalizeAudio = true, sampleRate = 441
const startOffset = MIDIticksToSeconds(parsedMid.firstNoteOn, parsedMid);
const loopStart = loopStartAbsolute - startOffset;
const loopEnd = loopEndAbsolute - startOffset;
let loop = undefined;
if (loopCount === 0)
{
loop = { start: loopStart, end: loopEnd };
}
let loop = { start: loopStart, end: loopEnd };
SpessaSynthInfo(
`%cWriting loop points: start %c${loopStart}%c, end:%c${loopEnd}`,
consoleColors.info,
consoleColors.recognized,
consoleColors.info,
consoleColors.recognized
);
const wav = audioBufferToWav(buf, normalizeAudio, 0, meta, loop);
this.saveBlob(wav, `${this.seqUI.currentSongTitle || "unnamed_song"}.wav`);
}
Expand Down
Loading

0 comments on commit bd4d697

Please sign in to comment.