picture-16
First off, a big thanks to Matthew Eddey for helping with the Ruby script and Twitter API. Also to all the people that helped along the way.

This should work on Max 5 and Mac OS and Window.

how to send a tweet directly from Max/MSP

I used the Ruby programming language to access Twitter’s API. To use Ruby within Max/MSP you need to download the [ajm.ruby] external by Adam Murray. After downloading, follow the “INSTALL.txt” instructions to correctly install it.

This is not necessary, but if you want to count the remaining characters you need to download the [strlen] external by Jasch and put it in Max’s search path.

Finally, download the MaxToTwitter patch.

That should be it, enjoy sending tweets from Max!

If you use it in a project don’t be shy to include my name or link back to here :-)


25 Responses to “How To Send A Tweet From Max/MSP { sound + tutorial }”  

  1. 1 themetakid

    Just checked Max 5 on Windows, works great! Now I can tweet on stage w/o leaving Max5!! Keep up the good work!

  2. 2 Andrew Spitz

    Awesome! Thanks for letting me know. I’ll update the post.

  3. 3 Adam Murray

    This is rad. Glad to see my software is being put to cool uses! If you run into any issues with ajm.ruby or have thoughts on ways to enhance it, don’t hesitate to drop me a line. I’ll be releasing an update soon-ish with a new JRuby version that is faster and more efficient than the current version.

  4. 4 Andrew Spitz

    Adam, thanks so much for making ajm.ruby available!!! Let me know when the update is ready, and I’ll update TAS. And thanks for the comment.

  5. 5 crei

    thanks, huge help

  6. 6 ader

    ruby the best!!!

  7. 7 Aaron Oppenheim

    I’m trying to use this patch, but it doesn’t seem to be working – I keep getting the error message

    ajm.ruby: could not evaluate: $message = whatever

    However, I tried the Tweet-A-Sound app and I am able to tweet from that just fine.. Is there any difference between the standalone patch and the patch you use within tweet-a-sound?

    Any help would be much appreciated.

    Thanks a lot

  8. 8 Andrew Spitz

    Hi Aaron, can you give a bit more details? What setup are you on? Is the problem happening once you build a standalone or through Max? Are you sure you installed [ajm.ruby] correctly? Maybe open the [ajm.ruby] help patch and test it?

    It’s working with me as a patch. I’m on Snow Leopard, it also worked on Leopard. However, I’ve been working on an other application, which uses a similar setup and is not working when building standalones. It might be an issue when using java in Max on Snow Leopard, I need to email Cycling ‘74 for more info.

  9. 9 Aaron Oppenheim

    I’m running the patch through max 5.1 on snow leopard.. haven’t tried making a standalone. ajm.ruby seems to be installed correctly, the help patches for it work and everything. Everything seems to run okay but it doesn’t like the “$message = x” message.. Strange

  10. 10 Andrew Spitz

    umm… same as me. I’m not sure then. It could be that when you type it is not entered into the message boxes. Maybe try type your message and password and username and then click again on each and hit enter to make sure they get put into the code. It should look like: [$message = yourmessage]

    If you look into the Twitter subpatch, you should see all the info you put into the text boxes being entered into the red message boxes. Did you try change the message manually?

  11. 11 ushi

    hi Aaron and Andrew,
    I had same thing but i figured out what was happening. Maybe $message has to have double-quated text. But when the input text is just one word like “whatever”, textedit object outputs without ” ” between the word. 2 more words like “whatever text” will be output as , so you can try with 2 more words!

  12. 12 ushi

    hi Aaron and Andrew,
    I had same thing but i figured out what was happening. Maybe $message has to have double-quated text. But when the input text is just one word like “whatever”, textedit object outputs *text whatever* without ” ” between the word. 2 more words like “whatever text” will be output as *text “whatever text”*, so you can try with 2 more words!

  13. 13 Andrew Spitz

    Haha, yes. I remember now, totally forgot about that. It doesn’t work with just one word… It didn’t matter for me because I always use it with more than one word.

    if you want to be able to use it with just one word, you can probably just use [sprintf] to add a space before or after.

  14. 14 Joe

    Hey guys, I get a funky message when trying to send:

    ajm.ruby: could not evaluate: require ‘net/http’ require ‘uri’ $url = $url.delete(’ ‘) puts $url res = Net::HTTP.post_form(URI.parse($url), {’status’ => $message}) if res.code == ‘200′ then out1(Sent!) else out1(Error! (#{res.code}: #{res.message})) end

    Any ideas?

    Thanks, this is a crazy patch ;)

  15. 15 Joe

    I get this message “could not evaluate” from the ajm.ruby external every time I try to send it anything, even from the help files… Troublesome.

  16. 16 Andrew Spitz

    Hi Joe, sorry for the delay in replying. Been very busy and with limited access to internet. I don’t have time to look at it in detail, but off the top of my head, there are a few things that could be doing this.

    Make sure that you have at least 2 words in your message, if not just add a space. It’s a stupid bug that I could fix (check the comment above) but it will be for some other day.

    Are you sure you installed the [ajm.ruby] stuff correctly? That could also be the problem.

    Try these suggestions, and if it still doesn’t work don’t hesitate to message again with what OS you’re using.

    Hope you get it working :-)

  17. 17 Joe

    Thanks Andrew,

    Actually I’ve been emailing with Adam and I think its an issue with the newest update of Max and the ruby object. Hopefully he’ll have some time to fix it, and it gets resolved, but for now, i think one must remain on the previous version of Max to get this to work.

    Thanks again!

  18. 18 Andrew Spitz

    Oh, good to know! Thanks for telling me. cause I need some of the ajm objects for something I’m soon compiling… so I won’t update! Curious to see what you’re up to if you wanna share.

  19. 19 Aaron Oppenheim

    Just put up some documentation of a project I did using your patch, generating gibberish tweets through a needlessly complex text-to-speech-to-text process. There’s a page for it up at http://www.aaronoppenheim.com/?page_id=241

    Thanks muchly for the work you did. I had to downgrade to Max 5.08 to get it running though, hopefully ajm.ruby will be updated soon.

  20. 20 Andrew Spitz

    @Aaron cool project. Thanks for sharing it. I’ve been waiting to update Max/MSP for that exact reason. I hope Adam updates it soon.

  21. 21 Baudry

    Thanks for your idea!
    Hello I’woudlike to know if I must modify anything in these script to send tweet

    require ‘net/http’
    require ‘uri’

    $url = $url.delete(’ ‘)
    puts $url
    res = Net::HTTP.post_form(URI.parse($url),
    {’status’ => $message})

    if res.code == ‘200′ then
    out1(”Sent!”)
    else
    out1(”Error! (#{res.code}: #{res.message})”)
    end

    I see in a max window:
    ajm.ruby: could not evaluate: require ‘net/http’ require ‘uri’ $url = $url.delete(’ ‘) puts $url res = Net::HTTP.post_form(URI.parse($url), {’status’ => $message}) if res.code == ‘200′ then out1(Sent!) else out1(Error! (#{res.code}: #{res.message})) end

  22. 22 Andrew Spitz

    @Baudry The script should work. Apparently the latest update of Max/MSP doesn’t work with [ajm.ruby], which might be the cause of your issues. Try downgrading Max and see if that fixes the issue. I’m on version 5.1.1 and it works.

  1. 1 Create Digital Music » Twitter Everywhere: More Tweet a Sound, SuperCollider Code, Richie Hawtin + Traktor
  2. 2 Twitter Everywhere: More Tweet a Sound, SuperCollider Code, Richie Hawtin + Traktor | Speakear
  3. 3 谷奥——探寻谷歌的奥秘 (http://google.org.cn) » 用四种方法通过 twitter 自动传播自己制作的音乐

Leave a Reply