# Berlioz Shepherds Farewell arranged for Sonic Pi

**URL:** <https://in-thread.sonic-pi.net/t/berlioz-shepherds-farewell-arranged-for-sonic-pi/1735>\
**Category:** Performances, Streams & Live Coding\
**Created:** [November 26, 2018, 9:46pm UTC](https://in-thread.sonic-pi.net/t/berlioz-shepherds-farewell-arranged-for-sonic-pi/1735 "2018-11-26T21:46:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [November 26, 2018, 9:46pm UTC](https://in-thread.sonic-pi.net/t/berlioz-shepherds-farewell-arranged-for-sonic-pi/1735/1 "2018-11-26T21:46:31Z")

</div>

I am currently singing this piece with my local choir, and decided as a challenge to see what it would be like to arrange it for Sonic Pi. It has a good range of orchestral instruments not to mention a four part choir, with 17 different channels, and I decided to use the free [VMPK](https://sourceforge.net/projects/vmpk/) (Virtual Midi Piano) project to play these. I wanted to automate the set up of the VMPK and used the midi\_pc command to select the instrument for each channel. I also used the midi\_cc 10 control to set the pan position of each instrument and adjusted the balance of the instruments by setting different velocity settings for each channel, using the velocity: parameter for Sonic PI’s midi command. Overall volume level was set using the midi\_cc 11 control (expression). By sending the output of this (range 0-\>127) to every channel I could implement crescendos and decrescendos in the piece. The overall result comes out quite well, and I found it a good exercise for exploring how to control midi output from Sonic Pi, and then use the live\_audio input command to retrieve the resulting audio (which I fed back using [Amoeba’s Loopback utility](https://rogueamoeba.com/loopback/)) and further process that with some reverb.  
You can hear the result on SoundCloud:

https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F535905822&show_artwork=true&maxheight=166

The code is available on my gist site

> <https://gist.github.com/rbnpi/c14d909a0ab452e068bf480d4a9a603c>
