Hi all, I just downloaded chuck. Perhaps I'm being a bit blind/dense, but there doesn't seem to be a simple power operator in chuck. Given that power-laws appear in many places, it would be a very useful operator. Hopefully I'm just missing it? Cheers, -T
Welcome Tennessee!
I just downloaded chuck. Perhaps I'm being a bit blind/dense, but there doesn't seem to be a simple power operator in chuck. Given that power-laws appear in many places, it would be a very useful operator. Hopefully I'm just missing it?
Currently, there is math.pow( float, float ) but no dedicated power operator (like ** in python?). Other languages sometimes use a^b to denote power, however ^ is the xor binary operator in ChucK (like in C). Unless there is a really compelling reason to include a specialized power operator, it is unlikely chuck will support it (at least for now). Best, Ge!
Ge Wang wrote:
Welcome Tennessee!
I just downloaded chuck. Perhaps I'm being a bit blind/dense, but there doesn't seem to be a simple power operator in chuck. Given that power-laws appear in many places, it would be a very useful operator. Hopefully I'm just missing it?
Currently, there is math.pow( float, float ) but no dedicated power operator (like ** in python?). Other languages sometimes use a^b to denote power, however ^ is the xor binary operator in ChucK (like in C). Unless there is a really compelling reason to include a specialized power operator, it is unlikely chuck will support it (at least for now).
My bad, I hadn't discovered the math library yet. As note progressions (and pitch perceptions) are logarithmic, being able to access a decent power operator seems important. I want to start with a walk up an octave, divided into an arbitrary number of segments. (12 notes in an octave? Well, maybe if you're limited by a keyboard...) Chuck is like a breath of fresh air after days of wondering where to find a decent scripting language for music. I want to play around, and nothing else ... fits me right. :) Cheers, -T
Hi Tennessee,
As note progressions (and pitch perceptions) are logarithmic, being able to access a decent power operator seems important. I want to start with a walk up an octave, divided into an arbitrary number of segments.
You may have found this already: std.mtof( float ) converts MIDI pitch (note number) to frequency in Hz. Adjacent note numbers are a semitone apart (so every 12 is an octave) and the function will also take fractional values as well. std.ftom( float ) converts in the other direction, from frequency to MIDI note number. Here is a chart mapping some MIDI note numbers -> frequencies: http://www.borg.com/~jglatt/tutr/notefreq.htm Best, Ge!
participants (3)
-
Ge Wang
-
Tennessee Leeuwenburg
-
Tennessee Leeuwenburg