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 
 Forum index » DIY Hardware and Software » ChucK programming language
Getting Started
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [20 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
ausz99



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Mon Feb 25, 2008 5:30 pm    Post subject: Getting Started
Subject description: Have been asked by my uni to use chuck to create a song.
Reply with quote  Mark this post and the followings unread

Hi guys.

I have been asked by my uni to create a peice of music using chuck. After going through all the tutorials that come with the download I've come to realise that it's actually a lot of fun although I can only go as far as mucking about with the OTF files using two ms promp windows.

All I'm asking for is good advise for what I should look into next. My lecture did explain how to use arrays to create melodies however this just went right over my head. If any one's got anything they can suggest then please let me know.

If on the other hand you hate newbies posting on the forum then just tell me to shut up lol

Cheers

Rob
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Mon Feb 25, 2008 9:50 pm    Post subject: Re: Getting Started
Subject description: Have been asked by my uni to use chuck to create a song.
Reply with quote  Mark this post and the followings unread

ausz99 wrote:
If on the other hand you hate newbies posting on the forum then just tell me to shut up lol

Cheers

Rob


We love newbies! I was a ChucK newbie 4 months ago too. Now maybe I'm "beginner", lol. Welcome to ChucK.

I think you're asking about sequencing, which I'm learning is the process by which notes and variable note parameters are scheduled in time. We recently did a math in music project that you can read about in this forum, and there were some sequencing techniques in there. Plus there are some more that some of us have posted, so look around the recent forum threads for ideas.

If you want to use my personal technique, that one is Boolean Sequencing, which yields complex results from simple logic expressions. Let me know and I will try to explain it to you.

Most importantly, have fun! ChucK is a big software fun machine.
Back to top
View user's profile Send private message Send e-mail
kijjaz



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

PostPosted: Tue Feb 26, 2008 12:20 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi.. I'm still a newbie too (hehehe) ..
(I really feel that coz I still haven't explored and try out all the features of ChucK -_-")

I've got some basic sequencing methods for you to try.
It involves using array, but in a very easy way to understand.
Sometimes if I can't think of any other way to do sequencing, these are what I think of:


(1) Sequencing in a Tracker Style:
In a Tracker, we usally key in musical values (notes, velocity, etc..) in to cells that we know exactly what beat it is. (or fraction of beat)

example (it'd explain itself)
Code:
60 => int baseNote; // choose the note that we'll start at (60 = middle C)
128.0 => float tempo; // tempo in Beat Per Minute
minute / tempo => dur beat; // with Tempo, we can calculate how long a beat should be

Flute s => dac; // prepare a flute
s => DelayA d => Gain d_gain => dac; // send to a delay
d => Gain d_feedback => d; // and delay feedback into itself

d.max(second); // initialize delay by setting maximum delay we'll use
d.delay(1.5::beat); // set delay time
d_feedback.gain(.25); // set delay feedback
d_gain.gain(.3); // set delay overall gain

.5 => s.gain; // adjust flute volumn

// create an array of melody by note numbers
[0, 0, 0, 0, 2, 0, 0, 7, 0, 3, 0, 12, 0, 14, 15, 9] @=> int melody1[];
// create an array of velocity (make it a float)
// (the size of these arrays should be the same)
[1.0, 0, 0, 0, .5, 0, 0, .7, 0, .4, .2, .7, 0, .5, .6, .9] @=> float
velocity1[];


while(true)
for(int i; i < melody1.cap(); i++)
{
    melody1[i] + baseNote => Std.mtof => s.freq; // set the frequency of the flute
    velocity1[i] => s.noteOn; // use velocity to trigger flute (to blow)
    .2::beat => now;
    velocity1[i] => s.noteOff; // perform note off
    .05::beat => now;
}


(2) Sequencing by also using an array to keep the length of note to play

Code:
72 => int baseNote; // choose the note that we'll start at (60 = middle C)
128.0 => float tempo; // tempo in Beat Per Minute
minute / tempo => dur beat; // with Tempo, we can calculate how long a beat should be

Flute s => dac; // prepare a flute
s => DelayA d => Gain d_gain => dac; // send to a delay
d => Gain d_feedback => d; // and delay feedback into itself

d.max(second); // initialize delay by setting maximum delay we'll use
d.delay(1.5::beat); // set delay time
d_feedback.gain(.25); // set delay feedback
d_gain.gain(.3); // set delay overall gain

.5 => s.gain; // adjust flute volumn

// create an array of melody by note numbers
[0, 2, 7, 3, 12, 14, 15, 9] @=> int melody1[];
// create an array of velocity (make it a float)
// (the size of these arrays should be the same)
[1.0, .5, .7, .4, .2, .7, .5, .6, .9] @=> float velocity1[];
// creat an array to hold number of beats to play
[1.0, .75, .5, .5, .5, .25, .25, .25, .25] @=> float duration1[];


while(true)
for(int i; i < melody1.cap(); i++)
{
    melody1[i] + baseNote => Std.mtof => s.freq; // set the frequency of the flute
    velocity1[i] => s.noteOn; // use velocity to trigger flute (to blow)
    duration1[i]::beat => now;
    velocity1[i] => s.noteOff; // perform note off   
}


Using this way of sequencing is more flexible in terms of timing.
But it's useful both ways.

One thing that's fun is that,
we can manipulate (or animate) the values in this array in many ways, anything we can think of.
for example, looping on only some part(s) of the array.. rotating / retrograding / transposing / joining array values..
turning the 'read head' in a different direction..
make values in the array interact with eachother (for example, like cellular automata)

This can make exciting music out of very few lines of code.
Okay. let's share soon. and welcome! Very Happy

Last edited by kijjaz on Wed Feb 27, 2008 1:48 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
ausz99



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Wed Feb 27, 2008 6:01 am    Post subject: Doesn't work Reply with quote  Mark this post and the followings unread

I tried your second bit of coding kijjaz in mini audicle and it doesn't work, it says there a syntax error on line 27 charactor 29. There was a simular problem with the first peice of coding too but I can't remember what line and charator etc. i'm guessing it's probably something really simple like a space or something.

Also I'm gonna be stupid and ask Inventor to share his technique

Inventor wrote:
If you want to use my personal technique, that one is Boolean Sequencing, which yields complex results from simple logic expressions. Let me know and I will try to explain it to you.


It'll probably go right over my head at first but will give me something fun to play with lol!!
Back to top
View user's profile Send private message
kijjaz



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

PostPosted: Wed Feb 27, 2008 1:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ahhh! I forgot to check "Disable HTML in this post" -_-" ...
that messed up the codes a bit.
I'll edit the original code.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Wed Feb 27, 2008 4:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, ausz99, Boolean Sequencing is very simple. You just make a binary counter, then play the notes based on when that counter satisfies logic expressions. to make a binary counter, you can use nested for loops that count 0101010101 like that, with the innermost for loop being the LSB and the outermost variable being the MSB. Then you might have a logic expression like play_note = j1 & j0, which will play every fourth note. You put your time delay in the innermost loop, and make it say 1/6 of a second.

That should be enough to get you started, post whatever code you come up with and describe its behavior and we will help you fix it up!

Good luck and have fun.
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


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

PostPosted: Wed Feb 27, 2008 4:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

I think Kijjaz's example is quite good as a introductory sequencing example, it's quite compact and anything that's not clear can be edited to see what the values do.

I'm not sure "a piece of music" would need to be sequenced as such and of course there are other examples in the "examples" dir that could be used as a starting point. Editing the "otf" files as soon as turning them on and off stops being satisfactory is a very good approach as well, BTW, you could for example consider editing one or two of those to include a structure like Kijjaz's. "Boolean sequencing" is great but I'm not sure it's basic accessible stuff, unless of course you already know some logic, at that point it might be great because you can extend it in any number of directions.

What course is this, BTW?

_________________
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 Feb 27, 2008 11:23 pm    Post subject: Reply with quote  Mark this post and the followings unread

I also use logic and modulo for sequencing also. I'll give an example of using it for some simple rhythmic idea.

Code:
// initialize two triangle oscillators and set to a different pitch
TriOsc s1 => dac;
Std.mtof(48) => s1.freq;
s1.gain(.4);
TriOsc s2 => dac;
Std.mtof(67) => s2.freq;
s2.gain(.4);

// prepare tempo value and calculate into beat duration
120.0 => float BPM;
minute / BPM => dur beat;

int i;
while(true)
{
    if (i % 8 == 0) s1.gain(1); else s1.gain(0);
    if (i % 4 == 1) s2.gain(1); else s2.gain(0);
    .5::beat => now; // each cycle is an 8-note (half a beat)
    i++; // increase the counter
}


One thing very easy in this example is that we use if to test if the modulo is equal to a number, if yes, the note can be triggered on and off.
(this on and off can also be used with noteOn and noteOff in StkInstruments.)

now, i'll edit only in the while ... loop.

Code:
while(true)
{
    if (i % 8 == 0) s1.gain(1); else s1.gain(0);
    if ((i * 3 + 2) % 8 < 2) s2.gain(1); else s2.gain(0);
    .5::beat => now;
    i++;
}

Now this one result in something with syncopation / playing something on an upbeat.

with this we can trasform into a more rhythmic stuffs, for example:

Code:
while(true)
{
    if ((i * 5) % 16 < 3) s1.gain(1); else s1.gain(0);
    if ((i * 3) % 8 < 3) s2.gain(1); else s2.gain(0);
    .25::beat => now;
    i++;
}

Ahh! That sounds more latin. (Or Techno i'm not sure -_- hahahah)

we can also use the result from this kind of modulo, addition, to work with pitch.
let me transform the oscillators to StkInstrument, so we can noteOn and noteOff easily.

Code:
int i;
while(true)
{
    if ((i * 5) % 16 < 4) s1.noteOn(.4); else s1.noteOff(.4);
    if ((i * 3) % 8 < 4) s2.noteOn(.4); else s2.noteOff(.4);
    Std.mtof( (i * 5) % 16 + 60 ) => s1.freq;
    Std.mtof( (i * 7) % 8 + 72 ) => s2.freq;
    .25::beat => now;
    i++;
}


With the same rythmic on/off mechanic, value calculated from the mehod is added with note value, then form some kind of a chromatic machine.
But adjusting the multiplication and modulation,
you'll get different inversions and jumps in the melody.

Code:
while(true)
{
    if ((i * 5) % 16 < 4) s1.noteOn(.7); else s1.noteOff(.7);
    if ((i * 3) % 8 < 5) s2.noteOn(.4); else s2.noteOff(.4);
    Std.mtof( (i * 3) % 16 + 38 ) => s1.freq;
    Std.mtof( (i * 7) % 16 + (i * 5) % 8 + 60 ) => s2.freq;
    .25::beat => now;
    i++;
}


The result may seem hard to control at first, but when playing around with it, i gain a lot of more ideas to mess up a little with the code and produce a much-more-complex-sounding melodies.

Using the output of the calculation to choose notes from a scale is interesting also if you'd like to hear the result based on a scale, so it'd be more tonal in quality.

Hmm this is gonna be all i'm suggesting today heheh.
Have fun!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Thu Feb 28, 2008 2:01 am    Post subject: Reply with quote  Mark this post and the followings unread

I agree with Kassen that for a true beginner, kijjaz's examples are more accessible - they make more sense. You would probably want your one and only ChucK program (for now) to represent the mainstream rather than some wild idea like Boolean sequencing. Plus kijjaz gave you a bunch of code to use! So give that a try i guess. Cheers!
Back to top
View user's profile Send private message Send e-mail
ausz99



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Thu Feb 28, 2008 7:24 am    Post subject: cheers Reply with quote  Mark this post and the followings unread

Cheers for all you help, although I'm stuggling with the lingo a bit, I am having fun playing around with the examples you gave me. The boolean stuff is going strait over my head though!

I'll post you some stuff when I come up with it.

p.s. I've left a link to the course it's for this

[Blue Hell: I shortened the link]
Back to top
View user's profile Send private message
ausz99



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Thu Feb 28, 2008 9:02 am    Post subject: Reply with quote  Mark this post and the followings unread

Cheers blue hell for shortening the link lol was kinda long. I know I was the last person to reply in this topic but i have another question.

In a simular way to how Kijjaz made some intesting flute melodies with the use of arrays (cheers for the pointer notes EXSTREMELY HELPFUL to get my head around it), could this technique be used to create drum beats by playing sampled wav files instead of notes?

Obviously you would have to give a value for each sample e.g.

0 kick
1 snare
2 hi-hat

then make an array like

[0, 2, 1, 2, 0, 0, 2, 1] array for drum samples to play.
[1.0, .5, .9, .6, .7, .5, .8, .6] array for amplitude of each sample.
[.5, .5, .5, .5, .5, .5, .5, .5] array to hold number of beats to play.

Just a thought, would be interesting if you could make anything of it. Btw those arrays if it's possible should give you a classic rock drum beat lol.

Cheers for any help.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


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

PostPosted: Thu Feb 28, 2008 10:33 am    Post subject: Reply with quote  Mark this post and the followings unread

ausz99 wrote:
could this technique be used to create drum beats by playing sampled wav files instead of notes?


Sure! Let me give you a incomplete sketch of such a program.

Code:
//a array of samples
SndBuf samples[3];

//add code here to load your own samples!

for(0 => int n; n < samples.cap(); n++)
 {
 //conect every sample to the dac
 samples[n] => dac;

 //simple trick to avoid them playing by accident
 //works by placing the read-pointer at the end of the file
 samples[n].samples() => samples[n].pos;
 }

//array for drum samples to play.
[0, 2, 1, 2, 0, 0, 2, 1] @=> int sequence[];

int step;

while(true)
 {
 //here it gets tricky.
 //we look up the number of the sample to play in the sequence
 //then use that as a index to the array of samples
 //and set that sample's read-pointer to the beginning of the file
 0 => samples[ sequence[ step ] ].pos();
 
 //this is where you can add things like volume modulation
 //and so on

 //go to next step
 step++;
 //make sure we loop at the end of the sequence
 step % sequence.cap() => step;

 .5::second => now;
 }


I think that's roughly the design you were after? As Kijjaz pointed out modulus is a great operation for looping. This design uses a lot of arrays and uses them in slightly more advanced ways. Arrays are your friend in sequencing and they lead to compact and efficient code so understanding them is very useful indeed.

Do give a shout if this isn't clear and won't become clear after playing with it for a bit.

"boolean sequencing" *is" a more advanced technique, no harm done there but it's probably wise to point out what words of "the lingo" are unclear.

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



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Thu Feb 28, 2008 12:18 pm    Post subject: Reply with quote  Mark this post and the followings unread

ok at this point your probably thinking "this bloke really is an idiot!" but when you say connect your samples to the DAC i simply thought that would be a case of putting

"wavs/kick.wav" => dac;
"wavs/snare.wav" => dac;
"wavs/hihat.wav" => dac;

To give you this peice of coding

Code wrote:


//a array of samples
SndBuf samples[3];

//add code here to load your own samples!

for(0 => int n; n < samples.cap(); n++)
{
//connect every sample to the dac

"wavs/kick.wav" => dac;
"wavs/snare.wav" => dac;
"wavs/hihat.wav" => dac;


//simple trick to avoid them playing by accident
//works by placing the read-pointer at the end of the file
samples[n].samples() => samples[n].pos;
}

//array for drum samples to play.
[0, 2, 1, 2, 0, 0, 2, 1] @=> int sequence[];

int step;

while(true)
{
//here it gets tricky.
//we look up the number of the sample to play in the sequence
//then use that as a index to the array of samples
//and set that sample's read-pointer to the beginning of the file
0 => samples[ sequence[ step ] ].pos();

//this is where you can add things like volume modulation
//and so on

//go to next step
step++;
//make sure we loop at the end of the sequence
step % sequence.cap() => step;

.5::second => now;
}


Also can you have more then one array playing at one time e.g have two flutes playing to gether but different notes?!?!
Back to top
View user's profile Send private message
Frostburn



Joined: Dec 12, 2007
Posts: 255
Location: Finland
Audio files: 9

PostPosted: Thu Feb 28, 2008 12:54 pm    Post subject: Reply with quote  Mark this post and the followings unread

You'll notice that Kassen used an array of SndBuf objects. You'll need to use the .read method to load up samples:

Code:
//Create an array of Sound Buffer to play the samples
SndBuf samples[3];

//Load some sound files that come with ChucK (your path may differ):
"doc/examples/data/kick.wav" => samples[0].read;
"doc/examples/data/snare.wav" => samples[1].read;
"doc/examples/data/hihat.wav" => samples[2].read;

for(0 => int n; n < samples.cap(); n++)
 {
 //conect every SndBuf to the dac
 samples[n] => dac;

 //simple trick to avoid them playing by accident
 //works by placing the read-pointer at the end of the file
 samples[n].samples() => samples[n].pos; //If this is not done all of the loaded wav files would play now.
 }

//array for drum samples to play.
[0, 2, 1, 2, 0, 0, 2, 1] @=> int sequence[];

int step;

while(true)
 {
 //here it gets tricky.
 //we look up the number of the sample to play in the sequence
 //then use that as a index to the array of samples
 //and set that sample's read-pointer to the beginning of the file
 0 => samples[ sequence[ step ] ].pos;
 
 //this is where you can add things like volume modulation
 //and so on

 //go to next step
 step++;
 //make sure we loop at the end of the sequence
 step % sequence.cap() => step;

 .5::second => now;
 }

also you may want to use the Code tag instead of the Quote tag for code.

EDIT:
I'd also like to give my view on sequencing with arrays.
I like to keep all the data that relates to a single note in a single unit so instead of many arrays with single type of data I'd use a two dimensional array. The down side is that all the data has to be of the same type (float).
Code:
//Enumerate some pitches:
60 => float c;
64 => float e;
67 => float g;

//2D array with six units of [durationFromLastNote, thisNotesPitch, thisNotesVelocity, thisNotesDuration]
[
 [0.0, c, 1.0, 2.0], //play c immediately with full velocity for two beats
 [2.0, e, 0.5, 1.0], //play e two beats after that with half velocity and one beat duration
 [0.5, g, 0.5, 1.0], //play g half a beat after e, while it's still playing
 [2.0, c, 0.3, 1.0], //wait for some time and...
 [0.0, e, 0.3, 1.0], //..add e to the c...
 [0.0, g, 0.3, 1.0] //finally top it with a g to make a chord
] @=> float score[][]; //Chuck to a new 2D array.

//We need a beat
0.5::second => dur beat;

//We need an instrument:
fun void tribeep(float freq,float velocity,dur duration){
        TriOsc beeper => Envelope e => dac; //The patch
        freq => beeper.freq;
        velocity => beeper.gain;
        duration => e.duration;
        1.0 => e.value; //Start with a full envelope...
        e.keyOff(); //...and start decaying
        duration => now;
        beeper =< e =< dac; //unchuck to stop the sound
        //well actually the shred will at this point exit and the beeber will be destroyed anyhow
}

//Let's do this thing!
for(0 => int i; i < score.cap(); i++){
        score[i][0]::beat => now; //Wait for the next note to play
        spork~tribeep( Std.mtof(score[i][1]), score[i][2], score[i][3]::beat ); //Spork a new shred to play according to the data;
}

3::second => now; //Give some relaxation time for the notes to finish playing

Last edited by Frostburn on Thu Feb 28, 2008 1:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
kijjaz



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

PostPosted: Thu Feb 28, 2008 12:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

If you'd like to play a sound file by using SndBuf,
it's the SndBuf that'd be the sound generator (sound data read from the file).
so it's that SndBuf that should be chucked to dac.

you can see the example in the sndbuf.ck in the examples.
http://chuck.cs.princeton.edu/doc/examples/basic/sndbuf.ck

So.. what you have to do to try to play a wav file...

first, make a SndBuf, connect to dac
( for example, SndBuf s => dac; )

load a wave file into it
s.read("ThePathAndTheWaveFileName");

( or you can "ThePathAndTheWaveFileName" => s.read;
those two lines are the same )

each time that you 0 => s.pos; or s.pos(0);
s will play the sound contained in the wave file.
(the meaning is: play from the beginning.)

you can also use s.gain to set gain
set s.rate to set playback speed.

after that, it's up to you to modify.
- - -

Okay, so now you can create an array and loop around and read the array.
Now you can try to use if to read if a value in a cell of an array contained a specific number for a drum sound..

for example, if you have 3 drum sounds:
bassdrum.wav, snaredrum.wav, hihat.wav

you can create 3 SndBuf:
SndBuf bd => dac;
SndBuf sd => dac;
SndBug hh => dac;

read wave files by the .read function i told you about,
then play each sound by .pos(0) if the condition is right..

but what Kassen is recommending is very useful:
we can have an array of SndBufs!
and also can create an array of wave file names!! ..

Code:
["bass drum file name", "snare drum file name", "hihat file name"] @=> string soundFiles[]; // create an array of strings to hold file names for the SndBufs
SndBuf buf[3]; // create an array of sound buffers called 'buf'
for(int i; i < 3; i++)
{
buf[i] => dac; // connect each of them to dac
soundFiles[i] => buf[i].read; // make each of them read from files indicated in the soundFiles array
}


with this, you'll get an array of SndBuf ready to make some sound out.
just say buf[x].pos(0) and it'd play right away.
but you have to supply x.
x can be any number between 0-2
so it'd be easy for you if you've got an array that holds numbers that represent this kind of thing:
0 = bass drum
1 = snare drum
2 = hi hat

i hope you can build the drum sequencer machine soon!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Kassen
Janitor
Janitor


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

PostPosted: Thu Feb 28, 2008 1:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

ausz99 wrote:
ok at this point your probably thinking "this bloke really is an idiot!" but when you say connect your samples to the DAC i simply thought....


No, not at all. In fact I'm hitting my head here because I should have made a much clearer distinction between "a sample" (like "/my_files/boom.wav") and "a sample player" like SndBuf.

Samples, as you may know, are just trains of numbers representing a sound and SndBuf is a little device that takes such a series of numbers and plays it back, kinda like a program like Winamp or I-tunes, except really basic and without a graphical interface. The difference could also be seen as the difference between a record and a turntable, they depend on each-other to be useful. The ".read()" function my friends above mention could be seen as meaning "put this record on that turntable". All Ugens (SndBuf is a "Ugen") have functions that tell them what to do and how to behave. These are mentioned in the manual and the online reference. There is no need to know them all by heart but it *is* important to know how to look such things up.


Quote:
Also can you have more then one array playing at one time e.g have two flutes playing to gether but different notes?!?!


Oh, yes. If your computer can take it you could have a thousand flutes :¬). As with everything it depends on *how* you'd like to use two flutes. I'm sure you can see already that even for something simple like sequencing three drums there are many possible approaches. Perhaps the most important thing about programming is thinking carefully about what you want and how you'd like to approach it.

Let's talk about two flutes once you have the basics down, we can extend from those basics based on your own ideas. You see, I like to help but I don't think you'd be served that well by me doing your homework. :¬)

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


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

PostPosted: Thu Feb 28, 2008 1:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:

but what Kassen is recommending is very useful:
we can have an array of SndBufs!
and also can create an array of wave file names!! ..


Yes. I thought that would be a bit more advanced but it seemed like a logical choice because Ausz99 started by numbering the drums in his own conceptual idea. That way I could use his own example "rock" array... with numbered drums.

It also lead to demonstrating you can have arrays of anything which is really quite useful once you get used to it and saves sooooo much code. I kinda wanted to force Ausz99 to look up SndBuf in the manual but that wasn't so clear. My bad.

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



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Mon Mar 03, 2008 9:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Woke up with one hell of a hangover and thought "lets start chucking". Not as in chucking up last nights beer and food but as in making music lol

Got the drum sequencer to work in the end, kinda had a problem but was just due to the directories of the wav files which was easily sorted.

Quote:
I kinda wanted to force Ausz99 to look up SndBuf in the manual but that wasn't so clear. My bad.


Yeah i checked it out by pressing "control/f" (find) but nothing really came up for SndBuf.

I also changed the last bit which said

Code:
.5::second => now;


to .25::second = > now;

This gave me a tempo of 120 BPM which is about right for my song Smile
Back to top
View user's profile Send private message
kijjaz



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

PostPosted: Mon Mar 03, 2008 9:52 am    Post subject: Reply with quote  Mark this post and the followings unread

more with tempo,
i recommend calculating beat from minute/BeatPerMinute
just like i did xxx.x => float BPM; minute / BPM => dur beat;
so you can set up the tempo more music-theoretically. hheheheh.

How's it going with sequencing?
I hope to see you make more than 2-3-4 instruments playing at the same time.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
ausz99



Joined: Feb 25, 2008
Posts: 9
Location: UK
Audio files: 1

PostPosted: Mon Mar 03, 2008 11:58 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah gonna work on that next Kijjaz

My peice isn't sounding too great so far, but this is what little I have done.


tester.mp3
 Description:
Just a small mp3 file of what I have done

Download
 Filename:  tester.mp3
 Filesize:  933.47 KB
 Downloaded:  247 Time(s)

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [20 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