electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » ChucK programming language
So installed Chuck last night...
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Low Note



Joined: Jul 20, 2007
Posts: 146
Location: New Jersey
Audio files: 2

PostPosted: Sun Aug 12, 2007 7:24 am    Post subject: So installed Chuck last night...
Subject description: getting started
Reply with quote  Mark this post and the followings unread

a few questions:

I found miniaudicle to be a more immediately convenient. Is there any reason I would be better off using the command prompt other than stability? From my perspective, if my long term plans are to use miniaudicle, I'd be better off getting comfortable in it. Would I be able to ignore the developer aspects of Audicle? (a software developer I am definitely not!)

I went through the starters tutorial with a lot of ease. It seems very intuitive. But now I seem to be at a loss. Should I read the manual? I opened up two the examples, and they didn't seem the most informative of things.

Finally, I know the languages are new, but for those of you who have been writing using chuck - when you compose for live use, how have you been storing your material for later use? A simple list of actions? Do you save your files and then just call them up? It seems easy enough to program on the fly, but I would want some sort of "sheet music" to keep track of what to do next.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Mon Aug 13, 2007 4:20 am    Post subject: Re: So installed Chuck last night...
Subject description: getting started
Reply with quote  Mark this post and the followings unread

Low Note wrote:
a few questions:

I found miniaudicle to be a more immediately convenient. Is there any reason I would be better off using the command prompt other than stability? From my perspective, if my long term plans are to use miniaudicle, I'd be better off getting comfortable in it. Would I be able to ignore the developer aspects of Audicle? (a software developer I am definitely not!)


I think you should be fine with the Mini. The Mini is quite stable and usable these days.

Quote:
I went through the starters tutorial with a lot of ease. It seems very intuitive. But now I seem to be at a loss. Should I read the manual? I opened up two the examples, and they didn't seem the most informative of things.


I reccomend looking at the "otf" examples, running those then "remixing" them. After that a good choice might be starting a simple project; somthing small yet practical that you can use for your music like a joypad to MIDI converter. Those will give you speciffic questions. I recomend looking up the answers to those in the eaxmples and the manual.

Quote:

Finally, I know the languages are new, but for those of you who have been writing using chuck - when you compose for live use, how have you been storing your material for later use? A simple list of actions? Do you save your files and then just call them up? It seems easy enough to program on the fly, but I would want some sort of "sheet music" to keep track of what to do next.


I've tried two aproaches, I like both and will do both some more in the future. First of all I wrote my own sequencer in ChucK, I use that one to play live music and when I do I don't see any of the code and don't write any (but all of the actual music is completely improvised). I like that because in ChucK I could make my sequencer exactly like I want it. I've also written small pieces on stage directly in ChucK. This is also fun because you have such complete freedom. In the first case everything was prepared, in the second there were no files though I had a set of techniques that I had practiced and could combine or improvise around. Mixtures are definately possible too and could also be a lot of fun. This choice will depend completley on your own temprament and what you enjoy; experiment!

Welcome on board!

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Mon Aug 13, 2007 2:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks Kassen, yes, that is a very useful idea for practicing & preparing for live use.
Playing around with both sides is very beneficial, and I'm trying to learn by this method also.

At first I was not totally understanding each examples,
but with some basic understanding I started with the tutorial,
and with modifying the examples,
I can think up many more ideas on what I'd like to try with what I've known
(or what I guess it can be done)

Enjoy experimenting also!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Low Note



Joined: Jul 20, 2007
Posts: 146
Location: New Jersey
Audio files: 2

PostPosted: Mon Aug 13, 2007 8:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

I went through the OTF examples, and got into the MIDI examples. I think I've experienced overload.

I understand all the steps to getting MIDI to work, though I wish the examples didn't use those prebuilt instruments and instead used a simple Sine oscillator with a gain dependant on velocity, or something like that. If I have time tomorrow, I'm going to mess around with that, see if I can make it work on my own.

As far as the OTFs go, everything seems to make perfect sense to me as long as I don't try to explain ever line of code. The biggest hang up being right now the way it all syncs together. I understand that this:

Code:
// this synchronizes to period
.5::second => dur T;
T - (now % T) => now;


will cause all of my shreds to sync up if it is present in all of them, but I can't really explain the whole modulo operator. Could anyone rewrite that a little more algabraically?

If I understand the concept correctly, one is trying to say, allow a shred to jump onto a moving train (the virtual machine). This bit of code allows it to line up with the train's door so it can get on.

From a completely practical perspective, I know that as long as I put that in each of my shreds, I can keep things time synced, but I'd really like to understand the nuts and bolts of what's going on.

I really appreciate the elegance of how chuck can imitate natural performances with the randomization. Seems almost too easy.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Tue Aug 14, 2007 4:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Low Note wrote:
I went through the OTF examples, and got into the MIDI examples. I think I've experienced overload.


That's not cool, let's see what we can do about that. Let's start at teh beginning and deal with the OTF question.


Quote:
As far as the OTFs go, everything seems to make perfect sense to me as long as I don't try to explain ever line of code. The biggest hang up being right now the way it all syncs together. I understand that this:

Code:
// this synchronizes to period
.5::second => dur T;
T - (now % T) => now;


will cause all of my shreds to sync up if it is present in all of them, but I can't really explain the whole modulo operator. Could anyone rewrite that a little more algabraically?


modulo works like this; you have two numbers, let's call them x and n. For the moment let's asume both x and n are positive.

what x % n (pronounced "x modulo n") means is basically that we substract n from x untill x is smaller then n. You can also say we devide x by n and then take the remainder.

So;
5 % 3 = 2
5 % 4 = 1
5 % 5 = 0
and
13 mod 4 = 1
(make sure you understand this, the rest depends on it)

So, if T is a period of time that translates to one "beat" and "now" is the current time then we now know that "now % T" means "the amount of time that has past since the last beat (or click of the metronome). in that case "T - (now %T)" refers to the amount of time that will have to pass untill the next beat, because all beats have the same length and they don't stop.

Because "second => now;" means "wait for a second" we can see that
"T - (now %T) => now;"
Actually translates to "wait untill then next beat". This is actually exactly what you'd do when playing in a band.

Make sure you also understand how the OTF examples mean Ge likes composing music at 120 BPM.

Recomended exersise; change then numbers in those examples and see what happens. Determine what each number refers to, try to change the numbers to remix the piece.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Low Note



Joined: Jul 20, 2007
Posts: 146
Location: New Jersey
Audio files: 2

PostPosted: Tue Aug 14, 2007 5:30 am    Post subject: Reply with quote  Mark this post and the followings unread

makes perfect sense now. thanks!

To double check:

When the manual says "advances time" for a line of code like:

Code:

1::second => now;


What it means is that the machine will wait until that time has elapsed until it moves on in the code?

(Going back into miniaudicle...)

When using the SndBuf uGen, chuck will automatically read it? That is why in the time loops, all you have to do is reset the sample to 0 (or at any point in the sample) for it to play again?
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Tue Aug 14, 2007 6:11 am    Post subject: Reply with quote  Mark this post and the followings unread

Low Note wrote:

When the manual says "advances time" for a line of code like:

Code:

1::second => now;


What it means is that the machine will wait until that time has elapsed until it moves on in the code?


It means that that section of code will wait for a second. Other pieces of code that might be running at the same time might do a lot of stuff in the meantime and the Ugens will keep calculating their sound as well. Advancing time just makes execution of that speciffic shred (thread) of code pause for a second before it goes on. so that's a "Yes", I think :¬).

Quote:

When using the SndBuf uGen, chuck will automatically read it? That is why in the time loops, all you have to do is reset the sample to 0 (or at any point in the sample) for it to play again?


Yes! exactly! SndBuf will calculate sound on it's own and only needs atention to be given new instrutions. The following will generate a tone (at the default frequency) that lasts for a hour, without needing any attention;

SinOsc s => dac;
hour => now;

That's a bit exagerated but it does demonstrate how it works nicely.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Tue Aug 14, 2007 8:54 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have one idea for understanding the "advance time" issue.
at first I didn't have experience in this type of programming also
(was playing around puredata and csound hahah)

After I get to understand what I can do with ChucK,
I imagine like this:

ChucKing UGens: means connect signal wires.
ChucKing other values: tweak some knobs:
Advancing Time: wait and hear

So actually, we can just hear the result of the system only when we wait and hear out.
Without advancing any time, everything'd end suddenly.

I like this time advancing idea, it's so easy to implement, and I like it when I can dynamically control how often I want to update some control in the program.
^_^

fight fight.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Low Note



Joined: Jul 20, 2007
Posts: 146
Location: New Jersey
Audio files: 2

PostPosted: Tue Aug 14, 2007 11:18 pm    Post subject: Reply with quote  Mark this post and the followings unread

speaking of csound, is there way to work with increments of time in a tempo fashion?

I mean - its easy enough to just compute everything relative to seconds, but it would nice to be able skip that step in certain situations, I'd imagine.


I could define variables for beats and measures and use those variables rather than increments of time, I suppose. Its probably too late for me to be thinking about things like this.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Aug 15, 2007 12:58 am    Post subject: Reply with quote  Mark this post and the followings unread

Low Note wrote:

I could define variables for beats and measures and use those variables rather than increments of time, I suppose. Its probably too late for me to be thinking about things like this.


Not too late at all. Defining beats and measures is a good idea, you can also have ChucK calculate how long a beat is for a given amount of BPM and update that if the BPM would change. "dur" for duration is a variable, just like "int" and can be modulated in the exact same way.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Wed Aug 15, 2007 4:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes! Not too late hehe. I was a classical-jazz instrumentalist, so I was thinking like you,
but thanks to ChucK and basic Physics, implementing that is easy & easy to understand:

(although very dynamic scoring on ChucK might require a more complex system)

If you wanna work with beat, tempo (beat per minute), measures..
you can calculate just like Kassen's suggestion:

Code:
120.0 => float BPM;
minute / BPM => dur beat; // comment: minute / BPM = beat duration
<<< "1 beat lasts", beat/second, "seconds" >>>;
4.0 => float BeatPerBar;
BeatPerBar::beat => dur bar;
<<< "1 bar lasts", bar/second, "seconds" >>>;


for example, I can program rhythms into array of floats:

Code:
120.0 => float BPM;
minute / BPM => dur beat; // comment: minute / BPM = beat duration
4.0 => float BeatPerBar;
BeatPerBar::beat => dur bar;

// connect SinOsc to dac
SinOsc s => dac;

// prepare melody (in semitone)
[12, 0, 3, 4, 0, 6, 7, 8, 7, 4, 3] @=> int melody1[];

// prepare rhythm (as duration in beats)
[1.0, 1, .5, .5, 1, .5, .5, .5, 1, .5, 1] @=> float rhythm1[];

48 => int BaseNote; // melody = 0 means C below middle C

do
{
    for(int i; i < melody1.cap(); i++)
    {
        Std.mtof(melody1[i] + BaseNote) => s.freq;
        rhythm1[i]::beat => now;
    }
    bar => now;
} while(true);


I guess this is can let us put in musical durations rather easily.
I mainly use this method for simple melody / groove patterns in ChucK.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use