unpacked audio loop but its got noise

This commit is contained in:
Brooke Vibber 2022-12-08 11:47:04 -08:00
parent 48a91b96ef
commit 1edff506c1
2 changed files with 7 additions and 5 deletions

View file

@ -188,11 +188,11 @@ wait_loop:
sta sample_ptrh
cmp #.hibyte(audio_samples_end)
bne audio_cont
bmi audio_cont
;lda sample_ptrl
;cmp #.lobyte(audio_samples_end)
;bne audio_cont
lda sample_ptrl
cmp #.lobyte(audio_samples_end)
bmi audio_cont
lda #.lobyte(audio_samples)
sta sample_ptrl

View file

@ -50,6 +50,7 @@ function audio2assembly(audio) {
audio_samples:
${byte2byte(pack(audio))}
audio_samples_end:
.byte 24
`;
}
@ -57,7 +58,8 @@ audio_samples_end:
function wav2assembly(buffer) {
let wav = new WaveFile(buffer);
let samples = wav.getSamples();
return audio2assembly(samples);
let n = samples.length - (samples.length % 131);
return audio2assembly(samples.slice(0, n));
}
let infile = process.argv[2];