Author Topic: making seamless bidi loops in samples  (Read 347 times)

Offline musicalman

  • Active artist
  • *
  • Posts: 15
  • Operating System: Windows 10 X64
making seamless bidi loops in samples
« on: September 07, 2017, 10:06:01 »
Hi all,
This has been something I've been thinking about for a while. In most module formats, samples can either be looped or unlooped of course, and when looped, you can either have a normal loop or a bidi loop (loop repeats forwards then backwards). I can often tell when I hear a bidi loop because of the swaying back and forth effect it creates. It can often make a loop sound longer than it is, or at least make a short loop's existence a little less noticeable sometimes.
Open MPT has a crossfade function that I think works pretty well for normal loops, if you set things up carefully. I get really picky about how my loops sound, and I don't like there to be any sudden jumps, or even worse, a click/thump at the loop point. I know that a lot of loop errors can be masked in the mix and it's only when listening to samples that you notice a problem, but I really don't like taking that chance, since I've listened to more than a couple modules already where a clicking loop wasn't masked and it just sounded disconcerting.
The crossfading is all well and good for normal loops, but I've no clue how to make seamless bidi loops. With certain sounds like those with a lot of noisy elements, you can normally just tweak the loop until it sounds reasonable, but with strings and pads, two things which I intended to heavily use bidi loopps on, I cannot get anything resembling seamless out of it. judging by the modules I've looked at, this is a common problem. However I've encountered a few samples which were somehow magically made to work as bidi loops. There is a strings sample which seems to be used all the time, at least in the modules I listen to, where this is the case. The sample is really short and small yet the bidi loop is perfect, so it does the sample a lot of favors. There are also a few synth leads I've found to be fairly good-sounding with bidi loops, and don't seem to have disconcerting jumps at the loop boundaries.
I know a common solution for nailing a loop is to visually look at the loop window or some equivalent and make sure the waveform lines up at the loop boundaries. I can't do this for two reasons: I am visually impaired, and even if I tweak one sample value for a few minutes, I can never get anything seamless out of a normal or bidi loop, especially of something tonal like a pad, unless it's crossfaded. Open MPT doesn't support crossfading over bidi loops, and Googling around isn't much help either. The best I could come up with is that someone was describing how a 90s Ensoniq sampler he had offered a ton of crossfade options and also supported bidi loops. I played with an Ensoniq synth once and I could definitely hear bidi loops there, as well as in Roland synthesizers, so I imagine crossfades can work if done right. I even managed to make one by crossfading forwards into backwards once in an audio editor, but it took me about an hour, and I can't remember how I ever did it and wouldn't want to try to figure it out again. So my question is this: To those who use bidi loops, is there any hope for making things seamless with pads?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,292
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: making seamless bidi loops in samples
« Reply #1 on: September 07, 2017, 10:50:11 »
Since there is no specific crossfade option for bidi loops, modifying them manually is the only way to go at the moment. I had no idea so far how to implement a crossfader that would work well for bidi loops. The problem is that while of course they should look symmetrical around the loop point, this is far from being the only criterion that needs to be right, and so it's even difficult for sighted users to create good bidi loops. I don't think that every waveform is easily suitable for bidi loops, and synth manufacturers of course have the advantage that they can choose which waveforms they want to put in their synth and how to loop them.
ยป 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 musicalman

  • Active artist
  • *
  • Posts: 15
  • Operating System: Windows 10 X64
Re: making seamless bidi loops in samples
« Reply #2 on: September 08, 2017, 12:00:06 »
I don't think that every waveform is easily suitable for bidi loops, and synth manufacturers of course have the advantage that they can choose which waveforms they want to put in their synth and how to loop them.
Ah, this is exactly how I thought. And yeah, certain waveforms don't lend themselves well to bidi loops (saw waves for instance). I know just enough about wave shapes to know that that will likely create problems.

I had no idea so far how to implement a crossfader that would work well for bidi loops. The problem is that while of course they should look symmetrical around the loop point, this is far from being the only criterion that needs to be right, and so it's even difficult for sighted users to create good bidi loops.

I really don't know if this would help at all, but I'm going to attempt to describe the method I worked out to get bidi loops that sounded decent. Didn't take me as long as I thought to rework it through this time, so I guess it always goes easier the second time. :)
I've uploaded some demonstrative samples so you can try this if you want . It's pretty crude, probably more of a proof of concept than anything else. Probably would work way better if you took other criteria into account like symetry and stuff, which I wasn't able to do. What I'm showing is easiest to do if you have a sample that you want to bidi loop in its entirety. If there's a pre-loop section you have to do more work.

In the attached archive, 'original pad' is a sample I recorded. The sample is exactly 3 seconds long to keep things simple. To start, I reversed the original pad sample, and crossfaded that reversed copy into the end of the forward copy. The crossfade time I used was 0.16 seconds. In other words, the sample length is now 5.84 seconds, with 0.0 to 2.84 being the forward pad, 2.84 to 3.0 being the crossfade into the reverse, and from 3.0 to 5.84 being the reversed sample. The 'pad crossfade' file is the result.

Now, we need a crossfade from backward into forward (I'll explain why shortly). For now, I'm using the same crossfade time of 0.16 seconds. Perhaps you could get away with different crossfade times, I haven't tried working it out with that in mind. The 'pad crossfade again' file reflects what happens after this second fade. So from 2.84 to 3.0 is crossfade from forward into backward, from 5.68 to 5.84 is crossfade from backward into forward, and the rest is forward again.

Now, here's where we set the loop. Our loop will start halfway through the first fade, and end halfway through the second. First crossfade is from 2.84 to 3.0, so the loop start will be 2.92. Second crossfade goes from 5.68 to 5.84, so the loop end is 5.76. Isolate this section and you will have a backwards copy of the loop with half a crossfade at both ends. And it's seemless when doing a bidi loop! Well not quite seamless, you can hear the crossfades a bit but there's no click. If you want the sample to start playing forward instead of backward, you can of course reverse it, which I did in the 'pad bidi loop' file.

Hope that has at least made some sense to whoever reads this, if not provided something interesting.