You are not logged in.

#1 2013-01-03 17:59:06

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Proper audio setup?

Hello there!

I'm new to Archlinux and this is my first post on this forum. I've been using Ubuntu for about 2 years but I learned nothing about Linux. Now I have fast system where I installed only those things I wanted and I feel I accomplished something. I was able to setup my internet connection, installed X11 and then Openbox with some themes and icons. I also installed Tint2 and Dropbox which shows on it nicely and managed to install Pacaur which manages AUR packages nicely. I was even clever enough to mount my Windows and Ubuntu partitions and copy-pasted script which pops-up when USB drive is inserted. All in all I have now fairly well performing system and I would be ready to run cfdisk and delete my Ubuntu partition if there weren't one big annoyance: SOUND.

In every situation I presented above I was complete noob but with Google and magnificent Archwiki I learned everything I needed to overcome all problems. Even though there's still much work to do, I have at least a glimpse on what is it about and where should I look for help. But one thing I'm completely lost in is sound configuration.
According to alsamixer I have 3 devices:
0. Lexicon Alpha (USB sound card)
1. HDA Intel
2. HDA ATI HDMI

Since I have my speakers plugged into Lexicon Alpha, and plan to use it solely, I don't care about the two others. I have ALSA (default from installation) and I also installed pulseaudio in an effort to solve my sound issues. Here's a list of features I expect to get from my sound setup (sorted by priority):
1. Play music & videos via VLC and Youtube.
2. Record basic input from my microphone.
3. Complete audio workstation: MIDI sequencing by Rosegarden with soundfonts provided by Qsynth (or something else), drum writing done in Hydrogen, everything synchronized via Jack and put it into Ardour where I can record other sound from outside.

Right now, I'm trying to get point 1 working. VLC seems to work after I directly told it to use ALSA. Youtube randomly works. Right now it's fine but sometimes it works only after reinstallation of flashplugin and sometimes not at all. But my goal is not only to get something working. I'd like to know what I'm doing. Are there any configuration files where I could easily tell my system what soundcards to run (or not to)? How to tell Firefox to use one particular driver or sound card? Is it neccessary to have Pulseaudio installed? If possible I'd love to get rid of it. I'm totally lost and know nothing about how sound works on linux. I remember that I was able to run all 3 points in my Ubuntu days but I was as lost as I'm now and it had stopped working some time ago as well.

And yes, I read ALSA Archwiki, Pulseaudio documentation and various Google results. I found solutions like copy-paste this to get that working but none of them helped me in terms of understanding my sound system. Most of them I didn't onderstand. Here's a summary of what I'm trying to accomplish:

- Get point 1 working at 100% (other points are not that important and I think I should be able to figure them out once I know how to do the rest).
- Know whether Pulseaudio is neccessary for point 1, 2 and 3.
- Know how to configure my system to use only Lexicon Alpha (but with an option to take it back).
- Overall Improve my knowledge of audio in Linux to the point where I'm able to determine what to Google for.

I'd be glad if someone helped me out or at least point me at a reasonable source of information.

Cheers,
Kubouch

Offline

#2 2013-01-03 18:47:48

brebs
Member
Registered: 2007-04-03
Posts: 3,414

Re: Proper audio setup?

See my ~/.asoundrc, read it and play with it.

No, you will not need pulseaudio.

Kubouch wrote:

Complete audio workstation

Ah, in that case you probably want a realtime kernel, or maybe the BFS scheduler with threadirqs will be sufficient. Maybe Gentoo Studio has good ideas.

Offline

#3 2013-01-03 19:05:43

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,657

Re: Proper audio setup?

Kubouch wrote:

3. Complete audio workstation: MIDI sequencing by Rosegarden with soundfonts provided by Qsynth (or something else), drum writing done in Hydrogen, everything synchronized via Jack and put it into Ardour where I can record other sound from outside.

You might also want to take a look at LinuxBBQ Rocks: http://linuxbbq.org/bbs/viewtopic.php?f=3&t=30

Offline

#4 2013-01-03 19:21:15

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: Proper audio setup?

brebs wrote:

See my ~/.asoundrc, read it and play with it.

No, you will not need pulseaudio.

Thanks, breps, this is helpful. I'll look into the file, it seems to be very well descripted. Also good to know Pulseaudio isn't necessary. I like to keep things as small as possible.

breps wrote:
Kubouch wrote:

Complete audio workstation

Ah, in that case you probably want a realtime kernel, or maybe the BFS scheduler with threadirqs will be sufficient. Maybe Gentoo Studio has good ideas.

I'm aware of realtime kernels but I'd rather solve my basic issues first, then delete Ubuntu and after that I can play with kernels. I'll look into it, eventually, when the right time comes.

2ManyDogs wrote:
Kubouch wrote:

3. Complete audio workstation: MIDI sequencing by Rosegarden with soundfonts provided by Qsynth (or something else), drum writing done in Hydrogen, everything synchronized via Jack and put it into Ardour where I can record other sound from outside.

You might also want to take a look at LinuxBBQ Rocks: http://linuxbbq.org/bbs/viewtopic.php?f=3&t=30

As I replied to breps, my main priority is to get my bearings, set up my sound to work reliably and then fiddle with recording. But LinuxBBQ is another distro, isn't it? I'd rather not reinstall my system once again. But thanks for the reply, anyway. I can at least look at the list of applications to broaden my horizons.

Offline

#5 2013-01-03 19:26:09

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,657

Re: Proper audio setup?

Kubouch wrote:

As I replied to breps, my main priority is to get my bearings, set up my sound to work reliably and then fiddle with recording. But LinuxBBQ is another distro, isn't it? I'd rather not reinstall my system once again. But thanks for the reply, anyway. I can at least look at the list of applications to broaden my horizons.

Yes, it's another distro. But it's already set up with the applications on your list and a real-time kernel, so installing it would probably be easier than installing and configuring everything in Arch. But hey, it's your system. Just trying to show you some options.

Offline

#6 2013-01-04 12:13:06

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: Proper audio setup?

I progressed. According to ALSA Archwiki instructions, in ~/.asoundrc I defined Lexicon Alpha to be my default sound card. Then I installed alsaequal and copy-pasted the script into ~/.asoundrc. After running alsamixer -D equal, sound is on. If I don't install system-wide equalizer, sound in Youtube doesn't work even though I have specified my default sound card already. Isn't that wierd? Isn't equalizer only responsible for controlling volume levels, muting channels and such? In alsamixer my USB sound card has no options avaliable to change so it would be pointless to use it if its absence didn't prevent me playing videos on Youtube.

Offline

#7 2013-01-04 12:28:52

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Proper audio setup?

@Kubouch, you don't need alsaequal, only alsa-lib and alsa-utils should be needed to get running. What is the contents of your .asoundrc? Are you using dmix?


ᶘ ᵒᴥᵒᶅ

Offline

#8 2013-01-05 09:23:21

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: Proper audio setup?

Thanks for response, litemotiv. I have both alsa-lib and alsa-utils. Does it mean that only these two packages (and their dependencies ofc) are required for successful playback both from system and flashplugin?

Here's what I currently have in .asoundrc:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

ctl.equal {
type equal;
}

pcm.plugequal {
  type equal;
  # Modify the line below if you do not
  # want to use sound card 0.
  #slave.pcm "plughw:0,0";
  #by default we want to play from more sources at time:
  slave.pcm "plug:dmix";
}
#pcm.equal {
  # If you don't want the equalizer to be your
  # default soundcard comment the following
  # line and uncomment the above line. (You can
  # choose it as the output device by addressing
  # it with specific apps,eg mpg123 -a equal 06.Back_In_Black.mp3)
pcm.!default {
  type plug;
  slave.pcm plugequal;
}

The first three lines should define Lexicon Alpha to be the default soundcard.
Next comes the script which - as I understand it - makes me use system-wide equalizer. I don't really understand what it is and what it is good for but if it isn't necessary, I'll probably get rid of it.

I don't really know what 'dmix' is so I don't think I use it unless it's default part of my system. When I do

pacman -Qs dmix

it does search nothing.

Offline

#9 2013-01-05 10:32:06

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Proper audio setup?

Kubouch wrote:

Thanks for response, litemotiv. I have both alsa-lib and alsa-utils. Does it mean that only these two packages (and their dependencies ofc) are required for successful playback both from system and flashplugin?

Yes it's really quite simple, if the Lexicon is card 1 then this should be enough to use it from any application:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

However, by default this only allows 1 program at a time to use the audio output. To work around this you need an audiocard with hardware mixing (which your card doesn't do i think), or you can enable dmix to do the mixing in software.

To achieve this install the "alsa-plugins" package and use this .asoundrc:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

defaults.pcm.type asym
defaults.pcm.rate_converter "samplerate_best"

ᶘ ᵒᴥᵒᶅ

Offline

#10 2013-01-16 11:08:22

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: Proper audio setup?

So right now, everything works quite fine. I have uninstalled flashplugin which apparently helped a lot. Right now I have only alsa-lib, alsa-utils and alsamixer installed. In .asoundrc I have only the first three lines.

litemotiv wrote:

However, by default this only allows 1 program at a time to use the audio output. To work around this you need an audiocard with hardware mixing (which your card doesn't do i think), or you can enable dmix to do the mixing in software.
...

I can play music from PC and internet sounds at the same time so there's probably no issue.

On rare occasions, however, I don't get sound from Firefox and need to restart. If that happens and I open alsamixer, I see that my default card is set to Intel for some reason. This happens mostly when I play Youtube video right after boot. It doesn't happen often, though.

All in all, I can live with the playback setup I have right now. The only thing which troubles me a bit is why sometimes after starting Firefox my default sound is changed to the wrong one. I think the real fun will begin when I decide to record something :-).

Offline

#11 2013-01-16 13:25:59

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,699
Website

Re: Proper audio setup?

Card numbering may not be consistent between boots.  I prefer to use the naming scheme - I don't remember off the top of my head how it works, but it's in the docs.

I just wanted to add that I learned quite a bit from breb's example asoundrc a while back (thanks BTW), but I also found the alsa wiki to be a great info source - not the alsa page on the arch wiki, though that is good, but the alsa-project wiki (which for some odd reason is very low on the results list whenever I search for it):

http://www.alsa-project.org/main/index.php/Main_Page


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#12 2013-01-17 08:20:49

fivedigits
Member
Registered: 2012-12-12
Posts: 13

Re: Proper audio setup?

If the points in your list are thus far all that you care about when it comes to audio i would propose another setup that simplified things for me a lot.

You could:
1. Start you're jackserver at startup via systemd using your prefered soundcard.
2. Use jack-plugins for VLC and flash.

This would avoid using pulseaudio which is in my opinion a pita when you also want to do some recording and playing with hydrogen etc.
It would still be possible to dynamically load other soundcards at startup if your primary is not available via a simple script and fixed slots for each soundcard in /etc/modprobe.d/alsa-base.conf .

Edit:
Getting basic setup working is probably a good idea, nevertheless i learned that compiling a realtime kernel is a breeze on arch, there is an excellent linux-rt package in the aur.

Last edited by fivedigits (2013-01-17 08:26:01)

Offline

#13 2013-01-17 19:01:33

Odaer
Member
Registered: 2010-08-14
Posts: 87

Re: Proper audio setup?

I think the easiest solution today is route pulseaudio to jack when I use recording software.
If you use the jack2-dbus you can even  playing sound with pulseaudio, start jack realese alsa from pulseaudio, and plug in the soundstream from pulseaudio in jack instead, without loosing the soundstream you playing.

Offline

#14 2013-01-21 11:56:12

photong
Member
Registered: 2013-01-21
Posts: 1

Re: Proper audio setup?

I'm not sure about recording, but for general sound playback over usb audio, see:

http://ubuntuforums.org/showthread.php?t=922860

I used the index method (there's also a "slot" method, see alsa website) to make sure that my usb card was always hw0:0 (default card). Without the index assignment, my onboard intel audio would sometimes become default.

Adam

Offline

Board footer

Powered by FluxBB