# Sonic Pi MidiFile Player CODE NOW PUBLISHED

**URL:** <https://in-thread.sonic-pi.net/t/sonic-pi-midifile-player-code-now-published/3195>\
**Category:** Creations & Ideas\
**Created:** [January 25, 2020, 10:50pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midifile-player-code-now-published/3195 "2020-01-25T22:50:51Z")\
**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:** [January 25, 2020, 10:50pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midifile-player-code-now-published/3195/1 "2020-01-25T22:50:52Z")

</div>

EDIT The code for the MidiFile Player is now published. Full details of how it works, how to set it up and downloads are available at the link below.

> **[A midi file player program for Sonic Pi](https://rbnrpi.wordpress.com/a-midi-file-player-program-for-sonic-pi/)**
>
>   I never cease to be amazed at the versatility of Sonic Pi to produce music in such a variety of ways. The two major additions to Sonic Pi with the advent of versions 3.0.1 for the Pi and 3.1…

First look at my Sonic Pi MidiFile player undergoing testing. This version has TouchOSC support to allocate synths to be used, which can be altered as the file is playing. Also three volume settings. It can be used with preset synths and volume without the TouchOSC controller. I am currently testing a wide range of midi files of differnt genre, and it performs quite well. Not up to the standard of a fully fledged midiFile player, but very passable. It works by looking at midi\_on messages and starting notes with a 5 second sustain. The note channel and value are saved, and when a note\_off or a note\_on with velocity 0 is received with corresponding midi number and channel the playing synth is killed. It works with up to 16 channels, and by default uses channel 10 to drive a GM midi set of percussion samples. You could substitute your own samples if you wish.  
This has been a very interesting project to do and I am pleased with the results.

> <https://twitter.com/rbnman/status/1221201258780020736>
