# Sonic Pi Midi Box Controller

**URL:** <https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774>\
**Category:** Creations & Ideas\
**Created:** [December 6, 2018, 8:42am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774 "2018-12-06T08:42:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![veganpete](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@veganpete](https://in-thread.sonic-pi.net/u/veganpete)\
**Post date:** [December 6, 2018, 8:42am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/1 "2018-12-06T08:42:07Z")

</div>

Hi, I read the tutorial (and browsed through the forum) but something wasn’t immediately apparent to me…

I am hoping to make my MIDI instrument, based on a Raspberry Pi3. It will hopefully have a keyboard (piano keys) and sliders and dials/knobs.

I was hoping to run a synth (such as Sonic Pi) that can play both generated-sounds and pre-recorded samples; who’s parameters and values can be tweaked by the MIDI controller (eg: the dials and sliders would affect sustain/amp/echo etc) and the key-presses would alter something akin to the pitch velocity parameter. It seems that Sonic Pi has some great features that would be well suited to this and the ability for fine-control of each sound.

Is this something that can be done with Sonic Pi or am I right in thinking that all input has to be typed as code? If it accepts typed commands only, I presume I would need the MIDI controller to pass code strings to the GUI somehow, from a script.

Also, here is a link to some great free samples (in various categories) which people here may find useful…  
[http://www.breakbeat-paradise.com/samplesite/bb\_acid.php](http://www.breakbeat-paradise.com/samplesite/bb_acid.php)

Thank you.

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [December 6, 2018, 9:19am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/2 "2018-12-06T09:19:03Z")

</div>

Hi @veganpete,

It is definitely possible: Sonic Pi can receive and send both MIDI and OSC messages.  
(See [http://sonic-pi.net/tutorial#section-11](http://sonic-pi.net/tutorial#section-11) and [http://sonic-pi.net/tutorial#section-12](http://sonic-pi.net/tutorial#section-12) if you haven’t already).  
I have never used this feature myself (so someone else will no doubt have more knowledge about it) but here is a possibly relevant example: [Polyphonic gated synth for Sonic Pi 3, works on a Pi3](http://in-thread.sonic-pi.net/t/polyphonic-gated-synth-for-sonic-pi-3-works-on-a-pi3/452)

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [December 6, 2018, 9:25am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/3 "2018-12-06T09:25:16Z")

</div>

Also, [Free Sample Libraries.... whats out there](http://in-thread.sonic-pi.net/t/free-sample-libraries-whats-out-there/297/14) is a perfect place for that free samples link - feel free to add it there in the first post 👍

---

<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:** [December 6, 2018, 1:03pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/4 "2018-12-06T13:03:49Z")

</div>

I was going to reply to this but Ethan beat me to it, with an example that I wrote for a midi keyboard input. I would just add that I find using OSC input particularly from the app TouchOSC is a very convenient way to let you control Sonic Pi, and I have published quite a lot of examples of this both on [youtube](https://www.youtube.com/user/rbn1tube/videos) and on [my blog](https://rbnrpi.wordpress.com) that may give you some ideas. The TouchOSC app is available for android and Mac ios and is very modestly priced.

---

<div class="post-metadata">

**Author:** ![veganpete](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@veganpete](https://in-thread.sonic-pi.net/u/veganpete)\
**Post date:** [December 6, 2018, 1:16pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/5 "2018-12-06T13:16:42Z")

</div>

Thanks, I had seen that post but unfortunately I can’t add it there, as it’s a patrion-only thread. Could someone possibly post it there for me please? Thank you!

---

<div class="post-metadata">

**Author:** ![veganpete](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@veganpete](https://in-thread.sonic-pi.net/u/veganpete)\
**Post date:** [December 6, 2018, 1:17pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/6 "2018-12-06T13:17:30Z")

</div>

Thanks so much! I’ll check it out and hopefully use Sonic Pi in my build  
🙂

---

<div class="post-metadata">

**Author:** ![veganpete](https://avatars.discourse-cdn.com/v4/letter/v/4da419/32.png) [@veganpete](https://in-thread.sonic-pi.net/u/veganpete)\
**Post date:** [December 6, 2018, 1:18pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-midi-box-controller/1774/7 "2018-12-06T13:18:26Z")

</div>

Perfect! Thanks for all the info and links. Truly exciting! 🙂 Much appreciated.
