Author |
Message |
chuckles
Joined: Apr 02, 2007 Posts: 72 Location: San Diego, California
|
Posted: Thu Jun 07, 2007 2:18 pm Post subject:
Today's question: read / write data files? |
|
|
Chuck has tools to read and write sound/sample files, but what I would like to know is if there is some way to read/write data files; for instance, text files with lots of lines of numbers representing frequencies, notes, times, etc.
This way I could create separate such note/score data from python/perl or other tools and have the Chuck program chomp on it.
I looked at the readline.ck example which will read some data from a command shell, but besides the worrisome comment "this is really hacked: ConsoleInput class to be replaced soon" I can't find anything in the manual or on this forum about anyone who's tried to do this.
It appears that I could emulate it using the OSC system but that seems like using a supercomputer as a four function calculator..
any ideas?
thanks a lot all
...c... |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Thu Jun 07, 2007 3:13 pm Post subject:
|
|
|
Today's answer! :¬)
Lots of people want this so it's on The List.... The List is quite long, as you might've gathered by now, but file in-out should definately get here.... _________________ Kassen |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Fri Jun 08, 2007 3:55 am Post subject:
|
|
|
There's one thing I still haven't tried..
writing data file by using 'WvOut' hahaah -_-"
For example,
creating an array of data you want to write,
and program some way to translate the data in to audio value
and play the whole thing out into WvOut when you want to write...
hmm that'd be awkward in some situation..
but will work ok. lol..
(sounds like a hard work for me though -_-) |
|
Back to top
|
|
|
chuckles
Joined: Apr 02, 2007 Posts: 72 Location: San Diego, California
|
Posted: Fri Jun 08, 2007 8:29 am Post subject:
|
|
|
Kassen: thanks for the quick response. Yes, add me to the list that wants this (and many other features too.) I did first check the wiki under Features and didn't see this particular thing.
kijjaz: if anyone can figure out how to do it I think you could! I suppose you could do the opposite by reading a file using a SndBuf.
But I guess I'll just wait patiently for that feature. Meanwhile there are still many ChucK projects on my list I can work on.
...c... |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Jun 08, 2007 9:33 am Post subject:
|
|
|
Actually, you have as much power as I do to "add things to the list" (I just tend to know what's on it). Generally, if you have a good idea and can explain why this would be usefull you have a very good chance of getting it on the list.
I'm realy just a fellow ChucKist who volunteered to moderate the board.
I think file in-out might be one of the things that depends on garabe colection and garabage colection. Garbage colection has been high on the list for a while now. i imagine something like that must be quite hard and not very exciting to do. _________________ Kassen |
|
Back to top
|
|
|
chuckles
Joined: Apr 02, 2007 Posts: 72 Location: San Diego, California
|
Posted: Fri Jun 08, 2007 2:41 pm Post subject:
|
|
|
Thanks, Kassen, I have been hesitant to do that since I'm not always sure what's already been done. I see now and then posts that have been answered in previous threads that are not always self-evidently titled. So I usually hang back rather than jump in, say, updating a wiki page, and wait if some Senior Chuckist offers a solution.
Implementing garbage collection seems like that kind of thankless/onerous task that is really cool in the guts on an application, but since it works "behind the scenes" the user doesn't really know about it -- until it fails and a stack overflows or something. In any case I'm sure we're all grateful to the developers and temper our eagerness for new/bugfix releases with respect for their own time and volunteer status (unless Princeton is paying them huge amounts that we don't know about to develop Chuck, which I find unlikely in the extreme.)
...c... |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Jun 08, 2007 9:23 pm Post subject:
|
|
|
Yeah, that's true; information is all over the place.
Garbage-colection was descussed on the mailing-list because string management/manipulation depended on it and people needed that. I think the curent situation is that string-manupulation was haxored in anyway but is leaky right now.
At least you can search this forum suing it's own search engine and you can make Google search the list archive. That already covers nearly everything that's out there.
To get back to the original issue; you could have Python write a .ck file holding a public class that in turn holds a huge array containing your score, If you'd have ChucK run that, followed by a ChucK file containing the "orchestra" and a method of parsing that array you'd be in business for now, I think? _________________ Kassen |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Fri Jun 08, 2007 10:24 pm Post subject:
|
|
|
I also have one better idea for implementing this..
But I still don't have time to try.
It involves sending and receiving MIDI messages.
My idea is this:
Program an application that can save or load datas via midi messages..
(for example.. on puredata?)
and connect MIDI in/out of chuck with MIDI in/out of puredata hahaha..
-_-" That'd be one fun thing to do around here -_-' .. |
|
Back to top
|
|
|
disablek
Joined: May 11, 2007 Posts: 10 Location: disablekville
|
Posted: Sat Jun 09, 2007 2:48 pm Post subject:
|
|
|
Oh here's a question.
which of the demo files leaks?
Or do you mean if i were to run something in miniaudicle, the chuck vm eventually leaks to bits, as in if i have a shred going on spawning itself and stopping the new shreds, the memory isn't freed.
Or do you mean auto variables created in the while loop of a chuck prog eventually gobbles everything up. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sat Jun 09, 2007 5:08 pm Post subject:
|
|
|
I'm not sure which bits leak eactly, just that *some* do. In practice this hasn't been a huge issue for me but that will likely depend heavily on how and what you write. I tend to try to avoid things I suspect will leak like defining Ugens inside of sporked function that will only run for a short while. _________________ Kassen |
|
Back to top
|
|
|
kijjaz
Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Sun Jun 10, 2007 12:25 pm Post subject:
|
|
|
Oh yes.. I sporked thousands of those kind of shred (shred that create its own UGens and'd run as short as a sound grain)
(yes! for generating hundreds or thousands of layering grains a second)
.. and on an old pc ..
The result's bad. -_- |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Mon Jun 11, 2007 7:49 am Post subject:
|
|
|
I think it'd be better to spork a few dozen shreds and triger those using signaled events. That way you can recycle the Ugens and thanks to the signaling ChucK will take care of most of the overhead of recycling them. You could even disconect Ugens that aren't used at the moment. It'd still be heavy but at least it'd stop leaking. _________________ Kassen |
|
Back to top
|
|
|
|