The Computer Oracle

How can I record sound from the windows command line?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: The World Wide Mind

--

Chapters
00:00 How Can I Record Sound From The Windows Command Line?
00:20 Accepted Answer Score 10
00:37 Answer 2 Score 1
01:05 Answer 3 Score 13
01:19 Answer 4 Score 6
02:18 Thank you

--

Full question
https://superuser.com/questions/192327/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windowsxp #commandline #audio #recording

#avk47



ANSWER 1

Score 13


rec is no longer provided in the SoX Windows package. Instead you can use this command line:

sox -t waveaudio -d new-file.wav



ACCEPTED ANSWER

Score 10


You can use SoX package.

rec recorded_track.wav 00:05

Records for 5 minutes.

More documentation on SoX manpage.




ANSWER 3

Score 6


To record sound using command line on Windows you can use fmedia:

fmedia --record --out=Recording.wav

You can stop recording at any time by pressing Ctrl+C.

While recording, fmedia shows how loud the signal is, for example:

g:\fmedia>fmedia --record --out=myrec.flac
fmedia v0.10
0:19  [========..] -7.89dB / -1.31dB

Supported formats are WAV, FLAC, OGG and MP3. Output to WAV is the fastest. However, FLAC compression is quite fast too, so you probably won't notice any difference in CPU usage.


If you want to capture sound from a specific device (not just the default one):

Step 1. Use --list-dev switch to show all available devices.

Step 2. Pick a device you want to use and call fmedia with --dev-capture argument.

For example, start recording from a specific device - Microphone:

C:\>fmedia --list-dev
fmedia v0.10
Playback:
device #1: Realtek Digital Output (Realtek High Definition Audio)
device #2: Speakers (Realtek High Definition Audio)

Capture:
device #1: Stereo Mix (Realtek High Definition Audio)
device #2: Microphone (Realtek High Definition Audio)
device #3: Line In (Realtek High Definition Audio)

C:\>fmedia --record --out=Recording.wav --dev-capture=2



ANSWER 4

Score 1


This is old but might be an alternative

LiveInCode

This program encodes live audio from line-in or microphone directly into Ogg Vorbis, MP3, FLAC, Speex and other formats.

The current version only has built-in support for Ogg Vorbis and Speex. It means you can use any other encoders too, but for encoders other than Ogg Vorbis and Speex you'll need to manually specify the command-line.