View previous topic :: View next topic |
Author |
Message |
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sat May 15, 2021 1:35 pm Post subject: Gentoo simple voice recorder? |
|
|
I'm looking for recommendations for a simple voice recorder to use with my microphone that would just work with my microphone input like an old time simple tape recorder (not a studio recorder) to record speech not music. It would have to be able to start and stop and restart for continuation.
I already have audacity installed but it's bug list sounds terrible. Gnome-sound-recorder is praised on the internet but requires rust and pulseaudio, I neither have nor want those.
Looking for something simple! command line commands that I could put in a custom script are totally acceptable. |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Sat May 15, 2021 1:48 pm Post subject: |
|
|
I don't think it has a pause function, but `arecord`, part of media-sound/alsa-utils |
|
Back to top |
|
|
Ralphred Guru
Joined: 31 Dec 2013 Posts: 501
|
Posted: Sat May 15, 2021 5:16 pm Post subject: |
|
|
cboldt wrote: | I don't think it has a pause function, but `arecord`, part of media-sound/alsa-utils |
I wonder what would it do if you ctrl-f arecord to pause, then fg to resume? |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
|
Back to top |
|
|
Ralphred Guru
Joined: 31 Dec 2013 Posts: 501
|
Posted: Sat May 15, 2021 8:52 pm Post subject: |
|
|
Ralphred wrote: | I wonder what would it do if you ctrl-f arecord to pause, then fg to resume? |
AHAHAHAHA, it only works.
Code: | #!/bin/bash
#simple-record: press enter to toggle pause, q then enter to quit.
RATE=48000
CHANNELS=1
MIC_PCM=pcm.pulse
FORMAT=S16_LE
DEBUG=1
cur_sig=19
savefile=$1
if [[ ${savefile} == "" ]];then savefile=~/simple_record.$(date +%y-%m-%d@%X).wav ;fi
do_exit(){
sleep 1;echo "Recording Finnished.";exit
}
arecord -r ${RATE} -c${CHANNELS} -D ${MIC_PCM} -f ${FORMAT} ${savefile} &
arecord_pid=$!
sleep 1;echo -n "Recording Running..."
while read w;do
[[ ${w} == "q" ]] && kill ${arecord_pid} && do_exit
kill -n ${cur_sig} ${arecord_pid}
[[ $cur_sig == 19 ]] && echo -n "Recording Paused...." || echo -n "Recording Running..."
cur_sig=$(echo "37-$cur_sig"|bc)
done |
|
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Sun May 16, 2021 2:33 am Post subject: |
|
|
Tony0945,
Am I correct in thinking you use KDE or LXQt? If you do, have you tried Kwave (kde-apps/kwave)? I'm not sure if it is quite what you are looking for, but you could try it to see if it is suitable. It records my voice easily enough, even when I'm using the microphone in an external USB Webcam. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog
Last edited by Fitzcarraldo on Sun May 16, 2021 2:41 am; edited 1 time in total |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sun May 16, 2021 2:39 am Post subject: |
|
|
Fitzcarraldo wrote: | Tony0945,
Am I correct in thinking you use KDE or LXQt? If you do, have you tried Kwave (kde-apps/kwave)? I'm not sure if it is quite what you are looking for, but you could try it to see if it is suitable. |
No. I switch between Mate and openbox. |
|
Back to top |
|
|
figueroa Advocate
Joined: 14 Aug 2005 Posts: 2964 Location: Edge of marsh USA
|
Posted: Sun May 16, 2021 3:11 am Post subject: |
|
|
Slick little quickie script. Only MIC_PCM=pcm.pulse definitely did not work. I'm running ALSA-only. But, if I just leave -D ${MIC_PCM} out of the script it works fine. Also, using @ in the default file name is funky.
Added: The quit function (q+enter) causes "play WARN wav: Premature EOF on .wav input file" which could end more gently but arecord doesn't seem to have a quit function. The Premature EOF could be removed with an editor so it's not a fatal problem. Also, the default filename does not add the ".wav" to it.
Added2: I modified the default filename string to ~/simple_record_$(date +%Y%m%d%H%M).wav and the .wav is appended to the filename. _________________ Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi |
|
Back to top |
|
|
Ralphred Guru
Joined: 31 Dec 2013 Posts: 501
|
Posted: Sun May 16, 2021 2:07 pm Post subject: |
|
|
The .wav not being there is odd, should have quoted (") the line after the =
Yeah, about the MIC_PCM, I have a very complicated sound set-up, and without -D I get 'device in use' errors.
I could have built the arecord command on per-variable basis, omitting the -D -C etc when the associated variables are null, but it would have been ugly in bash.
There may also be a signal to send whatever "recorder" you are using to generate a clean exit, this was more PoC than anything else.
I would have liked to have read a user input without 'enter' , so I could "\033[2K\r" the 'Recording [state]' message and keep it on one line, but hey...
EDIT:AHAHAHAHAHAHAHAHAHA, what a waste of time
man arecord wrote: | -i, --interactive
Allow interactive operation via stdin. Currently only pause/resume via space or enter key is implemented. | when looking for a clean quit signal.
This is interesting though man arecord wrote: | SIGNALS
When recording, SIGINT, SIGTERM and SIGABRT will close the output file and exit. SIGUSR1 will close the output file, open
a new one, and continue recording. However, SIGUSR1 does not work with --separate-channels. |
|
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Mon May 17, 2021 2:31 pm Post subject: |
|
|
Heh on "-i" option. I didn't know that was there, and it's a good thing to know.
Man page of "sox" version, which is the command `rec`, has some interesting options too. An example is offered that stops recording on silence. and resumes when sound is present. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Mon May 17, 2021 4:09 pm Post subject: |
|
|
I deleted the original text in this message, as I subsequently found that I could get the script working by changing some of the ALSA parameters on each of my machines. The version of the script for my Clevo W230SS laptop is listed below. I have re-jigged the script a bit just for my own understanding:
Code: | #!/bin/bash
echo "simple-record: press Enter to toggle pause, q to quit."
RATE=48000
CHANNELS=2
MIC_PCM=hw:1,0
FORMAT=S16_LE
SAVEFILE=$1
if [[ $SAVEFILE == "" ]]; then
SAVEFILE=~/simple_record_$(date +%Y%m%d%H%M).wav
fi
do_exit() {
sleep 1; echo "Recording Finished."; exit
}
arecord -r $RATE -c$CHANNELS -D $MIC_PCM -f $FORMAT $SAVEFILE &
arecord_PID=$!
sleep 1; echo "Recording Running..."
STATE="r"
while read -s -n1 A; do
[[ $A == "q" ]] && kill $arecord_PID && do_exit
if [[ $A == "" && $STATE == "r" ]]; then
kill -n 19 $arecord_PID # SIGSTOP
echo "Recording Paused..."
STATE="p"
elif [[ $A == "" && $STATE == "p" ]]; then
kill -n 18 $arecord_PID # SIGCONT
echo "Recording Running..."
STATE="r"
fi
done |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
|