3

I’m trying to figure out how to record the system audio from raspbian. I want to record audio from either the OS or a specific program... like recording an audio stream... if it possible? I tried searching but everything is talking about using a USB sound card. Any help is appreciated.

3
  • Your question is not very clear. What sort of audio signal do you wish to record. Is it your human voice input to a microphone, and you want to convert it into an mp3 file. Or do you wan to convert and analog signal output from a microphone input to the USB sound card, and convert it to digital signal stream? And what is the longest time of audio you want to record, say less than 10 seconds, or longer than 1 hours. And what is the sound quality you wish, say mp3, VCD, 44.1kHz sampling rate or higher?
    – tlfong01
    Commented Feb 11, 2020 at 5:34
  • For DIY hobbyists, usually the first thing to try is using an low resolution 10/12 bit ADC, say converting a microphone pre amp output to digital signals using MCP3008, or using dirt cheap HiFi ADC module such as: PCM1802: raspberrypi.stackexchange.com/questions/107778/….
    – tlfong01
    Commented Feb 11, 2020 at 5:37
  • you are welcome. Happy recording. Cheers.
    – tlfong01
    Commented Feb 11, 2020 at 8:32

1 Answer 1

2

I want to record audio from either the OS or a specific program.

You can store all speaker output by this procedure.

  1. Install these packages:

    sudo apt-get install pulseaudio-utils lame
    
  2. Search for your speakers and tap into your speaker's monitor stream:

    pacmd list-sinks | grep -e 'name:' -e 'index' -e 'Speakers'
    

    Find the monitor stream by:

    pacmd list-sources | grep -e 'name:' -e 'index'
    

    enter image description here

  3. Play anything you want to record and run this command with your alsa monitor output:

    parec -d alsa_output.pci-0000_00_1f.3.analog-stereo.monitor | lame -r -V0 - OutputAudio.mp3
    
  4. Hit ctrl+c to stop recording. Play the OutputAudio.mp3.


Source

2
  • 1
    Thanks @M.Rostami I’ll give that a try. I’m sorry if I didn’t make the question clearer. Your answer is exactly what I am trying to do. Thanks again.
    – randbasic
    Commented Feb 11, 2020 at 7:33
  • Thanks too much. Your answer helped me too, I'm trying to record sys audio with microphone audio in the same time is it possible using lame & parec? Commented Mar 26, 2021 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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