Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-10-2007, 04:06 AM
|
#1
|
|
Member
Registered: Sep 2005
Posts: 38
Rep:
|
VOX Recorder and Audio Timer Recorder?
Hello all. I'm looking for a VOX (voice operated) recording application for Linux. I want to record only when audio is coming in from the Line In, not during the dead air times.
I'm also looking for an application that will record audio on a timer basis coming from the Line In. Something like a VCR for audio that I can schedule or just set for xx hours.
I can't find anything on all the usual spots, Sourceforge, Freshmeat, KDE apps, etc. Anyone have any suggestions? Thanks.
|
|
|
|
11-10-2007, 10:01 PM
|
#2
|
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
The package sox provides an audio recording program, rec, which can be triggered by the lack of, and stop recording on detection of silence.
Here's a command which does this:
Code:
rec recording.wav silence 1 5 2% 1 0:00:02 2%
This will record as soon as non-silence is detected (with a 2% volume threshold). The recording will cease when silence is detected for 2 seconds or more.
Note that the program terminates when silence is detected, so if you wanted the program to listen for a second chunk of audio and continue the recording, you would have to call rec from a loop. This is fine, except that it will truncate the file it records to if you use the same file the next time.
One solution is to create a different file for each recording. This might be exactly what you want. If so, it's pretty easy to write a little script to do this. I added in recording for only an hour too, although it will continue to record if there is no silence after the last rec instance is started even if that goes over an hour.
Code:
#!/bin/bash
main () {
# handle control-c better than just letting sox exit current rec.
trap sighandler INT
if [ $? -ne 0 ]; then
usage 1
fi
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage 0
fi
n=1
while [ $(( $SECONDS / 3600 )) -lt $1 ]; do
file=recording_$(printf "%03d" $n).wav
rec $file silence 1 5 2% 1 0:00:02 2%
let n+=1
done
}
usage () {
cat << EOD
Usage:
$0 hours
where hours is the time to record
EOD
exit ${1:-0}
}
sighandler () {
exit "That's all folks."
exit 2
}
main "$@"
|
|
|
|
11-10-2007, 10:03 PM
|
#3
|
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
If you want to append to the same file, it is possible. You will need to record in raw format, and send the output to stdout, appending with shel re-direction to the file. After all the recording is finished, then you would need to convert the raw format into something more suitable.
This is necessary because .way files and other audio formats include a header at that start of each file. If you simple append wav files together, the resulting file is technically invalid, although it will probably play in most software with the output making a loud pop or squeak or click each time a header is encountered in the middle of the file.
|
|
|
|
11-10-2007, 10:04 PM
|
#4
|
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
The application rezound also has a threshold recording feature, but it crashed when I tried to use it. YMMV.
|
|
|
|
11-11-2007, 02:40 AM
|
#5
|
|
Member
Registered: Sep 2005
Posts: 38
Original Poster
Rep:
|
Thanks for the response! Rezound looked promising but crashes on me as well. I was hoping to make one continuous wav file. Rezound can probably do this. Is there anyway to make Audacity use a threshold detection?
|
|
|
|
09-25-2009, 11:38 AM
|
#6
|
|
LQ Newbie
Registered: Mar 2006
Posts: 16
Rep:
|
squeching app
I had the same problem and no acceptable solution (rezound trainwrecked for me too, and though I'm thankful for the bash script Matt, it often cut off the beginnings of dictations), so I wrote a simple C++ program to handle this. It uses a ring-buffer to ensure that the beginnings of non-silent sections of audio do not get cut-off.
Right now the program uses hard-coded sensitivity levels (you have to recompile to adjust them), and it only works with unsigned 8-bit mono. However, little work will be required to add any other (raw) audio format, I just don't have the know-how to work with 16-bit. If anyone manages to add such support, please let me know!
You can grab the code from here:
http://hotwigati.wordpress.com/2009/...ilence-filter/
Last edited by navaburo; 09-25-2009 at 11:39 AM.
|
|
|
|
10-23-2009, 11:55 PM
|
#7
|
|
Member
Registered: Sep 2005
Posts: 38
Original Poster
Rep:
|
navaburo,
I just happened to check this thread at random and see you posted something. Since I made this post I eventually found out something that works for me. It's just a simple script. It works almost perfectly, the only caveat is that you need to have some sound at the very beginning after you run it, otherwise it will keep the first stretch of silence after running it. If you make a noise at the beginning then it's not a problem. You can modify the silence thresholds as necessary as well as the pipe to lame. One final note, if you are using pulseaudio, you may need to get rid of the "-D" device name, just setup your source and check the pulseaudio VU meter to make sure audio is being routed properly then run the script and it should record from that source.
Code:
#!/bin/bash
#USAGE: ./VOX_Scanner_Recording.sh xxx output.mp3
#USAGE: Records from line-in for xxx seconds to output.mp3, or Ctrl-C to end recording early, then detects silence and splits tracks and combines into one file
TIME=$1
OUTPUT=$2
arecord -D plughw:0,0 -f S16_LE -c1 -r22050 -t raw -d ${TIME} | lame -r -s 22.05 -m m -b 64 - ${OUTPUT} ;
sleep 3 ;
mp3splt -s -p th=-30,min=1,rm ${OUTPUT} ;
sleep 2 ;
mv ${OUTPUT} ${OUTPUT}.original ;
sleep 2 ;
mpgjoin *.mp3 -o Joined_Output.mp3 ;
sleep 2 ;
rm Track*.mp3 ;
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:08 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|