Playing a song using trumpets

You’re welcome @rahelios! Congrats on your success! :smiley:

To address the undefined method error, a bit of Googling tells me that the double-splat parameter is in fact a hash, for key-value args, as the error message indicates. I believe that last should work as intended if you use the single-splat operator instead (i.e. *args), which gets you the intended args array.

The Sonic-Pi documentation explains what you have discovered, that the duration of a note in beats is specified by the sustain opt, and not duration. Your multiplier is in units of seconds/beat (since you divided 60 seconds/minute by your beats/minute), and when multiplied by the duration (in beats), it yields a sustain time in seconds. This conversion seems strange to me, given that the sustain opt is specified in beats, not seconds.

And regarding the release time, it should be noted that MIDI signals do not communicate data about the ADSR envelope, which is configured within the instrument itself. The MIDI itself consists of simple on and off signals. This diagram illustrates what the connection is between the MIDI ON signal (green), MIDI OFF signal (red), and the instrument’s ADSR envelope setting (blue).

If you need to compensate for the release time of an instrument, you can reduce the time of your MIDI signal. You could calculate this compensation while experimenting with the release time of your instrument so as to achieve a relatively natural or synthetic sound.

Keep at it! :+1: