Binary Conversion

There are quite a few ways to convert from decimal to binary or, as I should say, from base ten to base two and the reverse when using Max/MSP. I’ve written abstractions using native objects that provide this function and I’ve also written a javascript that does both conversions (and bases up to 36) in one line of code. It is fairly trivial in javascript using the parseInt() and toString() methods. Continue reading…

Automatically Resize [bpatcher]

I’ve recently been piecing together a performance patch and using the [bpatcher] object to hold multiple instances of the same subpatch. As I think of new things to add into the subpatch I find it a bit annoying having to shuffle the [bpatcher] view around so the new user interface objects fit in. Presentation mode helps but to make things really simple I wrote this javascript which I can drop into the subpatch to do all the hard work for me. It automatically resizes and repositions the [bpatcher] view when everything loads. This way I don’t have to make any changes by hand, it saves me some time and lets me concentrate on the project work. If you’re using presentation mode you should give it a positive number argument so it knows to look out for only the objects you need, otherwise it uses every object on the canvas to calculate the dimensions. Continue reading…

Including Extra Javascript Files

Sometimes when writing javascript for use with Max/MSP I find I need to reuse bits of code that I’ve already created for a different project. Most of the time a simple search, copy and paste suffices but in some situations it would be better to have the ability to import other javascript files to get access to all of the functions they contain. This would also be useful when trying to organise where you files are stored. I don’t always want my javascripts in the Max search path (too many files here will cause the program to take ages to load), and I don’t always want them in the same directory as my main patch (which is the default place Max will look for a javascript/abstraction/image). The following code will import a specified javascript file into the current one. Continue reading…

Regular Expressions in Max/MSP

Here’s a tutorial patch explaining how to use regular expressions with the [regexp] object in Max to parse text. It shows a few different techniques and includes examples of each. The code is below in JSON format so Max4 users can convert it and take a look too. Copy it into a new window, switch out of edit mode and click the titles to view them one by one. There are quite a few more complicated things you can ask regular expressions to do and if I ever find repeated uses for them I will try to add these topics to the file as well. Continue reading…

Max MSP Tools

I’ve just updated the collection of abstractions and javascripts I use on one of my project pages. One of my favourite things about Max MSP is the ability to extend and re-use pieces of code. There’s a list of all the included files with a short description included in the zipped archive. As stated it is a work in progress so if you notice that something is missing then let me know and I’ll look into it. I hope someone out there finds it helpful.

Follow

Get every new post delivered to your Inbox.