jweb + max 4 live

Mateo Marquez's icon

hi ~

I'm building a Fitbit API Integration for Max4Live, in which "Selected" summary data is used to control parameters within live.

1. I built a small web/interface which allow the user to pick up a date and visualize the summary activities data for that specific day. This was written with javascript, html and php (Temboo). This part works very well and can be checked out at: http://www.marquezmarquez.net/fitfit.

2. To parse/transfer the data from the Fitbit API to Max, I'm using jweb to open the previously mentioned website inside a live path. Using the "...window.max.outlet...", I'm able to fetch the data from the javascript in the web interface. I have no problems doing that, as a standalone max patch. Works perfectly.

Here is the code in my website:

    var ar = [
outputs['Calories'],
outputs['Distance'],
outputs['Active Minutes'],
outputs['goalSteps'],

outputs['activityCalories'],
outputs['caloriesOut'],
outputs['steps'],
outputs['sedentaryMinutes'],
outputs['lightlyActiveMinutes'],
outputs['fairlyActiveMinutes'],
outputs['veryActiveMinutes'],
outputs['Distances'],

];

window.max.outlet.apply(window.max, ['data'].concat(ar));

3. So, the patch works fine if used in Max. I went forward and started building the Max 4 Live instrument, designed the interface, connected the correct inputs to outputs and formatted the output of each activity to be midi, as well as scale the numbers based on the goals. Here is the issue: The jweb object works witihin max, but everytime I run the javascript code to populate the message with the data "window.max.outlet.apply(window.max, ['data'].concat(ar));", it doesn't populate it. instead of giving the array, it will just give me the website I'm currentl displaying in the jweb window. Is this a limitation of Max 4 Live? It works perfectly if I open the patch in Max 7, but not through Max 4 Live

~~~ Any help would be appreciated! I've spent a lot of time in this project and I hope there is a workaround regarding this specific issue.

*Notice in the attached images: The one that displays the array/list "data" with the numbers is when the patch is run on Max 7, the one that displays the web URL is when run on Max 4 Live.

Hope I'm clear enough!

Thanks!

Mateo

MIDIeffect_GA_2.amxd
amxd
Captura-de-pantalla-2015-04-26-a-las-8.07.39.png
png
Captura-de-pantalla-2015-04-26-a-las-8.07.13.png
png
Brennan Forrester's icon

Hi Mateo! thanks for your help on the Max/MSP Facebook page the other day. I'm hoping to work in the same direction ( I want to use live heart rate data to control parameters in Max for Live). I tried to click the link above but got a error message saying the page had been removed. How is your work going?