Tweet from Max with ruby

Update 6/2014: working version here: https://reactivemusic.net/?p=7013

notes

The zapier.com trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly.

Or you could use the mxj searchTweet program, which has been updated to do this on the search side.

twitter gem

update: Got it working with this gem: https://github.com/sferik/twitter. Its much easier than dealing with xively.

docs: http://rdoc.info/gems/twitter

how to destroy a tweet: http://stackoverflow.com/questions/10640811/twitter-gem-how-to-get-the-id-of-a-new-tweet

how to get a timeline: http://bobbyprabowo.wordpress.com/2010/01/01/simple-twitter-gem-tutorial/

example of error handling code:

MAX_ATTEMPTS = 3
num_attempts = 0
begin
  num_attempts += 1
  retweets = Twitter.retweeted_by_user("sferik")
rescue Twitter::Error::TooManyRequests => error
  if num_attempts <= MAX_ATTEMPTS
    # NOTE: Your process could go to sleep for up to 15 minutes but if you
    # retry any sooner, it will almost certainly fail with the same exception.
    sleep error.rate_limit.reset_in
    retry
  else
    raise
  end
end

 

Another useful SO post: http://stackoverflow.com/questions/16618037/twitter-rate-limit-hit-while-requesting-friends-with-ruby-gem/16620639#16620639

 

Hatsune Miku

A vocaloid character

http://en.wikipedia.org/wiki/Hatsune_Miku

(from Wikipedia)

Hatsune Miku (初音ミク?) is a singing synthesizer application with a humanoid persona, developed by Crypton Future Media. It uses Yamaha Corporation‘s Vocaloid 2 and Vocaloid 3 singing synthesizing technology. She was the second Vocaloid sold using the Vocaloid 2 engine, and the first Japanese Vocaloid to use the Japanese version of the Vocaloid 2 engine. Her voice is sampled from Japanese voice actress, Saki Fujita. Hatsune Miku has performed at her concerts onstage as an animated projection.[1] Hatsune Miku is portrayed to be a 16-year-old girl with long teal pigtails.

http://www.youtube.com/watch?v=rL5YKZ9ecpg

An example in Max

by FitanyCereal 

 

Tesla vehicle API with Max/MSP

notes

update 12/2013 – see this post for an example of how to display geo-coded data from Max/MSP to Google maps https://reactivemusic.net/?p=8115

original post

This is a reference to some notes. In June, I wrote a Max patch to communicate with my brother David’s Tesla Model S, using an API which runs on Tesla servers and communicates with the car. You can do things like honk horn, flash lights, open doors – and also receive data on speed, position, and battery condition.

Can’t really test the control part of this – without the possibility of causing a car accident in California, but here’s a screen shot of the files. Essentially  I just ran a node server for the API and communicated from Max using Osc.

The last thing I did was to track his return trip from SFO to Santa Cruz and plot points on a map.We will eventually update this prototype to plot data on a Google Map.

Much of the logic was borrowed from the Irish Train mapping project: https://reactivemusic.net/?p=5477

 

 

 

How to change Twitter trigger with Xively to use Zapier

notes

This method was used to fix the tweetcurl series of Max patches and anything else which uses Tom Igoe’s method of sending tweets from Arduino via cosm.

http://www.tigoe.com/pcomp/code/arduinowiring/1135/ (old method)

The automatic twitter trigger used in the “internet sensors” project via cosm, stopped working when cosm migrated to xively.com. But it works correctly from a device (or Max) to xively. So you don’t need to change anything except the xively trigger associated with the feed.

The fix is to go into your xively feed (legacy feed) delete the existing trigger and set up a new trigger using zapier – using the instructions in this tutorial.

https://xively.com/dev/tutorials/zapier/

Notes:

  • You will need to sign up for a free zapier account
  • the text value of the tweet for zapier is called “body trigger datastream value value”
  • limited to 10 tweets per hour
  • when you select Twitter as an action in zapier, it will attempt to log you in to do the oauth authentication. If you are already logged into Twitter – make sure its the correct account.

If you really want to send Tweets from Max, check out the Twitter client that uses ruby: https://reactivemusic.net/?p=7013