Hyperlink data from Excel to MaxMSP

Future_Lab's icon

Future_Lab

9月 05 2024 | 8:14 午前

Hi,

I'm trying to figure out a way to send data from Excel (or Google Sheets) to MaxMSP in order to trigger some audio.

Essentially it just needs to send a file name to Max so I'm wondering of a hyperlink might be a simple way to do this?

The reason I'm wondering about hyperlinks is the file names are somewhat dynamic.

Files can be added or names can changed so that's why I'd rather not go the csv/ coll route since there's a formula for making links in Excel and it would be nice not to have to export a new csv every time changes are made.

Any help appreciated!

Future_Lab's icon

Future_Lab

9月 05 2024 | 11:29 午前

Looking at the udpreceive object, seems like I'm on the right track but can't figure it out if anyone can shed any light on the situation :)

TFL's icon

TFL

9月 05 2024 | 11:35 午前

Looking at this old thread, you can apparently send UDP packages from Excel, but that seems quirky.

Maybe you would better set a server with nodejs using [node.script] and use pure http requests to that local server from Excel or anywhere else.

Future_Lab's icon

Future_Lab

9月 05 2024 | 12:58 午後

Forgive me, that has rather gone over my head. Does involve running JavaScript to receive http requests?

TFL's icon

TFL

9月 05 2024 | 2:40 午後

Yes. Any http request is addressed to a server, so you need a server to receive your http requests from Excel and transmit it to Max. I'm not sure you can do that with the classic [js] object, but for sure you can do it with nodejs using [node.script].

Here is a very simple example of a server running from node.script, by Cycling74. You can also search for "n4m.squiggle" in your Max search sidebar, it is another, a bit more complex, example.


Actually I just modified the example I linked above and here is the result.

express.zip
zip

Once the patch is open, script npm install has been run once and script start has been pressed, open your browser and type in http://localhost:3000/value/anything, and you can replace anything by what you want. In the patch you'll see you'll have received anything.

Now you can open http://localhost:3000/value/anything from anywhere on your computer and the Max patch will receive the last part of the URL.


Future_Lab's icon

Future_Lab

9月 05 2024 | 4:08 午後

That's amazing, thank you for sharing all that :)

Gonna have to do a deep dive on this!

TFL's icon

TFL

9月 05 2024 | 7:30 午後

I just realized that the http method isn't maybe what you actually want, because it doesn't send anything in itself, you need to open the link in a browser to actually send the data.
You could make your sheet to automatically create the URL with the data you want to pass to Max, but then you still need to click the link to actually send the data...

Future_Lab's icon

Future_Lab

9月 05 2024 | 9:40 午後

I mean clicking the link is absolutely fine, that's the intended goal.

Essentially the idea is have a clickable button of some kind that will play a specified audio file in a given column.

I was going the hyperlink route because it's very easily integratable in spreedsheets without faffing around with script codes.

But it's clear to me now that I don't understand enough about how http links work 😂

Peter Ostry's icon

Peter Ostry

9月 05 2024 | 11:56 午後

I guess you have a reason to use a separate spreadsheet app instead of making the whole thing in Max?

Future_Lab's icon

Future_Lab

9月 06 2024 | 7:55 午前

Yeah, it's for scripts for voice recording sessions and they can pretty complicated.

Having said that, I probably could make an enitre app for the whole thing.