Hi guys this is my first thread because I've download Chuck just yesterday night and I'm trying to make something with this today (yes we can!). Really nice world! I read something from the manual ( the beginning tutorial) and also downloaded chuck pages where objects and other things about language are written. The question is : how can I understand every single line of Chuck? And I'm gonna make an example: foo.ck example. I was looking at this and also to other ones to understand how they work but... I saw that there are objects that are explained in Chuck homepage (sinOsc, delayD, etc) but where can I find informations about Std? Hi?How can I understand what does Hi.cap mean? These are just examples, is there a place where every command is explained? Or maybe (and probably) it's just me not so good searcher? Thank you everybody Balbit
On Mon, Sep 24, 2012 at 6:06 AM, Alberto Alassio
Hi guys this is my first thread because I've download Chuck just yesterday night and I'm trying to make something with this today (yes we can!). Really nice world! I read something from the manual ( the beginning tutorial) and also downloaded chuck pages where objects and other things about language are written. The question is : how can I understand every single line of Chuck? And I'm gonna make an example: foo.ck example. I was looking at this and also to other ones to understand how they work but... I saw that there are objects that are explained in Chuck homepage (sinOsc, delayD, etc) but where can I find informations about Std? Hi?How can I understand what does Hi.cap mean? These are just examples, is there a place where every command is explained? Or maybe (and probably) it's just me not so good searcher?
Thank you everybody
Wow, it's nice to have one that I can handle. Std is not about unsanitary fun; it's standard functions you can read about in chapter 18 of the manualhttp://chuck.cs.princeton.edu/release/files/chuck_manual.pdf. I can't tell which "foo.ck" you're pointing to; I assume it's one of those in the tutorial but if you want to ask about it, it'll work better to copy the puzzling lines into the message[?] Forrest Curo San Diego
http://chuck.cs.princeton.edu/doc/examples/basic/foo.ck
That's what I'm talking about. Here you can find "hi" and "hi.cap" .
Thank you for your answer!
On Mon, Sep 24, 2012 at 4:23 PM, forrest curo
On Mon, Sep 24, 2012 at 6:06 AM, Alberto Alassio < alberto.alassio@gmail.com> wrote:
Hi guys this is my first thread because I've download Chuck just yesterday night and I'm trying to make something with this today (yes we can!). Really nice world! I read something from the manual ( the beginning tutorial) and also downloaded chuck pages where objects and other things about language are written. The question is : how can I understand every single line of Chuck? And I'm gonna make an example: foo.ck example. I was looking at this and also to other ones to understand how they work but... I saw that there are objects that are explained in Chuck homepage (sinOsc, delayD, etc) but where can I find informations about Std? Hi?How can I understand what does Hi.cap mean? These are just examples, is there a place where every command is explained? Or maybe (and probably) it's just me not so good searcher?
Thank you everybody
Wow, it's nice to have one that I can handle. Std is not about unsanitary fun; it's standard functions you can read about in chapter 18 of the manual http://chuck.cs.princeton.edu/release/files/chuck_manual.pdf.
I can't tell which "foo.ck" you're pointing to; I assume it's one of those in the tutorial but if you want to ask about it, it'll work better to copy the puzzling lines into the message[?]
Forrest Curo San Diego
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Mon, Sep 24, 2012 at 9:47 AM, Alberto Alassio
http://chuck.cs.princeton.edu/doc/examples/basic/foo.ck That's what I'm talking about. Here you can find "hi" and "hi.cap" . Thank you for your answer!
"// an array [ 0, 2, 4, 7, 9, 11 ] @=> int hi[]; while( true ) { Std.mtof( 45 + Math.random2(0,3) * 12 + hi[Math.random2(0,hi.cap()-1)] ) => s.freq;" ? Yeah, Math.random2() is one of the built-in functions and "you-name-it.cap" would be the number of elements in "you-name-it[]" so you'd be picking a random element of the array "hi", getting the frequency of that as a midi note, putting it into the oscillator ("s") you started a few lines back.
Thank you very much! And now my question is: How did you get to know that
that object (or command line, I don't know) - I'm referring to younameit -
has got that use?
Danke Schon
On Mon, Sep 24, 2012 at 7:18 PM, forrest curo
On Mon, Sep 24, 2012 at 9:47 AM, Alberto Alassio < alberto.alassio@gmail.com> wrote:
http://chuck.cs.princeton.edu/doc/examples/basic/foo.ck That's what I'm talking about. Here you can find "hi" and "hi.cap" . Thank you for your answer!
"// an array [ 0, 2, 4, 7, 9, 11 ] @=> int hi[];
while( true ) { Std.mtof( 45 + Math.random2(0,3) * 12 + hi[Math.random2(0,hi.cap()-1)] ) => s.freq;" ?
Yeah, Math.random2() is one of the built-in functions and "you-name-it.cap" would be the number of elements in "you-name-it[]"
so you'd be picking a random element of the array "hi", getting the frequency of that as a midi note, putting it into the oscillator ("s") you started a few lines back.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Mon, Sep 24, 2012 at 11:58 AM, Alberto Alassio wrote: Thank you very much! And now my question is: How did you get to know that
that object (or command line, I don't know) - I'm referring to younameit -
has got that use? My mistake: I'd thought you'd found the "foo.ck" (& other examples) in the
tutorial http://chuck.cs.princeton.edu/doc/learn/!
That should give you a simpler, clearer start! -- and if questions remain
afterwards, you have my email address with this message.
Forrest Curo
San Diego
Yes, I've founded it in the Tutorial but there is no explanation about the
function you-name-it. Now that you have explained to me it's clearer and
I've also found another example using that function in the same way. But,
as Metallica sing, the question still remains: How did you know that
function? Where have you read about? I cannot find informations about !
Thank you very much
On Mon, Sep 24, 2012 at 9:20 PM, forrest curo
On Mon, Sep 24, 2012 at 11:58 AM, Alberto Alassio < alberto.alassio@gmail.com> wrote:
Thank you very much! And now my question is: How did you get to know that that object (or command line, I don't know) - I'm referring to younameit - has got that use?
My mistake: I'd thought you'd found the "foo.ck" (& other examples) in the tutorial http://chuck.cs.princeton.edu/doc/learn/!
That should give you a simpler, clearer start! -- and if questions remain afterwards, you have my email address with this message.
Forrest Curo San Diego
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 24 Sep 2012, at 20:58, Alberto Alassio wrote:
Thank you very much! And now my question is: How did you get to know that that object (or command line, I don't know) - I'm referring to younameit - has got that use?
In the line
"// an array [ 0, 2, 4, 7, 9, 11 ] @=> int hi[];
the RHS declares an array. The symbol "@=>" is used for assigning references. So "hi" becomes a reference to whatever is on the LHS. Then in
Std.mtof( 45 + Math.random2(0,3) * 12 + hi[Math.random2(0,hi.cap()-1)] ) => s.freq;" ?
cap() is the size function. See the ChucK manual or the language reference listed here http://chuck.cs.princeton.edu/doc/
On Mon, Sep 24, 2012 at 03:06:59PM +0200, Alberto Alassio wrote:
Hi guys this is my first thread because I've download Chuck just yesterday night and I'm trying to make something with this today (yes we can!).
Of course you can! Most people turn language into sound and meaning from a very young age. Can't be that hard ;-)
Really nice world! I read something from the manual ( the beginning tutorial) and also downloaded chuck pages where objects and other things about language are written. The question is : how can I understand every single line of Chuck?
That's a rather broad question, great. My take; Start with the examples that came with your download, I particularly like the "otf...." series of examples in the "examples" dir. Together they form a techno song with a implied invitation to remix. Change stuff, the worst that can happen is that it crashes. If you make a mess; re-download and make a backup this time. Those cover a wide range of topics in a deceptively fun way, Many things can be understood through practical experimentation. Then there is the website that has documentation and the manual pdf that has explanations on the way it works and very useful appendices. Those can serve to explain bits that appear tricky or as a way to look for new interesting things as you start to elaborate on the given material on your own. This is, of course, a somewhat scattershot -if fun- method, and it could be that you'd like a higher-scope look at the how and why. For that I recommend this; http://www.cs.princeton.edu/~gewang/thesis.html That's Ge's Thesis and explains the method behind the madness. All of those will at some point fail to satisfy, maybe some bit of info got misplaced, maybe you overlooked something that seemed like a detail at first. Then you send a mail to this list, explaining where and how you ran into a issue. Preferably you'd paste the most simple code that causes the issue and explain clearly what you were hoping for or expecting. Then we (you get a free scene with your free software) try to figure out what the issue is. Everyone who could answer a question like this got to that point by experimenting and by asking questions; don't be shy, if you tried to look on your own and couldn't find it it's worth a mail. Most importantly; have fun, that's what it's there for, as far as I'm concerned. Yours, Kas.
Thank you very much for your answer. i've just downloaded that thesis you
were talking about .
I will come back with other questions!
Danke Schon
On Wed, Sep 26, 2012 at 1:51 AM, Kassen
On Mon, Sep 24, 2012 at 03:06:59PM +0200, Alberto Alassio wrote:
Hi guys this is my first thread because I've download Chuck just yesterday night and I'm trying to make something with this today (yes we can!).
Of course you can! Most people turn language into sound and meaning from a very young age. Can't be that hard ;-)
Really nice world! I read something from the manual ( the beginning tutorial) and also downloaded chuck pages where objects and other things about language are written. The question is : how can I understand every single line of Chuck?
That's a rather broad question, great.
My take;
Start with the examples that came with your download, I particularly like the "otf...." series of examples in the "examples" dir. Together they form a techno song with a implied invitation to remix. Change stuff, the worst that can happen is that it crashes. If you make a mess; re-download and make a backup this time. Those cover a wide range of topics in a deceptively fun way,
Many things can be understood through practical experimentation. Then there is the website that has documentation and the manual pdf that has explanations on the way it works and very useful appendices. Those can serve to explain bits that appear tricky or as a way to look for new interesting things as you start to elaborate on the given material on your own.
This is, of course, a somewhat scattershot -if fun- method, and it could be that you'd like a higher-scope look at the how and why. For that I recommend this; http://www.cs.princeton.edu/~gewang/thesis.html That's Ge's Thesis and explains the method behind the madness.
All of those will at some point fail to satisfy, maybe some bit of info got misplaced, maybe you overlooked something that seemed like a detail at first. Then you send a mail to this list, explaining where and how you ran into a issue. Preferably you'd paste the most simple code that causes the issue and explain clearly what you were hoping for or expecting. Then we (you get a free scene with your free software) try to figure out what the issue is. Everyone who could answer a question like this got to that point by experimenting and by asking questions; don't be shy, if you tried to look on your own and couldn't find it it's worth a mail.
Most importantly; have fun, that's what it's there for, as far as I'm concerned.
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I was trying to open the otf examples you told me and I got a question
about period.
what does
T - (now % T) => now;
means?
When we just make something like a sineosc and we want it to sound for 2
seconds we just write
2::second => now;
and when we make it start it sounds for 2 seconds from now till now. RIght?
So why wouldn't must be the same for period?
What am I supposed to do?
On Wed, Sep 26, 2012 at 10:36 AM, Alberto Alassio wrote: Thank you very much for your answer. i've just downloaded that thesis you
were talking about .
I will come back with other questions! Danke Schon On Wed, Sep 26, 2012 at 1:51 AM, Kassen On Mon, Sep 24, 2012 at 03:06:59PM +0200, Alberto Alassio wrote: Hi guys this is my first thread because I've download Chuck just
yesterday
night and I'm trying to make something with this today (yes we can!). Of course you can! Most people turn language into sound and meaning
from a very young age. Can't be that hard ;-) Really nice world! I read something from the manual ( the beginning
tutorial) and also downloaded chuck pages where objects and other things
about language are written. The question is : how can I understand every
single line of Chuck? That's a rather broad question, great. My take; Start with the examples that came with your download, I particularly
like the "otf...." series of examples in the "examples" dir. Together
they form a techno song with a implied invitation to remix. Change
stuff, the worst that can happen is that it crashes. If you make a
mess; re-download and make a backup this time. Those cover a wide
range of topics in a deceptively fun way, Many things can be understood through practical experimentation. Then
there is the website that has documentation and the manual pdf that
has explanations on the way it works and very useful appendices. Those
can serve to explain bits that appear tricky or as a way to look for
new interesting things as you start to elaborate on the given
material on your own. This is, of course, a somewhat scattershot -if fun- method, and it
could be that you'd like a higher-scope look at the how and why. For
that I recommend this; http://www.cs.princeton.edu/~gewang/thesis.html
That's Ge's Thesis and explains the method behind the madness. All of those will at some point fail to satisfy, maybe some bit of
info got misplaced, maybe you overlooked something that seemed like a
detail at first. Then you send a mail to this list, explaining where
and how you ran into a issue. Preferably you'd paste the most simple
code that causes the issue and explain clearly what you were hoping
for or expecting. Then we (you get a free scene with your free
software) try to figure out what the issue is. Everyone who could
answer a question like this got to that point by experimenting and by
asking questions; don't be shy, if you tried to look on your own and
couldn't find it it's worth a mail. Most importantly; have fun, that's what it's there for, as far as I'm
concerned. Yours,
Kas.
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Thu, Sep 27, 2012 at 02:36:20PM +0200, Alberto Alassio wrote:
I was trying to open the otf examples you told me and I got a question about period. what does
T - (now % T) => now;
means?
The "%" operator means "modulo". X modulo Y means; the remainder of dividing X by Y. So; "9 % 4" will be 1. Check? What we are doing here is that we start counting in increments of T since time 0. This line of code makes us wait for the next beat, being a integer multiple of T. After all; (now % T) must be the time since the last "beat", so "T - (now % T)" refers to the amount of time to go until the next beat. The total expression will then advance time until the next beat, more or less like you will wait a bit until falling in on your guitar when entering a jam session. That is actually exactly what happens in these examples; each file will wait until the next beat, then start playing, so because they are all aware of T and know we start at 0 they do not need to communicate with each other about this. Make sense now? Kas.
Now it does!it didnt' just because I didn't know anything about this
remainder ( I was thinking you made a mistake and you wanted to write
reminder and I was saying by myself, a reminder for what? ) but then i
checked it out on the web and wiki helped me.
yes its' a little complicated but yes I understand , in a easier way it is
what happens when you push the button in Ableton live and the clip waits to
start with another.
It's a good way to connect different patches together and mix them as you
like.
On Thu, Sep 27, 2012 at 6:53 PM, Kassen
On Thu, Sep 27, 2012 at 02:36:20PM +0200, Alberto Alassio wrote:
I was trying to open the otf examples you told me and I got a question about period. what does
T - (now % T) => now;
means?
The "%" operator means "modulo". X modulo Y means; the remainder of dividing X by Y. So; "9 % 4" will be 1. Check?
What we are doing here is that we start counting in increments of T since time 0. This line of code makes us wait for the next beat, being a integer multiple of T. After all; (now % T) must be the time since the last "beat", so "T - (now % T)" refers to the amount of time to go until the next beat. The total expression will then advance time until the next beat, more or less like you will wait a bit until falling in on your guitar when entering a jam session.
That is actually exactly what happens in these examples; each file will wait until the next beat, then start playing, so because they are all aware of T and know we start at 0 they do not need to communicate with each other about this.
Make sense now?
Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Thu, Sep 27, 2012 at 07:33:30PM +0200, Alberto Alassio wrote:
Now it does!it didnt' just because I didn't know anything about this remainder ( I was thinking you made a mistake and you wanted to write reminder and I was saying by myself, a reminder for what? ) but then i checked it out on the web and wiki helped me.
I can understand; after our first calculus lessons and we learn about decimals we tend not to encounter remainders formally, certainly not as something we'd like to see abbreviated as a single symbol. Once you get it though, that line illustrates many of the nice things of ChucK's way of dealing with time... and of course stuff that is basically like modulo operator is all around us in our day to day life.
yes its' a little complicated but yes I understand , in a easier way it is what happens when you push the button in Ableton live and the clip waits to start with another.
Exactly. Well, starting a .ck file isn't that much harder than dragging in a wave into Live, I'd argue... ChucK just invites you to also look into the *how*, which is a bit more challenging. If you like Live (I personally think it is quite nice, though I stopped buying upgrades) you might like to see whether you can implement Ableton's quantise settings in ChucK, then move on to stuff like those "follow actions" that Live has. That kind of stuff is quite possible. From there on you can get more fancy.... :-) Happy ChucKing, Kas.
Not using Live but I think I will to control what I'm doing in Max....I'm
learning Max as well but I really like to get something about Chuck also,
and for i'm a bit into jazz music, I find the idea of improvisation in real
time with chuck tilde object really amazing.
But now, just learning, I'm a beginner, no fun just hard work!
http://www.youtube.com/watch?v=I3jX4WhIW6o
happy chuckin' 2 u
On Fri, Sep 28, 2012 at 1:16 AM, Kassen
On Thu, Sep 27, 2012 at 07:33:30PM +0200, Alberto Alassio wrote:
Now it does!it didnt' just because I didn't know anything about this remainder ( I was thinking you made a mistake and you wanted to write reminder and I was saying by myself, a reminder for what? ) but then i checked it out on the web and wiki helped me.
I can understand; after our first calculus lessons and we learn about decimals we tend not to encounter remainders formally, certainly not as something we'd like to see abbreviated as a single symbol. Once you get it though, that line illustrates many of the nice things of ChucK's way of dealing with time... and of course stuff that is basically like modulo operator is all around us in our day to day life.
yes its' a little complicated but yes I understand , in a easier way it is what happens when you push the button in Ableton live and the clip waits to start with another.
Exactly. Well, starting a .ck file isn't that much harder than dragging in a wave into Live, I'd argue... ChucK just invites you to also look into the *how*, which is a bit more challenging.
If you like Live (I personally think it is quite nice, though I stopped buying upgrades) you might like to see whether you can implement Ableton's quantise settings in ChucK, then move on to stuff like those "follow actions" that Live has. That kind of stuff is quite possible. From there on you can get more fancy.... :-)
Happy ChucKing, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Fri, Sep 28, 2012 at 07:06:14PM +0200, Alberto Alassio wrote:
But now, just learning, I'm a beginner, no fun just hard work!
I believe that in this kind of field hard work and fun need not be mutually exclusive. I also believe that we should strive to make hard work as much fun as possible. Look into the "Shakers" UGen, that one always has a jazzy feeling to me though I'd be hard-pressed to define why. At any rate it is one of the nicer UGens to explore, which is good in and of itself. Kas.
Me again. Looking at the examples, now I'm messing with Chirp. I cannot understand what Tinc and Inc are. I think that tinc is something like the time of every step from a freq to another one, is it right? And Inc is how much freq increases according to tinc's time, is it correct? But what is -count-? A counter of what? And what " while ( count < steps ) " and " 1+ => count " mean? http://chuck.cs.princeton.edu/doc/examples/basic/chirp.ck thanks!
On Sun, Sep 30, 2012 at 09:41:13PM +0200, Alberto Alassio wrote:
Me again. Looking at the examples, now I'm messing with Chirp. I cannot understand what Tinc and Inc are. I think that tinc is something like the time of every step from a freq to another one, is it right? And Inc is how much freq increases according to tinc's time, is it correct?
That seems to be exactly right, yes.
But what is -count-? A counter of what? And what " while ( count < steps ) " and " 1+ => count " mean?
"count" refers to the current step. It starts out as zero and increases until the desired number of steps has been reached. "1 +=> count" adds one to the "count" and also stores the result back in "count". It is not so clear to me why a float is used here for "count", instead of a integer, which would make more sense and enable us to simply increment by using; count++; Better yet would be a "for" loop. Maybe this example is deliberately doing unusual stuff to encourage people like you to spend some time picking it apart and figuring it out? It might also be very old and pre-dating something like comparing floats to integers. To me it looks like Ge's style which would make sense in both cases. Hope that helps, Kas.
Ok, to me it wasn't so easy to understand count < steps. so it counts till
the steps end, right? And in this patch count refers to steps but it is
also the one who makes the freq increases by inc, I mean, for each count we
have, then the freq increases.
Is it correct?
Thank you Kas, it always helps!
On Sun, Sep 30, 2012 at 9:59 PM, Kassen
On Sun, Sep 30, 2012 at 09:41:13PM +0200, Alberto Alassio wrote:
Me again. Looking at the examples, now I'm messing with Chirp. I cannot understand what Tinc and Inc are. I think that tinc is something like the time of every step from a freq to another one, is it right? And Inc is how much freq increases according to tinc's time, is it correct?
That seems to be exactly right, yes.
But what is -count-? A counter of what? And what " while ( count < steps ) " and " 1+ => count " mean?
"count" refers to the current step. It starts out as zero and increases until the desired number of steps has been reached. "1 +=> count" adds one to the "count" and also stores the result back in "count".
It is not so clear to me why a float is used here for "count", instead of a integer, which would make more sense and enable us to simply increment by using;
count++;
Better yet would be a "for" loop. Maybe this example is deliberately doing unusual stuff to encourage people like you to spend some time picking it apart and figuring it out? It might also be very old and pre-dating something like comparing floats to integers. To me it looks like Ge's style which would make sense in both cases.
Hope that helps, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Sun, Sep 30, 2012 at 10:08:11PM +0200, Alberto Alassio wrote:
Ok, to me it wasn't so easy to understand count < steps. so it counts till the steps end, right?
Yes. As long as "count < steps", which means "count is lower than steps" evaluates to true the loop keeps repeating and each time the loop repeats in increases "count". Once this is no longer true the clause returns false, the loop stops and we reach the end of the function.
And in this patch count refers to steps but it is also the one who makes the freq increases by inc, I mean, for each count we have, then the freq increases. Is it correct?
Yes, totally correct.
Thank you Kas, it always helps!
No problem. The more I look at it the more I suspect this example is doing unusual things on purpose, demonstrating a few things at the same time. It is also demonstrating "function overloading" in a way that I think is designed to make that principle understandable by looking at this code. Note that two functions named "chirp" are defined here.... Yours, Kas.
I'd like to point out that "count" is a variable name, not a built-in ChucK thing. In this example, "count" is just the name someone has chosen to keep track of a number that keeps increasing by 1. You might want to look at the ChucK tutorials I made for our Intro to Electronic Music course here at the University of Cincinnati. There are 7 tutorials that start from a simple SinOsc and introduce variables, functions, STK instruments, and sporking. They were intended as notes to accompany the class but they might be useful. I uploaded them here: https://github.com/jwmatthys/chuck-tutorials Joel On 09/30/2012 04:08 PM, Alberto Alassio wrote:
Ok, to me it wasn't so easy to understand count < steps. so it counts till the steps end, right? And in this patch count refers to steps but it is also the one who makes the freq increases by inc, I mean, for each count we have, then the freq increases. Is it correct? Thank you Kas, it always helps!
On Sun, Sep 30, 2012 at 9:59 PM, Kassen
mailto:signal.automatique@gmail.com>wrote: On Sun, Sep 30, 2012 at 09:41:13PM +0200, Alberto Alassio wrote: > Me again. > Looking at the examples, now I'm messing with Chirp. > I cannot understand what Tinc and Inc are. I think that tinc is something > like the time of every step from a freq to another one, is it right? > And Inc is how much freq increases according to tinc's time, is it correct? > That seems to be exactly right, yes.
> But what is -count-? A counter of what? And what " while ( count < steps ) > " and " 1+ => count " mean?
"count" refers to the current step. It starts out as zero and increases until the desired number of steps has been reached. "1 +=> count" adds one to the "count" and also stores the result back in "count".
It is not so clear to me why a float is used here for "count", instead of a integer, which would make more sense and enable us to simply increment by using;
count++;
Better yet would be a "for" loop. Maybe this example is deliberately doing unusual stuff to encourage people like you to spend some time picking it apart and figuring it out? It might also be very old and pre-dating something like comparing floats to integers. To me it looks like Ge's style which would make sense in both cases.
Hope that helps, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu mailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Really helpful thank you! I'm going to look at it tomorrow morning
On Sun, Sep 30, 2012 at 11:14 PM, Joel Matthys
I'd like to point out that "count" is a variable name, not a built-in ChucK thing. In this example, "count" is just the name someone has chosen to keep track of a number that keeps increasing by 1.
You might want to look at the ChucK tutorials I made for our Intro to Electronic Music course here at the University of Cincinnati. There are 7 tutorials that start from a simple SinOsc and introduce variables, functions, STK instruments, and sporking. They were intended as notes to accompany the class but they might be useful.
I uploaded them here:
https://github.com/jwmatthys/chuck-tutorials
Joel
On 09/30/2012 04:08 PM, Alberto Alassio wrote:
Ok, to me it wasn't so easy to understand count < steps. so it counts till the steps end, right? And in this patch count refers to steps but it is also the one who makes the freq increases by inc, I mean, for each count we have, then the freq increases. Is it correct? Thank you Kas, it always helps!
On Sun, Sep 30, 2012 at 9:59 PM, Kassen
wrote: On Sun, Sep 30, 2012 at 09:41:13PM +0200, Alberto Alassio wrote:
Me again. Looking at the examples, now I'm messing with Chirp. I cannot understand what Tinc and Inc are. I think that tinc is something like the time of every step from a freq to another one, is it right? And Inc is how much freq increases according to tinc's time, is it correct?
That seems to be exactly right, yes.
But what is -count-? A counter of what? And what " while ( count < steps ) " and " 1+ => count " mean?
"count" refers to the current step. It starts out as zero and increases until the desired number of steps has been reached. "1 +=> count" adds one to the "count" and also stores the result back in "count".
It is not so clear to me why a float is used here for "count", instead of a integer, which would make more sense and enable us to simply increment by using;
count++;
Better yet would be a "for" loop. Maybe this example is deliberately doing unusual stuff to encourage people like you to spend some time picking it apart and figuring it out? It might also be very old and pre-dating something like comparing floats to integers. To me it looks like Ge's style which would make sense in both cases.
Hope that helps, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing listchuck-users@lists.cs.princeton.eduhttps://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Sun, Sep 30, 2012 at 05:14:35PM -0400, Joel Matthys wrote:
I'd like to point out that "count" is a variable name, not a built-in ChucK thing. In this example, "count" is just the name someone has chosen to keep track of a number that keeps increasing by 1.
Oh, yes, that is right. Another thing is that the "*=>" operator is not some magical unique thing, but part of a larger set. So; float count; //define a float named count, by default it will be 0.0 2 => count; set it to be 2 3 +=> count; now "count" will have a value of 5 count + 3 => count; //same as the above but more typing. 2 *=> count; //also available 4 -=> count; //collect them all! 3 /=> count; //why not that one? They are free! BTW, as Joel noted; we could think here that "count" were some sort of build in thing, like "now". If you would like to be able to read code longer than this example in half a year I suggest naming stuff like this; 0 => int steps; //keeps track of the steps taken so far 16 => int max_steps; //how many steps we need to take Then you can write; while (steps < max_steps) { <<<"Stuff">>>; steps++; } Now it is clear what the variable means (what is being counted) and it will be obvious we should stop when the maximum is exceeded. For very simple things "count" or even "i" (meaning integer) is ok, of course, but if there is any doubt that it might somehow become unclear I'd name the variable after what is being counted or measured. This saves confusion and also -like here- clarifies the border between what we are doing and what ChucK has included. Naming everything "x", "y" and "z" is quick to type but it may well take a LOT more time to understand in half a year or even to find the typo in half a hour. Yours, Kas.
On 30 Sep 2012, at 21:41, Alberto Alassio wrote:
Me again.
I add some comments, in addition to Kassen's.
Looking at the examples, now I'm messing with Chirp. I cannot understand what Tinc and Inc are.
As ChucK is case sensitive, one normally keep the case.
I think that tinc is something like the time of every step from a freq to another one, is it right?
Probably short for "time increment" - typed as duration by "dur". Just a function argument variable. This file illustrates function name (or Koenig) overloading: there are two different functions named 'chirp' with differently typed arguments.
And Inc is how much freq increases according to tinc's time, is it correct?
The LHS of the line duration / tinc => float steps; divides the two durations, the RHS declares a float variable 'steps', and '=>' assigns LHS to this variable. So this divides the time interval of length 'duration' into 'steps' steps of length 'tinc'. Then the line ( target - src ) / steps => float inc; divides the frequency interval from 'src' to 'target' into 'steps' steps of length 'tinc'.
But what is -count-? A counter of what? And what " while ( count < steps ) " and " 1+ => count " mean?
This is just a loop counter. The line float count; declares it and initializes it to 0. Then "while (count < steps) {...}" loops over "{...}" as long '1 +=> count' does not increment up to 'steps' or beyond - which could happen, due to round-off errors, as they are floats. So the proper way would be to ensure 'steps' is an 'int'. Here, 'x +=> y' is the same as the 'y += x' of C/C++: instead of assigning x to y, it does x + y => y, thus adding x to y. Hans
participants (5)
-
Alberto Alassio
-
forrest curo
-
Hans Aberg
-
Joel Matthys
-
Kassen