soundgrab hacks
Soundgrab is a perl application that uses flac, rawrec, and ogg/mp3enc to chop
up, delineate, and create chunks of audio in whatever format you want (via sox).
You can use the '1' and '2' commands to make templates for use with
regualar-format audio programs (with a bit of fudging via 'adj' command).
The home page is on SourceForge.net (of course!), but my hacks extend it quite a bit
mostly because I actively use it on a weekly basis.
Added Features:
- If .sg file, corresponding to named volume, exists in the same
directory as the volume, soundgrab will ask you if you wish to load
it. (Soon it will ask if you want to jump to last position defined, too)
- '--automatic' argument to soundgrab will look for .sg file
(saved with '1' command)
corresponding to the give volume name and will execute the
'export' command and exit. This allows for interactive selection
and leaves the hard CPU work for later.
- '1' - saves the current list of chunks to volume.sg
- Reads the chunk name, start, end, and oggment-stuff
from 'volume.sg'. If you open 'Mar32004.wav' then the
.sg file is called 'Mar32004.sg'.
- '2' - reads list of chunk definitions from volume.sg
- Reads the chunk name, start, end, and oggment-stuff
- specifying "AUTONAME" for the chunk name
(with a text editor, for example) will automagically
rename chunks based on volume name when .sg file is loaded
- When volume is opened, soundgrab checks and prompts to
load corresponding .sg file.
- 'name *' - automatically creates the 'next' uniquely named
chunk of the format 'volume_0xx.ext' where '0xx' is a zero-padded
3 digit integer counter (starting with number of chunks in .sg
file +1) and '.ext' is the output format specified with the -f
argument to soundgrab. ogg_* stuff is copied from previous chunk
if possible (I have a default .sg file which defines these for this
purpose). BTW, deleting intermediate chunks does not change the
naming - ie. I kept it dirt-simple.
- 'verify' - checks for overlap and containment among chunks,
by default stopping after the first error. If you specify 'verify *'
then all error cases will be reported. Shows a pictorial view of
what is wrong for each set of chunks.
- 'adjust' - easy adjustment of start/end point of a chunk
(usage: adjust chunk [start|end] [+|-|set] offset)
- 'oggment *' - will spit out the current definitions for
all the fields.
- 'list' - gives delta (End - Start) of each chunk. Also gives
space column which calculates space between chunks. First chunk's
space is from Start of Volume while last chunk's space is to End of
Volume.
- now - synonym for 'head'
- 'huh' - shows a visual of what soundgrab does... if it
was in the original code, I would have understood what I needed
to to a lot faster :-)
Note: a bug in pthreads library will give you a core dump on RH9/FC2 (maybe
ealier too?). This has nothing to do with soundgrab. I create an alias in
my .tcshrc file like this:
alias editwav "soundgrab -s 24000 -i u8 -f ogg -c 1 -b 36 \!*;/bin/rm -f core.[0-9]*"
key is the '; /bin/rm -f core.[0-9]*' at the end - that kills any resulting
core files.
Updated on 01/05 (minor):
- soundgrab-f8.pl (.txt extension!)
- Added option to specify signal in stop_core(). On my linux
2.6.10 with ALSA drivers system and low-bitrate files, I was
getting 3sec latency with 'TERM' signal and INSTANT response
with 'KILL'. I did not notice any ill effects of the change.
Also added "Delta" to the 'list' command. It helps me approximate
the 'pattern' inside the files I edit better.
Updated on 11/04 (minor):
- soundgrab-f7.pl (.txt extension!)
- See source for minor tweaks. Added the "Space" column to "list"
command and cleaned up previous code some. Used to process about 2GB
more data - much faster with the help of delta and space columns to
predict breaks!
Updated on 03/10/04
- soundgrab-f5.pl (.txt extension!)
- Cleaned up the
.sg file handling (prompts to load one if found when opening new
volume), 'name *' will automatically create a 'reasonable' name
for the chunk (short but unique) and copy all the ogg_* from
previous chunk, 'oggment *' gives list of all ogg_* fields for
all chunks, etc. I've had a nasty cold for the last 3 days so
I was only up to processing almost 2GB of wav files... with good
results. Next version will probably allow an offset argument to
'mark' command. I found myself 'stop', 'jump', then 'mark'ing in
numerous places. Oh, also added a 'verify' command which checks
for overlap/within cases for chunks.
- soundgrab-f3.pl (.txt extension!)
- I added the '1', '2', and 'adjust' commands and some small fixes.
This allows basic "file termplates" to be preserved and tweaked.
You may be familar with 'templates' if you use OCR software.
A typical 3 hour show on AM breaks on-the-hour and most of the
commercials are on a somewhat fixed schedule (+/- few min) so
these additions allow for 'cleaning up' of such things...
I usually copy the previous show's '.sg' file to the new one
and then make some adjustments.
- TODO: fix bug in 'exporting' and ogg_comment -
Update: this seems to be a problem with oggenc binary not
accepting comments. It's a low priority now.
I've used soundgrab-f3 to process ~55 hours of audio.
Update: -f5 was used to process about 2 GB of wav
files.
- Sample .sg file (so 'n *' works automatically)
-
#V100 .soundgrab - do not move/change this line!
#"NAME",START,END,"COMMENT","ARTIST","TITLE","ALBUM"
"AUTONAME",00.00,00.00,"various","various","various","various"
#The End - do not move/change this line!
TODO:
- Would be nice if sox would also FADE OUT. Need to change the
pipe to save to temporary file first (can't find length of file inside
pipe!)