hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it.... dt
dac => WvOut rec => blackhole;
"/Users/kurt/Music/SFDIR/ChucK" => rec.aifFilename;//<---- CHANGE THIS
TO WHERE YOU WANT THE FILE
100::second => now;//<------CHANGE THIS TO LENGTH OF RECORDING
rec.closeFile();
run this and it should record what is coming out of chuck. you could
change it to 'day => now' and chuck will close the file when you
remove the recording shred.
hope that helps.
kurt
On Thu, Sep 30, 2010 at 11:34 AM, Daniel Trueman
hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it....
dt _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- -------------------------------------------------- www.kurtkotheimer.com --------------------------------------------------
hey, thanks. i'm actually looking for non-realtime file writing; want to write the contents of LiSa buffers to disc, but i don't want to hack that into LiSa itself, for many reasons including lack of time and laziness... dt On Sep 30, 2010, at 4:59 PM, kurt wrote:
dac => WvOut rec => blackhole; "/Users/kurt/Music/SFDIR/ChucK" => rec.aifFilename;//<---- CHANGE THIS TO WHERE YOU WANT THE FILE 100::second => now;//<------CHANGE THIS TO LENGTH OF RECORDING rec.closeFile();
run this and it should record what is coming out of chuck. you could change it to 'day => now' and chuck will close the file when you remove the recording shred. hope that helps. kurt
On Thu, Sep 30, 2010 at 11:34 AM, Daniel Trueman
wrote: hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it....
dt _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- -------------------------------------------------- www.kurtkotheimer.com -------------------------------------------------- _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
You will have to use the command line then (hope you are on
Mac/Linux...there might be a Windows way also?). Try:
%> chuck --silent record.ck your_shred.ck
...where record.ck is a shred containing my code and your_shred.ck is
what you want to record.
later.
kurt
On Thu, Sep 30, 2010 at 12:05 PM, Daniel Trueman
hey, thanks. i'm actually looking for non-realtime file writing; want to write the contents of LiSa buffers to disc, but i don't want to hack that into LiSa itself, for many reasons including lack of time and laziness...
dt
On Sep 30, 2010, at 4:59 PM, kurt wrote:
dac => WvOut rec => blackhole; "/Users/kurt/Music/SFDIR/ChucK" => rec.aifFilename;//<---- CHANGE THIS TO WHERE YOU WANT THE FILE 100::second => now;//<------CHANGE THIS TO LENGTH OF RECORDING rec.closeFile();
run this and it should record what is coming out of chuck. you could change it to 'day => now' and chuck will close the file when you remove the recording shred. hope that helps. kurt
On Thu, Sep 30, 2010 at 11:34 AM, Daniel Trueman
wrote: hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it....
dt _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- -------------------------------------------------- www.kurtkotheimer.com -------------------------------------------------- _______________________________________________ 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
-- -------------------------------------------------- www.kurtkotheimer.com --------------------------------------------------
On 30 September 2010 18:05, Daniel Trueman
hey, thanks. i'm actually looking for non-realtime file writing; want to write the contents of LiSa buffers to disc, but i don't want to hack that into LiSa itself, for many reasons including lack of time and laziness...
So, you are looking for non-realtime writing from a VM that itself runs in realtime and outputs audio that may be different from the contents of the buffer that you are trying to save? I'm not sure about the non-realtime writing, but you could copy the contents of your LiSa to a separate LiSa used for this purpose, then have that play into a WvOut (and a blackhole) while the original LiSa is free to go on to do new things? I don't think you can do exactly what you proposed, but I'm fairly sure there will be workarounds depending on what you want to accomplish. I also think we might be able to use a file output in a function that takes a LiSa as a argument and creates a audio file. This would, however, require implementing the file format of whatever type of file we pick in ChucK. It's also a rather theoretical approach as I never heard of anyone doing this. In my experience that means trying will unearth bugs (not a bad thing, as such). Does that help? Do we need to go over the details of your needs? Yours, Kas.
i just want the opposite of SndBuf.read(); want to be able to open a file and write to it all at once, even if it causes hiccups in the VM. but as far as i can tell it's not possible. i'm pretty sure i can cram samples into SndBuf using valueAt, doing the opposite of what we do now to load samples into LiSa, but i haven't tried that either... so maybe it's all a big mess. thanks, dan On Sep 30, 2010, at 9:10 PM, Kassen wrote:
On 30 September 2010 18:05, Daniel Trueman
wrote: hey, thanks. i'm actually looking for non-realtime file writing; want to write the contents of LiSa buffers to disc, but i don't want to hack that into LiSa itself, for many reasons including lack of time and laziness... So, you are looking for non-realtime writing from a VM that itself runs in realtime and outputs audio that may be different from the contents of the buffer that you are trying to save?
I'm not sure about the non-realtime writing, but you could copy the contents of your LiSa to a separate LiSa used for this purpose, then have that play into a WvOut (and a blackhole) while the original LiSa is free to go on to do new things?
I don't think you can do exactly what you proposed, but I'm fairly sure there will be workarounds depending on what you want to accomplish. I also think we might be able to use a file output in a function that takes a LiSa as a argument and creates a audio file. This would, however, require implementing the file format of whatever type of file we pick in ChucK. It's also a rather theoretical approach as I never heard of anyone doing this. In my experience that means trying will unearth bugs (not a bad thing, as such).
Does that help? Do we need to go over the details of your needs?
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
2010/9/30 Daniel Trueman
i just want the opposite of SndBuf.read(); want to be able to open a file and write to it all at once, even if it causes hiccups in the VM. but as far as i can tell it's not possible.
Got it.
i'm pretty sure i can cram samples into SndBuf using valueAt, doing the opposite of what we do now to load samples into LiSa, but i haven't tried that either... so maybe it's all a big mess.
From memory (mine, I mean, not ChucK's) I don't think you can. For LiSa valueAt() is read/write and for SndBuf I think it's read only.
I think it will have to be a fileIO with some function that formats the numbers from the LiSa to stick to some audio file format. Might be easy enough for raw PCM file though you will have to convert the floats to ints. I heard bad things about implementing the .wav format yourself. I'm not sure this would actually be easier than having LiSa call libsndfile in C++. This is, after all, what libsndfile is supposed to do and we already support it. I imagine that you would be quite sick, quite soon, of turning raw files into something useful in your wave editor. It's hard for me to say as I have very little C++ experience. We could also wonder what the most general solution to this would be as a potential new feature. Right now I think LiSa is the only build-in thing that really records anything we might like to save. We could also have a function that would turn a array of floats into a wave file, give LiSa the possibility of returning a array like that and also add that to anything that records that we think of in the future? That sounds more complicated and I'm not sure it's so much more versatile that it makes sense. Yours, Kas.
i'm pretty sure i can cram samples into SndBuf using valueAt, doing the opposite of what we do now to load samples into LiSa, but i haven't tried that either... so maybe it's all a big mess.
From memory (mine, I mean, not ChucK's) I don't think you can. For LiSa valueAt() is read/write and for SndBuf I think it's read only.
well, that would probably be easy enough to hack in. but i don't want to wade into sf writing; did that many times years ago... i guess i figgered i was just being stupid, and there was an obvious way to do this that i was missing, so this is paradoxically gratifying and annoying. thanks? ;--} dan
well, that would probably be easy enough to hack in. but i don't want to wade into sf writing; did that many times years ago...
Excuse my ignorance, but isn't that why we have a library that will deal with writing out soundfiles for us? If it weren't for this http://www.mega-nerd.com/libsndfile/ I might have risen to the challenge of doing it in ChucK. I think that's possible, but I'm also in the process of learning Scheme and on a deadline. Doing it "manually" in ChucK seems possible but not that efficient in either terms of CPU or used hours.
i guess i figgered i was just being stupid, and there was an obvious way to do this that i was missing, so this is paradoxically gratifying and annoying.
I can completely understand this.
thanks? ;--}
Maybe? I'm only semi-formally in charge of navigating The Mess, not of The Mess itself. I propose we move on to stage 2 of any ChucKist issue which -as I remember it- is "blaming Ge" ;¬). Clearly a feature is missing. That said; I could see advantages to building this into LiSa in the long term. Some audio file formats consist of both wave data and loop points, much like LiSa. That could mean advantages to exporting straight from LiSa, even though I feel that our cutest UGen is far more interesting with regard to looping than traditional formats and samplers are. Yours, Kas.
Maybe? I'm only semi-formally in charge of navigating The Mess, not of The Mess itself. I propose we move on to stage 2 of any ChucKist issue which -as I remember it- is "blaming Ge" ;¬).
oh, i have many things for Ge to do before this. ;--}
Clearly a feature is missing.
That said; I could see advantages to building this into LiSa in the long term. Some audio file formats consist of both wave data and loop points, much like LiSa. That could mean advantages to exporting straight from LiSa,
this sounds like a great independent study project for a student somewhere! in the meantime, i'm doing something ridiculous....
oh, i have many things for Ge to do before this. ;--}
I hear he eats a great deal; quite clearly he should keep busy to compensate. We are performing a valuable service here.
That said; I could see advantages to building this into LiSa in the long term. Some audio file formats consist of both wave data and loop points, much like LiSa. That could mean advantages to exporting straight from LiSa,
this sounds like a great independent study project for a student somewhere!
I think it could make sense with data flowing either way.
in the meantime, i'm doing something ridiculous....
Sounds good! Will there be reports, pictures and/or recordings? Kas.
Wow, I totally misinterpreted that original question. That is a
tricky one. I like the idea of copying the LiSas and writing their
contents to a WvOut in real time in another shred. I think a class
that does this could be made pretty easily.
2010/9/30 Kassen
oh, i have many things for Ge to do before this. ;--}
I hear he eats a great deal; quite clearly he should keep busy to compensate. We are performing a valuable service here.
That said; I could see advantages to building this into LiSa in the long term. Some audio file formats consist of both wave data and loop points, much like LiSa. That could mean advantages to exporting straight from LiSa,
this sounds like a great independent study project for a student somewhere!
I think it could make sense with data flowing either way.
in the meantime, i'm doing something ridiculous....
Sounds good! Will there be reports, pictures and/or recordings? Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- -------------------------------------------------- www.kurtkotheimer.com --------------------------------------------------
On Thu, Sep 30, 2010 at 8:34 AM, Daniel Trueman
hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it....
Am I remembering correctly that someone posted a UGen that would control the tick rate of other UGens? If so, or there's another way to do that, you could use it to tick a WvOut through your entire file in one sample. -- Tom Lieber http://AllTom.com/ http://favmusic.net/
that would do it; i don't remember that posting... On Sep 30, 2010, at 10:47 PM, Tom Lieber wrote:
On Thu, Sep 30, 2010 at 8:34 AM, Daniel Trueman
wrote: hey, anyone ever do any writing of soundfiles to disc? i can't seem to make SndBuf or WvOut do it....
Am I remembering correctly that someone posted a UGen that would control the tick rate of other UGens? If so, or there's another way to do that, you could use it to tick a WvOut through your entire file in one sample.
-- Tom Lieber http://AllTom.com/ http://favmusic.net/ _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 1 October 2010 00:14, Daniel Trueman
that would do it; i don't remember that posting...
Me neither. I'm not sure that's easily possible and if it would be I'm not at all sure that would be a good idea. What would happen if this UGen (let's call it greyhole) and the dac would both pull a UGen "foo"? Suppose "foo" were a filter, what would the .freq() of foo mean, it anything? I agree that this concept would "do it", but I fear it would also do all sorts of other things and would generally complicate matters. Yours, Kas.
On Thu, Sep 30, 2010 at 3:14 PM, Daniel Trueman
that would do it; i don't remember that posting...
Darn, I was remembering a minim UGen:
http://code.compartmental.net/2010/09/01/sound-byte-broken-record/
2010/9/30 Kassen
Me neither. I'm not sure that's easily possible and if it would be I'm not at all sure that would be a good idea. What would happen if this UGen (let's call it greyhole) and the dac would both pull a UGen "foo"? Suppose "foo" were a filter, what would the .freq() of foo mean, it anything? I agree that this concept would "do it", but I fear it would also do all sorts of other things and would generally complicate matters.
I think it would correspond to cycles per grey second! C'mon, Kassen, you know it'd be fun! -- Tom Lieber http://AllTom.com/ http://favmusic.net/
Tom, Darn, I was remembering a minim UGen:
http://code.compartmental.net/2010/09/01/sound-byte-broken-record/
Looks cool!
C'mon, Kassen, you know it'd be fun!
Sure, though there are questions, but as a solution to this issue it's not unlike Dan having eaten something wrong and you proposing that we build a rollercoaster on the spot, theorising that it might induce vomiting. It's a potential solution and it would be fun but we still have some tablets marked "cure stomach aches" that we already paid for. :¬p Kas.
participants (4)
-
Daniel Trueman
-
Kassen
-
kurt
-
Tom Lieber