Malik, Do you get any sort of error messages when you run this program? It seems to work on my machine. The only potential problem that I can see is that chuck might not be finding your WAV file. By output nothing, do you mean that it doesn't print anything, or it doesn't produce audio output, or both? If anything gets printed out, can you post that? In general its okay to send patches to the mailing list, as far as I am aware. spencer On Nov 14, 2006, at 6:46 AM, Malik Martin wrote:
hi Spencer thanks for the welcome! glad to be here.
i was suspecting that might be the case but didnt try it because i did some research on the buf.pos command because i kept getting an error saying the argument has 2 different types. It turns out that buf.pos or formally speaking, SndBuf.pos only takes an int type so i turned all the values to ints rounded to their highest value in the one's place.
this worked, but it still output nothing. the patch just works as if the array that i made doesn't exist!! here is a copy of the patch. but before i post it, would i be able to send patches as attatchments to the mailing-list?(would like to know for future refference)
// the patch SndBuf buf => dac;
// load the file "E:\samples\AmenMRZ2-180bpm.wav" => buf.read;
//get number of samples buf.samples() => int NumOfSamps; <<<NumOfSamps>>>;
//get length in milliseconds by converting seconds to ms buf.length() / ms => float length; <<<length>>>;
// time loop while( true ) { //1 bar at 180bpm cut into 8ths [ 0, 167, 333, 500, 667, 833, 1000, 1166 ] @=> int push[]; push[Std.rand2(0,7)] => buf.pos; 1333::ms => now; }
Spencer Salazar wrote:
Hi Malik, Welcome to ChucK land!
What you have found is a bug, the lack of a feature, or a result of strong typing (depending on your point of view), in which the type of the first element of an array determines the overall type of an array. This is better explained by example:
[ 0, 166.625, 333.25, 499.875, 666.5, 833.125, 999.75, 1166.375 ] @=> float push[];
produces an error, whereas
[ 0.0, 166.625, 333.25, 499.875, 666.5, 833.125, 999.75, 1166.375 ] @=> float push[];
does not produce an error (but is functionally equivalent). The difference is that the first element is explicitly a float when initializing the array of floats. hopefully this clarifies things a bit.
spencer
On Nov 13, 2006, at 10:21 PM, Malik Martin wrote:
hi i already posted this on the forums, but it doesnt seem as active as i imagine the mailing list might be(no offense of course).
so here's my post
hi i'm trying to access an array with rand2() but i get syntax errors:
while( true ) { //1 bar at 180bpm cut into 8ths float push[ 0, 166.625, 333.25, 499.875, 666.5, 833.125, 999.75, 1166.375 ] push[Math.rand2(0,7)] => buf.pos;
1333::ms => now; }
i made a second post with a minor update
i noticed my syntax errors in comparison to otf_06.ck on page 49 in the manual and re-wrote it.
// time loop while( true ) { //1 bar at 180bpm cut into 8ths [ 0, 166.625, 333.25, 499.875, 666.5, 833.125, 999.75, 1166.375 ] @=> float push[]; push[Math.rand2(0,7)] => buf.pos;
1333::ms => now; }
but i still get this error: [SndBufTest1.ck]:line(19): array init [...] contains incompatible types...
Malik _______________________________________________ chuck-users mailing list 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
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users