MIDI loop/recording

Hi @cyprien,

you’re working on something fun - I’m looking forward to watching your progress.

However, be aware that ‘all of standard Ruby’ is not supported in Sonic Pi. Although Sonic Pi is built-on-top-of Ruby, it isn’t Ruby and not all of Ruby works well with Sonic Pi’s design.

For the record, only the things documented in the help section are officially supported. Everything else may or may not work and today and that situation may change without notice in the future. In other words, if you stray out of the confines of the documentation you’re in your own unprotected and unsupported Wild West :slight_smile:

As a concrete example, standard Ruby classes and methods are not supported. As you have discovered, Sonic Pi’s DSL design doesn’t mesh particularly well with Ruby classes and the official way of creating a function is with define, not def. This will allow us to do some very important and interesting things with determinism and threading in the future.

We definitely do need to put some thought and consideration into what an extension system would look like. However, for now, it’s best represented as a file of calls to define and/or set which you can load with run_file.

If what you’re looking for isn’t implementable with this approach, then please do let me know, and we can start using this exploration as a way of specifying an extension system that can both work for this project and other people’s projects :slight_smile:

1 Like