[Cs-dev] Not sure I understnd this
Date | 2012-07-24 15:51 |
From | john ffitch |
Subject | [Cs-dev] Not sure I understnd this |
In the code below (from ugrw2) the comment says sqrt but the code says (1/2)^v Surely these are not the same? Or is age catching me up? It has been like this since 2003 which is the oldest source I can find at present with this code ==John ffitch int kport(CSOUND *csound, KPORT *p) { /* Set up variables local to this instance of the port ugen, if * khtim has changed. * * onedkr = one divided by k rate. * * c2 = sqrt 1 / kr * half time * c1 = 1 - c2 * */ if (UNLIKELY(p->prvhtim != *p->khtim)) { p->c2 = POWER(FL(0.5), csound->onedkr / *p->khtim); p->c1 = FL(1.0) - p->c2; p->prvhtim = *p->khtim; } ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-07-24 16:11 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Not sure I understnd this |
It looks wrong to me, the arguments are the other way round, are they not? The comment is correct, the coeff should have the square root. I am surprised it works. On 24 Jul 2012, at 15:51, john ffitch wrote: > In the code below (from ugrw2) the comment says sqrt but the code > says (1/2)^v > Surely these are not the same? Or is age catching me up? It has > been like this since 2003 which is the oldest source I can find at > present with this code > ==John ffitch > > int kport(CSOUND *csound, KPORT *p) > { > /* Set up variables local to this instance of the port ugen, if > * khtim has changed. > * > * onedkr = one divided by k rate. > * > * c2 = sqrt 1 / kr * half time > * c1 = 1 - c2 > * > */ > if (UNLIKELY(p->prvhtim != *p->khtim)) { > p->c2 = POWER(FL(0.5), csound->onedkr / *p->khtim); > p->c1 = FL(1.0) - p->c2; > p->prvhtim = *p->khtim; > } > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-07-24 16:24 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] Not sure I understnd this |
It gets odder; the original Vercoe code has pow(0.5,...) for the related port opcode (I was looking at portk). Time for some maths! ==John > It looks wrong to me, the arguments are the other way round, are they not? > The comment is correct, the coeff should have the square root. I am > surprised it works. > > On 24 Jul 2012, at 15:51, john ffitch wrote: > >> In the code below (from ugrw2) the comment says sqrt but the code >> says (1/2)^v >> Surely these are not the same? Or is age catching me up? It has >> been like this since 2003 which is the oldest source I can find at >> present with this code >> ==John ffitch >> >> int kport(CSOUND *csound, KPORT *p) >> { >> /* Set up variables local to this instance of the port ugen, if >> * khtim has changed. >> * >> * onedkr = one divided by k rate. >> * >> * c2 = sqrt 1 / kr * half time >> * c1 = 1 - c2 >> * >> */ >> if (UNLIKELY(p->prvhtim != *p->khtim)) { >> p->c2 = POWER(FL(0.5), csound->onedkr / *p->khtim); >> p->c1 = FL(1.0) - p->c2; >> p->prvhtim = *p->khtim; >> } >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. >> Discussions >> will include endpoint security, mobile security and the latest in >> malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > Dr Victor Lazzarini > Senior Lecturer > Dept. of Music > NUI Maynooth Ireland > tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-07-24 16:45 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Not sure I understnd this |
Maybe it's correct. I always assumed it was basically the same filter used in tone/atone, but it does not look like it is. Looking at it, it makes sense that the signal will decrease by half in halftime seconds. Victor On 24 Jul 2012, at 16:24, jpff@cs.bath.ac.uk wrote: > It gets odder; the original Vercoe code has pow(0.5,...) for the related > port opcode (I was looking at portk). > Time for some maths! > > ==John > >> It looks wrong to me, the arguments are the other way round, are they not? >> The comment is correct, the coeff should have the square root. I am >> surprised it works. >> >> On 24 Jul 2012, at 15:51, john ffitch wrote: >> >>> In the code below (from ugrw2) the comment says sqrt but the code >>> says (1/2)^v >>> Surely these are not the same? Or is age catching me up? It has >>> been like this since 2003 which is the oldest source I can find at >>> present with this code >>> ==John ffitch >>> >>> int kport(CSOUND *csound, KPORT *p) >>> { >>> /* Set up variables local to this instance of the port ugen, if >>> * khtim has changed. >>> * >>> * onedkr = one divided by k rate. >>> * >>> * c2 = sqrt 1 / kr * half time >>> * c1 = 1 - c2 >>> * >>> */ >>> if (UNLIKELY(p->prvhtim != *p->khtim)) { >>> p->c2 = POWER(FL(0.5), csound->onedkr / *p->khtim); >>> p->c1 = FL(1.0) - p->c2; >>> p->prvhtim = *p->khtim; >>> } >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. >>> Discussions >>> will include endpoint security, mobile security and the latest in >>> malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> Csound-devel mailing list >>> Csound-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/csound-devel >> >> Dr Victor Lazzarini >> Senior Lecturer >> Dept. of Music >> NUI Maynooth Ireland >> tel.: +353 1 708 3545 >> Victor dot Lazzarini AT nuim dot ie >> >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel >> >> >> > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-07-24 17:03 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] Not sure I understnd this |
well... there is a history here. RW complained that csound was low in comments and wrote this code with the explicit rule that the comments not be removed. My research advisor told me never to comment code, because if one did readers would believe the comments rather than reading the code to see what it does. And this a prime example. I will ignore comments in future :-) ==John ff > Maybe it's correct. I always assumed it was basically the same filter used > in tone/atone, but it does not look like it is. > Looking at it, it makes sense that the signal will decrease by half in > halftime seconds. > > Victor > > On 24 Jul 2012, at 16:24, jpff@cs.bath.ac.uk wrote: > >> It gets odder; the original Vercoe code has pow(0.5,...) for the related >> port opcode (I was looking at portk). >> Time for some maths! >> >> ==John >> >>> It looks wrong to me, the arguments are the other way round, are they >>> not? >>> The comment is correct, the coeff should have the square root. I am >>> surprised it works. >>> >>> On 24 Jul 2012, at 15:51, john ffitch wrote: >>> >>>> In the code below (from ugrw2) the comment says sqrt but the code >>>> says (1/2)^v >>>> Surely these are not the same? Or is age catching me up? It has >>>> been like this since 2003 which is the oldest source I can find at >>>> present with this code >>>> ==John ffitch >>>> >>>> int kport(CSOUND *csound, KPORT *p) >>>> { >>>> /* Set up variables local to this instance of the port ugen, if >>>> * khtim has changed. >>>> * >>>> * onedkr = one divided by k rate. >>>> * >>>> * c2 = sqrt 1 / kr * half time >>>> * c1 = 1 - c2 >>>> * >>>> */ >>>> if (UNLIKELY(p->prvhtim != *p->khtim)) { >>>> p->c2 = POWER(FL(0.5), csound->onedkr / *p->khtim); >>>> p->c1 = FL(1.0) - p->c2; >>>> p->prvhtim = *p->khtim; >>>> } >>>> >>>> ------------------------------------------------------------------------------ >>>> Live Security Virtual Conference >>>> Exclusive live event will cover all the ways today's security and >>>> threat landscape has changed and how IT managers can respond. >>>> Discussions >>>> will include endpoint security, mobile security and the latest in >>>> malware >>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>> _______________________________________________ >>>> Csound-devel mailing list >>>> Csound-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/csound-devel >>> >>> Dr Victor Lazzarini >>> Senior Lecturer >>> Dept. of Music >>> NUI Maynooth Ireland >>> tel.: +353 1 708 3545 >>> Victor dot Lazzarini AT nuim dot ie >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. >>> Discussions >>> will include endpoint security, mobile security and the latest in >>> malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> Csound-devel mailing list >>> Csound-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/csound-devel >>> >>> >>> >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. >> Discussions >> will include endpoint security, mobile security and the latest in >> malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > Dr Victor Lazzarini > Senior Lecturer > Dept. of Music > NUI Maynooth Ireland > tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > > > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2012-07-24 18:03 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Not sure I understnd this |
That's an interesting point about comments John. The code should be the only thing someone needs to read in order to understand it, to a point I guess. I still don't have problems following large chunks of the Csound's internal code! I also want to point out that the RW you are referring to is not me! Rory. On 24 July 2012 18:03, |
Date | 2012-07-24 18:48 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] Not sure I understnd this |
> I also want to point out that the RW you are referring to is not me! True Rory -- I wanted tpo make it clear it was an individual but not identify Ro..... ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |