[Csnd] Aliasing when reading tables fast, how to avoid?
| Date | 2010-11-14 22:04 |
| From | Jim Credland |
| Subject | [Csnd] Aliasing when reading tables fast, how to avoid? |
Folks - I'm sure this problem has been solved a million times, but I
can't work the solution out. If I'm reading a table from an audio
file, and want to play at an increasing rate, how can I avoid aliasing
noise? Buggered if I can find the solution with google, and most
things can be found with google.
I'm doing approximately this (where sound.wav is a couple of seconds
long loop):
giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1
...
kcps line 1, p3, 100
aphasor phasor kcps
a1 tab aphasor, giWav, 1
out a1
Any bright ideas? I assume it's an aliasing problem anyway, I may be
wrong, but there's some pretty odd high frequency clutter appearing.
Increasing the sr= is beneficial but not perfect.
Some kind of massive oversampling and a filter?
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-14 22:18 |
| From | Victor Lazzarini |
| Subject | [Csnd] Re: Aliasing when reading tables fast, how to avoid? |
You'll need to decide what is the fastest rate you will play it
back, then filter it with a good parametric EQ, removing all
components that will be aliased. Then you can load and play it back at
that rate.
Say you will play a sound 2x at 44100. Then you should apply a filter
at around 10K, so that little energy is left
beyond 11025Hz. Then when this is played double-speed, very little
will be aliased art 22050Hz.
Victor
On 14 Nov 2010, at 22:04, Jim Credland wrote:
>
>
> Folks - I'm sure this problem has been solved a million times, but I
> can't work the solution out. If I'm reading a table from an audio
> file, and want to play at an increasing rate, how can I avoid
> aliasing noise? Buggered if I can find the solution with google,
> and most things can be found with google.
>
> I'm doing approximately this (where sound.wav is a couple of seconds
> long loop):
>
> giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1
> ...
> kcps line 1, p3, 100
> aphasor phasor kcps
> a1 tab aphasor, giWav, 1
> out a1
>
> Any bright ideas? I assume it's an aliasing problem anyway, I may
> be wrong, but there's some pretty odd high frequency clutter
> appearing. Increasing the sr= is beneficial but not perfect.
>
> Some kind of massive oversampling and a filter?
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-14 22:44 |
| From | Jim Credland |
| Subject | [Csnd] Re: Re: Aliasing when reading tables fast, how to avoid? |
Victor - The problem is that the playback frequency is variable over a
wide range. I think your method only works when the playback
frequency is known in advance. Otherwise when playing back slowly all
the top end will be missing.
thoughts?
J.
On 14 Nov 2010, at 22:18, Victor Lazzarini wrote:
> You'll need to decide what is the fastest rate you will play it
> back, then filter it with a good parametric EQ, removing all
> components that will be aliased. Then you can load and play it back
> at that rate.
>
> Say you will play a sound 2x at 44100. Then you should apply a
> filter at around 10K, so that little energy is left
> beyond 11025Hz. Then when this is played double-speed, very little
> will be aliased art 22050Hz.
>
>
> Victor
>
> On 14 Nov 2010, at 22:04, Jim Credland wrote:
>
>>
>>
>> Folks - I'm sure this problem has been solved a million times, but
>> I can't work the solution out. If I'm reading a table from an
>> audio file, and want to play at an increasing rate, how can I avoid
>> aliasing noise? Buggered if I can find the solution with google,
>> and most things can be found with google.
>>
>> I'm doing approximately this (where sound.wav is a couple of
>> seconds long loop):
>>
>> giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1
>> ...
>> kcps line 1, p3, 100
>> aphasor phasor kcps
>> a1 tab aphasor, giWav, 1
>> out a1
>>
>> Any bright ideas? I assume it's an aliasing problem anyway, I may
>> be wrong, but there's some pretty odd high frequency clutter
>> appearing. Increasing the sr= is beneficial but not perfect.
>>
>> Some kind of massive oversampling and a filter?
>>
>> Send bugs reports to the Sourceforge bug tracker
>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-14 23:06 |
| From | Victor Lazzarini |
| Subject | [Csnd] Re: Re: Re: Aliasing when reading tables fast, how to avoid? |
You could always use various copies of the same thing filtered at
different frequencies and crossfade as you get higher/lower. That is
how vco2 does alias-free waveforms
(multiple wavetables).
Also (I have not tried this), GEN 30 appears to allow re-sampling of
tables to generate multiple wavetables. See the example in GEN32.
Victor
On 14 Nov 2010, at 22:44, Jim Credland wrote:
> Victor - The problem is that the playback frequency is variable over
> a wide range. I think your method only works when the playback
> frequency is known in advance. Otherwise when playing back slowly
> all the top end will be missing.
>
> thoughts?
>
> J.
> On 14 Nov 2010, at 22:18, Victor Lazzarini wrote:
>
>> You'll need to decide what is the fastest rate you will play it
>> back, then filter it with a good parametric EQ, removing all
>> components that will be aliased. Then you can load and play it back
>> at that rate.
>>
>> Say you will play a sound 2x at 44100. Then you should apply a
>> filter at around 10K, so that little energy is left
>> beyond 11025Hz. Then when this is played double-speed, very little
>> will be aliased art 22050Hz.
>>
>>
>> Victor
>>
>> On 14 Nov 2010, at 22:04, Jim Credland wrote:
>>
>>>
>>>
>>> Folks - I'm sure this problem has been solved a million times, but
>>> I can't work the solution out. If I'm reading a table from an
>>> audio file, and want to play at an increasing rate, how can I
>>> avoid aliasing noise? Buggered if I can find the solution with
>>> google, and most things can be found with google.
>>>
>>> I'm doing approximately this (where sound.wav is a couple of
>>> seconds long loop):
>>>
>>> giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1
>>> ...
>>> kcps line 1, p3, 100
>>> aphasor phasor kcps
>>> a1 tab aphasor, giWav, 1
>>> out a1
>>>
>>> Any bright ideas? I assume it's an aliasing problem anyway, I may
>>> be wrong, but there's some pretty odd high frequency clutter
>>> appearing. Increasing the sr= is beneficial but not perfect.
>>>
>>> Some kind of massive oversampling and a filter?
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe csound"
>>>
>>
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-14 23:19 |
| From | Jim Credland |
| Subject | [Csnd] Re: Re: Re: Re: Aliasing when reading tables fast, how to avoid? |
Will have a go tomorrow. Need some sleep.
Just knocked up a similar function in puredata though. There's an
oversampling demo in the help files, so I borrowed their code. It
solved the problem in the most straightforward (if not most
computationally efficient) way. Is there an oversampling solution
for csound? I can't imagine how it would work straightforwardly,
probably running with very large values of sr?
On 14 Nov 2010, at 23:06, Victor Lazzarini wrote:
> You could always use various copies of the same thing filtered at
> different frequencies and crossfade as you get higher/lower. That is
> how vco2 does alias-free waveforms
> (multiple wavetables).
>
> Also (I have not tried this), GEN 30 appears to allow re-sampling of
> tables to generate multiple wavetables. See the example in GEN32.
>
> Victor
>
> On 14 Nov 2010, at 22:44, Jim Credland wrote:
>
>> Victor - The problem is that the playback frequency is variable
>> over a wide range. I think your method only works when the
>> playback frequency is known in advance. Otherwise when playing
>> back slowly all the top end will be missing.
>>
>> thoughts?
>>
>> J.
>> On 14 Nov 2010, at 22:18, Victor Lazzarini wrote:
>>
>>> You'll need to decide what is the fastest rate you will play it
>>> back, then filter it with a good parametric EQ, removing all
>>> components that will be aliased. Then you can load and play it
>>> back at that rate.
>>>
>>> Say you will play a sound 2x at 44100. Then you should apply a
>>> filter at around 10K, so that little energy is left
>>> beyond 11025Hz. Then when this is played double-speed, very little
>>> will be aliased art 22050Hz.
>>>
>>>
>>> Victor
>>>
>>> On 14 Nov 2010, at 22:04, Jim Credland wrote:
>>>
>>>>
>>>>
>>>> Folks - I'm sure this problem has been solved a million times,
>>>> but I can't work the solution out. If I'm reading a table from
>>>> an audio file, and want to play at an increasing rate, how can I
>>>> avoid aliasing noise? Buggered if I can find the solution with
>>>> google, and most things can be found with google.
>>>>
>>>> I'm doing approximately this (where sound.wav is a couple of
>>>> seconds long loop):
>>>>
>>>> giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1
>>>> ...
>>>> kcps line 1, p3, 100
>>>> aphasor phasor kcps
>>>> a1 tab aphasor, giWav, 1
>>>> out a1
>>>>
>>>> Any bright ideas? I assume it's an aliasing problem anyway, I
>>>> may be wrong, but there's some pretty odd high frequency clutter
>>>> appearing. Increasing the sr= is beneficial but not perfect.
>>>>
>>>> Some kind of massive oversampling and a filter?
>>>>
>>>> Send bugs reports to the Sourceforge bug tracker
>>>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>>> Discussions of bugs and features can be posted here
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>> "unsubscribe csound"
>>>>
>>>
>>>
>>>
>>> Send bugs reports to the Sourceforge bug tracker
>>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe csound"
>>>
>>
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>> https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-15 21:37 |
| From | Mark Van Peteghem |
| Subject | [Csnd] Re: Aliasing when reading tables fast, how to avoid? |
I think you can handle this nicely with vco2init, vco2ft and oscilikt. With these you can let CSound create a bunch of tables behind the scenes, suitable for different rates so aliasing is avoided. Here is an example of how I did this. Do this once: iwave_new ftgen 0, 0, i_table_len, ... i_tmp vco2init -iwave_new, iwave_new+1, 1.02, 128, i_table_len, iwave_new iwave = -iwave_new Then do this to generate the signal: kfn vco2ft kfreq, iwave, 1 asig oscilikt 1, kfreq, kfn In my case kfreq was the actual frequency I wanted, if you use samples you may have to adjust this. I'm not sure how much memory this will use when your samples are big, but I used it successfully with i_table_len = 2^18, which is about 250,000. Regards, Mark Jim Credland wrote: > > > Folks - I'm sure this problem has been solved a million times, but I > can't work the solution out. If I'm reading a table from an audio > file, and want to play at an increasing rate, how can I avoid aliasing > noise? Buggered if I can find the solution with google, and most > things can be found with google. > > I'm doing approximately this (where sound.wav is a couple of seconds > long loop): > > giWav ftgen 0, 0, 0, 1, "sound.wav", 0, 0, 1 > ... > kcps line 1, p3, 100 > aphasor phasor kcps > a1 tab aphasor, giWav, 1 > out a1 > > Any bright ideas? I assume it's an aliasing problem anyway, I may be > wrong, but there's some pretty odd high frequency clutter appearing. > Increasing the sr= is beneficial but not perfect. > > Some kind of massive oversampling and a filter? > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" > > |