Sampling Short Sequences From Long MP3 Recordings?
mehl writes "I am a professor for social psychology at the University of Arizona and I am looking for help with finding / developing a special program. In my research, I ask participants to carry around a digital voice recorder while they go about their normal lives. The voice recorder then tracks the ambient sounds in their environments and produces an 'acoustic log' of a person's day. We then use these ambient sound recordings as source data for various person perception studies. For privacy reasons, we are required to sample brief snippets of ambient sounds instead of recording an entire day continuously ('Big Brother is listening to you...'). So far, we have achieved this by modifying the hardware of a digital voice recorder (triggering it with an external microchip). With the high turn-over in player models, however, this strategy has turned out to be short-sighted (every half a year we have to build a new chip). I am thinking about switching strategy, recording continuously in the first place (no problem with the current generation of flash memory) and then sampling (random) snippets after the fact from the continous recordings. Does anybody know of an existing program that can randomly (or pseudo-randomly; e.g., 30 sec every 10 min) and automatically sample short sequences from a day-long (18 hours) mp3 recording? What would it entail to develop such a program (for Windows)?."
Pick up Microsoft Visual C++ then look at their time and sound librar.. uh.. oh.. IT colour scheme hurt brain... cannot continue.. blarerhfdsl jjjjjjjjjjjjjj fjwkef
Ask P-Diddy.
He frequently samples other artists' work and then makes millions. Reminds me of an archived Onion article, which you now must pay for
Click here for a free picture of an iPod!
Sounds like a job for a really simple shell script driving mp3split. Sounds a lot easier than a custom chip!
Jump to a a random offset, look for the sync-word, copy a number of frames, repeat. The MP3 format is made of frames, there is no per-file header and since the format is designed to be used in streaming applications and to be robust against errors, you can jump right to the middle and grab a couple of frames without worrying about the rest. Many webpages have the frame spec. Here is one.
MP3 is a bitstream, so you can basically use the language of your choice to seek to arbitrary offsets, slice wherever you like for as long as you like, and whatever frames are broken will simply not get decoded. You may of course want to actually have on-frame-boundry edits (they generally sound better and play more reliably, especially on ipod which doesn't have great stream reassembly code). cutmp3 can work:
- 0. 08/Frame.pm
/ Sp litter.pm
t /p p
:-)
http://www.puchalla-online.de/cutmp3.html
There's lots of pure windows code to do this too:
http://www.programurl.com/software/cutter.htm
But if you want to code this yourself, there's some excellent Perl libraries for managing MP3:
http://search.cpan.org/~nuffin/MPEG-Audio-Frame
(and most directly speaking to what you're working on)
http://search.cpan.org/~ilyaz/MP3-Splitter-0.02
It's not too bad to use Perl either, especially with the Perl Packager. Given only one host with the full Cygwin Perl install, you can create compiled executables that encapsulate everything you need down to a single file. It rocks!
http://search.cpan.org/~autrijus/PAR-0.85/scrip
I imagine though that you'd eventually want to only analyze random chunks that contain speech, or at least speech like frequency distributions. This is trickier, and I don't know if there's Perl code to do it. Maybe you could investigate Praat's internal scripting language?
http://www.fon.hum.uva.nl/praat/
Praat is pretty mind-bogglingly cool -- it's worth checking out no matter what.
--Dan
P.S. Yes, I've been working on some mildly related stuff. How could you tell?
Why does this seem absurdly simple to me?
/. isn't the best place, but I think it's great that he's trying to combine a couple of fields of study to develop something new.
It probably probably sounds simple to you because it is. However, this professor said that pyschology was his field, not computer science or programming. I personally think it's great that someone that far out of a tech field has found an useful application for modern technology AND that he decided to check with those most likely to understand the finer details of the techonology. Maybe
Mike Scanlon
I think what this guy is looking for is a CS student who will write it for him. This is how academia works.
Cretin - a powerful and flexible CD reencoder
Agreed..
In any case I couldn't imagine that it'd take more than half a day or so to do this in Java or Python.
Or five minutes in Perl with MP3::Splitter:
Me: In any case I couldn't imagine that it'd take more than half a day or so to do this in Java or Python.
You: perl -MMP3::Splitter -e 'mp3_split($_,{},[ rand(64800), 30 ], ...) for @ARGV' filename.mp3
I would like to take this opportunity to say that Perl guys are smartasses.
Use small Windows-based devices and don't give it any further thought. The OS will crash at random (you don't have to pay extra for this, it does it out of the box), thereby giving you the fragmented recordings you seek.
On the other hand, you could do it with an embedded linux device too; the frequent battery changes will have the desirable effect.
Okay I confess I wrote this post to confuse the moderators into inaction; he's bashing windows -- no, he's bashing linux -- oh FUCK what to do...
The correct moderation, gentle mod point merchant, is `funny'.
Blearf. Blearf, I say.
You can't run Open Source code on Windoze without destroying the American way of life!, pinko