Every sample

--
Nuno Santos

No dia 20/03/2015, às 18:51, Marco Lo Monaco <marco.lomon...@teletu.it> 
escreveu:

> How often do you update the LFO? Every buffersize (32/64 samples)?
> 
> M.
> 
>> -----Messaggio originale-----
>> Da: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-
>> boun...@music.columbia.edu] Per conto di Nuno Santos
>> Inviato: venerdì 20 marzo 2015 19:06
>> A: A discussion list for music-related DSP
>> Oggetto: Re: [music-dsp] Glitch/Alias free modulated delay
>> 
>> Hi,
>> 
>> Today I have used a piece of code which is on musicdsp for testing this out
>> again.
>> 
>> http://musicdsp.org/archive.php?classid=4#98
>> <http://musicdsp.org/archive.php?classid=4#98>
>> 
>> I was able to have a delay changing in time without any kind of artefact or
>> glitch. However I have only managed to get this results by changing the
>> parameter by myself.
>> 
>> When I say, manually moving the parameter by myself I say that I update a
>> property which will be linearly interpolated in time (500ms).
>> 
>> When I try to apply the modulation which is a value between -1 and 1, that
>> comes from an LFO, I always end up with artefacts and noise
>> 
>> I don’t understand why it works so well when I move the parameter value
>> (which is also changing constantly due to interpolation, and it doesn’t work
>> when I apply the modulation with the lo…
>> 
>> Any ideas?
>> 
>> This is my current code
>> 
>> void IDelay::read(IAudioSample *output)
>> {
>>    double t=double(_writeIndex)-_time; // works perfectly moving the
>> handle manually with the value being interpolated before getting the
>> variable _time;
>>    //double t=double(_writeIndex)-_time+_modulation*_modulationRange;
>> 
>>    // clip lookback buffer-bound
>>    if(t<0.0)
>>        t=_size+t;
>> 
>>    // compute interpolation left-floor
>>    int const index0=int(t);
>> 
>>    // compute interpolation right-floor
>>    int index_1=index0-1;
>>    int index1=index0+1;
>>    int index2=index0+2;
>> 
>>    // clip interp. buffer-bound
>>    if(index_1<0)index_1=_size-1;
>>    if(index1>=_size)index1=0;
>>    if(index2>=_size)index2=0;
>> 
>>    // get neighbourgh samples
>>    float const y_1= _buffer[index_1];
>>    float const y0 = _buffer[index0];
>>    float const y1 = _buffer[index1];
>>    float const y2 = _buffer[index2];
>> 
>>    // compute interpolation x
>>    float const x=(float)t-(float)index0;
>> 
>>    // calculate
>>    float const c0 = y0;
>>    float const c1 = 0.5f*(y1-y_1);
>>    float const c2 = y_1 - 2.5f*y0 + 2.0f*y1 - 0.5f*y2;
>>    float const c3 = 0.5f*(y2-y_1) + 1.5f*(y0-y1);
>> 
>>    *output=((c3*x+c2)*x+c1)*x+c0;
>> }
>>>> On 20 Mar 2015, at 14:20, Bjorn Roche <bj...@shimmeo.com
>>> <mailto:bj...@shimmeo.com>> wrote:
>>> 
>>> Interpolating the sample value is not sufficient to eliminate artifacts.
>>> You also need to eliminate glitches that occur when jumping from one
>>> time value to another. In other words: no matter how good your
>>> sample-value interpolation is, you will still introduce artifacts when
>>> changing the delay time. A steep low-pass filter going into the delay
>>> line would be one way to solve this. (this is the idea of
>>> "bandlimiting" alluded to earlier in this discussion.)
>>> 
>>> I can say from experience that you absolutely must take this into
>>> account, but, if memory serves (which it may not), the quality of
>>> interpolation and filtering is not that important. I am pretty sure
>>> I've written code to handle both cases using something super simple
>>> and efficient like linear interpolation and it sounded surprisingly
>>> good, which is to say everyone else on the project thought it sounded
>>> great, and that was enough to consider it done on that particular project.
>>> 
>>> HTH
>>> 
>>> 
>>> 
>>> On Fri, Mar 20, 2015 at 6:43 AM, Steven Cook
>>> <stevenpaulc...@tiscali.co.uk <mailto:stevenpaulc...@tiscali.co.uk>>
>>> wrote:
>>> 
>>>> 
>>>> Let suppose that I fix the errors In the algorithm. Is this
>>>> sufficient
>>>>> for a quality delay time
>>>>> Modulation? Or will I need more advance technics?
>>>> 
>>>> That's a matter of opinion :-) My opinion is that the hermite
>>>> interpolation you're using here (I didn't check to see if it's
>>>> implemented
>>>> correctly!) is more than adequate for modulated delay effects like
>>>> chorus - I suspect a lot of commercial effects have used linear
>> interpolation.
>>>> 
>>>> Steven Cook.
>>>> 
>>>> 
>>>> 
>>>> -----Original Message----- From: Nuno Santos
>>>>> Sent: Thursday, March 19, 2015 6:28 PM
>>>>> To: A discussion list for music-related DSP
>>>>> Subject: Re: [music-dsp] Glitch/Alias free modulated delay
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> Thanks for your replies.
>>>>> 
>>>>> What I hear is definitely related with the modulation. The artefacts
>>>>> are audible every time the modulation is applied: manually or
>>>>> automatically (please not that I have an interpolator for manual
>>>>> parameter changes to avoid abrupt changes). I think I was already
>>>>> applying an Hermit interpolation. This is my delay read function.
>>>>> 
>>>>> void IDelay::read(IAudioSample *output) {  float t =
>>>>> _time+_modulation*_modulationRange;
>>>>> 
>>>>> if (t>(_size-1))
>>>>>     t=_size-1;
>>>>> 
>>>>> float sf;
>>>>> 
>>>>> #if 0
>>>>> sf = _buffer[int(readIndex(t,0))];
>>>>> #else
>>>>> float const y_1= _buffer[int(readIndex(t,-1))];  float const y0 =
>>>>> _buffer[int(readIndex(t,0))];  float const y1 =
>>>>> _buffer[int(readIndex(t,1))];  float const y2 =
>>>>> _buffer[int(readIndex(t,2))];  float const
>>>>> x=readIndex(t,0)-int(readIndex(t,0));
>>>>> float const c0 = y0;
>>>>> float const c1 = 0.5f*(y1-y_1);
>>>>> float const c2 = y_1 - 2.5f*y0 + 2.0f*y1 - 0.5f*y2;  float const c3
>>>>> = 0.5f*(y2-y_1) + 1.5f*(y0-y1);
>>>>> 
>>>>> sf=((c3*x+c2)*x+c1)*x+c0;
>>>>> #endif
>>>>> 
>>>>> *output = sf;
>>>>> }
>>>>> 
>>>>> float IDelay::readIndex(float t, int offset) {  float
>>>>> index=_writeIndex-t+offset;
>>>>> 
>>>>> if (index<0)
>>>>>     index+=_size;
>>>>> 
>>>>> return index;
>>>>> }
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Nuno
>>>>> 
>>>>> On 19 Mar 2015, at 18:12, David Olofson <da...@olofson.net
>> <mailto:da...@olofson.net>> wrote:
>>>>>> 
>>>>>> On Thu, Mar 19, 2015 at 6:15 PM, Nuno Santos
>>>>>> <nunosan...@imaginando.pt <mailto:nunosan...@imaginando.pt>>
>>>>>> wrote:
>>>>>> [...]
>>>>>> 
>>>>>>> If I use interpolation for buffer access I experience less glitch
>>>>>>> and more alias.
>>>>>> 
>>>>>> What type of interpolation are you using? I would think you need
>>>>>> something better than linear interpolation for this. I'd try Hermite.
>>>>>> That should be sufficient for "slow" modulation, although
>>>>>> theoretically, you *should* bandlimit the signal as soon as you
>>>>>> play it back faster than the original sample rate.
>>>>>> 
>>>>>> For more extreme effects (which effectively means you're sometimes
>>>>>> playing back audio at a substantially higher sample rate than that
>>>>>> of your audio stream), you may need a proper bandlimited resampler.
>>>>>> (Apply a brickwall filter before the interpolation, and/or
>>>>>> oversample the interpolator.)
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> //David Olofson - Consultant, Developer, Artist, Open Source
>>>>>> Advocate
>>>>>> 
>>>>>> .--- Games, examples, libraries, scripting, sound, music, graphics ---.
>>>>>> |   http://consulting.olofson.net <http://consulting.olofson.net/>
>> http://olofsonarcade.com <http://olofsonarcade.com/>   |
>>>>>> '---------------------------------------------------------------------'
>>>>>> --
>>>>>> dupswapdrop -- the music-dsp mailing list and website:
>>>>>> subscription info, FAQ, source code archive, list archive, book
>>>>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>>>>> <http://music.columbia.edu/cmc/music-dsp>
>>>>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>>>>> 
>>>>> --
>>>>> dupswapdrop -- the music-dsp mailing list and website:
>>>>> subscription info, FAQ, source code archive, list archive, book
>>>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>>>> <http://music.columbia.edu/cmc/music-dsp>
>>>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>>>>> --
>>>>> dupswapdrop -- the music-dsp mailing list and website:
>>>>> subscription info, FAQ, source code archive, list archive, book
>>>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>>>> --
>>>> dupswapdrop -- the music-dsp mailing list and website:
>>>> subscription info, FAQ, source code archive, list archive, book
>>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>>> <http://music.columbia.edu/cmc/music-dsp>
>>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>>>> --
>>>> dupswapdrop -- the music-dsp mailing list and website:
>>>> subscription info, FAQ, source code archive, list archive, book
>>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>>> 
>>> 
>>> 
>>> --
>>> Bjorn Roche
>>> @shimmeoapp
>>> --
>>> dupswapdrop -- the music-dsp mailing list and website:
>>> subscription info, FAQ, source code archive, list archive, book
>>> reviews, dsp links http://music.columbia.edu/cmc/music-dsp
>>> <http://music.columbia.edu/cmc/music-dsp>
>>> http://music.columbia.edu/mailman/listinfo/music-dsp
>> 
>> --
>> dupswapdrop -- the music-dsp mailing list and website:
>> subscription info, FAQ, source code archive, list archive, book reviews, dsp
>> links http://music.columbia.edu/cmc/music-dsp
>> http://music.columbia.edu/mailman/listinfo/music-dsp
> 
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp 
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to