First I tried using the loopback device, but I've had problems similar to those in other threads:
viewtopic.php?f=3&t=4485
viewtopic.php?f=3&t=3576
The first time running ossrecord works, but anytime after it records garbage. Running "soundoff" and "soundon" as root allows it to be recorded one more time. Some of the threads I read on this board suggested trying different settings in ossxmix, but none of the settings I tried worked. My experience agrees with what's written in the oss_hdaudio manpage:
Unfortunately the mixer and control panel interface (see ossmix(1)) for
"generic" systems is very cryptic and difficult to understand. To solve
problems with volumes or signal routing you need to start ossxmix(1)
and change the controls one at time until you get the desired effect.
It's full of names like "mix2" and "mix3" none of which are explained anywhere.
I thought there might be problems with the loopback device for my soundcard and/or the driver (oss_hdaudio). So I tried using oss_audioloop instead. This does work better, but I found that the audioloop could very easily get stuck. For example, if I run "ossrecord -d /dev/oss/oss_audioloop0/server0 tmp.wav" in one window, and then "mplayer -ao oss:/dev/oss/oss_audioloop0/pcm0 tune.mp3" in another, it will start recording fine. If I then kill ossrecord, mplayer will continually print an error message saying "Audio device got stuck!", which is to be expected. But then if I try the same thing again, ossrecord starts fine, but then mplayer won't start, saying that it couldn't open the driver. Running "ossinfo -v" while ossrecord is playing outputs the lines:
Code: Select all
Audio loopback 0 server side /dev/oss/oss_audioloop0/server0 (device index 6)
Legacy device NONE
Caps: TRIGGER VIRTUAL HIDDEN
Modes: IN/OUT
Engine 1: Busy (IN) by PID 23657 / ossrecord label 'ossrecord'
Audio loopback 0 /dev/oss/oss_audioloop0/pcm0 (device index 7)
Legacy device /dev/dsp7
Caps: TRIGGER VIRTUAL
Modes: OUTPUT
Out engine 1: Busy (OUT) by PID 22816 / mplayer label 'mplayer'
Notice it thinks mplayer is still using the other end of the pipe. However, there is no mplayer process running.
Running it the other way round does the same thing: If I run mplayer on the master side, with "mplayer -ao oss:/dev/oss/oss_audioloop0/server0 tune.mp3", and record with ossrecord, the first time it works. But then if I kill mplayer and ossrecord, and try doing it again, mplayer appears to start playing even before I start ossrecord, when it should be hanging waiting for the other end to be opened. ossrecord prints the message
Code: Select all
/dev/oss/oss_audioloop0/pcm0: Device or resource busy
There is some other application using this audio device.
Exit it and try again.
You can possibly find out the conflicting application bylooking
In the ossplay source code at http://manuals.opensound.com/developer/ossplay.c.html the code for this error message is
http://manuals.opensound.com/developer/ossplay.c.html
Code: Select all
case EBUSY:
print_msg (ERRORM,
"\nThere is some other application using this audio device.\n"
"Exit it and try again.\n");
print_msg (ERRORM,
"You can possibly find out the conflicting application by"
"looking\n",
"at the printout produced by command 'ossinfo -a -v1'\n");
I don't know what happened to the last line of the error message, but ossinfo -a -v1 gives
Audio loopback 0 server side /dev/oss/oss_audioloop0/server0 (device index 6)
Legacy device NONE
Caps: TRIGGER VIRTUAL HIDDEN
Modes: IN/OUT
Engine 1: Busy (OUT) by PID 27434 / mplayer label 'mplayer'
Audio loopback 0 /dev/oss/oss_audioloop0/pcm0 (device index 7)
Legacy device /dev/dsp7
Caps: TRIGGER VIRTUAL
Modes: INPUT
In engine 1: Busy (IN) by PID 25052 / ossrecord label 'ossrecord'
despite there being no ossrecord process.
I may be able to work round this by being careful always to close the slave process before the master. I'm still not sure if it will be possible to record the sound of multiple processes one after another.
Output of ossinfo:
Code: Select all
Version info: OSS 4.2 (b 2008/201403042318) (0x00040100) GPL
Platform: Linux/i686 3.2.29-smp #1 SMP Mon Sep 17 13:02:10 CDT 2012 (darkstar)
Number of audio devices: 8
Number of audio engines: 12
Number of MIDI devices: 0
Number of mixer devices: 1
Device objects
0: osscore0 OSS core services
1: oss_hdaudio0 Intel HD Audio interrupts=408 (408)
HD Audio controller Intel HD Audio
Vendor ID 0x8086293e
Subvendor ID 0x10250212
Codec 0: Unknown (0x10ec0272/0x10250212)
2: oss_usb0 USB audio core services
3: oss_audioloop0 audioloop
MIDI devices (/dev/midi*)
Mixer devices
0: High Definition Audio 0x10ec027 (Mixer 0 of device object 1)
Audio devices
HD Audio play pcm1 /dev/oss/oss_hdaudio0/pcm0 (device index 0)
HD Audio play pcm2 /dev/oss/oss_hdaudio0/pcm1 (device index 1)
HD Audio play pcm3 /dev/oss/oss_hdaudio0/pcm2 (device index 2)
HD Audio rec mix6 /dev/oss/oss_hdaudio0/pcmin0 (device index 3)
HD Audio rec mix5 /dev/oss/oss_hdaudio0/pcmin1 (device index 4)
HD Audio play pcm1 (vmix) loopback record /dev/oss/oss_hdaudio0/loop0 (device index 5)
Audio loopback 0 server side /dev/oss/oss_audioloop0/server0 (device index 6)
(Audio loopback 0 /dev/oss/oss_audioloop0/pcm0 ) (device index 7)
Nodes
/dev/dsp -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_in -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_out -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_mmap -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_multich -> /dev/oss/oss_hdaudio0/pcm0