I see the following functions in the Chuck manual, for SndBuf: .read - (string, WRITE only) - loads file for reading .chunks - (int, READ/WRITE) - size of chunk (# of frames) to read on-demand; 0 implies entire file, default; must be set before reading to take effect. .write - (string, WRITE only) - loads a file for writing (or not) .pos - (int, READ/WRITE) - set position (0
int j ; j < 10000 ; j++) {
j => a.pos ;
j => samp_pos ;
a.valueAt() => samp_val ;
// <<
Hi Laurie, Its not documented but SndBuf.valueAt() actually takes an integer argument, which is the buffer position of the sample you are trying to take the value of. So a.valueAt( a.pos ) will give you the sample at the current buffer position. Also, it returns a float. Im not sure why it is documented like it is on the website; we'll be sure to make the docs more clear on that soon. spencer On Dec 3, 2006, at 11:48 PM, Laurie Hollander wrote:
I see the following functions in the Chuck manual, for SndBuf: .read - (string, WRITE only) - loads file for reading .chunks - (int, READ/WRITE) - size of chunk (# of frames) to read on-demand; 0 implies entire file, default; must be set before reading to take effect. .write - (string, WRITE only) - loads a file for writing (or not) .pos - (int, READ/WRITE) - set position (0
I am now trying to use the .valueAt function, but am getting errors. The program is something like.... SndBuf a ; ...etc I read a soundfile into sndbuf a and play it - that much works....
int samp_pos ; float samp_val ; for (0 => int j ; j < 10000 ; j++) { j => a.pos ; j => samp_pos ; a.valueAt() => samp_val ; // <<
>> ; // <<< samp_pos, samp_val >>> ; } Here's the error message: [trigplay2calc.ck]:line(151): arguments type(s) do not match: [trigplay2calc.ck]:line(151): ... for function 'SndBuf.valueAt (...)' ... [trigplay2calc.ck]:line(151): ...(please check the argument types)
When I change the type of samp_val to int, I get the same message. When I leave out the parentheses, it complains that it's a function.
Does the .valueAt function work?
Thank you!
-Laurie _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
hi spencer i'd really love to see come clearer docs on sndbuf myself:) i havent touched chuck since that last little issue i had with it. i do miss chuck. but i want to learn to sample with it. not really much of a synth fanatic. i sample my synths then throw them into my sampler :) Spencer Salazar wrote:
Hi Laurie, Its not documented but SndBuf.valueAt() actually takes an integer argument, which is the buffer position of the sample you are trying to take the value of. So a.valueAt( a.pos ) will give you the sample at the current buffer position. Also, it returns a float. Im not sure why it is documented like it is on the website; we'll be sure to make the docs more clear on that soon.
spencer
On Dec 3, 2006, at 11:48 PM, Laurie Hollander wrote:
I see the following functions in the Chuck manual, for SndBuf: .read - (string, WRITE only) - loads file for reading .chunks - (int, READ/WRITE) - size of chunk (# of frames) to read on-demand; 0 implies entire file, default; must be set before reading to take effect. .write - (string, WRITE only) - loads a file for writing (or not) .pos - (int, READ/WRITE) - set position (0
I am now trying to use the .valueAt function, but am getting errors. The program is something like.... SndBuf a ; ...etc I read a soundfile into sndbuf a and play it - that much works....
int samp_pos ; float samp_val ; for (0 => int j ; j < 10000 ; j++) { j => a.pos ; j => samp_pos ; a.valueAt() => samp_val ; // <<
>> ; // <<< samp_pos, samp_val >>> ; } Here's the error message: [trigplay2calc.ck]:line(151): arguments type(s) do not match: [trigplay2calc.ck]:line(151): ... for function 'SndBuf.valueAt (...)' ... [trigplay2calc.ck]:line(151): ...(please check the argument types)
When I change the type of samp_val to int, I get the same message. When I leave out the parentheses, it complains that it's a function.
Does the .valueAt function work?
Thank you!
-Laurie _______________________________________________ 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
participants (3)
-
Laurie Hollander
-
Malik Martin
-
Spencer Salazar