Firefox - How to make sound output to /dev/dsp1?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Sun Apr 26, 2009 5:56 am

I would like to make Firefox output all sound specifically to /dev/dsp1. How can this be done?

This is the precise approach which I use to receive all sound in VLC, under the 'Unix OSS audio output' in the 'Audio' tab in the VLC preferences. Doing this with Firefox should also allow me to hear sound when viewing Youtube, etc.

How can Firefox sound be routed to a specific output such as /dev/dsp1?
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Linux Mint is funded by ads and donations.
 

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Husse on Sun Apr 26, 2009 2:50 pm

I don't know, but possibly with the asound.rc file like in this link
http://www.mail-archive.com/fsck@mtcs.t ... 00882.html
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Tue Apr 28, 2009 9:12 am

Thank you for your help and for pointing out this article. It looks really positive.

The writer of the article posts some initial code. He then some more code which he identifies as a script.

Can you help me understand what I should do with the code which the article writer has posted in that link?

Thank you for your help and support.
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Husse on Wed Apr 29, 2009 6:01 am

I have to guess how much you all know and as you talked about sound to /dev/dsp1 I thought you knew a lot :)
That link is a bit difficult for the non geek :)
Start by creating a file in home called .asoundrc
The dot in the beginning means it's "hidden"
Add this to it
Code: Select all
pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

Create another file in home called setaudio or whatever you like
Add this to it
Code: Select all
#!/bin/bash

if [ -e /dev/dsp1 -a ! -e ~/.asoundrc ]; then
  cat > ~/.asoundrc << ASOUNDRC
pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}
ASOUNDRC
fi

if [ -e ~/.asoundrc -a ! -e /dev/dsp1 ]; then
  rm ~/.asoundrc
fi

exec "$@"
#-----  end  setaudio -----

Make the file executable (right click)
According to the link:
Then I can just do:
$ setaudio firefox
or
$ setaudio totem movie.avi
(In the terminal - I think you can make a launcher if you like)
No sudo anywhere in this!
Hope this clears things up
I hope
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Thu Apr 30, 2009 2:33 am

Thank you so much for your kind and considerate assistance. I must admit that my opening post must have been rather misleading as to my very low level of bash experience!

I already had a file called .asoundrc. When I viewed it for the first time I could see that it contained the following:

# ALSA library configuration file

# Include settings that are under the control of asoundconf(1).
# (To disable these settings, comment out this line.)
</home/rp/.asoundrc.asoundconf>


So I added the designated code to it, leaving a line space between after the existing text which it contained. I backed up the original .asoundrc file to my desktop first, and then pasted the new text in as you advised.

I then created a new file in /home called 'setaudio'. I pasted all the designated code into it as you suggested.

I right clicked on that file, went to the permissions tab and ticked the only check box for 'execute'.

I then opened a terminal and typed:
Code: Select all
setaudio firefox

And then pressed 'enter'.

I then received the following response from the terminal:
bash: setaudio: command not found


So I had a think, and then went to Nautilus preferences, went to the Behaviour tab, and then changed the radio button selection from: View executable text files...' to 'Run executable text files'.

I double click on the 'setaudio' file again in Nautilus. Nothing happens.

I tried audio with Firefox, and to my amazement, it now worked!

Would I be right in thinking that the double-clicking in Nautilus is what did the trick, albeit silently?

How could I make this work at the command line, as well, as intended?
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Husse on Thu Apr 30, 2009 6:43 am

Yes the double click did it
When I read this little script it's as something is missing - and that's how it's directed to FF and Totem
If it works ok then there's nothing more to it
If you want this to autostart at boot time you could just add the script without the
#!/bin/bash
between the comments and exit 0 in /etc/rc.local
I think it runs fine in terminal just as setaudio - nothing more
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Thu Apr 30, 2009 4:14 pm

Thank you for confirming that 'setaudio' alone will do the job, in the terminal.

And thank you even more for explaining how to make the script work automatically from startup. This will be essential for my specific purposes, and will make my life a great deal easier!

Thank you!! :D
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Sat May 02, 2009 12:05 pm

I try typing 'setaudio' in the terminal, but I still receive the response:

Code: Select all
bash: setaudio: command not found


How can I make this command work from the terminal?
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Husse on Sat May 02, 2009 1:01 pm

It works from terminal (I hope :))
However home is not in your path so you would have to do /home/your_name/Desktop/setaudio if you have setaudio on the Desktop
I should have pointed that out straight ahead - sorry
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: Firefox - How to make sound output to /dev/dsp1?

Postby Pipps on Sat May 02, 2009 4:30 pm

That makes perfect sense now! Thank you! :D
Pipps
Level 1
Level 1
 
Posts: 47
Joined: Sat Oct 25, 2008 1:51 pm

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: karlchen, niowluka and 19 guests