| Author |
Message |
lambdoid

Joined: Dec 12, 2008 Posts: 3 Location: Basingstoke
|
Posted: Fri Dec 12, 2008 1:56 pm Post subject:
Pitch envelopes? |
 |
|
Hi all. New to this forum. I downloaded ChucK a few days ago, and so far so good. Absolutely loving it! Already made a random beat generator, using an array of probabilites. Will post it if anyone's interested.
What I was wondering is how can you do a pitch envelope. I managed to use the ADSR class for amplitude and filtering, but I'm stumped with the pitch.
I'd also like to know if there's a boolean type, and if not, what constitutes truth(in a programming sense, not a philosophical one lol). |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Dec 12, 2008 4:04 pm Post subject:
Re: Pitch envelopes? |
 |
|
| lambdoid wrote: | Hi all. New to this forum. I downloaded ChucK a few days ago, and so far so good. Absolutely loving it! Already made a random beat generator, using an array of probabilites. Will post it if anyone's interested.
|
Sounds great, welcome on board! I think sharing code is nice in any case; it may help others and you might get valuable feedback. It's probably a good idea to briefly point out how you feel about others working with your code; is it for information only, do you encourage "remixes", etc.
| Quote: | | What I was wondering is how can you do a pitch envelope. I managed to use the ADSR class for amplitude and filtering, but I'm stumped with the pitch. |
Well, there are several ways, depending on your needs and preferences. I'm not sure what the issue is; if you can modulate a filter using a ADSR you should be able to modulate a sound-source as well, in fact both tend to use ".freq()". Maybe I'm missing the exact nature of your question?
| Quote: | | I'd also like to know if there's a boolean type, and if not, what constitutes truth(in a programming sense, not a philosophical one lol). |
No, there is no boolean type as such. "true" and "false" are keywords that resolve to "1 (int)" and "0 (int)" respectively. The "!" operator will resolve to 0 for any non-zero int and 1 for a input of "0". I tend to use quite a few arrays that are basically boolean yet are represented by a int data-type. This works without issue.
Conditions like "while" or "if" will be satisfied for any non-zero value, I recommend using a int instead of a float as float can and will have very slight rounding errors; the tenth decimal digit may be non-zero, for example, throwing your plans off. _________________ Kassen |
|
|
Back to top
|
|
 |
lambdoid

Joined: Dec 12, 2008 Posts: 3 Location: Basingstoke
|
Posted: Sat Dec 13, 2008 3:56 pm Post subject:
|
 |
|
I've found a couple of simple ways of doing it in the example files chirp.ck and chirp2.ck, which is a start.
The one in chirp2.ck is based on a simple envelope, but I'd like a full ADSR, with 3 separate pitch parameters ie the initial pitch, the pitch at the end of the attack phase, and the last value would be the release pitch. The pitch at the sustain phase would be the original pitch.
I'll post my drum generator in its own thread. |
|
|
Back to top
|
|
 |
|