LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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

Reply
 
Search this Thread
Old 11-10-2007, 04:06 AM   #1
devmoc
Member
 
Registered: Sep 2005
Posts: 38

Rep: Reputation: 15
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.
 
Old 11-10-2007, 10:01 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
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 "$@"
 
Old 11-10-2007, 10:03 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
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.
 
Old 11-10-2007, 10:04 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
The application rezound also has a threshold recording feature, but it crashed when I tried to use it. YMMV.
 
Old 11-11-2007, 02:40 AM   #5
devmoc
Member
 
Registered: Sep 2005
Posts: 38

Original Poster
Rep: Reputation: 15
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?
 
Old 09-25-2009, 11:38 AM   #6
navaburo
LQ Newbie
 
Registered: Mar 2006
Posts: 16

Rep: Reputation: 0
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.
 
Old 10-23-2009, 11:55 PM   #7
devmoc
Member
 
Registered: Sep 2005
Posts: 38

Original Poster
Rep: Reputation: 15
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 ;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
digital audio recorder compatible with mandriva randogrulz Linux - Hardware 1 06-25-2007 10:49 AM
Linux audio recorder with squelch of threshold function vuurst Linux - Software 0 11-23-2006 07:56 AM
I can't configure my cd-dvd recorder as a recorder!!! slamd64 Lier Linux - Software 4 10-26-2006 11:40 PM
make screen capture movies with audio & transmit continously to a central recorder radionits Linux - Software 2 01-12-2006 02:45 PM
What's audio recorder in Mdk9.2? akihandyman Mandriva 1 02-12-2004 04:44 AM


All times are GMT -5. The time now is 09:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration