LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Can't record sound going to speakers. Slackware error? Where is /dev/dsp? What? (https://www.linuxquestions.org/questions/slackware-14/cant-record-sound-going-to-speakers-slackware-error-where-is-dev-dsp-what-4175539291/)

GreyBeard 04-10-2015 02:00 AM

Can't record sound going to speakers. Slackware error? Where is /dev/dsp? What?
 
I run Slackware Linux 14.1 using KDE version 4.10.5 as my desktop manager, an it all runs on an Intel D5410M0 "Atom" Mini ITX board.

All I want to do is make a copy of whatever sounds are going to my speakers. I've been looking around for how to do this and I seen and tried commands like
ffmpeg -f oss -i /dev/dsp -ac 2 out.wav
or
arecord -f cd -d 10 -D default out.wav
I have tried many such commands with every "input" I can find which does not produce an error on the command line. (The "arecord -L" output is at the end of this post.) The commands which run yields either a silent .WAV file or a .WAV file which is just white noise. Obviously I am connecting to no input or to the wrong input.

I may have multiple problems here.


First off there is no /dev/dsp. If there is an equivalent I don't know what it is. The closest I get is /dev/snd/ which I presume has something to do with sound. The files under it are below, and they are the only "audio" group files under /dev.

root $?=0> ls -laF -R /dev/snd

/dev/snd:
total 0
drwxr-xr-x 3 root root 220 Mar 25 06:28 ./
drwxr-xr-x 16 root root 5540 Apr 9 19:42 ../
drwxr-xr-x 2 root root 60 Mar 25 06:28 by-path/
crw-rw---- 1 root audio 116, 7 Mar 25 10:28 controlC0
crw-rw---- 1 root audio 116, 6 Mar 25 10:28 hwC0D2
crw-rw---- 1 root audio 116, 5 Apr 9 19:45 pcmC0D0c
crw-rw---- 1 root audio 116, 4 Apr 9 19:46 pcmC0D0p
crw-rw---- 1 root audio 116, 3 Mar 25 10:28 pcmC0D1p
crw-rw---- 1 root audio 116, 2 Mar 25 10:28 pcmC0D2c
crw-rw---- 1 root audio 116, 1 Mar 25 06:28 seq
crw-rw---- 1 root audio 116, 33 Mar 25 10:28 timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Mar 25 06:28 ./
drwxr-xr-x 3 root root 220 Mar 25 06:28 ../
lrwxrwxrwx 1 root root 12 Mar 25 10:28 pci-0000:00:1b.0 -> ../controlC0
When I try the above under ffmpeg I get different errors for different devices:

[oss @ 0x9e55fc0] SNDCTL_DSP_SETFMT: Inappropriate ioctl for device
/dev/snd/pcmC0D0c: Input/output error
for most devices or, for hwC0D2, I get

[oss @ 0x9d22fc0] /dev/snd/hwC0D2: Permission denied
/dev/snd/hwC0D2: Input/output error
Note that I have checked file permissions and they are OK. Both my user account and root can do an LS of /dev/snd/hwC0D2 but not even root can read that file. I am a member of the "audio" group. There is no /lib/udev/rules.d/40-alsa.rules file.


The second problem is that when I log in a message box pops up with an error message. If I click on it or wait a while it goes away. It says:
Multimedia System
The audio playback device HDA Intel (ALC662 rev1 Analog) does
not work. Falling back to HDA Intel (ALC662 rev1 Analog).
Aside from not being able to record sound the rest of my sound system seems to work, ie I get sound from videos on Firefox, music or videos played through mplayer, the occasional system beep, etc. Nothing fancy, but the sound system works for me.

I seem to recall that this error message only showed up when I went to Slackware 14.0 or 14.1, I forget which. Since my sound system continued to work and the error message "falls back" to the same device which failed, I have ignored it. This is also why I am posting this here in Slackware first.

I tried running alsaconf but it just says, "No supported PnP or PCI card found. Would you like to probe legacy ISA sound cards/chips?" I looked at the legacy list and proceded no further. No help there.


And of course the third problem here is that this is well outside my area of expertise or, to be more accurate, when it comes to sound (and video) I have no idea what I am doing.

All I want to do is record the same sound that goes to my speakers. That should not be this hard. Suggestions or solutions would be much appreciated.


Thanks In Advance. :-)

-------------------------------

root $?=0> arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
HDA Intel, ALC662 rev1 Analog
Default Audio Device
sysdefault:CARD=Intel
HDA Intel, ALC662 rev1 Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers


root $?=0> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC662 rev1 Alt Analog [ALC662 rev1 Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0

arfon 04-10-2015 05:05 AM

Let me tell you what I learned when trying to do this...
1) It's hard (because like most opensource things, documentation absolutely sucks).

2) You need to enable/setup a loopback in your mixer.

3) It has nothing to do with /dev/dsp

That's as far as I got before giving up and putting an audio device on my outputs.

schmatzler 04-10-2015 05:44 AM

/dev/dsp is specific to OSS. Almost no one uses OSS for audio output anymore, this is all done by ALSA. Some even use another layer on top of that with Pulseaudio, Jack etc.

You can record the sound of your speakers in ALSA. But by default, any recording application is blocking the sound card, so you can either hear the sounds or record them.

I made a blog post about that a while ago - basically, it's setting up a loopback device and record the audio of the loopback device while still getting it out to the speakers:

http://schmatzler.de/en/2014/11/29/s...ulseaudiojack/

It's overly complicated to just record some things. I chose this approach since Pulseaudio doesn't run here (like the usual Poettering software), but it should work out-of-the-box with Pulseaudio.

Alien Bob 04-10-2015 06:52 AM

At almost the same time as schmatzler (well, one month later) I wrote a similar article: http://alien.slackbook.org/blog/a-jo...-in-slackware/ followed by an article how to setup Jack Audio: http://alien.slackbook.org/blog/sett...-in-slackware/

The first link will be helpful, the second link may be helpful.

schneidz 04-10-2015 08:39 AM

a while back i played around with netcat-ing sound from one machine to another. something like
Code:

##### pc1 #####
netcat -l 1515 > /dev/dsp
netcat <ip-address-of-pc2> 5151 < dev/dsp

##### pc2 #####
netcat -l 5151 > /dev/dsp
netcat <ip-address-of-pc1> 1515 < dev/dsp

i think there is a program called padsp to help emulate this old functionality.

slacktroll 04-10-2015 09:34 AM

Your INTEL HDA soundcard is probably crippled and won't support recording what's played up. :(
hope it's not. Mine is on my laptop. But on a older Laptop (X60 instead of X61) it works

ReaperX7 04-10-2015 03:54 PM

OSS is done by emulation through ALSA.

In Slackware, OSS is disabled by default. To enable it, run:

Code:

chmod +x /etc/rc.d/rc.aoss
And then restart ALSA:

Code:

/etc/rc.d/rc.alsa restart
This will allow Alsa's OSS to setup the correct device nodes as needed for /dev/dsp and associated nodes and load appropriate modules.

Nh3xus 04-10-2015 04:20 PM

You can also create a virtual Alsa device that is bound to your actual (as in regular) soundcard.

dugan 04-10-2015 04:42 PM

You need /dev/dsp, set /etc.rc.d/rc.aoss executable and run it.

EDIT: ReaperX already posted.

commandlinegamer 04-10-2015 05:30 PM

I needed to use OSS in the past when ALSA couldn't reliably run my Envy24 onboard sound (Chaintech motherboard). But that was a decade ago, and unfortunately recent attempts to use it just seemed to cause more problems than they solved.

Not that I'm impressed with ALSA. Having to craft configuration files by hand strikes me as little better than having to calculate one's own modelines for X (I've done that in the past, but I can't imagine anyone suggesting that would be acceptable nowadays unless you're trying to run some seriously ancient hardware).

ReaperX7 04-10-2015 07:41 PM

Although it's not recommended, especially when many apps look specifically for ALSA in Linux, you can use the OSSv4 driver.

You may have to rebuild MANY packages to use this driver, and honestly, I don't recommend it.

There is an ALSA toolkit specially for Envy24, last I knew, so you might want to look into it.

GreyBeard 04-11-2015 02:06 AM

Quote:

Originally Posted by ReaperX7 (Post 5345607)
OSS is done by emulation through ALSA.

In Slackware, OSS is disabled by default. To enable it, run:

Code:

chmod +x /etc/rc.d/rc.aoss
And then restart ALSA:

Code:

/etc/rc.d/rc.alsa restart
This will allow Alsa's OSS to setup the correct device nodes as needed for /dev/dsp and associated nodes and load appropriate modules.

There is no "/etc/rc.d/rc.aoss" file on my machine. When I install Slackware I install everything, tho I do not enable many of the services. Is there some service I am not running which creates this file? Did you install some package which does not come with the released Slackware? BTW, I checked this on my Slackware 14.1 machine on which I am trying to record sound and also my older Slackware 11.0.0 server machine. There is no rc.aoss file on either machine.

Thanks.

ReaperX7 04-11-2015 03:09 AM

Did you perform a complete install?

Alsa's OSS package has the required file.

Can you run:

Code:

ls /etc/rc.d/
And post the readout?

Didier Spaier 04-11-2015 05:49 AM

Quote:

Originally Posted by ReaperX7 (Post 5345757)
Alsa's OSS package has the required file.

No. In Slackware the Alsa OSS package includes shared libraries, the script /usr/bin/aoss and its associated man page but no startup script.

ReaperX7 04-11-2015 06:13 AM

Correction, the file name is /etc/rc.d/rc.alsa-oss and it's part of alsa-utils.

Sorry, but I'm not on Linux ATM to get everything completely correct. Often, you should double check the directories yourself rather than just follow what is posted so you can make sure you know what is needed in case a file name isn't exactly correct. This way you also learn your system also and get familiar with it better.


All times are GMT -5. The time now is 02:33 PM.