stsaz / fmedia

fast audio player/recorder/converter
BSD 2-Clause "Simplified" License
212 stars 20 forks source link

Cannot record both from playback and microphone #54

Closed ghost closed 3 years ago

ghost commented 3 years ago

I can't understand how to both record speakers output and microphone input at the same time (e.g. a conversation on MS-Teams or Zoom).

These are my devices:

C:\Users\name.surname\Downloads>fmedia --record --dev-loopback=0 --dev-capture=0 -o rec.wav
fmedia v1.22 (win-x64)
Recording...  Source: float32 48000Hz stereo.  Press "s" to stop.
0:05  [..........] -40dB / -26.44dB  ^C
C:\Users\name.surname\Downloads>fmedia --list-dev
fmedia v1.22 (win-x64)
Playback/Loopback:
device #1: Altoparlanti (Realtek(R) Audio)
 Default Format: 2 channel, 48000 Hz
device #2: BenQ EW2480 (Intel(R) Display Audio)
 Default Format: 2 channel, 48000 Hz
device #3: Realtek HD Audio 2nd output (Realtek(R) Audio) - Default
 Default Format: 2 channel, 48000 Hz
Capture:
`device #1: External Mic (Realtek(R) Audio) - Default`
 Default Format: 2 channel, 48000 Hz
device #2: Microphone Array (Realtek(R) Audio)
 Default Format: 2 channel, 48000 Hz

Running fmedia as following does not record both sound sources (speakers and mic), but only speakers output:

C:\Users\name.surname\Downloads>fmedia --record --dev-loopback=0 --dev-capture=1 -o rec.wav

0 (default) loopback arg selects actually "device #1: Altoparlanti (Realtek(R) Audio)". I tried both 0 and 1 to capture mic but it keeps recording only my speakers output. I'm on Windows 10 Enterprise (version 1909).

stsaz commented 3 years ago

It's an interesting feature! fmedia will record from multiple sources simultaneously and mix the data together into one output stream. Let's hope I can find the time to implement this.

ghost commented 3 years ago

Sorry for not being of any help: not a C programmer, but I will try to stick my nose into the code anyway.

stsaz commented 3 years ago

In v1.23 there's a new feature:

 + Windows: record from capture and loopback device in parallel into separate files:
   "--record --dev-capture=N --dev-loopback=N -o rec$counter.wav"

Now you can record from both devices into separate files. Then you need to use some other tool like Audacity to mix the files together. fmedia doesn't yet have a user interface to properly mix files - it requires separate volume settings per track, for example, and there's no way to set it via command-line now.

Closing the issue for now. Please reopen if something doesn't work.

ghost commented 3 years ago

Thanks for the update, @stsaz .

Demi256 commented 3 years ago

When using --dev-capture=0 (select default input device) together with --dev-loopback=N (with any index for the output device) the input capture will be missing. Example:

fmedia.exe --record --dev-capture=1 --dev-loopback=0 --out=record$counter.wav
fmedia v1.24 (win-x64)
Recording...  Source: float32 48000Hz stereo.  Press "s" to stop.
0:00  [..........] -40dB / -40dB  Recording...  Source: float32 48000Hz stereo.
 Press "s" to stop.
0:08  [=======...] -11.56dB / -2.86dB

saved file record1.wav, 1391 kbytes
saved file record2.wav, 1388 kbytes

fmedia.exe --record --dev-capture=0 --dev-loopback=0 --out=record$counter.wav
fmedia v1.24 (win-x64)
Recording...  Source: float32 48000Hz stereo.  Press "s" to stop.
0:08  [======....] -13.95dB / -2.47dB
saved file record1.wav, 1443 kbytes

Also on the console output, the timer for the input device does not update and a line break before the second "Recording..." would help with redability.

stsaz commented 3 years ago
fmedia v1.24.1 - May 17, 2021

 - capture stream didn't work with "--dev-capture=0 --dev-loopback=N"

Thank you, @Demi256

Also on the console output, the timer for the input device does not update and a line break before the second "Recording..." would help with redability.

It seems difficult. It would require special treatment in TUI module for these recording tracks -- harder to maintain.