ndiddy wrote:
Hate to ask ANOTHER question, but is there a way to get rid of the clicking noise when looping a sample? The dev manual says you have to get rid of sudden volume changes in the audio to fix it, bit that obviously won't work if you want to keep a piano note held or something, as the loop point has to be while the note's already playing.
Apologies if the following is too basic, but it's hard to determine the appropriate level of response from your question...
You have to match up the end of the loop with the beginning of the loop, so that the waveform keeps doing the same thing rather than making a sudden jump (a click) or suddenly heading off in a different direction (a ping or blip). That's what that means.
Also, if you're using a tonal sample (e.g. a piano rather than a snare drum), the loop length needs to be a multiple of the fundamental wavelength of the sample. Ideally this would result in the previous requirements being satisfied automatically, but in a real sample the waveform doesn't in general repeat perfectly (and the sample rate is generally not an exact multiple of the note frequency), so you still have to consider both factors.
Also, on the SNES, your loop has to be a multiple of 16 samples (one BRR block), on top of the previous considerations. This may require you to resample the data to an appropriate sample rate so that you can meet all the requirements at the same time. I'd suggest finding a good loop in the uncompressed audio first, and then resampling the audio so that the loop you found is a multiple of 16 samples long. After doing this, it will probably be necessary to trim or pad the beginning of the audio so that the start of the loop is a multiple of 16 samples from the start of the audio.
This is what a good loop looks like (though you can't rely only on looks; you have to listen to your loop and adjust it sample by sample to minimize artifacting):
Attachment:
goodloop.png [ 2.18 KiB | Viewed 3749 times ]
The above is a single-cycle loop, which works reasonably well for a wide variety of tonal sounds, particularly if the playback device is capable of adding modulation to the sound to liven it up (ADSR, LFOs, etc.). It is not necessary to put the loop points at zero crossings, but it may be helpful.
Not every sound works well with a tiny loop range like what I'm showing here. Noisy sounds often lose their character when looped very tightly, and detuned or heavily modulated sounds suffer from obvious "freezing" when the loop hits. In such cases, a longer loop may be warranted if you've got the memory for it.
This is a bad loop:
Attachment:
badloop.png [ 2.18 KiB | Viewed 3749 times ]
A loop like this will produce a loud buzzing noise at a frequency different from that of the recorded sound, because there's a loud click every time it loops, and the loop length is not a multiple of the sound's wavelength.
Note that it is absolutely possible to get clicks and other garbage even if your loop length is perfect, because the waveform is probably not going to be totally uniform. If you absolutely can't find a good loop, it may be helpful to upsample to give yourself finer control, but most samples shouldn't be that pathological. Do not remove audio past the end of the loop until you're sure you've got a good loop, because getting a good loop requires you to move both loop points.
This is another bad loop:
Attachment:
badloop2.png [ 2.19 KiB | Viewed 3749 times ]
The buzzing wouldn't be as bad with this one, because the levels are similar between the start and end of the loop. But not only does the waveform have a different slope at both points, but the loop length is nowhere near any multiple of the wavelength of the recorded sound. This one will sound very wrong.