| Author |
Message |
alphacore
Joined: Aug 10, 2006 Posts: 12 Location: Washington
|
Posted: Wed Dec 05, 2007 7:55 pm Post subject:
sequencing Text 2 midi within chuck Subject description: sequencing Text 2 midi within chuck |
 |
|
Hello One of my main projects Ive been working on for several is converting text/Literature 2 Music.
Im looking at creating a text sequences that is read by chuck.
with each letter triggering a musical event I was just wondering if anyone had any ideas on this subject..
Alphacore/Gabriel |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6244 Location: The Hague, NL
G2 patch files: 3
|
Posted: Thu Dec 06, 2007 7:05 am Post subject:
|
 |
|
I'm sorry, G, but I don't think that will work right now.
String manipulations in ChucK are still in a rather rudimentary stage and you can't -for example- take the first character of a string off it and base something on that. This has to do with garbage collection still not being finished and string manipulation needing that. Right now you can merge strings but doing so will leak memory. Another issue is that we can't yet load arbitrary files, then only types of file ChucK can deal with are ChucK code and samples.
It's high on the wish list of many people, not just to synthesise text but also to do stuff like loading and parsing scores written by other programs or saving the settings of ChucK programs and so on. It should get here eventually but garbage collection seems to be hard. _________________ while(!machine.crash() ) <<<"all is well">>>; |
|
|
Back to top
|
|
 |
Antimon

Joined: Jan 18, 2005 Posts: 926 Location: Sweden
Audio files: 6
G2 patch files: 48
|
Posted: Fri Dec 07, 2007 4:34 am Post subject:
|
 |
|
Hmm... you can read keyboard input, right? What you could do is make a ChucK patch that reads text from standard input and acts on that. Then you send the text to a running ChucK instance by pasting it into the terminal it is running on. In ChucK, you save the inputted text character by character into a buffer array, or act on it immediately.
/Stefan _________________ You are Wendy Mackaye, first girl on the red planet. |
|
|
Back to top
|
|
 |
Antimon

Joined: Jan 18, 2005 Posts: 926 Location: Sweden
Audio files: 6
G2 patch files: 48
|
Posted: Fri Dec 07, 2007 4:39 am Post subject:
|
 |
|
Here's a way to read keyboard input.
| Code: | KBHit kb;
while (true) {
kb => now;
<<< "KB Hit: ", kb.getchar()>>>;
}
|
Check the code that I have posted for my command line sequencer for more information about what you can do with the keyboard input (a longish program but hopefully readable enough):
http://electro-music.com/forum/topic-21431.html
/Stefan
[/code] _________________ You are Wendy Mackaye, first girl on the red planet. |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6244 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Dec 07, 2007 5:21 am Post subject:
|
 |
|
Yeah, we already helped Alpha with some KB issues on the list, I think he should have that working now?
One friendly warning; .getchar() will remove the last command from the stack so if you use that you should immediately write the value to a variable or it's lost. Generally I think using the newer implementation using a HID abstraction with .openKeyboard() and messages is a lot more friendly to use, especially when you may want to use keys like the F ones and the cursor arrows. _________________ while(!machine.crash() ) <<<"all is well">>>; |
|
|
Back to top
|
|
 |
hanez
Joined: Feb 07, 2007 Posts: 7 Location: Austria
|
Posted: Tue Dec 11, 2007 6:41 am Post subject:
Re: sequencing Text 2 midi within chuck Subject description: sequencing Text 2 midi within chuck |
 |
|
| alphacore wrote: | Hello One of my main projects Ive been working on for several is converting text/Literature 2 Music.
Im looking at creating a text sequences that is read by chuck.
with each letter triggering a musical event I was just wondering if anyone had any ideas on this subject..
Alphacore/Gabriel |
hi, you can use the program (oscFileIO) described here
http://electro-music.com/forum/topic-21276.html.
to read text files. this program reads a textfile (or a file with numerical contents), converts the read data to osc-messages and sends them to chuck.
the disadvantage is that you have to setup some osc-structure in your chuck code (described in the documentation of the program) and that the textfile must be formated in some specific way: ASCII textfile with one letter (string) per line or equal number of letters (strings) per line separated by space should work. and, if i remember right, you can only read the file at once, so that you must define some data structure ( string array) that holds the data of the textfile which must be read before the start of your main loop.
a work around untill native fileIO arrives in chuckland ...
greets
hannes |
|
|
Back to top
|
|
 |
|