Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to record sound being played using arecord

250 views
Skip to first unread message

lou

unread,
Oct 2, 2021, 4:00:05 AM10/2/21
to
Could you give me commands that record sound being played?

i don't know how to use alsaloop

Can arecord use mp3 format?

Thanks!

  ~$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 31609 [48%] [on]
  Front Right: Playback 31609 [48%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 3479 [5%] [off]
  Front Right: Capture 3479 [5%] [off]

~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC272 Analog [ALC272 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Dan Ritter

unread,
Oct 2, 2021, 7:50:04 AM10/2/21
to
lou wrote:
> Could you give me commands that record sound being played?
>
> i don't know how to use alsaloop
>
> Can arecord use mp3 format?

Nothing records directly into mp3; mp3 is a compressed format.
ffmpeg or lame can turn the .wav or .au that you get from a
recording system into an mp3.

>   ~$ amixer
> Simple mixer control 'Master',0
>   Capabilities: pvolume pswitch pswitch-joined
>   Playback channels: Front Left - Front Right
>   Limits: Playback 0 - 65536
>   Mono:
>   Front Left: Playback 31609 [48%] [on]
>   Front Right: Playback 31609 [48%] [on]
> Simple mixer control 'Capture',0
>   Capabilities: cvolume cswitch cswitch-joined
>   Capture channels: Front Left - Front Right
>   Limits: Capture 0 - 65536
>   Front Left: Capture 3479 [5%] [off]
>   Front Right: Capture 3479 [5%] [off]
>
> ~$ arecord -l
> **** List of CAPTURE Hardware Devices ****
> card 0: Intel [HDA Intel], device 0: ALC272 Analog [ALC272 Analog]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0

Do you have a microphone plugged in?

Try

arecord test.wav

and make some noise, then hit ctrl-c to stop the recording.

Use

aplay test.wav

to play it back.

If you need a more sophisticated interface, consider installing
audacity.

-dsr-

lou

unread,
Oct 2, 2021, 8:20:05 AM10/2/21
to

On 10/2/21 7:46 AM, Dan Ritter wrote:
> Do you have a microphone plugged in?
> Try
>
> arecord test.wav
>
> and make some noise, then hit ctrl-c to stop the recording.
>
> Use
>
> aplay test.wav
>
> to play it back.
>
> If you need a more sophisticated interface, consider installing
> audacity.
>
> -dsr-
>
>

Thank Dan!

i don't have microphone

i want to record sound being played by application, alsaloop is needed

i will use .wav or .au format, hopefully my cell phone can play it

Dan Ritter

unread,
Oct 2, 2021, 9:40:04 AM10/2/21
to
Yes, you want to read

https://dt.iki.fi/record-system-output-alsa

for an example.

-dsr-

Michael Lange

unread,
Oct 2, 2021, 2:20:05 PM10/2/21
to
Hi,

On Sat, 2 Oct 2021 03:55:50 -0400
lou <loushan...@sina.com> wrote:

> Could you give me commands that record sound being played?

apart from the solution using alsaloop Dan already pointed out, there is a
rather simple way to do this with Alsa's OSS compatibility modules:

sudo modprobe snd-pcm-oss
aumix -v R

Explanation:
The first command loads the oss-compatibility drivers (snd-pcm-oss and
snd-mixer-oss); to automatically load these drivers on each boot, just
add the line

snd-pcm-oss

to /etc/modules .

The second command sets the main Volume channel (-v) as
recording source (R); you may need to do

sudo apt install aumix

first, though. Of course, you can use any gui mixer app that can handle
the OSS mixer device instead of the shell command to set the recording
source. Just select the channel that is usually labeled "Vol".

>
> Can arecord use mp3 format?

Not directly as far as I know. However you can use something like:

arecord -V stereo -f cd | sox -t wav -r 44100 -c 2 -b 16 - test.mp3

(requires sox and libsox-fmt-mp3). This should create a 128 kBit/sec CBR
mp3 output file. Please consult the manpages of arecord and sox for fine
tuning each command's options.

Best regards

Michael


.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.

Totally illogical, there was no chance.
-- Spock, "The Galileo Seven", stardate 2822.3

lou

unread,
Oct 2, 2021, 10:10:04 PM10/2/21
to


On 10/2/21 9:38 AM, Dan Ritter wrote:
Yes, you want to read 

https://dt.iki.fi/record-system-output-alsa

for an example.

-dsr-


to Dan:

it's not easy to follow instruction at https://dt.iki.fi/record-system-output-alsa

after running "modprobe snd-aloop", i can hear sound being played

no wonder i can hear nothing from recording


to Michael:

why shall i need OSS compatibility module if alsa works?
after loading them, they don't help, i can't hear anything from recording


ffmpeg -f alsa -i hw:1,1 -c:a flac output.flac

command above is from https://dt.iki.fi/record-system-output-alsa
i use it to record, i can't hear anything from recording

~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC272 Analog [ALC272 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

Michael Lange

unread,
Oct 3, 2021, 9:30:04 AM10/3/21
to
Hi,

On Sat, 2 Oct 2021 22:02:39 -0400
lou <loushan...@sina.com> wrote:

(...)
> why shall i need OSS compatibility module if alsa works?

Because the thing you wanted to do did *not* work for you? ;-)

> after loading them, they don't help, i can't hear anything from
> recording

which commands exactly did you try? Did you set the capture channel to
"Vol" either by some gui mixer or with the aumix command I suggested?

The only reason I suggested loading the sound_*_oss modules is that
alsamixer/amixer seems to have no equivalent for this.

Best regards

Michael

.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.

You go slow, be gentle. It's no one-way street -- you know how you
feel and that's all. It's how the girl feels too. Don't press. If
the girl feels anything for you at all, you'll know.
-- Kirk, "Charlie X", stardate 1535.8

lou

unread,
Oct 3, 2021, 4:30:05 PM10/3/21
to

On 10/3/21 9:23 AM, Michael Lange wrote:
> Hi,
>
> Because the thing you wanted to do did *not* work for you? ;-)
>
>> after loading them, they don't help, i can't hear anything from
>> recording
> which commands exactly did you try? Did you set the capture channel to
> "Vol" either by some gui mixer or with the aumix command I suggested?
>
> The only reason I suggested loading the sound_*_oss modules is that
> alsamixer/amixer seems to have no equivalent for this.
>
> Best regards
>
> Michael
>

Thank Michael!

i've solved it, with help from pulseaudio, not OSS compatibility module

but it's done in fedora, not in stretch

i've installed pavucontrol for stretch, it doesn't work

pavucontrol has several tabs: Playback, Recording, Output Devices...

under Playback tab, it shows "System Sounds"

i can't change sound volume with scrollbar
0 new messages