Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Moderator: Forum moderators

Post Reply
User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by mikewalsh »

Evening, gang.

I'd always had "issues" with recording audio through the internal sound card on this HP Pavilion rig, right from the day I bought it. The necessary 'loopback' control has never shown in either Retrovol OR alsamixer, without which you're on a hiding to nothing. The control is, apparently present & correct under Windows, but various threads in the ArchLinux forum showed that the Linux kernel has problems with the interface on this thing. Windows compatibility, it seems, was boosted by HP writing a custom patch for the thing to function as it should with the Redmond behemoth.

number77 started a thread about a very similar problem a while back:-

viewtopic.php?t=6083

.....in which I posted myself, hoping, vaguely, that this time a solution just might be found:-

viewtopic.php?p=58660#p58660

As it turned out, a solution was indeed found, although not in quite the way I expected..... :D

----------------------------------------------------

I still don't know quite who it was "discovered" it first - Bill (rcrsn51), Fred (fredx181) or jamesbond of the FatDog team - but the kernel, it seems, possesses the ability to create 'virtual' loopback devices by means of the snd_aloop module. Anyway, during the course of the thread various things were tried out, then Bill came up with a script which not only let you record what you were hearing, but also permitted monitoring it while recording.......under normal usage of the virtual device, recording will cut-off the sound from the source, so recording, while possible, becomes something of a matter of guesswork. Bill's script restored the ability to monitor, so.....problem solved.

I took to this like a duck to water. It fixed my "issue", and allowed me to once again record audio. I built a wee GUI for the thing, and was quite satisfied with it.....for a while!

---------------------------------------------------

Over the course of the next couple of months, I built a more elaborate GUI, added a few things, and really tarted it up for my own personal use. And that's where it remained, until the other day when I was idly scanning the forum, and a post from a new member had brought a thread by jamesbond in the FatDog forum "back to the top". I had a read through it, recognised a lot of what we'd discussed in number77's thread a year previously, and took a long hard look at my 'personal' build. I decided it could do with a re-vamp, so started re-building the GUI to tidy it up and make it look more presentable, added a few more functions in light of stuff I've learnt over the last 12-15 months with the construction of both MultiCam and CamRecord, made it simpler to use, added a help-file and turned it into a full-fledged 'portable' along with Menu entry scripts.

It now records both .mp3 and .wav, about the two most common audio formats out there. It uses arecord for recording - with mp3 piped via lame - and ffplay for playback (necessary because although aplay will recognise .wav, upon playback of .mp3 all you get is 'white noise'. Ffplay solves this, along with the fact it's present in nearly all Puppies, as is arecord.....plus you get a nice wee graphical display with it during playback. Neat!)

Bill's original script recorded in mono, which I modified to stereo a long while back. The 'portable' also stores your recordings within its directory. IF you add a menu entry via the script, this 'Saved_Files' directory is sym-linked into /root, for quick access to those recordings. You can also access your saved recordings direct from the GUI, too.

Fred's long since produced the ffmpeg-based ALSA-Cap GUI, but since I've re-vamped this one, I thought it would be nice to share, so.....

It's no-arch, so should work in pretty much most Puppies. I'm attaching it to this post, since it's basically a bunch of scripts, therefore pretty small.....

Image

Huge thanks must go to Bill & Fred, without whom this wouldn't have been possible...

Have fun.

Mike. :D

Attachments
SimpleAudioRecorder_v2.tar.xz
Simple ALSA-based audio recorder - "Lets you record what you can hear..."
(112.23 KiB) Downloaded 93 times
User avatar
fredx181
Posts: 3086
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 376 times
Been thanked: 1315 times
Contact:

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by fredx181 »

mikewalsh wrote:

since I've re-vamped this one, I thought it would be nice to share, so.....

Sure! And it's working well from what I tested.

Bill's original script recorded in mono, which I modified to stereo a long while back.

I think you are confusing two things: recording in mono/stereo and showing the VU meter in mono/stereo.
Bill's script records in stereo but the VU meter display is mono, which you changed to stereo.

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by mikewalsh »

fredx181 wrote: Fri Oct 20, 2023 8:48 am

Bill's original script recorded in mono, which I modified to stereo a long while back.

I think you are confusing two things: recording in mono/stereo and showing the VU meter in mono/stereo.
Bill's script records in stereo but the VU meter display is mono, which you changed to stereo.

Ah! Fair comment. I wasn't aware of that. I was under the impression the two were tied together. I stand corrected... :D

Mike. ;)

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by mikewalsh »

SimpleAudioRecorder v2 released - new version in post #1
-------------------------------------------------------------------------

EDIT:- Re-uploaded after a small change to remove my personal screen location co-ordinates! Sorry about that... :oops:

-------------------------------------------------------------------------

Morning, gang.

Now then; following some info earlier today via PM from ozsouth about ffplay - or rather, the lack of it - in the Slacko-based SCPups as they come, OOTB, I've made a couple of modifications.

At launch, the app now first checks for the presence of ffplay. If it finds it, it fires-up; if it doesn't find it, it pops-up a gxmessage window to say it hasn't found it on the system. Since .mp3s are created with arecord piped via lame, it goes on to say that you can still record in .mp3, but you will need another way to play those files back, since the internal player will only be able to fall back on aplay. And because aplay can't do anything with mp3s, all you will hear is "white noise"!

Closing the gxmessage window then fires up the app.

I've also re-jigged the playback & stop scripts for the "internal player". Playback still goes with ffplay for mp3s, but now uses aplay for wav files. And the stop script checks for the type of file being played, so that it knows which process to kill.

Since the biggest proportion of Puppians - myself included! - are probably using 'buntu or Debian-based Pups/Dogs, this is only going to affect a minority of users......but there's no reason why they shouldn't be able to use the app! :D

Enjoy.

Mike. Image

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by number77 »

mikewalsh wrote: Fri Oct 20, 2023 1:11 am

Evening, gang.

Mike. :D

Mike I am dying to try your recorder but have got stuck with what to do with tar.xz file on xenial64.

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by number77 »

number77 wrote: Sat Jan 06, 2024 9:08 am
mikewalsh wrote: Fri Oct 20, 2023 1:11 am

Evening, gang.

Mike. :D

Mike I have sorted my tar.xz problem and can get Simple ALSA Audio Recorder working. I have a test piece from BBC sounds I tried to record. It recorded something but locks BBC snds up, it gives error This content doesnt seem to be working. Nothing plays, bbc sounds or anything else Is there any way to reset alsa. Thanks

User avatar
Flash
Moderator
Posts: 978
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 51 times
Been thanked: 127 times

Re: Simple ALSA Audio Recorder - "Record what you hear" via the snd_aloop module...

Post by Flash »

I'd like to see a 32 kbps mono option, for transcribing audio books from tape cassettes (I happen to have a machine that still plays cassette tapes) to mp3 so I can listen to them in my car. Why use high-quality stereo to record someone talking into a microphone?

Chaos coordinator :?
Post Reply

Return to “Multimedia”