# Connecting an instrument into sonic pi live\_audio

**URL:** <https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698>\
**Category:** \[P\] Patreon Support\
**Created:** [February 1, 2018, 5:28pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698 "2018-02-01T17:28:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![finwath](https://avatars.discourse-cdn.com/v4/letter/f/a88e57/32.png) [@finwath](https://in-thread.sonic-pi.net/u/finwath)\
**Post date:** [February 1, 2018, 5:28pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/1 "2018-02-01T17:28:52Z")

</div>

I’ve been looking around, but I haven’t come across instructions or recommendations on how to hook up an instrument to a computer and into Sonic Pi to use live\_audio. Would someone lay out what would be necessary (beyond the instrument, like a guitar) in order to get it pulling in on a Windows machine or Raspberry Pi 3, such as cabling or connectors?

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![JorshTheHacker](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@JorshTheHacker](https://in-thread.sonic-pi.net/u/JorshTheHacker)\
**Post date:** [February 1, 2018, 7:20pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/2 "2018-02-01T19:20:32Z")

</div>

Use the `channel` opt.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 1, 2018, 8:38pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/3 "2018-02-01T20:38:57Z")

</div>

Hi,

Please do take a look at the documentation for the `live_audio` fn and also the included examples.

The simplest case to get audio from your sound card into Sonic Pi is:

```ruby
live_audio :foo

```

This will read audio from the first input of the sound card and play it as a synth 🙂

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 1, 2018, 8:39pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/4 "2018-02-01T20:39:39Z")

</div>

> [@JorshTheHacker](#):
>
> Use the channel opt

To choose between different inputs of a multi-channel audio card, the opt to use is called `input:` 🙂

---

<div class="post-metadata">

**Author:** ![finwath](https://avatars.discourse-cdn.com/v4/letter/f/a88e57/32.png) [@finwath](https://in-thread.sonic-pi.net/u/finwath)\
**Post date:** [February 1, 2018, 11:06pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/5 "2018-02-01T23:06:31Z")

</div>

Alrighty, but I’m looking for a what kind of cable/hardware do I need to get my guitar plugged in to the computer. Something that is known to work,so I don’t have to spend money on several different products that won’t work to find one that works. I mean, is there like, a 1/4" plug to USB cable or something, that’s what I’m digging for. I’ve found many different products, but I was hoping to hear from someone who has already sorted through them and found what works.

---

<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:** [February 2, 2018, 9:28am UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/6 "2018-02-02T09:28:43Z")

</div>

Hi,

if you just would like to plugin you guitar the Behringer Guitar Link UCG102 might be enough. I did buy it sometime ago, it works quite well and is cheap but I don’t use it anymore, because I 1. wanted have input options for playing live with others and 2. I wanted to have better latency values:

So you can try some sort of USB audio device (an external soundcard). I bought the Focusrite Scarlett 2i2 (there is also one by Steinberg about the same price region). You can reach quite low latency values and you can plug in instruments and/or microphones (2 line resp. instruments inputs). Mine works flawlessly with Linux (which is not a natural thing); before you buy get some information about the device and how it works with Windows (which usually is well supported).

---

<div class="post-metadata">

**Author:** ![JorshTheHacker](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@JorshTheHacker](https://in-thread.sonic-pi.net/u/JorshTheHacker)\
**Post date:** [February 2, 2018, 12:23pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/7 "2018-02-02T12:23:25Z")

</div>

Oh, yeah. I’ve only used `live_audio` a few times, although I’ve been experimenting with it a lot recently. I really should reread the documentation at some point.

---

<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:** [February 2, 2018, 1:32pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/8 "2018-02-02T13:32:06Z")

</div>

On a raspberry pi the add on pisound board works well but no that cheap. See site  
[blokas.io](http://blokas.io)

(I use it)

---

<div class="post-metadata">

**Author:** ![finwath](https://avatars.discourse-cdn.com/v4/letter/f/a88e57/32.png) [@finwath](https://in-thread.sonic-pi.net/u/finwath)\
**Post date:** [February 10, 2018, 12:31am UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/9 "2018-02-10T00:31:32Z")

</div>

Awesome! Many thanks!

---

<div class="post-metadata">

**Author:** ![casaler](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@casaler](https://in-thread.sonic-pi.net/u/casaler)\
**Post date:** [February 12, 2018, 3:30am UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/10 "2018-02-12T03:30:19Z")

</div>

I recently bought, installed the Pisound hat, plugged in my guitar and still got no sound. All tested okay per the checks I could find online. Any thoughts on what I should try? I did notice that live\_audio did not auto populate when I typed into the sonic pi terminal.

---

<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:** [February 12, 2018, 12:49pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/11 "2018-02-12T12:49:09Z")

</div>

I have just written a post to aid in setting up the pisound board with Sonic Pi which you can read here

> **[Setting up Sonic-Pi to work with a pisound midi/audio interface board.](https://rbnrpi.wordpress.com/2018/02/12/setting-up-sonic-pi-to-work-with-a-pisound-midi-audio-interface-board/)**
>
> I thought it would be useful to gather my experience of using the excellent pisound midi/audio interface board by blokas.io with Sonic Pi. The samplerate, frames/period and number of periods/buffer…

---

<div class="post-metadata">

**Author:** ![casaler](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@casaler](https://in-thread.sonic-pi.net/u/casaler)\
**Post date:** [February 12, 2018, 9:58pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/12 "2018-02-12T21:58:31Z")

</div>

Thanks! Found it very helpful, but I cannot get the live\_audio thread to populate. Also, when I changed my input/outputs to the suggested, I get a cannot connect to server (only selecting defaults do I get a connection). I have re-checked my configure and all seems to be in order. Where do I go next?

The Sonic Pi gives me a runtime error of sonicpilang when Imtype live\_audio.

---

<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:** [February 13, 2018, 1:49pm UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/13 "2018-02-13T13:49:26Z")

</div>

You are using Sonic Pi version 3.0.1? live\_audio is not available on earlier versions, and if you are getting an error message for live\_audio that may be why.

---

<div class="post-metadata">

**Author:** ![carltesta](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/carltesta/32/1512_2.png) [@carltesta](https://in-thread.sonic-pi.net/u/carltesta)\
**Post date:** [October 7, 2020, 4:07am UTC](https://in-thread.sonic-pi.net/t/connecting-an-instrument-into-sonic-pi-live-audio/698/14 "2020-10-07T04:07:56Z")

</div>

I’m trying to use the Built-in Microphone with live\_audio on a 2012 MacBook Pro. For some reason I can’t get it to play the input. When I plug in a USB microphone or audio interface live\_audio works. Any ideas why it might not be working? I’m running Sonic Pi 3.2.2 on Mac.
