XML Feeds

.

[maxmsp] Re: list letter shifting

volker böhm vboehm at gmx.ch
Wed Sep 12 01:42:24 MDT 2007


On 12 Sep 2007, at 01:55, Jared Madere wrote:

>
> that works great, thank you so much. the only problem is that  
> certain characters such as quotation marks and commas do not even  
> get registered. I would like to be able to put an entire essay into  
> the patch and have it shift every letter and number in it one  
> character up. does anybody know how to go about making max  
> recognize " and , as symbols and not simply ignoring them?

first of all, if you want to filter " and , you should put in the  
corresponding ascii numbers, i.e. 34 and 44.
but it's true, since these characters have special meanings in max,  
it's a little cumbersome to deal with them.
therefore i would suggest using javascript for this task - at least  
for the text file reading.
here is a little script that reads a text file (use raw text and not  
some word docs etc.) and feeds single lines back to max.
send it the message [readfile my_file] to read in a text, and  
[get_line x] to access it.
you can bypass the [textedit] object. but [itoa] e.g. can only handle  
256 elements. that won't give you very long sentences...
in the end i think it's easier to do the whole thing in js.
vb


// (watch out, email coding...)

outlets = 2;
var lines = new Array();

function readfile(s) {
	lines = new Array();
	var f = new File(s);
	var c, line;

	if (f.isopen) {
		c = f.eof;
		line=0;		
		while(f.position<c) {		// check for "end of file"
			lines[line] = f.readline();							
			line++;				// increment line count
		}
		outlet(1, line);
		f.close();
	}
	else {
		post(">>> could not open file: " + s + "\n");
	}
}

function get_line( i ) {
	outlet(0, lines[i]);
}


More information about the maxmsp mailing list