Csound Csound-dev Csound-tekno Search About

[Csnd] how to avoid aliasing in fm-modulation

Date2014-03-30 17:12
FromStefan Thomas
Subject[Csnd] how to avoid aliasing in fm-modulation
Dear community,
I have a problem with the following file.
When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
Here is my snippet:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -m0d
</CsOptions>

; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
alwayson 1
instr 1   
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5
    index = 1
    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>




Date2014-03-30 17:40
FromHlöðver Sigurðsson
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
Just an idea.

To turn off the index for high notes

instr 1    
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5

if (icps > 10000) then
index = 0
else
index = 1
endif

    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin


2014-03-30 16:12 GMT+00:00 Stefan Thomas <kontrapunktstefan@gmail.com>:
Dear community,
I have a problem with the following file.
When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
Here is my snippet:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -m0d
</CsOptions>

; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
alwayson 1
instr 1   
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5
    index = 1
    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>






--
Hlöðver Sigurðsson

Date2014-03-30 19:38
FromStefan Thomas
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
Yes, that could be an idea, but than I will get another basis pitch (with this ratio between carrier and modulator the perceived pitch is lower).


2014-03-30 18:40 GMT+02:00 Hlöðver Sigurðsson <hlolli@gmail.com>:
Just an idea.

To turn off the index for high notes

instr 1    
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5

if (icps > 10000) then
index = 0
else
index = 1
endif

    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin


2014-03-30 16:12 GMT+00:00 Stefan Thomas <kontrapunktstefan@gmail.com>:

Dear community,
I have a problem with the following file.
When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
Here is my snippet:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -m0d
</CsOptions>

; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
alwayson 1
instr 1   
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5
    index = 1
    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>






--
Hlöðver Sigurðsson


Date2014-03-31 19:04
FromDavid Mooney
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
You could also use a low pass filter. Stack a few butterlp filters somewhat below the Nyquist limit for the sample rate you are using:

a1   butlp asig,20000
a2   butlp a1,20000
aout   butlp a2,20000

Stacking them hardens the cutoff.

--David Mooney


On Sun, Mar 30, 2014 at 12:12 PM, Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
Dear community,
I have a problem with the following file.
When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
Here is my snippet:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -m0d
</CsOptions>

; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
alwayson 1
instr 1   
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5
    index = 1
    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>






--
Opaque Melodies
http://opaquemelodies.com

Date2014-03-31 19:05
FromJustin Smith
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
Frequency aliasing places higher frequencies into lower ones. You would need to also up the sr in order for filtering to really work.


On Mon, Mar 31, 2014 at 11:04 AM, David Mooney <dmooney023@gmail.com> wrote:
You could also use a low pass filter. Stack a few butterlp filters somewhat below the Nyquist limit for the sample rate you are using:

a1   butlp asig,20000
a2   butlp a1,20000
aout   butlp a2,20000

Stacking them hardens the cutoff.

--David Mooney


On Sun, Mar 30, 2014 at 12:12 PM, Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
Dear community,
I have a problem with the following file.
When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
Here is my snippet:
<CsoundSynthesizer>
<CsOptions>
-odac -Ma -m0d
</CsOptions>

; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
alwayson 1
instr 1   
    iamp     ampmidi 0.1
     icps cpsmidi
    icps = icps*3.64 ; key 69 sounds as "normal" a
    icar = 1
    imod = 1.27475486
    aenv    linsegr 0,0.01,1,5,0,0.1,0
    kndxenv    expseg  1,0.1,0.75,5,0.5
    index = 1
    asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
</CsScore>
</CsoundSynthesizer>






--
Opaque Melodies
http://opaquemelodies.com


Date2014-03-31 19:06
FromVictor Lazzarini
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
If the aliasing is in the generated signal, filtering like that will not help.

On 31 Mar 2014, at 19:04, David Mooney wrote:

> You could also use a low pass filter. Stack a few butterlp filters somewhat below the Nyquist limit for the sample rate you are using:
> 
> a1   butlp asig,20000
> a2   butlp a1,20000
> aout   butlp a2,20000
> 
> Stacking them hardens the cutoff.
> 
> --David Mooney
> 
> 
> On Sun, Mar 30, 2014 at 12:12 PM, Stefan Thomas  wrote:
> Dear community,
> I have a problem with the following file.
> When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
> Here is my snippet:
> 
> 
> -odac -Ma -m0d
> 
> 
> ; ==============================================
> 
> 
> sr    =    44100
> ksmps     =     100
> nchnls    =    2
> 0dbfs    =    1
> gisine ftgen 0,0,2^13, 10, 1
> alwayson 1
> instr 1    
>     iamp     ampmidi 0.1
>      icps cpsmidi
>     icps = icps*3.64 ; key 69 sounds as "normal" a
>     icar = 1
>     imod = 1.27475486
>     aenv    linsegr 0,0.01,1,5,0,0.1,0
>     kndxenv    expseg  1,0.1,0.75,5,0.5
>     index = 1
>     asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
>     outs asig, asig
> endin
> 
> 
> ; ==============================================
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Opaque Melodies
> http://opaquemelodies.com

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-04-01 09:07
FromStefan Thomas
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
Dear friends,
I found out that changing the ratio between modulator and carrier will result in the same spectrum but with desired basis-pitch.
The ratio is  4.64010769 (I've calculated this with the software scala).


2014-03-31 20:06 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
If the aliasing is in the generated signal, filtering like that will not help.

On 31 Mar 2014, at 19:04, David Mooney wrote:

> You could also use a low pass filter. Stack a few butterlp filters somewhat below the Nyquist limit for the sample rate you are using:
>
> a1   butlp asig,20000
> a2   butlp a1,20000
> aout   butlp a2,20000
>
> Stacking them hardens the cutoff.
>
> --David Mooney
>
>
> On Sun, Mar 30, 2014 at 12:12 PM, Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
> Dear community,
> I have a problem with the following file.
> When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
> Here is my snippet:
> <CsoundSynthesizer>
> <CsOptions>
> -odac -Ma -m0d
> </CsOptions>
>
> ; ==============================================
> <CsInstruments>
>
> sr    =    44100
> ksmps     =     100
> nchnls    =    2
> 0dbfs    =    1
> gisine ftgen 0,0,2^13, 10, 1
> alwayson 1
> instr 1
>     iamp     ampmidi 0.1
>      icps cpsmidi
>     icps = icps*3.64 ; key 69 sounds as "normal" a
>     icar = 1
>     imod = 1.27475486
>     aenv    linsegr 0,0.01,1,5,0,0.1,0
>     kndxenv    expseg  1,0.1,0.75,5,0.5
>     index = 1
>     asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
>     outs asig, asig
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
>
>
>
> --
> Opaque Melodies
> http://opaquemelodies.com

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-04-01 14:44
FromAidan Collins
SubjectRe: [Csnd] how to avoid aliasing in fm-modulation
I'm also pretty interested in this topic. I had been experimenting with FM in the past and hadn't really appreciated the aliasing concern.

Stefan, could you describe a little more the thought process that lead you to that alternate ratio?
Does anyone else have any other interesting ways to address these aliasing in FM synthesis? Is the typical approach to do the math or use your ears to just avoid generating those frequencies, or using a really high sr?

Thanks!

Aidan


On Tue, Apr 1, 2014 at 4:07 AM, Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
Dear friends,
I found out that changing the ratio between modulator and carrier will result in the same spectrum but with desired basis-pitch.
The ratio is  4.64010769 (I've calculated this with the software scala).


2014-03-31 20:06 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:

If the aliasing is in the generated signal, filtering like that will not help.

On 31 Mar 2014, at 19:04, David Mooney wrote:

> You could also use a low pass filter. Stack a few butterlp filters somewhat below the Nyquist limit for the sample rate you are using:
>
> a1   butlp asig,20000
> a2   butlp a1,20000
> aout   butlp a2,20000
>
> Stacking them hardens the cutoff.
>
> --David Mooney
>
>
> On Sun, Mar 30, 2014 at 12:12 PM, Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
> Dear community,
> I have a problem with the following file.
> When I play in the highest octave of the piano, I get aliasing sounds. Off course, if the index is nearly 0, the aliasing diappears, but the sound looses its character. Is there another possibility to suppress the aliasing sound?
> Here is my snippet:
> <CsoundSynthesizer>
> <CsOptions>
> -odac -Ma -m0d
> </CsOptions>
>
> ; ==============================================
> <CsInstruments>
>
> sr    =    44100
> ksmps     =     100
> nchnls    =    2
> 0dbfs    =    1
> gisine ftgen 0,0,2^13, 10, 1
> alwayson 1
> instr 1
>     iamp     ampmidi 0.1
>      icps cpsmidi
>     icps = icps*3.64 ; key 69 sounds as "normal" a
>     icar = 1
>     imod = 1.27475486
>     aenv    linsegr 0,0.01,1,5,0,0.1,0
>     kndxenv    expseg  1,0.1,0.75,5,0.5
>     index = 1
>     asig foscil aenv*iamp, icps, icar, imod, index*kndxenv, gisine
>     outs asig, asig
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
>
>
>
> --
> Opaque Melodies
> http://opaquemelodies.com

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"