passing audio thru javascript

jayrope's icon

Is there a way to pass audio through a javascript?

i tried setting up a

function audio (val) {
outlet(0,val);
}

but that doesn't seem to work.

any help is VERY appreciated, thank you,

jrp

Emmanuel Jourdan's icon

You could do that (iPhone coding...):

function signal()
{
outlet(0, arrayfromargs(messagename, arguments));
}

Although this won't do much... Except routing, but in a static way
when you start the DSP chain.

ej

On 2 déc. 08, at 15:43, jayrope wrote:

>
> Is there a way to pass audio through a javascript?
>
> i tried setting up a
>
> function audio (val) {
> outlet(0,val);
> }
>
> but that doesn't seem to work.
>
> any help is VERY appreciated, thank you,
>
> jrp
> --
> ---
> fiction-induced heat
> in too many places to name.
> mood description: audiotic.

jayrope's icon

Thank you for answering Emmanuel,

how COULD i trigger the function called signal() from outside the js object?
i cant seem to run audio thru a message like [signal $1] and then into the js. the message object just doesn't accept an audio cable on it's inlet.
actually just routing thru to a dedicated outlet is exactly what i need. would you happen to have a more complete example, which includes the external setting?

i have posted an example patch and js file below.

Thanx very much for looking into this!

jrp

Remover's icon

this may seem like a silly question but... does this meean that there is a message 'signal' prepended to every value output by all signal objects? I'm thinkning this might give me a bit of a deeper understanding of how things work in Max as there doesn't seem to be too much in the docs that would give you this kind of info...

where might I read up on useful info about the underlying functioning of max that isn't covered in the help?

Sorry, I know its a bit vague.

jayrope's icon

remover, "signal" here is the name of the javascript function EJ had posted further up in this thread. i don't know too much about the underlying programming of max nor msp, many things can be guessed though by opening patches as text.

anyone else on routing audio through javascript?

i think my example patch is almost there...

Thank you very much,

jrp

Emmanuel Jourdan's icon
jayrope's icon

Thank you for the insight, Emmanuel.

Well, my idea is to use a bit of javascript inside a poly~ object in order to send signal from it's individual instances to individual receive objects.

i can't see any other way, than using javascript to create individual send objects for individual instances, the only otehr option i could see, but are not capable of, is using a script to only create the individiualized send object and be able to connect this back to an object already present in the root patch of the poly~. but i couldn't find out, if or how that works.

Please let me know, if that would be an option to go, hopefully with a hint how to establish that.

Thank you again,

jrp

jayrope's icon

Emmanuel, i lacked half of my answer.

In fact i needed to set a routing only once. There'll be no need for dynamic changes after the patch has loaded. Would that help the issue?

jrp

mattyo's icon

to create individual send~s for each instance of a poly, use loadbang
to thispoly~:

Max Patch
Copy patch and select New From Clipboard in Max.

M

On Dec 2, 2008, at 14:34, jayrope wrote:

>
> Thank you for the insight, Emmanuel.
>
> Well, my idea is to use a bit of javascript inside a poly~ object in
> order to send signal from it's individual instances to individual
> receive objects.
>
> i can't see any other way, than using javascript to create
> individual send objects for individual instances, the only otehr
> option i could see, but are not capable of, is using a script to
> only create the individiualized send object and be able to connect
> this back to an object already present in the root patch of the
> poly~. but i couldn't find out, if or how that works.
>
> Please let me know, if that would be an option to go, hopefully with
> a hint how to establish that.
>
> Thank you again,
>
> jrp
> --
> ---
> fiction-induced heat
> in too many places to name.
> mood description: audiotic.

jayrope's icon

Oh, i already send signal into the [poly~] using [in~]. what i'm trying to achieve, is to sending signal out from each poly instance to a different location afterwards. i can't get to do this using [out~], as then all [poly~] signal is using the same outputs.

jrp

jayrope's icon

M: Thank you! ...unfortunately i am on max 4.63.

Also i used the loadbang -> thispoly~ combination to pass on the instance number to my script before. my problem is, that i neither can't seem to route audio through my script (which needs to establish that only during loading, but not later) as well as i can't seem to find a way to connect a dynamically created and individually named send~ object to connect back to an audio source within the patch.

it's a bummer, i know.

jrp

Emmanuel Jourdan's icon
jayrope's icon

yes, Emmanuel, that's almost what i did now, instead i hardwired a gate to several send~ objects, controlled by thispoly~. the beauty is gone, though, as the otehr approach would have allowed to change the number of poly~ instances at any time.

i'll reserach further.

Thank you all for your replies.