If I can send audio to the output devices, then I can record the same audio as a wave. With filesystems, you can just setup a loopback filesystem and write binary data on a file instead of a device.

My question is: Can I send the audio signal to a (for instance) WAV file instead of my audio devices? How?

  • The video introduced four sound card loopback modes. youtu.be/pqV3P9zRyYc
    – user119451
    Jun 15, 2015 at 8:01

4 Answers 4



Actually there are lots of ways. You can set up a sound dummy sound card device that you can just rip the data out of the device ... however this isn't a very useful format.

More useful to you is something like the arecord utility that allows you to eavesdrop on the alsa output stream and save it to several known formats. Basically anything that you can get to play over the alsa sound system can be copied to a standard format sound file.

Similar tools exist for pulse audio.


If your system, or just the application you want to record, is directing its output to a sound server, look into recording possibilities for that sound server. For example, on Ubuntu, the official sound server is PulseAudio, which comes with the parec command (from the pulseaudio-utils package Install pulseaudio-utils http://bit.ly/software-small). You may need to convert the output from parec into something usable with SoX (Ubuntu: sox Install sox http://bit.ly/software-small).

parec -r --rate=44100 | sox --type raw --rate 44100 - --type ogg recording.ogg

It is supposed to be possible to record directly in to Audacity, but I couldn't get that to work on my system (Ubuntu 10.10). So following the instructions here from the Audacity wiki, I use the ALSA playback device to divert the audio to a file.

This uses an .asoundrc file (in your home directory):

pcm.teeraw {
   type empty
   slave.pcm "tee:default,'/tmp/out.raw',raw"
   # 48000 S16_LE 2ch (aplay -t raw -f dat)

For recording from flash (on firefox), I use

FLASH_ALSA_DEVICE=teeraw firefox

The resulting file, /tmp/out.raw is in raw format so converting it needs knowing what the right parameters are. Bizarrely, lame seems able to work this out for itself but sox needs to know it explicitly. So the following all seem to work:

aplay -t raw -f dat -r 44100 /tmp/out.raw # to play
sox -r 44100 -b 16 -e signed -c 2 /tmp/out.raw /tmp/out.wav # to convert to wav
lame /tmp/out.raw # to convert to mp3
  • The link from the Audacity wiki is dead.
    – Suzana
    Nov 25, 2015 at 18:47

There is a loopback driver in the ALSA tree, aloop-kernel.c (via here); which you'd have to build yourself (and figure out its utilization as a a device through audio applications like aplay/arecord) ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.