Author Topic: Making Better Samples for Looping  (Read 513 times)

Offline I-S3-O

  • Inspired artist
  • **
  • Posts: 50
  • Gender: Male
  • Operating System: Windows 10 Pro
Making Better Samples for Looping
« on: April 12, 2019, 04:23:53 »
I've been trying to set loop points in this one stereo sample, but for the life I can't seem to figure why they keep clicking / popping.

What I've tried so far:

  • Make sure that both L / R samples are at the same point (i.e. zero point)

  • Make sure that slopes of the loop points are both going the same direction (i.e. both descending / ascending)
  • Make sure both loop points are looping at a conceptual phrase of the sample.
To further explain that, let's I have this as a sample:


The circled part is a phrase. I try to find one on the other edge of the sample that looks close to that, and find a spot that satisfies the other rules.
Nonetheless, it still clicks and pops.
[/list]

Anything else I can do?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,641
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: Making Better Samples for Looping
« Reply #1 on: April 12, 2019, 08:49:47 »
I think there is a conceptual misunderstanding here. You try to make the left and right channels to be similar, but that is not necessary for a perfect loop. In fact, most of the time this will not be possible because the left and right channel will be out of phase (which is a big part of the stereo impression).
What's important is that the part before the loop end smoothly continues into the part after the loop end (i.e. the loop start), and it has to do so on both channels independently, i.e. the phase before the loop end must match the phase after the loop start (independently for L and R). The "on both channels" is the difficult part exactly because of the different phases. As an example, if you apply a slow chorus effect on the sample, the loop will only sound good if it repeats at a multiple of the chorus cycle's length because that's where the phases will be "in sync".
I think a good approach is to find a loop that is relatively good (i.e. both L and R phases match approximately at the loop start and end, but may still produce clicks) and  then apply the loop crossfader from the toolbar to fix up the loop. Depending on the sample content, a very small crossfade (just a couple dozen or hundreds of samples) with the second slider all the way to left (constant volume) might already do the trick for fixing the click. Otherwise, a longer crossfade but with the second slider all the way to the right (constant power) might be better.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,044
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
Re: Making Better Samples for Looping
« Reply #2 on: April 12, 2019, 10:24:57 »
The reason this fails is because when you focus on the left channel and loop that, the right channel is not aligned properly and that is where the pop comes from. Also as Saga explained.

What I would do is make a duplicate of that sample, then for one sample, convert it to mono, taking only the left channel, and for the other repeat but for the right channel.

Now set the loop points correctly for the independent samples but make sure the start of the samples are unaltered, only that they have a loop point.

Pan the left channel sample hard left, and the right channel sample hard right, now play both at the same time and voila, it works. It is cumbersome but it works. If you just one one sample, then Saga's approach with cross fading is the way to go.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline I-S3-O

  • Inspired artist
  • **
  • Posts: 50
  • Gender: Male
  • Operating System: Windows 10 Pro
Re: Making Better Samples for Looping
« Reply #3 on: April 12, 2019, 23:35:45 »
Thank you both for your input! I found that, indeed, the crossfade did help remove the click in some of my samples. What was weird though was that only some of samples needed that; there were some that I just to do what did before (find the zero points), and it was completely undetectable. Is that just because the pitch on those samples were different enough for me to get lucky or something?

Either way, LPChip, I never considered doing that. I was thinking that maybe I could "slide one of the channels to make it match with the zero point of the other, but okay. Neat. One question: when should I use that instead of the crossfade option? Is there a benefit to doing it that way versus? Cuz I don't think I'm doing anything that hard. I'm still making really simple samples from sampling programs from VSTs.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,641
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: Making Better Samples for Looping
« Reply #4 on: April 13, 2019, 12:05:05 »
Is that just because the pitch on those samples were different enough for me to get lucky or something?
Again - it's all about continuity between loop end and loop start. If you manage to (automatically) find a loop start and end that match each other perfectly, then this is the most optimal situation to be in, but sometimes it's simply not possible, and this is where crossfading helps a bit by reshaping the waveform (at the possible expense of introducing weird-sounding phasing issues). It has nothing to do with pitch - the only thing that matters is that the waveform before the loop end and after the loop start is continuous.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,044
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
Re: Making Better Samples for Looping
« Reply #5 on: April 13, 2019, 13:42:02 »
Indeed, also, it helps looking for the big sine in your waveform to find the optimal point for a loop, because these points tend to be the same for both sides of the stereo field.

If you look at the 2nd image, you circulated the 2nd part of the sine wave basically. If you look closely to the entire waveform, you'll see the following:

It starts at the up position of the sine going down, going up, going down, at ths point you start your yellow circle, going up, going down, this is where your circle ends.

However, if you go to the left where the sine starts (or the phase of the sample) there are actually 2 spots that will most likely give you a perfect loop.

From your circle, 2 small sine waveforms to the left, and then where it starts, that would be the start of the phase, which is approximately 35%-40% from the left in the image. The end is 4 small sine waveforms to the right where the same larger shape repeats, about 65% from the left in the image, and exactly in the middle of your circle.

EDIT: never mind the percentages... I didn't noticed the scrollbars. I can't get the whole image on screen so I can't estimate the percentage in the image.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline I-S3-O

  • Inspired artist
  • **
  • Posts: 50
  • Gender: Male
  • Operating System: Windows 10 Pro
Re: Making Better Samples for Looping
« Reply #6 on: April 16, 2019, 02:06:58 »
Ok. It took me a while to think about this a little more, but I'm still not getting it. How do I determine where the phase cycles begin / end? I'm not sure where I could find that out.

Sorry. I can't really phrase a good question. I'm still confused on how to fix this. I may just have to split the stereo. Is that a common practice among the veteran sample-makers?

Also as a little background about this sample here:

I made this sound by using a VST (Crisalys to be exact here's a picture of the program config)


However, I found that I wanted more granular control without using PCs all over the place (plus I can't figure out how to make vibrata work in the VST). So I went into a playground file, played a note (e.g. C4), and used a main volume PCs to then turn it off and then turn it back on. Then I repeated the process, playing a note halfway up the chromatic scale (e.g. F#4 ). I then continued that for 3 more octaves, and then exported that "song" to a .wav file. Then I reloaded the whole thing as a sample, which attached to an instrument, and proceeded to split the sample into smaller ones, using the PCs silences to denote when one note stopped and began, and trimmed a little of each sample off each side along with the silences. What you are looking at is a snippet of one of the notes I used in the final instrument.

Now, for a little more clarification: (WARNING: BIG PIC DUMP...sorry)

This is a full arbitrary sample, already resampled for loop smoothing:


This is a close-up of the loop beginning:


And finally, the loop end:


In most cases, the end didn't really resemble the beginning (this may have happened here because of the smoothing), but even with the smoothing I'll still be able to detect the loop wrap-around point.

Offline herodotas

  • Inspired artist
  • **
  • Posts: 62
  • Gender: Male
Re: Making Better Samples for Looping
« Reply #7 on: April 16, 2019, 15:01:05 »

Offline I-S3-O

  • Inspired artist
  • **
  • Posts: 50
  • Gender: Male
  • Operating System: Windows 10 Pro
Re: Making Better Samples for Looping
« Reply #8 on: Yesterday at 04:50:13 »
What a magnanimous amount of information! I've been pouring over this for a couple of days. Thanks a bunch!