|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
multiplying signalsHello List, Why is s*s different from s**2? { var f=200, s; f.postln; s = SinOsc.ar(f); Out.ar([0,1], s*s); }.scope; { var f=200, s; f.postln; s = SinOsc.ar(f); Out.ar([0,1], s**2); }.scope; |
|
|
Re: multiplying signals{SinOsc.ar.squared}.plot
gives the same result as s*s which is the correct result. s**2 seems to be incorrect. No idea why, though. -mgc On Sat, Apr 18, 2009 at 12:09 PM, Miguel Cardoso <mcardoso@...> wrote:
|
|
|
Re: multiplying signalsFor UGens pow is defined to maintain sign:
inline float sc_pow(float a, float b) { return a >= 0.f ? std::pow(a, b) : -std::pow(-a, b); } S. On 18 Apr 2009, at 20:28, michael cox wrote: {SinOsc.ar.squared}.plot |
|
|
Re: multiplying signals
Why?
Thanks Best -a- On 18 Apr 2009, at 21:30, Scott Wilson wrote: For UGens pow is defined to maintain sign: -------------------------------------------------- Andrea Valle -------------------------------------------------- CIRMA - DAMS Università degli Studi di Torino --> andrea.valle@... -------------------------------------------------- " This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." (Jeffrey 'The Dude' Lebowski) |
|
|
Re: multiplying signalsHelpfile for '**': "When the signal is negative this function extends the usual definition of exponentiation and returns neg(neg(a) ** b). This allows exponentiation of negative signal values by noninteger exponents." That is, SinOsc.ar.sqrt would produce nan very quickly without this tweak. But this is only for the BinaryOpUGen implementation. Integers and Floats in the language behave as you'd expect. -2**0.5 --> nan hjh On Apr 18, 2009, at 3:46 PM, Andrea Valle wrote: Why? : H. James Harkins .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |
|
|
Re: multiplying signalsHi James,
shouldn't this difference in behaviour for UGens and Integers/Floats should be mentioned in the ** helpfile? Maybe with an extra example which shows the difference? I can imagine people getting confused about this when using it both in the lang and for UGens. Something like this: { Line.ar(-1,1,0.01).abs ** 2 }.plot; ({ |i| i.linlin(0, 99, -1, 1) ** 2 } ! 100).plot; And, is there also an exponentiation BinaryOpUGen that does the mathematically correct version? cheers, Wouter Op 18 apr 2009, om 22:13 heeft James Harkins het volgende geschreven: > Helpfile for '**': > > "When the signal is negative this function extends the usual > definition of exponentiation and returns neg(neg(a) ** b). This > allows exponentiation of negative signal values by noninteger > exponents." > > That is, SinOsc.ar.sqrt would produce nan very quickly without this > tweak. > > But this is only for the BinaryOpUGen implementation. Integers and > Floats in the language behave as you'd expect. > > -2**0.5 --> nan > > hjh > > > On Apr 18, 2009, at 3:46 PM, Andrea Valle wrote: > >> Why? > > > : H. James Harkins > : jamshark70@... > : http://www.dewdrop-world.net > .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: > > "Come said the Muse, > Sing me a song no poet has yet chanted, > Sing me the universal." -- Whitman > _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: multiplying signalsOops should have removed the .abs (although it plots the same)
{ Line.ar(-1,1,0.01) ** 2 }.plot; ({ |i| i.linlin(0, 99, -1, 1) ** 2 } ! 100).plot; Op 19 apr 2009, om 17:30 heeft Wouter Snoei het volgende geschreven: > Hi James, > > shouldn't this difference in behaviour for UGens and Integers/Floats > should be mentioned in the ** helpfile? Maybe with an extra example > which shows the difference? I can imagine people getting confused > about this when using it both in the lang and for UGens. Something > like this: > > { Line.ar(-1,1,0.01).abs ** 2 }.plot; > > ({ |i| i.linlin(0, 99, -1, 1) ** 2 } ! 100).plot; > > And, is there also an exponentiation BinaryOpUGen that does the > mathematically correct version? > > cheers, > Wouter > > Op 18 apr 2009, om 22:13 heeft James Harkins het volgende geschreven: > >> Helpfile for '**': >> >> "When the signal is negative this function extends the usual >> definition of exponentiation and returns neg(neg(a) ** b). This >> allows exponentiation of negative signal values by noninteger >> exponents." >> >> That is, SinOsc.ar.sqrt would produce nan very quickly without this >> tweak. >> >> But this is only for the BinaryOpUGen implementation. Integers and >> Floats in the language behave as you'd expect. >> >> -2**0.5 --> nan >> >> hjh >> >> >> On Apr 18, 2009, at 3:46 PM, Andrea Valle wrote: >> >>> Why? >> >> >> : H. James Harkins >> : jamshark70@... >> : http://www.dewdrop-world.net >> .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: >> >> "Come said the Muse, >> Sing me a song no poet has yet chanted, >> Sing me the universal." -- Whitman >> > > > _______________________________________________ > sc-users mailing list > > info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: multiplying signalsOn Apr 19, 2009, at 11:30 AM, Wouter Snoei wrote:
I suppose so, but I didn't write that help file. Maybe I can get to it before 3.3.
It's been this way since sc2 and there hasn't been a great uproar over it in several years, so I wouldn't anticipate this changing anytime soon. hjh : H. James Harkins .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |
| Free embeddable forum powered by Nabble | Forum Help |