You are not logged in.

#1 2005-03-31 15:42:55

cornjump
Member
Registered: 2005-03-31
Posts: 6

script for alsa, alsamixer dmix and modules

First, excuse me for my bad english

Hi
I've wrote my first script in bash and this is for archlinux.
This one install all necessary packages, check with hwd what are the sound cards modules that have to be probe, write the /etc/rc.d/alsamixer module and install dmix

It also modify /etc/rc.conf to had the modules and the deamon and add a user to the audio group.

The script works fine on my computer but i'd like to know if it really works well.

install_alsa.sh

Offline

#2 2005-03-31 15:51:17

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: script for alsa, alsamixer dmix and modules

very nice script

it will really simplify arch instalation.

Offline

#3 2005-03-31 15:56:03

cornjump
Member
Registered: 2005-03-31
Posts: 6

Re: script for alsa, alsamixer dmix and modules

tanks, but it seems to still have some problems with it.

Offline

#4 2005-04-08 19:32:51

cornjump
Member
Registered: 2005-03-31
Posts: 6

Re: script for alsa, alsamixer dmix and modules

Well, it seems to work fine now.
I'll maybe add some fonctionality as for exemple, choice between alsaconf or manual install for the sound modules. And other one will be the choice between french and english language (In english for the moment)

This script is the first part of a project for a script that will do a big part of post install of archlinux. After alsa, i'm working now on a script that will write an optimised xorg.conf, install the graphic card (nvidia & ati) and install a window manager as fluxbox, with a nice configuration of it.

This work is designed to newbies on archlinux as we have seen that this kind of configuration seems difficult for some people.

Offline

#5 2005-04-08 20:12:19

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: script for alsa, alsamixer dmix and modules

very interesting, cornjump... maybe you should collaborate with rasat and z4ziggy - they're the ones who made hwd...

Offline

#6 2005-04-08 20:31:13

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: script for alsa, alsamixer dmix and modules

nice script. i might consider adding something like that to Archie, so tnx.

my 2cents - instead of using "hwd -e" use "lshwd -a" which will modprobe the modules for u so u can remove your modrpobe's list.

Offline

#7 2005-04-29 09:16:35

leeghoofd
Member
From: the Netherlands
Registered: 2005-04-28
Posts: 61

Re: script for alsa, alsamixer dmix and modules

cornjump,

Thanks a lot for creating this script, it makes installing sound on arhc simpler but also faster!
I testet it on my computer and it works great!

But I have a question, it also installed dmix this means that I can play multiple sounds at the same time doesn't it? I tried it on gnome but that doesn't work. I selected alsa as sound output for gnome and tried playing two sounds at one time but the second waits until the first is done? Do you know if it's possible and how?

Woops, stupid, it is already in english, I must have done something wrong..

David

Offline

#8 2005-04-29 14:53:29

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: script for alsa, alsamixer dmix and modules

the direct alsa device won't use dmix, IIRC - you need to use the name configured in dmix... this script names it "dmixer"

Offline

#9 2005-05-03 11:49:50

pixel
Member
From: Living in the Server Room
Registered: 2005-02-21
Posts: 119

Re: script for alsa, alsamixer dmix and modules

Yes, the script is nice, one command and you got the sound set up... smile


Favorite systems: ArchLinux, OpenBSD
"Yes, I love UNIX"

Offline

#10 2005-05-07 19:09:36

leeghoofd
Member
From: the Netherlands
Registered: 2005-04-28
Posts: 61

Re: script for alsa, alsamixer dmix and modules

Hi,

I used this script on pretty much computers now, so it has already saved me pretty much time wink Thanks again!

May I give a few suggestions:

In the begin you check if the user is root with $USER, maybe it is better to use whoami instead. Because whoami will also see that you are root when you are root in su

Maybe clean up the output a bit, you probably know that you can pipe the output of a program to /dev/null, for instance instead of

amixer set Master 70 unmute

you could use

echo -n 'Setting Master volume to 70...'
if amixer set Master 70 unmute > /dev/null
then
    echo 'done'
else
    echo 'failed'
    exit 1
fi

And maybe use the same layout of output pacman uses.

Also something goes wrong with the /etc/rc.d/aslamixer script. It keeps al the n signs in it instead of new lines. I think it is better to have a seperated file alsamixer and distribute you script in a tarball, so you can easiely copy the file to /etc/rc.d. But of course this is just my opinion.

You often add something to the rc.conf file, because this happens often and is nearly the same everytime you maybe could use a function where you send the parameters, file (in this case rc.conf) variable_name (here it is DAEMONS or MODULES) and of course the value. (for instance alsamixer)

On the end of the script you ask width users you want to add to the audio group. You can check if the user is already in the audio group (cat /etc/groups | grep audio etc) and don't show that user because he's already in it and maybe filter out groups as ftp, svn, etc

This is just a very rough idee but what about that every configuration script that's (going to be) written for arch uses the same file and output layout. For instance that every configuration script has:
1: A standart name, for instance arch-config-audio, arch-config-grub etc
2: As I already mention the same output to the users
3: Two scipts, one called configure, this script would do (if needed) some hardware detection and ask the user questions. The second called install, this would do the time consuming installation and would never ask a question to the user. This way one can do all the configuration of the 'install scripts' directly after each other and than install everything, where the user can leave the computer.
4: And of course add those script to the one of the ftp servers so you can install them with pacman wink

Don't take the last idee too serious, I often have a lot of stupid idees big_smile

Cheers,
David

Offline

#11 2005-05-08 13:39:56

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,487

Re: script for alsa, alsamixer dmix and modules

The script destroyed my rc.conf, so the thing won't reboot anymore. It deleted an ) on the end of the daemons line, and this was it.


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

Board footer

Powered by FluxBB