Music Hack for Max 7 - Elevator Music Generator

    Stefan Brunner, one of our Berlin-based developers, attended Music Hack Day in London last week, and created a really cool patch that generates "Elevator Music" by downloading and mixing sounds from (using OAuth2). Stefan was kind enough to share his patch and this short tutorial on getting it work. - ab
    The Elevator Music Generator is an example patcher created for last weekend's Music Hack Day in London. It will generate an endless stream of completely meaningless music.
    To achieve this great goal it needs to query the Freesound database. For this (and for downloading soundfiles) you need an OAuth2 authorization, a technology used all over the net, for example in Google Docs, Instagram etc.
    And this is what this patcher will do: It starts by displaying a Freesound login window, handling getting the OAuth2 access token and looking for soundfiles defined by your tags (at the moment it will mix percussion loops with piano sounds) and downloading them.
    Freesound also offers a nice way to get analysis data, for example the tempo of a loop, and in Max 7 we can use this information to time stretch the sounds to smoothly crossfade into each other. This gives you automatic beat-matching with very little effort.
    One thing: for using this example you need to sign up for a Freesound account, and register your application to receive a Client ID and a Client Secret. Make sure to use the supplied callback URL on the "Your application's callback URL" field. There are lots of simple ways this example could be extended, so I hope you enjoy.