Hello all, I was wondering if there is a ugen that will handle arbitrary looping points? I have some samples for various instruments (ie piano, mellotron strings, etc), and would like to hook them up in ChucK. Basically, if the sndbuf ugen is the starting point for this, then do I need to write my own "looping" function to ensure that it gets back to the proper points within the sample. Or has someone already implemented this functionality and would be interested in "sharing"? Thanks, Mike
Hi, This is part of the wonder of ChucK, you can define this yourself. Most often .pos is given the 0 argument to start from the beginning of the file. You can give it any int that will refer to an index in your sample. If you know the startpoint and endpoint of the looping for each file then you can put in a function like this and then call it for every instance of the sample. Then you can expand this to respond to noteons and noteoffs and all those other musical things. I hope this answers your question. --art fun void playsample(int startpoint, int endpoint, string filename){ sndbuf s => dac; filename => s.read; 0 => s.pos; endpoint::samp => now; while(true){ startpoint => s.pos; (endpoint - startpoint)::samp => now; } } On 27-Feb-06, at 1:17 PM, Mike McGonagle wrote:
Hello all,
I was wondering if there is a ugen that will handle arbitrary looping points? I have some samples for various instruments (ie piano, mellotron strings, etc), and would like to hook them up in ChucK. Basically, if the sndbuf ugen is the starting point for this, then do I need to write my own "looping" function to ensure that it gets back to the proper points within the sample.
Or has someone already implemented this functionality and would be interested in "sharing"?
Thanks,
Mike _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I wrote ChucKML to solve this kind of problem: it reads a xml file describing which files should be played and when; and prints ChucK source code to perform that. <chuckml> <wave src="wav/wave.wav" repeat_every="9::second"/> <wave src="wav/beat1.wav" start_after="3::second" repeat_every="3::second"/> <wave src="wav/beat2.wav" start_after="3::second" repeat_every="3::second"/> </chuckml> http://wiki-new.cs.princeton.edu/index.php/ChucKML I couldn't upload the tgz file to the wiki, but I'll post the source code there.
This is something that I would be interested in seeing. It is sad that
the WIKI won't allow uploading of archives, as that would make
downloading the files much simpler, as you won't have to "Copy and
Paste" everything into a new file.
I look forward to checking out ChucKML.
Mike
On 2/27/06, Nelson Ferraz
I wrote ChucKML to solve this kind of problem: it reads a xml file describing which files should be played and when; and prints ChucK source code to perform that.
<chuckml> <wave src="wav/wave.wav" repeat_every="9::second"/> <wave src="wav/beat1.wav" start_after="3::second" repeat_every="3::second"/> <wave src="wav/beat2.wav" start_after="3::second" repeat_every="3::second"/> </chuckml>
http://wiki-new.cs.princeton.edu/index.php/ChucKML
I couldn't upload the tgz file to the wiki, but I'll post the source code there. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Help the Environment, Plant a Bush back in Texas!
Hey, The bonus of having to put everything up on the wiki separately means that everyone can see your example. This will allow us to figure it out and add comments and link to your example when developing patches of a similar nature. If we can get archives to be accepted by the wiki then I would encourage you to also post all your source individually with some other comments. This will also help people who are looking at ChucK to see how it stacks up with other languages when they are trying to figure out which one they would prefer to use. --art On 28-Feb-06, at 10:33 AM, Mike McGonagle wrote:
This is something that I would be interested in seeing. It is sad that the WIKI won't allow uploading of archives, as that would make downloading the files much simpler, as you won't have to "Copy and Paste" everything into a new file.
I look forward to checking out ChucKML.
Mike
On 2/27/06, Nelson Ferraz
wrote: I wrote ChucKML to solve this kind of problem: it reads a xml file describing which files should be played and when; and prints ChucK source code to perform that.
<chuckml> <wave src="wav/wave.wav" repeat_every="9::second"/> <wave src="wav/beat1.wav" start_after="3::second" repeat_every="3::second"/> <wave src="wav/beat2.wav" start_after="3::second" repeat_every="3::second"/> </chuckml>
http://wiki-new.cs.princeton.edu/index.php/ChucKML
I couldn't upload the tgz file to the wiki, but I'll post the source code there. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Help the Environment, Plant a Bush back in Texas! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Try the WaveLoop (STK) class- it's built with a wavetable oscillator in mind, but will play a file of arbitrary length. http://chuck.cs.princeton.edu/doc/program/ugen_full.html#WaveLoop Adam Tindale wrote:
Hi,
This is part of the wonder of ChucK, you can define this yourself. Most often .pos is given the 0 argument to start from the beginning of the file. You can give it any int that will refer to an index in your sample.
If you know the startpoint and endpoint of the looping for each file then you can put in a function like this and then call it for every instance of the sample. Then you can expand this to respond to noteons and noteoffs and all those other musical things.
I hope this answers your question.
--art
fun void playsample(int startpoint, int endpoint, string filename){ sndbuf s => dac;
filename => s.read;
0 => s.pos;
endpoint::samp => now;
while(true){ startpoint => s.pos; (endpoint - startpoint)::samp => now; } }
On 27-Feb-06, at 1:17 PM, Mike McGonagle wrote:
Hello all,
I was wondering if there is a ugen that will handle arbitrary looping points? I have some samples for various instruments (ie piano, mellotron strings, etc), and would like to hook them up in ChucK. Basically, if the sndbuf ugen is the starting point for this, then do I need to write my own "looping" function to ensure that it gets back to the proper points within the sample.
Or has someone already implemented this functionality and would be interested in "sharing"?
Thanks,
Mike _______________________________________________ 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
Thanks, Philip, I will check this out...
Mike
On 2/27/06, Philip Davidson
Try the WaveLoop (STK) class- it's built with a wavetable oscillator in mind, but will play a file of arbitrary length.
http://chuck.cs.princeton.edu/doc/program/ugen_full.html#WaveLoop
Adam Tindale wrote:
Hi,
This is part of the wonder of ChucK, you can define this yourself. Most often .pos is given the 0 argument to start from the beginning of the file. You can give it any int that will refer to an index in your sample.
If you know the startpoint and endpoint of the looping for each file then you can put in a function like this and then call it for every instance of the sample. Then you can expand this to respond to noteons and noteoffs and all those other musical things.
I hope this answers your question.
--art
fun void playsample(int startpoint, int endpoint, string filename){ sndbuf s => dac;
filename => s.read;
0 => s.pos;
endpoint::samp => now;
while(true){ startpoint => s.pos; (endpoint - startpoint)::samp => now; } }
On 27-Feb-06, at 1:17 PM, Mike McGonagle wrote:
Hello all,
I was wondering if there is a ugen that will handle arbitrary looping points? I have some samples for various instruments (ie piano, mellotron strings, etc), and would like to hook them up in ChucK. Basically, if the sndbuf ugen is the starting point for this, then do I need to write my own "looping" function to ensure that it gets back to the proper points within the sample.
Or has someone already implemented this functionality and would be interested in "sharing"?
Thanks,
Mike _______________________________________________ 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
-- Help the Environment, Plant a Bush back in Texas!
Thanks, Adam, this is a good start. I do have all the looping points,
and was wondering how this would look. I was "afraid" that I would
have to call this every sample, but from the looks of it, that may not
be the case. Just have to account for any changes in frequency, as I
am sure that the time for each sample is based on using the sample
data at pitch for the file.
Mike
On 2/27/06, Adam Tindale
Hi,
This is part of the wonder of ChucK, you can define this yourself. Most often .pos is given the 0 argument to start from the beginning of the file. You can give it any int that will refer to an index in your sample.
If you know the startpoint and endpoint of the looping for each file then you can put in a function like this and then call it for every instance of the sample. Then you can expand this to respond to noteons and noteoffs and all those other musical things.
I hope this answers your question.
--art
fun void playsample(int startpoint, int endpoint, string filename){ sndbuf s => dac;
filename => s.read;
0 => s.pos;
endpoint::samp => now;
while(true){ startpoint => s.pos; (endpoint - startpoint)::samp => now; } }
On 27-Feb-06, at 1:17 PM, Mike McGonagle wrote:
Hello all,
I was wondering if there is a ugen that will handle arbitrary looping points? I have some samples for various instruments (ie piano, mellotron strings, etc), and would like to hook them up in ChucK. Basically, if the sndbuf ugen is the starting point for this, then do I need to write my own "looping" function to ensure that it gets back to the proper points within the sample.
Or has someone already implemented this functionality and would be interested in "sharing"?
Thanks,
Mike _______________________________________________ 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
-- Help the Environment, Plant a Bush back in Texas!
participants (4)
-
Adam Tindale
-
Mike McGonagle
-
Nelson Ferraz
-
Philip Davidson