Release Announcement: Scheme-For-Max 0.1 - script and live-code max in scheme/lisp
Hi everyone, I'm excited to announce the first public release of Scheme-For-Max, a Max/MSP external that enables scripting and live coding Max in Scheme/Lisp. Scheme-for-Max provides an external that embeds the S7 Scheme interpreter, a "lisp-y" embeddable Scheme implementation by Bill Schottstaedt at
CCRMA. An installable Max Package is available for Max 8 on OSX, and source is available that should build for Max 7 and on Windows. The package includes an extensive help file demoing all features with sample source code.
Scheme-for-Max 0.1-beta features include:
* Hot reloading code
* Live code evaluation from a REPL, with a REPL-terminal object
* Evaluating Max messages as scheme
* Listening to Max messages with dynamic registered listener functions for basic Max messages
* Sending remote messages to other objects to interact with other objects
A short video overview of the features in 0.1 is here:
https://youtu.be/ErirIFCTdjg
Documentation is here: https://iainctduncan.github.io/scheme-for-max-docs/
To download and install, please visit the github page for the release.
https://github.com/iainctduncan/scheme-for-max
As this is the very first release, and my very first Max Package, there are no doubt issues. A Google Group exists for questions, bug reports, installation issues, etc. Tickets can also be submitted on the Github page.
https://groups.google.com/forum/#!forum/scheme-for-max
Enjoy, and hope to hear from some of you soon.
Iain
Hi folks, I have added a first pass at docs, including build instructions.
https://iainctduncan.github.io/scheme-for-max-docs/
I would love to try that, but I'm on windows and I'm completly lost with building stuff from source, someone have a good tutorial or documentation about how to build ?
Hi Guillaume, thanks for your interest. There is info on building from source in the SDK docs, but I don't know if it's good enough for someone new to visual studio. :-/
https://cycling74.com/sdk/max-sdk-8.0.3/html/chapter_platform.html#chapter_platform_building
If I don't get any interest soom from someone who knows building on Windows, I will bite the bullet and do it myself using Parallels. That may just take a few weeks for me to get to. But I will definitely get this out for windows too. Any release announcements will go here and also on the google group for Scheme For Max.
Do keep in touch!
hey, I found this nice video about scheme live coding for music (with supercollider):
https://www.youtube.com/watch?v=T6jGBWfqafc
This could be done with scheme for max?
Hi Guillaume, yes there's no reason you couldn't use S4M that way, though it's a bit different from how I like to work live. I will be doing new releases over the next while adding direct buffer, table, and dict i/o, and also working on hooking into the internal timing system for delayed events. I will keep posts coming!
hey yesterday I tried to build s4m on windows (visual studio) with your documentation. Unfortunately I failed, I think is too complicated for me,I never did that before so I understand nothing haha.
So I hope one day someone will do that.
I'm really exited to try something with scheme, I did a lot with Tidal Cycle and it's really powerfull especially because of haskell , for instance I really like list comprehension.
But I suppose scheme s7 is different.
By the way, I don't know if it's the best place here, but it could be nice for peoples like me who don't know these languages but want to learn, to make a list of links for documentations.
Hi Guillaume, thanks for trying! I will get on that in the next few weeks, I'm just not sure how easy it will be for me either. But I should be able to get some help from some C dev friends. I need to do the whole parallels and install VS thing and stuff so it could be some work.
BTW, re the list comprehensions, S7 scheme includes a port of the common lisp "loop" macro, which is like a whole little mini language for list comprehensions, it's pretty amazing. I do plan to add documentation and cookbook recipes for people new to Scheme. It's just me right now, so it might be a bit, but I will definitely be doing that. Keep in touch!
While waiting for the release of s4m on windows, in which environement can I experiment the s7 language?
I downloaded Racket which is great, but is not exactly the same no?
Thank you
Hi Guillaume, there are a few things you can do to learn S7. Scheme is funny compared to other languages, in that the core language is very small, and then implementations add some things according to which standards and extensions they want to provide. This has pros and cons, on the one hand it's a pain because there's no single "here's Scheme" like there is in Python say, but on the other, it means there are *many* different implementations optimized for different things. S7 is closest to R4RS and R5RS scheme, but with Common Lips macros instead of scheme macros.
Much of Racket is similar, so there's definitely no harm in learning Racket, especially because the docs are great and the Realm of Racket book is a very good beginner intro. (I looked at embedding Racket, but that was going to be really difficult and I decided S7 made more sense for embedding in a Max external ultimately) If you want to specifically run a closer variant of scheme, you can set the language in Dr Racket to R5RS in the language pull down, but then you'll to make some adjustments.
The other thing you can do on windows is run S7 itself by downloading the Grace application for Common Music, which has an installer for Windows. Once you Grace open, you got to File -> New Editor, and this opens an editor. Then you can evaluate scheme in that editor by highlighting it and executing it in the Eval menu (don't know the window command). The nice thing about this is it's actual S7 with the same goodies loaded as Scheme for Max.
I plan on making a page on the docs for how to get going on scheme for people new to lisp and I'll post it here when I do.
Hope that helps!
iain
Thank you very much iain, I was on dr racket for the moment, I'm downloading grace now.
Also I found videos from Andy Balaam really good to learn : https://www.youtube.com/watch?v=byofGyW2L10&list=PLfHYba8zC7hTNImXmUAxuPcmhpgWlZLAc
Cool, I have not checked those out. If you find you are having a hard time learning to *think* in lisp, the best books are "The Little Schemer" and it's follow up "The Seasoned Schemer". They aren't normal programming books, they are more interactive exercises, but if you do them, you'll be thinking in lisp recursion much more easily. Also the Dybvig Scheme book is good as a reference, and the author of S7 said you can get the older 3rd edition to cover S7 well. I got it used quite cheaply. Finally, if you're looking to learn Scheme in general, Chicken Scheme has excellent docs. I am using it as well for personal stuff, but it wasn't going to be as helpful/easy to embed as S7. But for normal use, Chicken has the second easiest experience for just getting going, after Racket. HTH
Oh also, I have set up a windows dual boot now and am working on building for windows. Hopefully it'll be done in the next few days, we'll see how it goes!
Great project! Today I'm debating using js, lua or gen for some complex computation. Then I recall this project and just use scheme.
Thanks Larme! I'd love to hear how it works out for you, whether here or on the google group. And what you'd like to see in it next.
Hi Iain,
The overall experience is very smooth, maybe the smoothest one among all the lisp environments for max.
My suggestions:
1. doc should mention loop.scm and utilities.scm or just load them by default
2. like doc says, `(out 0 (list 'set 99))` won't work. Will this be fixed? Though I can just use 2 outlets and a [prepend] as a dirty hack, it's still annoying.
Hi Larme, thanks for getting back to me. You're right about the docs and loop, I just (this weekend) got bug reports with test scripts to the author of loop and it looks like it might be a bit before we sort out what's up with Common Music's loop code on windows, so I'm going to update the docs soon to reflect that properly.
Re #2, can you tell which part of the docs you are referring to? Because you can run:
(out 0 (list 'set 99)) in code, or in the repl. If that's not working for you, there's something up and I should hop on the bug. (It's working in OSX and I just retested.) If you mean from a max message, that's different, because I'm not trying to support (at this time) perfect lisp syntax in max messages. The issue there is that it would require a bunch of parsing to let max know that (list is not an atom. If you do want to use parens in a max message you can do so by routing through a tosymbol and then prepend eval-string.
I do plan to port over the thread-first and thread-last macros from Clojure so that one can do the following in a message, without parentheses and with each token being space separated in the normal Max message way:
list 'set 99 => out 0
thanks for the feedback, and I'll try to get those fixes up in the next day or two! You can also always make tickets on github or post to google group if you find more issues or areas where the docs are unclear. I'm a huge believer in the importance of great docs. :-)
I just open an issue at github about #2 with an example.
Meanwhile I already start coding scheme in max.
awesome, thanks! I'll go check out the issue. And fantastic that you are using it for real code!
iain
Aha, that was very helpful, great find! I can see what is happening now and how to fix it. We output the message "list {arg} {arg} {arg}", which is normally what we want, but for it to behave as max does for other messages, I need to have S4M check the first atom, and send either "list {atom} {atom} ..." for lists that start with numbers, but "{atom} {atom} {atom}" for lists that start with symbols. In your example, the counter is getting the message "list 'max 10", which it doesn't understand. Will update this thread (and github) when a fix is up. This is an area where Max is a bit odd under the hood. :-)
This has been solved now, and there is a bug fix build up on github for OSX. A new release with the fix for windows as well will be done over the next couple of days. Thanks for the bug report!
Hey Iain, I have been trying to test your scheme for Max in macOS. I got the latest source and build from github and when I run it, I get the following error.
s4m: s4m: s7-stuff.scm: not found
This file does not seem to be present anywhere. Am I missing something here?
Hi Anthony, I had not been making sure that master builds cleanly as no one else was building it. My intention is to ensure that from the next release on Master stays buildable and next releases are branches. (I'm building a giant set of regression tests right now actually!) Did you try using one the release binaries? they should work fine. If you have issues, I have a google group for bug reports and I will happily work through them with you, I'm actually focusing on it this week anyway. This release for OSX should give you a working binary, if it doesn't, I'll fix it up for you.
https://github.com/iainctduncan/scheme-for-max/releases/tag/0.1.7-rc-osx
Actually I was not able to get it to build with Xcode so I am using the binary you provided. It seems to be looking for the file s7-stuff.scm but this file is not present in the github repo.
Re: your specific error, I see what I have done now, oops. I was wrestling with whether to rename the hodge-podge of scheme files that come as extras for S7. I have it setup so that a build renames those files when packaging it up. So what's happening is s4m.scm is trying to load s7-stuff.scm but that file is not renamed (as you wouldn't have run the build script). I need to think about how to make this easier for someone to run from a build, but in the meantime you can either edit that line in s4m.scm or copy stuff.scm in the scm directory to s7-stuff.scm.
Hi Anthony, I've just updated master to have a second copy of stuff.scm in the scm directory, and I am able to build and work with master now. But you know, the old "works on my machine"... ;-)
I'd love to make sure it works for you too so feel free to try again and we can work through whatever you hit.
Ok hang on, as much as I hate the fact that Bill called that file "stuff.scm", haha, I'm going to abandon the idea of renaming it and cut another release off master with no problematic file renaming. I'll update here when I have one ready for you to test, prob in the next half hour. :-)
Hi Anthony, please try this one. I have just done a fresh install with it and it worked for me.
https://github.com/iainctduncan/scheme-for-max/releases/tag/0.1.7-beta-osx
Hey Iain, renaming the file seemed to do the trick. It finds the file but I am seeing a different error:
s4m: s4m: scm4max.scm: not found
Hi Anthony, are you wanting to build it or just run it? One of the issues I'm having is that it's very difficult to set up a nice workflow for dev that also allows me to properly test a release package. So the release script does some stuff on my file system to hide my dev work from Max and install the package. (and the uninstall.py reverses this). You should not need to use it unless you are trying to build and test release packages. It sounds to me like you might be getting a bit of mess between having tried both building from source and installing the package. (Clearly I need to figure out how to document that better...)
I would suggest hiding the dev version from Max and installing the package as a normal package from the latest release to see if it works. You should get a Max package to install in your packages dir, and it should have an "s4m.mxo" external in the externals directory and scm files in the extras dir. I'm happy to help out if you want to email me, it would be great to improve the docs as needed to help folks trying it out.
I would love to fix things up so you can build it too, but my Xcode knowledge is low, so I'd prob need to figure it out with you, I'm sure it's not good right now. You can reach me at iainctduncan @ g mail.com if you want to work that out together. thanks!
Okay am happy to help, will contact you
That would be fantastic, thanks!