Following the successful development of a sample based flute over three octaves for Sonic Pi 2, I have today embarked on the more ambitious project of producing a 7 octave sample based Grand Piano voice for Sonic Pi 2. The technique described in my previous article is the same as for the Flute voicing as is the source of the samples from the Sonatina Symphonic Orchestra (SSO). However the scale is much bigger with 7 octaves to cover. I made use of the automator app on my Mac to do global renaming of the samples (whose names contained – and # characters), the TextWrangler editor to set up tab separated list of the parameters from the .sfz file from the SSO containing the sample names and associated notes, and an Excel Spreadsheet to calculate the entries for the sam array using the same format as in the Flute program featured here. There were various tweaks and changes necessary in the remainder of the program. The samples worked better with a zero attack time, and there was no need for the “bodge” to deal with “breathy” notes as occurred with the flute samples.
There were no fine tuning “cent” numbers for these samples in the .sfz file, but in practice I found it necessary to use some as the tuning was not very good. In fact, although the present state of affairs is not too bad, the values require further tweaking before I would want to release the program. However results are encouraging, and I have converted one or two of my previous programs which played with synths to utilise the sample based piano voice.
One unfortunate problem is that the files can become quite large, and on the Mac version of Sonic Pi 2 I have with one or two of the programs hit the limit of just over 9000 characters above which it will not play the files. Sam Aaron is working on the required fix, but it will not be available until a later version. So at present some of the files, including the one I am featuring today, will only work on a Raspberry Pi.
Below are three recordings I made tonight of a Bach Prelude in C, which uses the new voice. It also illustrates the use of crescendos an diminuendos and a rit in the music. The code I have written for the voice can handle transposition, and so to illustrate the range of the piano I have a recording at the normal setting, one transposed an octave down and one transposed two octaves up. For comparison I also include a recording of Sonic Pi playing the previous version of the piece using built in Sonic Pi synths.
I hope to add further details of this sample voice, including the program at a later date