My first scamp piece

Music:

Code:

I encountered some difficulties for which I found workable solutions:

  • when working with an external synth (midi parts) I did experience hanging notes when forcing my script to end: I fixed it by creating a class that sends “all notes off” messages to the external synth whenever the script is stopped
  • I really prefer to think in terms of note names and octaves instead of midi note numbers, so I used some functionality from my “expremigen” python library

The absolute killer feature for me is the generation of musicxml. Scamp appears to be the only system known to me that can generate musicxml from a fairly high-level musical description.
I kind of hope to see notation for dynamics and perhaps also slur/hairpin support appear in the future.

1 Like

Thanks so much for posting this — very cool! I’m glad you found scamp good to work with.

Thanks for pointing out the hanging notes issue. I’ll look into it; I think I could use the atexit module from the standard library to make sure that all notes are terminated when the program ends.

As for note names vs midi note numbers, I went with midi note numbers because they are far more flexible for algorithmic manipulations, and also allow for microtonality in a straightforward way. However, I take your point about ease of use. It might be worth adding some sort of pitch translation feature to the scamp_extensions package.

I’ve recently combined scamp with music21 which seem like they complement each other well. Music21 provides a good basis for “music theoretical calculations”, but makes generating notation a bit cumbersome. Scamp makes performance and notation easy, but does not have a whole lot of built-in music theory. Combining both together, scamp can easily be used to perform/notate the music21 calculation results.

Yes, that’s by design, actually. I have tried, to as great an extent as possible, to make SCAMP musically agnostic, not pushing you towards any particular style or theoretical framework. So I don’t put music theory constructs in SCAMP. I have created the scamp_extensions package for that kind of thing — at the moment it has a Scale class, for instance — but for the most part the idea is to use third party libraries for theory stuff or build your own.

So I’m glad it’s working with Music21!