Web Ticker/Counter to MIDI

Hi

Thanks to all the community here - am a new(ish) user leaning heavily on the work of others, all of which is appreciated!

So I’m trying to do something that seemed like an easy task, but failing.

I’m trying to send a MIDI note on every change of one of the ticker/counters from https://www.worldometers.info/. Composition attached. I’ve taken the approach of Motion Detection and tried to butcher it to my needs.

Two issues:

  • I can’t get the animation of the webpage to update faster than once per second, no matter what value I put in “Fire Periodically”. Is there something simple I’ve missed there?

  • At this stage the Midi Event out is just triggering at the same rate as the Fire Periodically. Solving the first issue I am presuming would help this, but any insights into a better approach are appreciated!

Cheers

Web ticker to MIDI Test.vuo (5.45 KB)

Second issue first, you just feed the value from the Midi Event out to a Hold node, and retrigger its output at the rate you want on the event in on the hold node.

As for the first issue, the way these counters work is that they take whatever last updated count of what something was, and apply a calculation adding or subtracting a fragment of the daily change every tick. They are more of an art piece than an actual counter of sorts. So to be as efficient as possible, you can do the same and not bother about reading the details from the website! :D

To set up a tick per baby born per day for instance, you just use a divide node, and divide 86 400 (seconds in a day) by 385 000 (babies per day according to Google according to UN) and feed the result to a Fire Periodically node. It should be a tick every 224ms or around there somewhere. Remember to use a Fire on Start to trigger the calculation in the divide node going to the Fire Periodically, if not it will be set at its default rate.

To also keep it in sync with the page you can possibly use a Fetch Tree node from the webpage, making sure it pulls the starting number from the page every time you restart the composition (provided you have an internet connection). In Chrome, you can see what to look for in the tree by marking the text you want to find, right-click and inspect. From the code in the webpage, you should search for rts-counter, births today, and rts-nr-int; rts-nr-10e3 and rts-nr-10e0.

2 Likes

Ah yes, this is all a much better approach! So much more reliable.

Thanks so much, working well.

1 Like

Sorry Magneson would you (or someone!) mind talking me through the Fetch Tree node in relation to the web code you mention? I can find the rts-counter elements but I can’t get the information into Vuo - I’m looking for an XML address?

No stress! The Vuo online documentation along with the example compositions are a lot better than me explaining it though, and you can find it here: https://doc.vuo.org/2.3.0/node/vuo.tree/. I don’t have a mac available right now, but I’m sure someone will help if you get stuck!

1 Like