Re: [linux-audio-dev] looped samples .. Was: extending LADSPA, it's not that easy ......

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] looped samples .. Was: extending LADSPA, it's not that easy ......
From: David Olofson (david_AT_gardena.net)
Date: Sat Nov 04 2000 - 10:35:43 EET


On Sat, 28 Oct 2000, Benno Senoner wrote:
> On Sat, 28 Oct 2000, Tom Pincince wrote:
> >
> > This is not what I am talking about. (Slightly off topic - these fades
> > are the same as the cross fades that EVO will need to allow sustain
> > based on looping.)
> >
>
> With "sustain based on looping" do you mean regular looping or some
> kind of special one ?
> Why should microfades be needed ?
>
> Speaking of sample looping I've read a part of the Soundfont PDF, and they
> require that looped samples replicate a few samples (8 I believe) preceding the
> loop start point past the loop end point.
>
> This to provide click-free looping when using interpolation. (which is almost
> always the case since we are talking about pitched sample-playback).

Actually, this is more of a hack to deal with very simple hardware,
than a general requirement.

> The addidional samples beyond the loop-end point are needed because the
> interpolator (in most cases) to calculate a sample value, acesses the samples at
> pos , pos+1 , pos+2 etc (depends on the order).

Exactly; and it's a *lot* easier to do it that way than to actually
wrap every single index at the loop end. :-)

Anyway, I definitely think this kind of hacks should be kept far away
from the file format! It's a software/driver issue to compensate for
this kind of engine/hardware limitations/shortcuts. Or see it this
way; are we going to do destructive "legacy" optimization tricks on
data that is supposed to be *editable*? (Or are we going to use
separate file formats for source and target/output banks...?)

> So I was wondering how other samplers handle this issue.
> How many samplers does allow you to move loop end points and/or
> turn on/off looping in realtime ?

I don't know about "real time", but I'd be very anoyed with any kind
of loop tuner that didn't allow tweaking while playing the loop...

> Any experts out here ?
>
> The problem arises when we want to turn on and off looping.
>
> On a pure RAM based sampler , when turning on looping we would need to replicate
> the samples beyond the loop end, and when turning it off, we would need to
> restore back the original data, otherwise the sample would click where the
> (deactivated) loop end point lies.

How about an algorithm similar to software sprite/mouse pointer
rendering? That is,

        1) Load the clean, non-demolished waveform
        2) Save all areas that will be changed for loop optimizations
        3) Apply the loop optimization (wrap sections etc)

        4) If you want to move one or more of the loop points,
           restore the waveform using the data from 2), then goto 2).

(There are various tricks to be smart about what to restore when
moving loop points, but I've left that part out for clarity. It's
basically about being able to deal with overlapping "demolished"
areas correctly, and this is a lot easier with opaque 1D audio data
than with partially transparent 2D graphic objects...)

> When implementing a varispeed HDR or a disk based sampler , it becomes easier to
> handle this issue, since you supply a continuous stream of samples to the audio
> thread, thus the interpolator automatically has data "beyond" the loop end
> point.
> (because if there is a loop, you simply queue up the samples within the loop in
> the stream buffer over and over again).

Yep, and that data is prepare by the engine, for the engine. No
problems with weird optimization tricks here.

//David

.- M u C o S -------------------------. .- David Olofson --------.
| A Free/Open Source | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
| for | | Open Source Advocate |
| Professional and Consumer | | Singer |
| Multimedia | | Songwriter |
`-----> http://www.linuxdj.com/mucos -' `---> david_AT_linuxdj.com -'


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Nov 06 2000 - 00:16:18 EET