New to ChucK: can this be done easily?
Hi ChucKers! I have a sonification project that I'm wondering if it makes sense to do in ChucK. I have a csv file with frequencies and amplitudes for 4 different sine waves, representing values at (say) half-second intervals. I want to read in a line, and then smoothly change the frequency and amplitude values using linear interpolation over the course of 24000 samples (a half second at 48k samples per second), then read in the next line, and smoothly change to those values over the next half-second, etc. until the data runs out. I could code this in C using libsndfile, but if I didn't have to worry about converting frequencies into phase distances between samples I'd consider that a win. I noticed Chuck has FileIO methods to read input files (although these are very poorly documented) so thought it should be possible to read in a csv file. I could calculate the amount of frequency and amplitude change per sample and adjust these in a 1-sample loop, and that's already simpler than coding in C. But I'm hoping there's some way to tell ChucK "I want this (e.g. frequency) value to change smoothly from its current value to f1 over the course of a half-second". If that were possible, ChucK would be a clear choice for my project. Thanks for any response! Forrest Cahoon
Hi Forrest.
Yes, it's quite possible in ChucK.
The FileIO method has several examples in the io/ folder. It's quite straightforward to use.
You may have to hack a tokenizer for csv. Have a look at strops.ck and strops2.ck in the string/ examples folder to see what's possible.
Joel
Sent from Mailspring (https://link.getmailspring.com/link/1528668398.local-ad033a99-df77-v1.2.2-96fb3a99@getmailspring.com/0?redirect=https%3A%2F%2Fgetmailspring.com%2F&recipient=Y2h1Y2stdXNlcnNAbGlzdHMuY3MucHJpbmNldG9uLmVkdQ%3D%3D), the best free email app for work
On Jun 10 2018, at 4:35 pm, Forrest Cahoon
Hi ChucKers!
I have a sonification project that I'm wondering if it makes sense to do in ChucK.
I have a csv file with frequencies and amplitudes for 4 different sine waves, representing values at (say) half-second intervals. I want to read in a line, and then smoothly change the frequency and amplitude values using linear interpolation over the course of 24000 samples (a half second at 48k samples per second), then read in the next line, and smoothly change to those values over the next half-second, etc. until the data runs out.
I could code this in C using libsndfile, but if I didn't have to worry about converting frequencies into phase distances between samples I'd consider that a win.
I noticed Chuck has FileIO methods to read input files (although these are very poorly documented) so thought it should be possible to read in a csv file.
I could calculate the amount of frequency and amplitude change per sample and adjust these in a 1-sample loop, and that's already simpler than coding in C. But I'm hoping there's some way to tell ChucK "I want this (e.g. frequency) value to change smoothly from its current value to f1 over the course of a half-second". If that were possible, ChucK would be a clear choice for my project.
Thanks for any response!
Forrest Cahoon
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hey there,
I did a csv project a while back at uni for a sonification class. It's not
quite the same thing as what you need but I think it might help. The
project took the csv lat and long of photos from the first ISS mission and
sonified them into sines. The project writeup in the folder explains more,
but the main part is that fileIO worked really nicely and should work well
for what you need.
Hope this helps!
-Morgan
Utting 311 as2.zip
https://drive.google.com/file/d/0Bw3YJ7ED-iZ1anJTV2pKTFBib0E/view?usp=drives...
On Mon, Jun 11, 2018, 09:35 Forrest Cahoon
Hi ChucKers!
I have a sonification project that I'm wondering if it makes sense to do in ChucK.
I have a csv file with frequencies and amplitudes for 4 different sine waves, representing values at (say) half-second intervals. I want to read in a line, and then smoothly change the frequency and amplitude values using linear interpolation over the course of 24000 samples (a half second at 48k samples per second), then read in the next line, and smoothly change to those values over the next half-second, etc. until the data runs out.
I could code this in C using libsndfile, but if I didn't have to worry about converting frequencies into phase distances between samples I'd consider that a win.
I noticed Chuck has FileIO methods to read input files (although these are very poorly documented) so thought it should be possible to read in a csv file.
I could calculate the amount of frequency and amplitude change per sample and adjust these in a 1-sample loop, and that's already simpler than coding in C. But I'm hoping there's some way to tell ChucK "I want this (e.g. frequency) value to change smoothly from its current value to f1 over the course of a half-second". If that were possible, ChucK would be a clear choice for my project.
Thanks for any response!
Forrest Cahoon
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (3)
-
Forrest Cahoon
-
Joel Matthys
-
Morgan Utting