How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Ottavio
Level 1
Level 1
Posts: 31
Joined: Sat Apr 20, 2019 4:46 pm

How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by Ottavio » Sun Aug 25, 2019 2:28 pm

Hi,

I'm trying to find a way to record from my laptop mic and monitor it in my headphones at the same time.

At the moment, the only ways I've been able to do it are:

1)

Code: Select all

arecord -f cd|aplay
in one terminal tab, and:

Code: Select all

arecord -f cd foo.wav
in another tab. Alternatively:

2)

Code: Select all

(arecord -f cd |aplay &)  && arecord -f cd Downloads/foo.wav
in the same terminal window, but then I have to manually kill arecord.

Does anybody know a more elegant way to achieve the same result? Even with different software?

Thanks

User avatar
coffee412
Level 5
Level 5
Posts: 964
Joined: Mon Nov 12, 2012 7:38 pm
Location: Indiana, USA
Contact:

Re: How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by coffee412 » Sun Aug 25, 2019 3:15 pm

Use Audacity to record it.

The basics of it are:
1. Fire up Audacity
2. Select your input for Audacity to record.
* Test this by using your microphone and selecting the different inputs to find the one that works.
3. When done with recording you can just save it as a wav or mp3.

Hope this helps.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
IceWarp 12.0.3 * Mint 18.3 * RAID 1/5 * OpenVPN * Linux since kernel 2.0.36
************* Get Your Linux on! ***************

User avatar
phd21
Level 19
Level 19
Posts: 9177
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by phd21 » Sun Aug 25, 2019 3:33 pm

Hi Ottavio,

It would help to know more about your system setup. If you run "inxi -Fxzd" and "lsusb" from the console terminal prompt, highlight the results, copy and paste them back here, that should provide enough information.

If your microphone is connected to your computer properly then you should be able to hear it through your speakers, headset, headphones, without using any applications. I would recommend installing the superb Qasmixer and "Qas" packages and pulse audio control from the "Synaptic Package Manager (SPM)". You can use your system's sound settings or qasmixer or pulse audio sound control to make sure the microphone is on and the volume is at a good level. In qasmixer if you want to record your voice and the system's sounds from any application that may be playing, music app, browser, etc... enable "loopback" or if you have a "stereo mix" option under input then select that instead of mic. You may have to adjust application volumes and or mic volumes to make sure your voice can be heard over other audio sources.

You can use various desktop applications like Audacity, sound recorder, audio-recorder, etc... I just tested Audacity with and audio source of "sysdefault:mic0" and "mono" because I have a mono microphone, if you have a stereo mic, use stereo 2 channel. Again, you may have to adjust Audacity's mic volume to lower it if you see red in volume meter, or to increase it if it is too low.

Tutorial - Recording Computer Playback on Linux - Audacity Manual
https://manual.audacityteam.org/man/tut ... linux.html

SimpleScreenRecorder (SSR) is a great desktop recorder that can also record from various sound sources like your microphone.

Another post: You would use microphone source settings rather than "line-in" like "sysdefault:mic0".
Line input from my Casette Player - Linux Mint Forums
viewtopic.php?f=49&t=300294

Hope this helps ...
Last edited by phd21 on Mon Aug 26, 2019 11:03 am, edited 3 times in total.
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

Ottavio
Level 1
Level 1
Posts: 31
Joined: Sat Apr 20, 2019 4:46 pm

Re: How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by Ottavio » Sun Aug 25, 2019 4:02 pm

phd21 wrote:
Sun Aug 25, 2019 3:33 pm
Hi Ottavio,

It would help to know more about your system setup. If you run "inxi -Fxzd" and "lsusb" from the console terminal prompt, highlight the results, copy and paste them back here, that should provide enough information.

Hi,

Code: Select all

$ inxi -Fxzd
System:
  Host: e130 Kernel: 4.9.0-8-amd64 x86_64 bits: 64 compiler: gcc v: 6.3.0 
  Desktop: MATE 1.16.2 Distro: LMDE 3 Cindy base: Debian 9.3 stretch 
Machine:
  Type: Laptop System: LENOVO product: 33588QG v: ThinkPad Edge E130 
  serial: <filter> 
  Mobo: LENOVO model: 33588QG v: Win8 Pro DPK TPG serial: <filter> 
  UEFI: LENOVO v: H4ET98WW (2.58 ) date: 08/24/2016 
Battery:
  ID-1: BAT1 charge: 34.0 Wh condition: 60.8/62.2 Wh (98%) model: N/A 
  status: Unknown 
CPU:
  Topology: Dual Core model: Intel Core i3-3217U bits: 64 type: MT MCP 
  arch: Ivy Bridge rev: 9 L2 cache: 3072 KiB 
  flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 14366 
  Speed: 1404 MHz min/max: 800/1800 MHz Core speeds (MHz): 1: 1404 2: 864 
  3: 811 4: 1271 
Graphics:
  Device-1: Intel 3rd Gen Core processor Graphics vendor: Lenovo 
  driver: i915 v: kernel bus ID: 00:02.0 
  Display: x11 server: X.Org 1.19.2 driver: modesetting unloaded: fbdev,vesa 
  resolution: 1366x768~60Hz 
  OpenGL: renderer: Mesa DRI Intel Ivybridge Mobile v: 3.3 Mesa 13.0.6 
  direct render: Yes 
Audio:
  Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
  Sound Server: ALSA v: k4.9.0-8-amd64 
Network:
  Device-1: Intel Centrino Wireless-N 2230 driver: iwlwifi v: kernel 
  port: efa0 bus ID: 03:00.0 
  IF: wlp3s0 state: up mac: <filter> 
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Lenovo driver: r8169 v: 2.3LK-NAPI port: 3000 bus ID: 09:00.0 
  IF: enp9s0 state: down mac: <filter> 
  IF-ID-1: wwp0s29u1u6i6 state: down mac: <filter> 
Drives:
  Local Storage: total: 465.76 GiB used: 46.32 GiB (9.9%) 
  ID-1: /dev/sda vendor: Hitachi model: HTS725050A7E630 size: 465.76 GiB 
  temp: 47 C 
  Message: No Optical or Floppy data was found. 
Partition:
  ID-1: / size: 47.81 GiB used: 12.80 GiB (26.8%) fs: ext4 dev: /dev/sda5 
  ID-2: swap-1 size: 8.08 GiB used: 3.1 MiB (0.0%) fs: swap dev: /dev/sda7 
Sensors:
  System Temperatures: cpu: 59.0 C mobo: 0.0 C 
  Fan Speeds (RPM): cpu: 599 
Info:
  Processes: 184 Uptime: 11h 51m Memory: 3.71 GiB used: 1.26 GiB (34.0%) 
  Init: systemd runlevel: 5 Compilers: gcc: 6.3.0 Shell: bash v: 4.4.12 
  inxi: 3.0.32 

Code: Select all

$ lsusb
Bus 004 Device 006: ID 0bdb:1926 Ericsson Business Mobile Networks BV 
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 012: ID 5986:0299 Acer, Inc 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

User avatar
Flemur
Level 17
Level 17
Posts: 7076
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by Flemur » Sun Aug 25, 2019 4:04 pm

If you want to record "what you hear", install

Code: Select all

pavucontrol
and set it up as shown here:
https://manual.audacityteam.org/man/tut ... linux.html
Recording with a GUI, like audacity, is a good idea because you can control the volume, avoid clipping, etc., also edit the final audio.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
phd21
Level 19
Level 19
Posts: 9177
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How can I record audio from mic and listen to it at the same time? (arecord + aplay)

Post by phd21 » Sun Aug 25, 2019 6:49 pm

Hi Ottavio,

I updated my last reply a little.

I do not see anything wrong with the results of the "inxi -Fxzd" console terminal command, so that is a good thing.
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

Post Reply

Return to “Software & Applications”