# 5.1 audio output?

**URL:** https://in-thread.sonic-pi.net/t/5-1-audio-output/7518
**Category:** Support, Help & Resources
**Created:** [February 4, 2023, 6:03pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518 "2023-02-04T18:03:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![wysiwyggins](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/wysiwyggins/32/2493_2.png) [@wysiwyggins](https://in-thread.sonic-pi.net/u/wysiwyggins)
#### Post date: [February 4, 2023, 6:03pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/1 "2023-02-04T18:03:32Z")

</div>

Is it possible to output multichannel audio other than stereo from Sonic Pi? (including panning, not just pushing stereo to multiple speakers)

---

<div class="post-metadata">

### Author: ![hitsware](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hitsware](https://in-thread.sonic-pi.net/u/hitsware)
#### Post date: [February 4, 2023, 7:56pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/2 "2023-02-04T19:56:11Z")

</div>

How would You wire that ?

---

<div class="post-metadata">

### Author: ![pashultz](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/pashultz/32/1964_2.png) [@pashultz](https://in-thread.sonic-pi.net/u/pashultz)
#### Post date: [February 6, 2023, 2:26am UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/3 "2023-02-06T02:26:04Z")

</div>

Yes! See section 13.3 of the [Sonic Pi Tutorial](https://sonic-pi.net/tutorial.html#section-13-3). I haven’t tried it myself, but I suspect the specifics of how channels are mapped to speakers will depend on your sound setup. What OS are you using, and what’s the audio interface? (e.g. I use a Behringer UMC204HD on Arch Linux, which has just two channels.)

As for panning, I’m pretty sure the built-in panning functions only work between the first two audio channels (left and right, by assumption). But you should be able to achieve the same effect by sending audio to other channels and modifying the `amp:` keywords to adjust levels. If you want the volume to stay constant, there are some small subtleties—see [the SuperCollider documentation](http://doc.sccode.org/Classes/Pan2.html) for some hints.

Good luck, and please let us know how it goes!

---

<div class="post-metadata">

### Author: ![wysiwyggins](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/wysiwyggins/32/2493_2.png) [@wysiwyggins](https://in-thread.sonic-pi.net/u/wysiwyggins)
#### Post date: [February 6, 2023, 6:31pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/4 "2023-02-06T18:31:48Z")

</div>

I’m currently trying a rpi 4 with raspbian and a cheapo StarTech usb audio device. Raspbian sees the channels on the device and I have output in the speaker-test. I do have some problems where the audio device is occasionally giving speaker test a busy error though, so I may move over to a Mac with whatever mac compatible 5.1 audio device I can locate. I’d love to stay on the Rpi and run the project headless (this is for an art installation), so maybe I should look for a more dependable audio interface.

I’ll keep you posted as I experiment.

---

<div class="post-metadata">

### Author: ![R2L](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/r2l/32/2508_2.png) [@R2L](https://in-thread.sonic-pi.net/u/R2L)
#### Post date: [February 23, 2023, 2:28pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/5 "2023-02-23T14:28:28Z")

</div>

On Linux with Jack or Pipewire backends you can route up to 16 channels coming from SupperCollider. In the Sonic Pi script use the sound\_out or sound\_out\_stereo fx, I would think this is the same on Raspberry Pi if you install Jack and QJackCtl?:

```ruby
    with_fx :sound_out_stereo, output: 3 do
      ...
    end
    
    with_fx :sound_out_stereo, output: 5 do
      ...
    end
    
    with_fx :sound_out_stereo, output: 7 do
      ...
    end

```

On my system routing looks like this:

![Schermafdruk_2023-02-23_15-20-02](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/2/26be9fa7fd281f460ec73b9c6becde3dc27ff42d.png)

Where output 1 and 2 are the default, `with_fx :sound_out_stereo, output: 3` sends the output to 3 and 4 and so on.

So it will still be mono going to one channel or stereo going to 2 channels, no true surround sound.

---

<div class="post-metadata">

### Author: ![wysiwyggins](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/wysiwyggins/32/2493_2.png) [@wysiwyggins](https://in-thread.sonic-pi.net/u/wysiwyggins)
#### Post date: [February 23, 2023, 2:47pm UTC](https://in-thread.sonic-pi.net/t/5-1-audio-output/7518/6 "2023-02-23T14:47:33Z")

</div>

This is very helpful! I’m not playing anything from a 5.1 mix down so just playing to individual mono lines out is fine for me.
