Csound Csound-dev Csound-tekno Search About

odd harmonics only, from gbuzz

Date2016-08-23 06:20
FromMichael Saunders
Subjectodd harmonics only, from gbuzz
I want to get gbuzz to produce a spectrum with only odd harmonics.

Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.

The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

sr = 96000
kr = 96000
ksmps = 1
nchnls = 2
0dbfs=1

instr 1
knho=((sr-50)/4000)-1;number of odd partials
knhe=(.5*(sr-50)/8000)-1;number of even partials
ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
out ao-(knhe/knho)*ae
endin

</CsInstruments>
<CsScore>

giCos  ftgen 0, 0, 2^10+1, 11, 1

i1 0 1

e
 </CsScore>
</CsoundSynthesizer>


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-08-23 12:41
FromVictor Lazzarini
SubjectRe: odd harmonics only, from gbuzz
You are producing only odd harmonics, as far as I can see. The frequency seems to be a bit high to tell,
but when I brought it down to 400 Hz I could hear the odd spectrum.

Also the max NH should be calculated as sr/(2*f).
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 23 Aug 2016, at 06:20, Michael Saunders  wrote:
> 
> I want to get gbuzz to produce a spectrum with only odd harmonics.
> 
> Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.
> 
> The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?
> 
> 
> 
> 
> 
> 
> sr = 96000
> kr = 96000
> ksmps = 1
> nchnls = 2
> 0dbfs=1
> 
> instr 1
> knho=((sr-50)/4000)-1;number of odd partials
> knhe=(.5*(sr-50)/8000)-1;number of even partials
> ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
> ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
> out ao-(knhe/knho)*ae
> endin
> 
> 
> 
> 
> giCos  ftgen 0, 0, 2^10+1, 11, 1
> 
> i1 0 1
> 
> e
>  
> 
> 
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-08-23 15:00
FromMichael Saunders
SubjectRe: odd harmonics only, from gbuzz
Thank you.  I corrected the line about the Nyquist and tried again.  When I look at the spectrum with my sound editor ("frequency analysis" on Audition), I see all the peaks, even and odd  (I had chosen a high frequency to make this easy to see).  At lower frequencies, I see the same thing.  

On Tue, Aug 23, 2016 at 7:41 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
You are producing only odd harmonics, as far as I can see. The frequency seems to be a bit high to tell,
but when I brought it down to 400 Hz I could hear the odd spectrum.

Also the max NH should be calculated as sr/(2*f).
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 23 Aug 2016, at 06:20, Michael Saunders <odradek5@gmail.com> wrote:
>
> I want to get gbuzz to produce a spectrum with only odd harmonics.
>
> Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.
>
> The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
>
> sr = 96000
> kr = 96000
> ksmps = 1
> nchnls = 2
> 0dbfs=1
>
> instr 1
> knho=((sr-50)/4000)-1;number of odd partials
> knhe=(.5*(sr-50)/8000)-1;number of even partials
> ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
> ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
> out ao-(knhe/knho)*ae
> endin
>
> </CsInstruments>
> <CsScore>
>
> giCos  ftgen 0, 0, 2^10+1, 11, 1
>
> i1 0 1
>
> e
>  </CsScore>
> </CsoundSynthesizer>
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-08-23 15:16
FromVictor Lazzarini
SubjectRe: odd harmonics only, from gbuzz
Look again. You can use dispfft for that. Sweep the odd partials gain and see the effect. 

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 23 Aug 2016, at 15:00, Michael Saunders <odradek5@GMAIL.COM> wrote:

Thank you.  I corrected the line about the Nyquist and tried again.  When I look at the spectrum with my sound editor ("frequency analysis" on Audition), I see all the peaks, even and odd  (I had chosen a high frequency to make this easy to see).  At lower frequencies, I see the same thing.  

On Tue, Aug 23, 2016 at 7:41 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
You are producing only odd harmonics, as far as I can see. The frequency seems to be a bit high to tell,
but when I brought it down to 400 Hz I could hear the odd spectrum.

Also the max NH should be calculated as sr/(2*f).
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 23 Aug 2016, at 06:20, Michael Saunders <odradek5@gmail.com> wrote:
>
> I want to get gbuzz to produce a spectrum with only odd harmonics.
>
> Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.
>
> The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
>
> sr = 96000
> kr = 96000
> ksmps = 1
> nchnls = 2
> 0dbfs=1
>
> instr 1
> knho=((sr-50)/4000)-1;number of odd partials
> knhe=(.5*(sr-50)/8000)-1;number of even partials
> ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
> ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
> out ao-(knhe/knho)*ae
> endin
>
> </CsInstruments>
> <CsScore>
>
> giCos  ftgen 0, 0, 2^10+1, 11, 1
>
> i1 0 1
>
> e
>  </CsScore>
> </CsoundSynthesizer>
>
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-08-23 15:55
FromVictor Lazzarini
SubjectRe: odd harmonics only, from gbuzz
I had a look again. The even harmonics are only partially suppressed, because of the shape of the
gbuzz spectrum given by kmult.

Try this instead

instr 1
kh linseg 0,p3,1
ih = sr/(2*p5)
af1 gbuzz p4,p5,ih,1,0.9,1
af2 gbuzz p4,2*p5,ih/2,1,0.9^2,1
  out af1-(kh/2)*af2
  dispfft af1-(kh/2)*af2,0.5,2048
endin

If you use buzz, as described in the book, it will work better.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 23 Aug 2016, at 15:16, Victor Lazzarini  wrote:
> 
> Look again. You can use dispfft for that. Sweep the odd partials gain and see the effect. 
> 
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
> 
> On 23 Aug 2016, at 15:00, Michael Saunders  wrote:
> 
>> Thank you.  I corrected the line about the Nyquist and tried again.  When I look at the spectrum with my sound editor ("frequency analysis" on Audition), I see all the peaks, even and odd  (I had chosen a high frequency to make this easy to see).  At lower frequencies, I see the same thing.  
>> 
>> On Tue, Aug 23, 2016 at 7:41 AM, Victor Lazzarini  wrote:
>> You are producing only odd harmonics, as far as I can see. The frequency seems to be a bit high to tell,
>> but when I brought it down to 400 Hz I could hear the odd spectrum.
>> 
>> Also the max NH should be calculated as sr/(2*f).
>> ========================
>> Dr Victor Lazzarini
>> Dean of Arts, Celtic Studies and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>> 
>> > On 23 Aug 2016, at 06:20, Michael Saunders  wrote:
>> >
>> > I want to get gbuzz to produce a spectrum with only odd harmonics.
>> >
>> > Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.
>> >
>> > The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?
>> >
>> > 
>> > 
>> > 
>> > 
>> >
>> > sr = 96000
>> > kr = 96000
>> > ksmps = 1
>> > nchnls = 2
>> > 0dbfs=1
>> >
>> > instr 1
>> > knho=((sr-50)/4000)-1;number of odd partials
>> > knhe=(.5*(sr-50)/8000)-1;number of even partials
>> > ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
>> > ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
>> > out ao-(knhe/knho)*ae
>> > endin
>> >
>> > 
>> > 
>> >
>> > giCos  ftgen 0, 0, 2^10+1, 11, 1
>> >
>> > i1 0 1
>> >
>> > e
>> >  
>> > 
>> >
>> >
>> > Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-08-23 17:33
FromMichael Saunders
SubjectRe: odd harmonics only, from gbuzz
Thank you.  I guess I can't really achieve the effect I want with gbuzz.  I suppose I'll try filtering buzz.

On Tue, Aug 23, 2016 at 10:55 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I had a look again. The even harmonics are only partially suppressed, because of the shape of the
gbuzz spectrum given by kmult.

Try this instead

instr 1
kh linseg 0,p3,1
ih = sr/(2*p5)
af1 gbuzz p4,p5,ih,1,0.9,1
af2 gbuzz p4,2*p5,ih/2,1,0.9^2,1
  out af1-(kh/2)*af2
  dispfft af1-(kh/2)*af2,0.5,2048
endin

If you use buzz, as described in the book, it will work better.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 23 Aug 2016, at 15:16, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
>
> Look again. You can use dispfft for that. Sweep the odd partials gain and see the effect.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
> On 23 Aug 2016, at 15:00, Michael Saunders <odradek5@GMAIL.COM> wrote:
>
>> Thank you.  I corrected the line about the Nyquist and tried again.  When I look at the spectrum with my sound editor ("frequency analysis" on Audition), I see all the peaks, even and odd  (I had chosen a high frequency to make this easy to see).  At lower frequencies, I see the same thing.
>>
>> On Tue, Aug 23, 2016 at 7:41 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
>> You are producing only odd harmonics, as far as I can see. The frequency seems to be a bit high to tell,
>> but when I brought it down to 400 Hz I could hear the odd spectrum.
>>
>> Also the max NH should be calculated as sr/(2*f).
>> ========================
>> Dr Victor Lazzarini
>> Dean of Arts, Celtic Studies and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>> > On 23 Aug 2016, at 06:20, Michael Saunders <odradek5@gmail.com> wrote:
>> >
>> > I want to get gbuzz to produce a spectrum with only odd harmonics.
>> >
>> > Dodge and Jerse (2nd ed., pp.170--171) describe a method that I implemented in Csound (minimal example below)---basically generating full and even spectra and subtracting.
>> >
>> > The two buzz opcodes appear to do just what they should---the spectra of ao and ae are as expected---but when I subtract ae, the even harmonics are not cancelled out.  I get a full spectrum, much like ao.  What is wrong?
>> >
>> > <CsoundSynthesizer>
>> > <CsOptions>
>> > </CsOptions>
>> > <CsInstruments>
>> >
>> > sr = 96000
>> > kr = 96000
>> > ksmps = 1
>> > nchnls = 2
>> > 0dbfs=1
>> >
>> > instr 1
>> > knho=((sr-50)/4000)-1;number of odd partials
>> > knhe=(.5*(sr-50)/8000)-1;number of even partials
>> > ao gbuzz .5, 4000, knho, 1, .5, giCos ;odd
>> > ae gbuzz .5, 8000, knhe, 1, (.5^2), giCos;even
>> > out ao-(knhe/knho)*ae
>> > endin
>> >
>> > </CsInstruments>
>> > <CsScore>
>> >
>> > giCos  ftgen 0, 0, 2^10+1, 11, 1
>> >
>> > i1 0 1
>> >
>> > e
>> >  </CsScore>
>> > </CsoundSynthesizer>
>> >
>> >
>> > Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here