# Complete Rewrite of Live Looper

**URL:** <https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792>\
**Category:** Creations & Ideas\
**Created:** [December 9, 2018, 3:15pm UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792 "2018-12-09T15:15:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [December 9, 2018, 3:15pm UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/1 "2018-12-09T15:15:55Z")

</div>

Hi,

I did a complete rewrite of my [Live Looper Script](https://github.com/mbutz/sonic-pi-live-looper) for Midi devices.

The former version had at least two severe disadvantages (besides the Spaghetti code):

1. it was device specific. I now did my best to provide a device independant logic and implementation; so in principle you should be able to use any Midi device (for full functionality you will need two toggles/pads and 3 rotary controllers (volume, lpf and hpf)). I did tests with the Beatstep and the Minilab (both Arturia). Strangely the rotary controllers of the later one show some anoying latencies. The Beatstep rotary controllers work as expected, in real time. I will also have to solve the [problem of feedback](http://in-thread.sonic-pi.net/t/midi-sysex-messages/1728/8) going back to the controllers (such as a blinking pad while recording, which the Beatstep already does).
2. The second, really annoying flaw was, that I had a latency while using the live looper (playing live I found that the replay is slightly delayed). I found out that this had to do with my initial implementation, which involved running some of the code via the `run_file` command. As soon as I put all the code in one file/buffer (which has some other advantages) I got rid of any latency concerning the recording and playback. That is also the reason why all the configuration resides in one and the same file; I would have liked to have a separate configuration file for the device specific variables (to be able to switch devices with just one line of code) but I again got the latency issue; of course I can not exclude that it is my poor coding rather than due to the fact that Sonic Pi has to read a file from the harddrive.

I hope the script is well documented so that you can try it out - if you are interested at all.

Thanks  
Martin

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [June 9, 2019, 1:56pm UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/2 "2019-06-09T13:56:43Z")

</div>

Hi to all,

I did manage to also rewrite the [Live Looper](https://github.com/mbutz/sonic-pi-touchosc-live-looper) version with [TouchOSC](https://hexler.net/products/touchosc)-interface. I also uploaded a small demo video (please forgive the typos in the commentaries):

I used the following setup as seen on the thumbnail before starting the video:

- my Laptop
- an Arturia MKII Keyboard
- [Helm](https://tytel.org/helm/)
- my old Samsung S4 with TouchOSC, which is set to USB-tethering (see note 1)

I’d be grateful for any feedback if you want to try out the `Live Looper`. I especially appreciate any productive comments on the code as this would help to improve my coding skills.

* * *

1. I also tried my Nexus tablet, which works also; but I unfortunately I do not have the option `USB-Tethering` available; does anyone have an idea why? It is running on Android 8.1 resp. LineageOS 15.1. USB-tethering seems to be a good option because a) you have a faster cable connection and b) you are not dependant on a Wifi (e. g. on stage).

---

<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:** [June 9, 2019, 2:19pm UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/3 "2019-06-09T14:19:17Z")

</div>

Nice video.  
(Is the latest code as in your [github site](https://github.com/mbutz/sonic-pi-midi-live-looper)?) edit forget this I found the link above

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [June 21, 2019, 5:56pm UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/4 "2019-06-21T17:56:17Z")

</div>

Hi,

I checked out [Open Stage Control](https://openstagecontrol.ammd.net/) because I ran into some limitations of [TouchOSC](https://hexler.net/products/touchosc) and I am pretty impressed. There are a few nice things about it, one of them: You can run it on any device which runs Google Chrome or Chromium…

As a proof of concept I set up a [layout](https://github.com/mbutz/sonic-pi-open-stage-control-live-looper/blob/master/osc-live-looper.png) and did some changes on my [Live Looper App for TouchOSC](https://github.com/mbutz/sonic-pi-touchosc-live-looper), see: [https://github.com/mbutz/sonic-pi-open-stage-control-live-looper](https://github.com/mbutz/sonic-pi-open-stage-control-live-looper)

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 24, 2019, 6:56am UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/5 "2019-06-24T06:56:59Z")

</div>

Hi @Martin

Congratulations for your work ! yes open stage control is a good software may i suggest to visit the community forum and propose your work into made with o-s-c [https://openstagecontrol.discourse.group/c/community/made-with-open-stage-control](https://openstagecontrol.discourse.group/c/community/made-with-open-stage-control)

Another little point : in order not to mix up with the protocol osc, maybe should you rename your repository as this o-s-c for Open Stage Control.

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [June 24, 2019, 7:59am UTC](https://in-thread.sonic-pi.net/t/complete-rewrite-of-live-looper/1792/6 "2019-06-24T07:59:53Z")

</div>

Hi @nlb,

thanks a lot! Will follow both your recommendations…
