No sound input working on my macbook or pi4

I’ve just started playing with live sound input but hit a wall straight away…

I can’t get sound coming in from anywhere despite enabling audio inputs within Sonic Pi and the prefs show my built in sound card and with my Scarlett 4i4 on both macbook and Pi4.

I’ve started with Sam’s fab built-in help resource using this:

synth :sound_in, sustain: 8

and i’ve also tried this and combinations of it:

live_audio :ch1, input: 1, stereo: true

I have no problem with sound going out on all devices

Thanks in advance for your help! :slight_smile:

Sonic Pi works with the default input on your Mac. You need to make sure that this is selected before starting sp. So in Audio MIDI Setup app set your interface as the default input before starting SP. Also make sure that the sample rate on your input and output ?Mac speaker. Are the same (probably either 41400 or 48000 hz or SP will object.
By default SP will setup 2 input channels. You can adjust it for the four channels from your scarlett 4/4 in the sound-settings.toml file

configuration of sound card settings happens in the sound-settings.toml file which is found within ~/.sonic-pi/config (where ~ refers to your ‘home’ directory).

You can change num_inputs to 4 and specify sample rate

Thanks Robin have done all that but still no joy i’m afraid :frowning:
Any other thoughts?
Thanks

I’ve been playing around with SP on my mac this afternoon. Set up 6 outputs 6 inputs in teh audio.toml file. I don’t have a multi-input hardward card, so been using two software syntths to get two sources. I have been using loopback to enanble SP to see the inputs 1-2 from synth 1, 3-4 from synth 2 and used a sound_out fx to send SP output to 5-6. This is working OK. (driving the synths (VMPK and AriaPlayer) separately with midi from SP.
The VMPK defaults output channel 1-2, I set the Aria Player to output to channels 3,4, and the SP program used a sound_out_stereo fx to channels 5,6. I used loopback rather than blackhole as it enables you to switch the speakers easily to monitor channels 5,6

Here is the test preogram I used.

#test multi inputs on Mac using Sonic PI with 6 inputs and outputs and loopback 6, to configure the sound paths.
with_fx :sound_out_stereo ,output: 5 do #speakers set to ch 5,6
  with_fx :level,amp: 1 do #sets overall output level
    with_fx :reverb, room: 0.8,mix: 0.7 do
      with_fx :pan,pan: 0.5 do
        live_audio :min,stereo: true,input: 3,amp: 0.3 #input from Aria player. amp adjusts signal
      end
    end
  end
  
  with_fx :reverb, room: 0.8 ,mix: 0.7 do
    with_fx :pan,pan: -0.5 do
      live_audio :min2,stereo: true,input: 1,amp: 1 #input from VMPK. Amp sets input level
    end    
  end
end
######## produce some midi to get the synths going
use_midi_defaults channel: 1
live_loop :mtest do
  midi scale(:c4,:major).choose,sustain: 0.125,port: "aria_player",vel_f: 0.8
  sleep 0.125
end
live_loop :mtest2 do
  midi scale(:c3,:major).choose,sustain: 0.2,port: "iac_driver_sonicpi",vel_f: 0.5
  sleep 0.5
end