Max Mbrola

Mar 4, 2008 at 6:02pm

Max Mbrola

Hi,

Have just been setting up MaxMbrola external object, but having a problem, when triggered, max window says ‘You should set the voice first’

Have loaded en1, the English male diphone database, cant seem to figure it out, been online all day looking for some help with it

Any experienced users?

#36182
Mar 4, 2008 at 6:14pm

On 04 Mar 2008, at 18:02, Harrison Ford wrote:

>
> Hi,
>
> Have just been setting up MaxMbrola external object, but having a
> problem, when triggered, max window says ‘You should set the voice
> first’
>
> Have loaded en1, the English male diphone database, cant seem to
> figure it out, been online all day looking for some help with it
>
> Any experienced users?

Any reason you post this to the javascript forum? the regular max
list would be more appropriate i guess.

well, i have been making heavy use of MBROLA last summer for an
interactive project.
but, as far as i know the maxMbrola object is only for Max 4.5, so i
couln’t use it in 4.6.
also i remember this object being rather buggy.
so i was simply using the MBROLA command line application (osx) and
controlled it through the shell object from max.
this worked pretty well.
hth,
volker.

#123990
Mar 6, 2008 at 9:52am

Moving this topic to the MaxMSP forum.

#123991
Mar 6, 2008 at 11:23am

#123992
Mar 6, 2008 at 11:40am

On 6 mars 08, at 12:23, Garth Paine wrote:

> I am using a for loop to read lines from a text file of data. I
> want to
> read one line every 20 ms. In processing or similar I would use the
> pause()
> function can I use SetInterval() to do this? What would the usual
> approach
> to timed loops for reading events like this is Javascript?

I don’t think there is such a thing. I woud use a [metro 20] in Max
and send its output to the [js] object.

>

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://www.crfmw.be/max

#123993
Mar 6, 2008 at 12:02pm

hello garth,

use a task: this is from the Javascript in Max.pdf on page 33 and
especially 35 ff..


Task Methods
repeat (number, initialdelay)
Repeat a task function. The optional number argument specifies the
number of
repetitions. If the argument is not present or is negative, the task
repeats until it is
cancelled. The optional initialdelay argument sets the delay in
milliseconds until
the first iteration.

hth

/*j

#123994
Mar 6, 2008 at 12:02pm

On 6 Mar 2008, at 11:40, Patrick Delges wrote:

> I don’t think there is such a thing. I woud use a [metro 20] in Max
> and send its output to the [js] object.

Max’s Javascript supports Task objects with timers. See the
documentation, p35.

– N.

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom
http://www.last.fm/music/cassiel
http://www.reverbnation.com/cassiel
http://www.linkedin.com/in/cassiel
http://www.loadbang.net

#123995
Mar 6, 2008 at 2:18pm

On 6 mars 08, at 13:02, jasch wrote:

> use a task: this is from the Javascript in Max.pdf on page 33 and
> especially 35 ff..

Ooopps. You’re right!

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://www.crfmw.be/max

#123996
Mar 14, 2008 at 6:28am

#123997
Mar 14, 2008 at 10:24am

#123998
Mar 14, 2008 at 11:24am

On 14 Mar 2008, at 11:24, Garth Paine wrote:
>
> I am reading out of a text file recorded using the Max Text object
> so it
> looks like
>
> 0, 110 9 220 218;
> 1, 110 9 218 218;
> 2, 110 9 218 218;
> 3, 110 9 218 218;
> 4, 110 9 218 218;
> 5, 110 14 218 218;
> 6, 110 9 218 216;
> 7, 110 9 218 220;
> 8, 110 4 220 220;
> 9, 110 4 220 220;
> 10, 110 4 220 220;
>
>
> I want to isolate each incoming integer and send it out a different
> output
>
> I looked at using regular expressions
>
> re = /(?d{4})?([,])d{2}1d{2}1d{2}1d{2}/;

maybe i miss your point here. but if your data files look like this
(coll format), it’s much easier doing it in max using the coll
object, a counter and a cycle object. trying to look at the text
lines as strings in javascript and squeezing out the integers is more
complex than it has to be in this case, imo. the format parsing is
done by the coll object.

you could try something like this:

#P window setfont “Sans Serif” 9.;
#P number 356 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 320 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 284 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 248 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 212 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 176 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 140 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 104 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 104 195 265 196617 cycle 8 1;
#P toggle 104 75 19 0;
#N counter 0 10;
#X flags 0 0;
#P newobj 104 137 68 196617 counter 0 10;
#P newex 104 101 58 196617 metro 200;
#N coll ;
#T flags 1 0;
#T 0 110 9 220 218;
#T 1 110 9 218 218;
#T 2 110 9 218 218;
#T 3 110 9 218 218;
#T 4 110 9 218 218;
#T 5 110 14 218 218;
#T 6 110 9 218 216;
#T 7 110 9 218 220;
#T 8 110 4 220 220;
#T 9 110 4 220 220;
#T 10 110 4 220 220;
#P newobj 104 165 53 196617 coll;
#P connect 1 0 2 0;
#P connect 3 0 1 0;
#P connect 0 0 4 0;
#P connect 2 0 0 0;
#P connect 4 0 5 0;
#P connect 4 1 6 0;
#P connect 4 2 7 0;
#P connect 4 3 8 0;
#P connect 4 4 9 0;
#P connect 4 5 10 0;
#P connect 4 6 11 0;
#P connect 4 7 12 0;
#P window clipboard copycount 13;

#123999
Mar 16, 2008 at 1:24pm

#124000
Mar 16, 2008 at 7:08pm

On 16 Mar 2008, at 14:24, Garth Paine wrote:

> Thanks Volker
>
> Yes indeed I am doing it that way at the moment, but I wanted to
> try it in
> JavaScript hence my clumsy attempts – I don’t get to do much coding
> these
> days and try to give myself the odd challenge – also I don’t
> generally see
> Max as good at iterative things although in this case you are right
> it is
> quite straight forward – this is my MAX solution which works fine,
> but any
> suggestions re my JavaScript version would be welcome

ok, if you really want to do this in javascript then i would suggest
using indexOf()
and slice() to get rid of the formatting (index + comma and semicolon).
something along these lines should work:

newstr = f.readline();
if (newstr !=null){
var komma = newstr.indexOf(“,”);
newstr = newstr.slice(komma+2, newstr.lastIndexOf(“;”));
newstr = newstr.split(” “);
for(i=0; i
outlet(i, parseInt(newstr[i]));
}

hth,
volker.

#124001
Mar 16, 2008 at 9:15pm

here’s my take on this:
you need to put the result of the string splitting operation into an
array. apart from that your code works:

result = newstr.split(” “, 5);

hth

/*j

max v2;
#N vpatcher 825 44 1264 278;
#P window setfont “Sans Serif” 9.;
#P message 68 86 116 196617 setFilename testfile.txt;
#P number 68 45 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 68 65 75 196617 setInterval $1;
#P number 48 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 95 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 142 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 189 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 236 159 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 48 25 15 0;
#P newex 48 128 194 196617 js biodata_reader.js 0 0 testfile.txt 500;
#P comment 66 25 35 196617 parse;
#P connect 10 0 1 0;
#P connect 8 0 1 0;
#P connect 2 0 1 0;
#P connect 1 0 7 0;
#P connect 9 0 8 0;
#P connect 1 1 6 0;
#P connect 1 2 5 0;
#P connect 1 3 4 0;
#P connect 1 4 3 0;
#P pop;

/////////// testfile.txt ///////////

0, 110 9 220 218;
1, 110 10 218 218;
2, 110 11 218 218;
3, 110 12 218 218;
4, 110 13 218 218;
5, 110 14 218 218;
6, 110 15 218 216;
7, 110 16 218 220;
8, 110 17 220 220;
9, 110 18 220 220;
10, 110 19 220 220;

/////////// biodata_reader.js ///////////

/*
* Reading through BioData Text File
*
* by garth paine March 2008
* http://www.activatedspace.com and http://www.syncsonics.com
*/

// global code
inlets = 1;
outlets = 5;
autowatch = 1;

var f = new File();
var t = new Task();

var myInterval = 0;
var myFilename = new String(“”);

var newstr = new String(“”);
var result = new Array(); // Array to contain split string

if (jsarguments.length > 0)
// nada = jsarguments[1];
if (jsarguments.length > 1)
// nada = jsarguments[2];
if (jsarguments.length > 2)
myFilename = jsarguments[3];
if (jsarguments.length > 3)
myInterval = jsarguments[4];

// re = /(?d{4})?([,])d{2}1d{2}1d{2}1d{2}/;

function bang()
{
post(“——————————————————- n”);
// fileName = jsarguments[3];
post(“Reding from file: “+ myFilename + “n”);
f = new File(myFilename);
f.open ();

if (f.isopen) {
newstr = “start”;
f.position = 0;
t = new Task(readFile, this);
// t.interval = jsarguments[4]; // time interval set as argument in
object
t.interval = myInterval; // time interval set as argument in object
or by message
t.repeat(); // repeat
}
}

function stopTask()
{
t.cancel();
}

function readFile()
{
newstr = f.readline();
if (newstr != null) {
result = newstr.split(” “, 5); // read split string into result Array
post(“result ” + result + “n”);
if (result != null) {
for(i=0; i < 5; i++) {
outlet(i, parseInt(result[i]));
}
//newstr = re.exec(aString); possible approach using expressions
}
} else {
t.cancel(); // stops task when nothing remains to be read in textfile
post(“the file ” + fileName +” is not open.”);
}
}

function list() //just incase a list is sent in
{
var aList = arrayfromargs(arguments);
post(“—— you sent me a list ———” + “n” +aList +”n”);
}

function setInterval(a)
{
myInterval = a;
post(“new Interval is “+myInterval+”n”);
}

function setFilename(fn)
{
myFilename = fn;
post(“new Filename is “+myFilename+”n”)
}

/* EOF */

#124002
Mar 17, 2008 at 4:39pm

On 16 Mar 2008, at 22:15, jasch wrote:
>
> result = newstr.split(” “, 5);

oh, ja, that’s better. from the example garth posted i think he
wanted to exclude the index.
but then again, simply outputting data starting at result[1] should
do it just fine.
volker.

result = newstr.split(” “);
for(i=1; i
outlet(i-1, parseInt(result[i]));

#124003
Mar 18, 2008 at 11:14pm

#124004

You must be logged in to reply to this topic.