Help - Search - Members - Calendar
Full Version: Automatic recording
Hydrogenaudio Forums > Lossy Audio Compression > Speech Codecs
zima
OK, this is a weird one I admit...

My sister has a very pesky speaking bird (uhmm...don't know English name, search for "gwarek" on google image search) that...well...doesn't speak almost (probably...) at all. Almost...unfortunatelly :/
And he especially doesn't speak when someobody's in room, etc
So: she has the idea to record it (she claims that once the bird speaks, he speaks almost perfectly...oh well, some imagination probably)

Here's the idea: I'll donate my very old laptop (with win95...) to the cause...unfortunatelly it has very small HDD, so speex would be great I guess (voice activated recording - perfect). Since this is my dumb sister and I'm not living with family anymore, it would be preferable if the thing started automatically with win and reamained...well, not in front will be enough I guess (but it's not necessesity; if she claims she trained the bird, I hope I can train her...)

Any ideas?
zima
OK, I've found something: Sound Snooper, quite perfect for the job. Unfortunatelly, although I did install illiminable codecs, Speex doesn't appear on the list, and the other are totally alien for me. So I'll list them and I ask you for help in choosing one that will have good sound quality and at the same time smallest possible size. What's worse it seems I'm quite limited in choosing kbps, bits per channel, and frequency in this app (I'll also list what's available)...

ACELP.net 11kHz, mono, 1kb/s (?!)
CCITT A-Law 11kHz, 8bits, mono, 10kb/s
CCITT U-Law as above
GSM 6.10 11kHz, mono, 2kb/s (?!)
IMA ADPCM this one has 4bits...so terrible I think
Microsoft ADPCM as above
Microsoft G.723.1 8kHz, mono, 6400 & 5333 bit/s, 0 kb/s (?!)
Windows Media Audio V1 10kbps, 11KHz, mono, 1kb/s (?!)
Windows Media Audio V2 as above

(main reason I'm asking instead on trying - I have no microphone, and I'd like to finish at my sisters place as quick as possible when I'll ride there one day)

Or is there any way to use Speex? (Sound snooper says in help file "Sound Snooper can save records in different formats that are supported by ACM (Windows Audio Compression Manager).")
Brink
You can try to use liveincode, and record the bird speaking directly to speex files.
rutra80
Speex has 2 nice options --VAD (Voice Activity Detection) and --DTX (file-based discontinuous transmission), thanks to them you can save a lot of disk space. Lately I recorded 24 hours in speex format and it took about 120MB IIRC (the room was empty for 23 hours and for 1 hour there was those thiefs speaking ph34r.gif ).
I used foobar2000's Record function with following Speexenc command-line in Diskwriter:
--quality 10 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - %d
I think I've set sample rate to 8000Hz, bits per sample to 16, and channels to 1.
I used very crappy microphone but the effect was more than good enough.
zima
Is Speexenc the standard form the speex site?

(and I seem to remember that I've read somewhere that the official one doesn't have yet VAD...so is there some special one I'd have to download?)
Mr_Rabid_Teddybear
QUOTE(zima @ Jun 15 2005, 09:20 AM)
Is Speexenc the standard form the speex site?

(and I seem to remember that I've read somewhere that the official one doesn't have yet VAD...so is there some special one I'd have to download?)
*


I think it's had VAD in for a long time, but why not use latest unstable version? (Found e.g. on RareWares.) I don't know why there's a "stable" and an "unstable" branch, unstable has been working without any problems for me....

zima
QUOTE(rutra80 @ Jun 11 2005, 12:47 PM)
Speex has 2 nice options --VAD (Voice Activity Detection) and --DTX (file-based discontinuous transmission), thanks to them you can save a lot of disk space. Lately I recorded 24 hours in speex format and it took about 120MB IIRC (the room was empty for 23 hours and for 1 hour there was those thiefs speaking ph34r.gif ).
I used foobar2000's Record function with following Speexenc command-line in Diskwriter:
--quality 10 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - %d
I think I've set sample rate to 8000Hz, bits per sample to 16, and channels to 1.
I used very crappy microphone but the effect was more than good enough.
*



Is this possible in fully automatic fashion? (so foobar will start recording right after startup by link in autostart, all by itself)
Mr_Rabid_Teddybear
QUOTE(zima @ Jun 16 2005, 08:00 AM)
Is this possible in fully automatic fashion? (so foobar will start recording right after startup by link in autostart, all by itself)
*


You could probably make a batchfile with command line options and put a link to it in autostart. Or Scheduled Tasks, run at startup. Find foobars command line options by running "your path to foobar"\foobar2000.exe /? in CMD. (You can also search on forum for how to access menu or context menu options by way of commandline).

Another option is to use Case's piperec (preferably the version where Preuss fixed the CPU hog bug), put speexenc.exe and piperec.exe somewhere in %PATH% and make a batchfile like e.g.
CODE
@echo off
title record speex from recording device
piperec 16000 16 1 | speexenc --quality 8 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - - > "C:\My Recordings\test.spx"


And just have the batchfile autostart at startup. This is a fully commandline solution, and quite simple. To stop recording, bring the CMD window in focus and hit CTRL+C.

link 1, link 2, link 3, link 4

EDIT:
You shouldn't take anyones word for what's best wav input samplerate/bitdepth/channels or best switches for speexenc. Experiment, and see what fits best in regards to filesize/quality for your use. Switches can be found by running speexenc -h in CMD.


zima
Thank you for quick reply.

I wonder...does the command line options in foobar allow automatic recording, when doing it manually requires choosing menu options form tool window inside foobar, clicking ok, choosing path, etc.? I can't quite find anything that would suggest it... sad.gif
(The real issue probably is that I'm totally ignorant when it comes to command line, batch files, etc. - although I am cosnidered by few as "advanced" and such crap, the thuth is: only in GUI, and probably only bacause I don't afraid it, not because I know everything...I started serious adventure with classic macs, then moved directly to windows...)

Also, another thing: I don't have means to check it (public computer at uni), but I assume that use of piperec will cause a command line window to appear whole the time...as I mentioned above, the less things the user of this solution will be able to do wrong, the better (so it's preferable if it'll be fully automatic & hidden...). or perhaps it's possible to hide this window?

Thanks again for help.
Mr_Rabid_Teddybear
QUOTE(zima @ Jun 16 2005, 09:23 AM)
I wonder...does the command line options in foobar allow automatic recording, when doing it manually requires choosing menu options form tool window inside foobar, clicking ok, choosing path, etc.? I can't quite find anything that would suggest it... sad.gif
*


All settings in foobar would have had to be set beforehand, I guess. I haven't tried if this can actually work. Maybe not. So I think piperec solution would be better for you.

QUOTE(zima @ Jun 16 2005, 09:23 AM)
Also, another thing: I don't have means to check it (public computer at uni), but I assume that use of piperec will cause a command line window to appear whole the time...as I mentioned above, the less things the user of this solution will be able to do wrong, the better (so it's preferable if it'll be fully automatic & hidden...). or perhaps it's possible to hide this window?
*


Check this.
EDIT: Alternative is to make a shortcut to the batchfile and choose in the Properties of the shortcut to start up minimized (and drag shortcut into Startup folder). This way it will still show up on Taskbar, but that gives you an opportunity to maximize window to stop recording if desired (not sure if first option allows for that, or if you will just continue recording until you shutdown system).

You can easily learn enough 'bout commandline and batchfiles to get something like this going.... smile.gif
Mr_Rabid_Teddybear
Take care that if restarting machine like this it will start recording, overwriting any existing file. The best ting here would be to have the setup not overwriting existing file, but auto append a number to the filename or something (e.g. date & time), like if you have it write to a file recording.spx, if a file of that name already exists it doesn't overwrite it, but creates a new file recording_1.spx, then recording_2.spx, and so on. However, I hardly think something like that is possible within the framework of a simple batchfile. I guess it would take some more advanced scripting, or the addition of some program of which I don't know the existence of to the setup to achieve something like that.... It's beyond me, I'm afraid.... Maybe someone else have a suggestion?

ChiGung
QUOTE(Mr_Rabid_Teddybear @ Jun 17 2005, 01:12 AM)
Maybe someone else have a suggestion?


CODE
piperec 16000 16 1 | speexenc --quality 8 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - - > "C:\My Recordings\earwig%TIME%.spx"


i think you can add %time% to the filename...

maybe not if the times format messes up the filename,

oh yeah this is it,
%random%%random% smile.gif

CODE
piperec 16000 16 1 | speexenc --quality 8 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - - > "C:\My Recordings\earwig%random%%random%.spx"


That makes it ~usualy not overwrite a previous file~


Mr_Rabid_Teddybear
QUOTE(ChiGung @ Jun 16 2005, 04:44 PM)
That makes it ~usualy not overwrite a previous file~
*


Super cool.gif !
I guess it would take a lot of trial to get %random%%random% to produce the same number twice, so I guess it's quite safe smile.gif

(If one where paranoid one could do somename%random%%random%%random%%random%.spx)

zima
Awesome guys! Thank you very much for the help. It seems I'm all set (now I just have to download all files & instructions on cdr (uni) and hope I'll be able to do it all tongue.gif )
zima
One problem with piperec: the archive with version that doesn't hog cpu is apparently broken...
Mr_Rabid_Teddybear
QUOTE(zima @ Jun 17 2005, 07:01 AM)
One problem with piperec: the archive with version that doesn't hog cpu is apparently broken...
*


It works OK here. Try to empty all cache, tempdirs, downloads and restart browser, then try again. (If you absolutely can't make it work PM me an e-mail adress I can send it to).

EDIT: BTW. The fixed version in the package are named piperec_fix.exe, piperec.exe are the original. Difference in size are due to UPX compression of original.

ChiGung
QUOTE(Mr_Rabid_Teddybear @ Jun 17 2005, 07:25 AM)
QUOTE(ChiGung @ Jun 16 2005, 04:44 PM)
That makes it ~usualy not overwrite a previous file~
Super cool.gif !
I guess it would take a lot of trial to get %random%%random% to produce the same number twice, so I guess it's quite safe smile.gif

(If one where paranoid one could do somename%random%%random%%random%%random%.spx)

Heh, ive already been kinda paranoid, because %random% returns a four digit number ( on my system anyway), but odds can be deceptive and after a modest number of saves I think even 9999:1 gets a little risky.

Nice automatic recording setup here though. I did this with linco.exe and lame before, but had to run lame in high priority to stop dropouts - thats something to look out for.

A Low vbr lame command line could be,

CODE
start /high /min piperec 22050 16 1 | lame -r --bitwidth 16 -s 22.05 -V9 -m m --resample 22 -B64 --lowpass-width 3 -q 5 - "C:\My Recordings\Learwig%random%%random%.mp3"


I havent used speex, but dont like it when I get a phone connection which compresses the ambient noise out - so the line goes totaly silent when no ones speaking.

edit:fixed one bug in commandline
Mr_Rabid_Teddybear
QUOTE(ChiGung @ Jun 17 2005, 08:07 AM)
Heh, ive already been kinda paranoid, because %random% returns a four digit number ( on my system anyway), but odds can be deceptive and after a modest number of saves I think even 9999:1 gets a little risky.
*


I know. wink.gif I was kinda joking. Well, putting in 4 %randoms%'s produce an 18-20 number digit, which should satisfy even the hyper hyper paranoid.....
Thank you, BTW! smile.gif

QUOTE(ChiGung @ Jun 17 2005, 08:07 AM)
CODE
start /high /min piperec 22000 16 1 | lame -r --bitwidth 16 -s 22.05 -V9 -m m --resample 22 -B64 --lowpass-width 3 -q 5 - "C:\My Recordings\Learwig%random%%random%.mp3"

*


Eh, shouldn't that be ... piperec 22050 16 1 ... ?

QUOTE(ChiGung @ Jun 17 2005, 08:07 AM)
I havent used speex, but dont like it when I get a phone connection which compresses the ambient noise out - so the line goes totaly silent when no ones speaking.
*


Speex is quite nice for it's use. And you can get plenty of continual annoying background noise if you want, just drop --denoise and such, play around with the switches...... smile.gif

ChiGung
QUOTE(Mr_Rabid_Teddybear @ Jun 17 2005, 05:35 PM)
Eh, shouldn't that be ... piperec 22050 16 1 ... ?

Good catch smile.gif
Mr_Rabid_Teddybear
Actually, it doesn't like start /high /min piperec etc....

My PC starts beeping as mad.

But if you put piperec 22000 16 1 | lame -r --bitwidth 16 -s 22.05 -V9 -m m --resample 22 -B64 --lowpass-width 3 -q 5 - "C:\My Recordings\Learwig%random%%random%.mp3" in a mp3rec.bat on the other hand, and start it from CMD thus:
start /high /min mp3rec.bat
it starts just fine.....

That Lame commandline produces a file that playbacks as pure static at my place, though.... ohmy.gif

Doing it with my Speex batch file, though, produces a good file
start /high /min spxrec.bat

And it was same thing; putting start /high /min piperec (etc....) in the batchfile itself made my system protest like hell....

ChiGung
QUOTE(Mr_Rabid_Teddybear @ Jun 17 2005, 06:19 PM)
Actually, it doesn't like start /high /min piperec etc....
My PC starts beeping as mad.

oh well rolleyes.gif
QUOTE
That Lame commandline produces a file that playbacks as pure static at my place, though....  ohmy.gif

-x swaps the byte endianism, could fix the static, or maybe piperec wont do that samplerate.

new lame try:
CODE
piperec 22050 16 1 | lame -r -x --bitwidth 16 -s 22.05 --priority 3 -V9 -m m --resample 22 -B64 --lowpass-width 3 -q 5 - "C:\My Recordings\Learwig%random%%random%.mp3"


experimental, add --scale 0.1 --athaa-sensitivity 3 to encourage silence detection, while increasing sensitivity at reduced volume, could decrease bitrate, file needs reamplified at playback.
Mr_Rabid_Teddybear
QUOTE(ChiGung @ Jun 17 2005, 09:33 AM)
new lame try:
CODE
piperec 22050 16 1 | lame -r -x --bitwidth 16 -s 22.05 --priority 3 -V9 -m m --resample 22 -B64 --lowpass-width 3 -q 5 - "C:\My Recordings\Learwig%random%%random%.mp3"

*


That line produced a working file.

Adding --scale 0.1 --athaa-sensitivity 3 also produce a working file, but volume level are almost inaudible..... much preamp would be necessary for playback...

zima
Yep, something was wrong on the PC I've been using, it works fine on another one.

BTW, do I have to car about this "start /high /min" thing when using Speex?
ChiGung
Only if you notice jitters happening in the recordings - then raising the processes priorities might help.
Mr_Rabid_Teddybear
QUOTE(ChiGung @ Jun 18 2005, 05:18 AM)
Only if you notice jitters happening in the recordings - then raising the processes priorities might help.
*

In that case you can do as follows:

Make a spxrec.bat thus:
CODE
@echo off
title record speex from recording device
piperec 16000 16 1 | speexenc --quality 8 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - - > "C:\My Recordings\polly%random%%random%.spx"


and put it in your %PATH%. Then make a run.bat:
CODE
start /high /min spxrec.bat


Make a shortcut to run.bat. Open Properties of this shortcut and choose Run: Minimized, then drag that shortcut into your Startup folder. Now it should start spxrec.bat as a high priority thread, minimized to taskbar when Windows starts up.


Mr_Rabid_Teddybear
Unfortunately, when checking closer, that seems to start only CMD.exe with high priority, while piperec.exe and speexenc.exe still runs at normal priority.... sad.gif
As posted above, adding start /high /min in the batchfile itself only achieved manic beeping from my PC, so then I don't know how to start speexenc.exe with high priority in this setup....

ChiGung
Yeh tricky that, but ive got you hacking ahead of yourself wink.gif Theres probably no problem with it at normal priority rolleyes.gif
Mr_Rabid_Teddybear
QUOTE(ChiGung @ Jun 18 2005, 07:44 AM)
Yeh tricky that, but ive got you hacking ahead of yourself wink.gif Theres probably no problem with it at normal priority  rolleyes.gif
*


Yes. It's probably only stupid to do it unless you get dropouts or stuttering or such.... on a reasonably fast system this shouldn't happen. I was more thinking of zima whom I think said was going to use an old comp, in which case such things might occur.....

zima
OTOH...does this priority stuff works at all in win9x? Somehow I don't think so...
Mr_Rabid_Teddybear
QUOTE(zima @ Jun 20 2005, 06:55 AM)
OTOH...does this priority stuff works at all in win9x? Somehow I don't think so...
*


I have no access to 9x, so you have to figure out what works and what don't yourself. Try some googleing. Experiment. One thing I'm pretty sure of is that the purely cosmetic "title" line I've added to my batchfile don't work. However, all it does are displaying the text after on the title bar.

I don't think you should care to much about priority, there's other things that's more important. I've been revising the Speex commandline that I basically just copied off rutra80.
QUOTE(rutra80 @ Jun 11 2005, 12:47 PM)
--quality 10 --vbr --vad --dtx --nframes 10 --comp 10 --denoise --agc - %d
I think I've set sample rate to 8000Hz, bits per sample to 16, and channels to 1.
I used very crappy microphone but the effect was more than good enough.
*



First of all I think samplerate of 8000 give some very strange sounds on s and f's. I'll go for 16000 as good for speech (speex supports 8, 16 and 32 kHz). I'll also go for 16 bits as 8 bits gives some really ugly distortion on background noise (8 and 16 supported). Stereo are a total waste of bits for speech, so channels number 1; mono.

Speex options can be found here.
I don't think its necessary, but I'll add -w for wideband (16 kHz) input. Options are -n, -w and -u (8, 16 and 32 kHz).

--quality 10 makes a file which averages at 38-40 kbps. Reducing to --quality 8 averages at 25-27 kbps, and sound quality is somewhat lower, but quite good. So this is a diskspace issue.

--vbr is a must for allocating bits intelligently. However;
QUOTE
VAD is always implicitly activated when encoding in VBR, so the option is only useful in non-VBR operation.

So one can remove --vad, it's on already.

--dtx
QUOTE
Discontinuous transmission is an addition to VAD/VBR operation, that allows to stop transmitting completely when the background noise is stationary. In file-based operation, since we cannot just stop writing to the file, only 5 bits are used for such frames (corresponding to 250 bps).

Very good for saving diskspace when nothing is happening.

--nframes. This is the documentaion I can find:
QUOTE
It is also possible to pack more that one frame in an Ogg packet (--nframes), reducing the overhead for low bit-rates.   

-nframes n
    Pack n frames in each Ogg packet (this saves space at low bit-rates)
    Number of frames per Ogg packet (1-10), default 1


I don't really understand if this is useful here. Keep it in if you want, I think I'll take it out. I'm really unsure here. Wish there was some more comprehensive documentation on this switch...

Now we come to CPU consumption. This is what complexity, --comp, is about:
QUOTE
With Speex, it is possible to vary the complexity allowed for the encoder. This is done by controlling how the search is performed with an integer ranging from 1 to 10 in a way that's similar to the -1 to -9 options to gzip and bzip2 compression utilities. For normal use, the noise level at complexity 1 is between 1 and 2 dB higher than at complexity 10, but the CPU requirements for complexity 10 is about 5 times higher than for complexity 1. In practice, the best trade-off is between complexity 2 and 4, though higher settings are often useful when encoding non-speech sounds like DTMF tones.

So this is a complexity vs. speed switch. The higher complexity the more CPU useage (speex default are 3). --comp 10 using 5 times as much CPU as --comp 1. So it might not be wise to use --comp 10 on an old 9x box.

--denoise
QUOTE
Denoise the input before encoding

Very good when recording from a cheap mic.

--agc
QUOTE
Apply adaptive gain control (AGC) before encoding

Also good when recording from cheap mic, I suppose. Keep it in.

Also adding -V (prints bitrate used to console), so you'll see some activity if you'll ever maximise the window...


So my revised line will be something like this, edit according to your needs:
CODE
piperec 16000 16 1 | speexenc -w --quality 8 --vbr --dtx --comp 4 --denoise --agc -V - - > "C:\My Recordings\polly%random%%random%.spx"



EDIT: BTW. One thing I forgot to mention; If you use ICL compiles from RareWares, don't forget to put libmmd.dll in %PATH%.


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.