Csound Csound-dev Csound-tekno Search About

tips desperately needed

Date2016-04-26 18:54
From"Joe ."
Subjecttips desperately needed
I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5 < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-26 19:01
FromHlöðver Sigurðsson
SubjectRe: tips desperately needed
if (p5 < 440) then
aout = aTimbrelow
elseif (p5 < 1760) then
aout = aTimbremid
else
aout = aTimbrehigh
endif

my shot.

2016-04-26 19:54 GMT+02:00 Joe . <not007ful@gmail.com>:
I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5 < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-26 19:12
FromVictor Lazzarini
SubjectRe: tips desperately needed
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . <not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5 < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-26 19:19
From"Joe ."
SubjectRe: tips desperately needed
yeah, I was wondering if there was a way to code clearly "mid 1760 > p5 > 440" instead of relying on the ordering.  

Joe

On Wed, Apr 27, 2016 at 2:12 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . <not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5 < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-26 19:22
FromJohn
SubjectRe: tips desperately needed

Also note the tests are i-rate and output a-rate which I think matters

Sent from TypeApp

On 26 Apr 2016, at 19:13, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . < not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5  < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-26 19:33
FromVictor Lazzarini
SubjectRe: tips desperately needed
I think if ... then with irate checks are init and perf-time (cgoto) so it should be ok.

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

On 26 Apr 2016, at 19:22, John <jpff@CODEMIST.CO.UK> wrote:

Also note the tests are i-rate and output a-rate which I think matters

Sent from TypeApp

On 26 Apr 2016, at 19:13, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . < not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5  < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-27 02:09
Fromthorin kerr
SubjectRe: tips desperately needed

This works as a one-liner

aout = (p5 >= 1760 ? aTimbrehigh : (p5 < 440 ? aTimbrelow : aTimbremid))

Tk


On Wed, Apr 27, 2016 at 4:33 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
I think if ... then with irate checks are init and perf-time (cgoto) so it should be ok.

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

On 26 Apr 2016, at 19:22, John <jpff@CODEMIST.CO.UK> wrote:

Also note the tests are i-rate and output a-rate which I think matters

Sent from TypeApp

On 26 Apr 2016, at 19:13, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . < not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5  < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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-04-27 09:32
FromIain McCurdy
SubjectRe: tips desperately needed
You can also try logical 'and':

if (p5>440 && p5<1760) then


Date: Wed, 27 Apr 2016 02:19:52 +0800
From: not007ful@GMAIL.COM
Subject: Re: [Csnd] tips desperately needed
To: CSOUND@LISTSERV.HEANET.IE

yeah, I was wondering if there was a way to code clearly "mid 1760 > p5 > 440" instead of relying on the ordering.  

Joe

On Wed, Apr 27, 2016 at 2:12 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Just figure out the logic. Check the value from high to low. 


if p5 >= 1760 then
...; high  >= 1760
elseif p5 > 440 then
...; mid 1760 > p5 > 440
else
...; low <= 440
endif 





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

On 26 Apr 2016, at 18:54, Joe . <not007ful@GMAIL.COM> wrote:

I wrote a piece of code in which different frequencies ranges are played by different oscillators/sounds:

 if p5 >= 1760 then
aout = aTimbrehigh

 elseif p5 < 440 then
aout  = aTimbrelow  

elseif p5 < 1760 then
aout = aTimbremid 

where aTimbrehigh/low/mid are different oscillators. Now I know that this is highly inelegant and would welcome any suggestions of how to code what I'm trying to achieve better. 

Also, if I put: 
( elseif p5 1760 then
aout  = aTimbremid )

before 
( elseif p5 440   then
aout  = aTimbremid )

the (elseif p5 < 440 then/ aout = aTimbremid ) line doesn't read, and all the freq's under 440 are still played by the 1760 timbre. I know this is an issue of ordering and such, I also get that this is very unclear from the code, so I'm also curious as to how I could do this better as well. Thanks


Joe "the noob" Joe
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