User avatar
JoelHinson
Posts: 90
Joined: Tue Dec 27, 2016 3:48 am

USB as primary audio out

Thu Jun 01, 2017 4:13 am

i have a new sequencer program and i would like to switch the audio out for the program from the out on the card to the USB and,.. so i am looking around and trying things and not having any luck at it. is there some way to just bypass the audio out on the card altogether and make the USB the primary audio out? perhaps Gordon Henderson or somebody could be so kind as to tell which config file to mod?? i would appreciate it. thanks

fruitoftheloom
Posts: 27226
Joined: Tue Mar 25, 2014 12:40 pm

Re: USB as primary audio out

Thu Jun 01, 2017 9:31 am

JoelHinson wrote:i have a new sequencer program and i would like to switch the audio out for the program from the out on the card to the USB and,.. so i am looking around and trying things and not having any luck at it. is there some way to just bypass the audio out on the card altogether and make the USB the primary audio out? perhaps Gordon Henderson or somebody could be so kind as to tell which config file to mod?? i would appreciate it. thanks
IF you are running Raspbian Jessie with Pixel Desktop then just right click on the Audio Applet and choose USB Device.

if you want a command line utility then install the alsa-utils package from the repository and run alsamixer.
Take what I advise as advice not the utopian holy grail, and it is gratis !!

User avatar
JoelHinson
Posts: 90
Joined: Tue Dec 27, 2016 3:48 am

Re: USB as primary audio out

Thu Jun 01, 2017 10:31 am

to just choose the USB setting does not switch the audio jack on the board to off and it is the default setting for the program and there isnt any kind of toggle option in the program. i was reading a couple posts on the net about "alsa-base.conf" / "alsa.conf" and there was instruction to make the USB the primary/default but that didn't work, what the post said to do. so then i was looking for a second opinion on either: "turning off the audio jack on the board in the config file" or "setting the USB to the primary/default"? if you have instruction on how to do that could you please fill me in?

User avatar
JoelHinson
Posts: 90
Joined: Tue Dec 27, 2016 3:48 am

Re: USB as primary audio out

Fri Jun 02, 2017 12:16 am

just trying to keep this topic fresh. this wasn't the advice i was looking for. once again i know how to adjust the setting on the alsamixer this is not the issue. the issue is a "seqencer" without any kind of selection feature that defaults to the audio out on the board. is there a way to make the default audio out the USB port? either by disabling the audio out on the board or making the USB the default?? its called "sonic pi" and it looks pretty cool and sounds ok but i'd really like to get the sound to default to the USB. any suggestions?
Attachments
Scan10097-2.jpg
Scan10097-2.jpg (62.81 KiB) Viewed 4890 times
Last edited by JoelHinson on Fri Jun 02, 2017 1:17 am, edited 1 time in total.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: USB as primary audio out

Fri Jun 02, 2017 1:11 am

How about just commenting out dtparam=audio=on in config.txt?

Code: Select all

#dtparam=audio=on

User avatar
JoelHinson
Posts: 90
Joined: Tue Dec 27, 2016 3:48 am

Re: USB as primary audio out

Tue Jun 06, 2017 12:50 am

which directory is this? and what is the scope of what that would effect? because i don't want all of the audio accessories "off", rather just would like the USB to be pointed to as the default.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: USB as primary audio out

Tue Jun 06, 2017 1:30 am

JoelHinson wrote:which directory is this? and what is the scope of what that would effect? because i don't want all of the audio accessories "off", rather just would like the USB to be pointed to as the default.
config.txt is usually located in the FAT16/32 boot partition -- /boot/config.txt.
audio -- Set to "on" to enable the onboard ALSA audio interface (default "off")
https://github.com/raspberrypi/linux/bl ... ays/README

Commenting it out or setting it to off (the default) should disable the onboard audio. The snd_bcm2835 module will not be loaded.

I've seen examples of people using an "index" parameter when loading the snd_usb_audio and snd_bcm2835 modules like this:
/etc/modprobe.d/alsa-base.conf

Code: Select all

options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd-usb-audio,snd-bcm2835
I'm not sure how that is supposed to work since it seems the only parameter that the snd_bcm2835 module accepts is force_bulk. Perhaps ordering them via the snd module's slots parameter works?

EDIT: http://alsa.opensrc.org/MultipleCards seems to confirm that.
How to choose a particular order for multiple installed cards

Which card is card number 0, 1 and so is by default determined by module load order. This is particularly useful to choose which card becomes the default one.

In theory therefore it is possible to choose which of several installed cards becomes card 0, the default one, by ensuring its driver module is loaded first. (Note: this assumes that each sound card requires a different driver. If you have two soundcards of the same type, please skip to the next section.)

There are two ways to achieve this, the "old" index= option of the card driver module, and the alternative (and new) slots= option of the snd module.

The older "index=" method
An example configuration for two sound cards is like below:

Code: Select all

# ALSA portion
options snd cards_limit=2
alias snd-card-0 snd-interwave
alias snd-card-1 snd-ens1371
options snd-interwave index=0
options snd-ens1371 index=1
# OSS/Free portion
alias sound-slot-0 snd-interwave
alias sound-slot-1 snd-ens1371
The newer "slots=" method

Alternatively, you can use the slot option instead of the index options:

Code: Select all

options snd slots=snd-interwave,snd-ens1371
Then, the first slot (#0) is reserved for snd-interwave driver, and the second (#1) for snd-ens1371. You can omit index option in each driver if slots option is used (although you can still have them at the same time as long as they don't conflict).

According to ALSA-Configuration.txt, The slots option is especially useful for avoiding the possible hot-plugging and the resultant slot conflict. For example, in the case above again, the first two slots are already reserved. If any other driver (e.g. snd-usb-audio) is loaded before snd-interwave or snd-ens1371, it will be assigned to the third or later slot.

User avatar
JoelHinson
Posts: 90
Joined: Tue Dec 27, 2016 3:48 am

Re: USB as primary audio out

Wed Jun 07, 2017 12:52 am

A+,.. that was a good tip. that pointed everything to the USB without having to go in and define everything as a priority within the alsa config. thanks for the advice ktb!!! (see attachment) see the problem is i built a box for the thing and added switches to the GPIOpins and i didnt plan the box for the "audio out" on the board, because i went and got the USB piece so it has "audio in",.. but then most of everything extra is pointed to the audio jack on the board,.. this solves this. i have been looking at all kinds of advice on this and have tried numerous techniques. thank you for your time and for helping me out.
Attachments
Scan10103-1.jpg
Scan10103-1.jpg (61.5 KiB) Viewed 4723 times

Return to “General discussion”