electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks GalleryGallery 
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
sequencing Text 2 midi within chuck
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
alphacore



Joined: Aug 10, 2006
Posts: 12
Location: Washington

PostPosted: Wed Dec 05, 2007 7:55 pm    Post subject: sequencing Text 2 midi within chuck
Subject description: sequencing Text 2 midi within chuck
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6244
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu Dec 06, 2007 7:05 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 926
Location: Sweden
Audio files: 6
G2 patch files: 48

PostPosted: Fri Dec 07, 2007 4:34 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 926
Location: Sweden
Audio files: 6
G2 patch files: 48

PostPosted: Fri Dec 07, 2007 4:39 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6244
Location: The Hague, NL
G2 patch files: 3

PostPosted: Fri Dec 07, 2007 5:21 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
hanez



Joined: Feb 07, 2007
Posts: 7
Location: Austria

PostPosted: Tue Dec 11, 2007 6:41 am    Post subject: Re: sequencing Text 2 midi within chuck
Subject description: sequencing Text 2 midi within chuck
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Buy N Save

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003, 2004, 2005, 2006 and 2007 by electro-music.com