Can't take in the correct audio

Some reason cannot get live audio to take in the correct sound - I’ve looked everywhere but some reason still can’t get it to work.

My setup is a macbook with Sonic Pi 3.1, connected to a moog minitaur via a focusrite clarett 2pre usb. I’m trying to use sonic pi to send midi to the moog (which is working fine) and then the audio back in.

However the problem is no matter what I do sonic pi only seems to take in the microphone input of my laptop - the input is correctly stated to be from the clarett 2 pre - I’ve tested this using garageband and works fine. Possibly not selected the correct channel? but i have tried numerous.

Any help would be greatly appreciated.


Sonic Pi uses the default audio channels in your Mac. YOu must assing these using audio MIDI setup BEFORE starting Sonic Pi.
If you set your focusrite as the default input device then it will use the channels that it provides numbered from 1.

In Sonic Pi you activate and select the channel using
live_audio :WhateverNameYouLike, input: 1 #for mon input from channel 1
live_audio :WhateverNameYouLike, input: 2 #for mon input from channel 2
live_audio :WhateverNameYouLike, input: 1, stereo: true #for stereo input from channels 1 and 2

you stop the stream with
live_audio :WhateverNameYouLike :stop

If you change the input source set up to a different device then you MUST choose the new device as the default one using audio MIDI setup and restart Sonic Pi or it will not recognise it.

Hope this helps

Brilliant thanks! I’ll see if it works tomorrow

@alexjperkins - yes, @robin.newman is right, Sonic Pi currently only binds to the OS-default audio cards. I’m hoping to implement an audio selection system for a future version but it’s very early days at the moment.

Hi everyone,

I know this is an old thread but I’m facing the exact same issue. I can’t for the life of me figure out how to get Sonic Pi to detect my sound card.

I applied everything that was mentioned in the previous replies, I made sure to select the appropriate audio interface BEFORE booting up Sonic Pi. I did it before when using a multi-channel output device for connecting 2 headphones (1 USB and the other regular) and Sonic Pi detected the device just fine. But the sound card, no dice.

Here’s a description of my setup and the steps I took:

  • I’m using a Focusrite Scarlett 2i4 with Macbook Pro running Mojave

  • on input 1, I connected a vocal mic

  • on input 2, I connected my computer running Sonic Pi

  • my Sonic Pi version is up to date

  • I made sure to select the correct audio interface before booting up Sonic Pi

  • I tried to manually set the input to 1 in the code like so:
    live_audio :voice, input: 1

  • I tested to leave it without giving it the input (since the default is 1 if I understand the docs correctly…)

  • I tried different numbers as input, just for the hell of it, to see if by any chance it would work

  • I tried wrapping an effect around live_audio, just to see if I could get anything to change:

    with_fx :reverb, room: 1 do
    live_audio :voice, input: 1

  • I also tried input 2 on my sound card and changed the code accordingly but no change.

I did a test in GarageBand and both inputs of the sound card are working fine…
But when I try to use it in SP, it detects the interface fine as output (I’m hearing the audio with headphones plugged in the sound card) but SP still uses the internal mic when I try to use live_audio (even though, as I mentioned, I don’t have the built-in mic selected in my sound preferences!).

At first I was getting a result and I thought everything was working fine, until I realized I could hear the clicks of my typing through the live_audio effects! I then muted the internal mic of my laptop and then didn’t get any output at all from live_audio.

I really don’t know what I’m missing… I did some research to see if I could find anything on the Focusrite sound card that could give me a clue on the problem, the only thing I found that might be related (I’m not sure…) is this article.

In that post, they mention:

This message is a reminder that the Mac computer consists of zero control for the signals coming in and routed through and out from the Focusrite devices. In other words, Mac will not be able to boost or attenuate signals when the Focusrite interfaces are set as the primary devices in System Preferences under Sound. All signals going in and coming out are controlled by the Focusrite hardware directly.

I have no idea if that has anything to do with the problem but anyway, even if it does, how come the sound card works just fine when I use it with a DAW? I’m very confused…

I read the documentation on live_audio over and over again and tried all the examples. I can make it work just fine when using the internal microphone but that’s not a viable option for performing and recording… I would so much love to use it in a performance context…

Any help on this matter would be greatly appreciated :pray: :sparkles:

So sorry you’re having issues. It sounds like you’re doing everything right, which must be very frustrating.

Would it be possible to paste a copy of your scsynth log in here? It can be found in ~/.sonic-pi/log/scsynth.log

That might help us to shed some light on the matter…

@samaaron Thank you so much for getting back to me, it seems like this is a classic case of Murphy’s law because after literally hours of trying to make it work yesterday, I plugged in today for one last test before copying the file you mentioned and for some reason, now it’s working! I have no idea what happened and yesterday wasn’t the first time I tried and it never worked before…

But now I’m very happy to finally start experimenting with this :smiley: Will try to keep investigating in case others run into the same issue…

1 Like

Yey! I’m so excited about what you’ll be able to do with live_audio :slight_smile: :slight_smile:

1 Like