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)?."
You'd be making a full recording though... wouldn't that still qualify as personal invasion.
Just get something like mp3 splitter, cut it into appropriate size chunks, shuffle them and merge them back together. Then cut them to your ideal length.
I don't know if this is really what you are looking for, but Audacity is what I would look at. Perhaps a custom module could be written to handle random samples.
M
Could someone please provide the 1 line perl script or 3 line python script or 5 line /bin/sh script that will do this on Linux?
Audacity and a relatively simple plugin. Open source software is good like that.
"It's not your information. It's information about you" - John Ford, Vice President, Equifax
...Google for it?
I work for an acoustics company and we use either matlab or CoolEdit pro to analyze waveforms. Given the size of your data, it could be difficult though. Probably would want to break down the input into hour segments.
Might want to check with an acoustics lab.
Try http://www.ee.sunysb.edu/~cspv/CSPV.html or something similar.
100% Insightful
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
Apple's iTIMS plays small samples from longer audio streams. I really wish they would pick better sections of the original stream though... I don't ever get a good idea of what the song is because it never has time to really get going.
Modest Mouse has a song Float On that really doesn't get cooking until the middle. I would never have purchased it if I had only the iTMS sample to try.
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!
"(for windows)"
wrong answer, try again.
If I was a participant in this research I think I would be more concerned with my privacy if they were physically recording everything and then just 'randomly sampling' what they needed later. Having the trigger physically on the player seems much more reassurring. But hey, maybe I'm just paranoid.
Download the MP3 Module, RTFM and do it!
I'd think it would be relatively easy to set up a Perl script within windows to randomly pull bits of data out of the file and assemble them into a new file suitable for playback.
Good thing they make perl for windows.
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.
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)
10 a = rand number
20 b = a + 30 seconds
30 open MP3 with appropriate sound API, get sound between a and b
40 save a and b to a table so you don't use those values again
50 goto 10
Why does this seem absurdly simple to me? I think just about any modern language with a decent set of libraries will be able to handle this, if there isn't a shareware app out there already. 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.
Doesn't this void your privacy requirements you previously mentioned. I understand you want to grab short samples after the fact, but you'll still have access to all the continous data to begin with.
"Look Lois, the two symbols of the Republican Party: an elephant, and a fat white guy who is threatened by change."
This is the sort of application that screams for a script, rather than some sort of drag-n-drool GUI windows-ish thing. There are several audio sampling and processing utilities over at sourceforge.net, which would be suitable for this sort of thing.
Maybe it's because my background is in the *nix world, but it'd be a half-day project to get this up and running done on a *nix box with something free from sourceforge.
Usually one wants to design the solution to fit the problem, not to introduce more complexity by limiting what the solution can be chosen from. Doesn't seem to be the case in this guy's project. I also can't imagine finding audio sampled snippets of someone's day all that interesting, but I'm sure there are people who enjoy that sort of thing?
Perhaps something based off of PyMP3Cut ? I haven't used it, but the description seems pretty relevant ("PyMP3Cut was designed to slice high quality MP3 recordings of day-long congresses into smaller per-speaker MP3 files. It only needs the exact same amount of disk space as the original file to slice, even less if you plan to skip some parts, which PyMP3Cut can do automatically if you use a specially formatted *SKIP* entry in your timeline. It was successfully used many times against several hundredths megabytes MP3 files.").
IIRC, a MP3 file is made up of frames which contain the sound data in its entirity. You should be able to just cut a block anywhere in the middle, say any 20 second piece and expect at elast 18 seconds of continous sound. Too lazy to script it.
All you need to do, is develop a program which will time on and off. Just program it so it switches itself on randomly.
If you know your bitrate, use the file size to rough out the play length and then write a simple script in VB or Python or C# or whatever you want to simply copy out chunks of the file into another one. The only possibly complicated thing would be to insert silences (maybe?) between chunks, but that shouldn't be too much of a chore.
Perhaps I didn't get the question right, but it seems very trivial to me and just about any semi-professional audio editing tool could do it.
But have you also considered using Matlab? Its DSP Toolbox (and other ones as well) is fantastic and manipulating audio data is almost a trivial thing to do (assuming you've already found a way to have your data recorded into a readable format -- which includes many popular choices). Matlab is also suitable for all kinds of manipulations with vectors and you can do an enormous amount of things (FFT, etc.) with some very simple and intuitive commands. Resampling, random number generation, time commands -- all these are provided.
So... check out www.mathworks.com -- the drawback is the price (but you can get very good deals for educational purposes).
PS: Of course, I am not affiliated in any way with Mathworks Inc.
Doomie
Linux + Mpg123 would do the job nicely
Just script it to open the file, play back the predetermined segments and capture the audio to sequentially numbered sound files.
Easy!
Sunday you're Thinking Different, Monday you're a huge tool, paying too much and waiting to think like everyone else.
If you set things up properly (namely limiting the use of the interframe bit reservoir), then there are many utilities which will allow you to pull out specific frames from within an MP3 file. This should both be much faster from a processing standpoint, and not incur more data loss from two encodings.
> you don't want to do that
Bashing Windows for the sake of bashing Windows, huh?
(checks URL)
Yup. I'm on Slashdot alright.
finally able to load http://dingo.sbs.arizona.edu/~mehl/EAR.htm and it says "...So far, the EAR has operated on a 30 seconds on -- 12 minutes off cycle (i.e., it comes on every 12 minutes for 30 seconds), yielding on average about 70 samples of a person's acoustic social environment (i.e., 35 minutes of ambient sounds) per person per day...." so it's not full on all the time to begin with.
"Look Lois, the two symbols of the Republican Party: an elephant, and a fat white guy who is threatened by change."
If they're desperate enough to use your program, they don't have to "40 save a and b to a table". The odds that they'll get the same random number again are lower than the probability that they'll use the program ;).
--
make install -not war
I thought you'd never ask....
echo OFF
REM MAKE SURE MANDRAKE CD'S ARE NEARBY
cd c:
deltree -A
Seriously. Ok, you want to trim little samples out of mp3 files. There are only about a jillion and one products that do just that.
/dev/random to grab little sections of files.
If you want to be the l337 hack0r and write some esoteric script to do it, go ahead. I'm sure you could massage dd and
In short, why don't you roll up your sleeves and do your own friggin job?
I don't need no instructions to know how to rock!!!!
I would also go for using mp3split (don't know how it handles very long files - should be okay, because of no re-encoding however).
Wrap it with a simple perl or python script to introduce the randomness.
If that is not sufficient, probably audacity with a custom plugin would be usable.
I would not start with writing a complete new problem, without having evaluated all scriptable options.
I have to agree with previous posts - if you have a problem with sampling a whole day, I don't see how recording a whole day and then only sampling parts is any different. You've still made the recording. I would suggest settling on a standard for the recorder, and then stick with it so you don't have to make new chips all the time. And if you can't afford to buy a few years' supply of the recorders, just make sure you settle on a wildly popular one and when they stop selling them retail, pick them up on eBay. The Dragon Naturally Speaking mobile edition (comes with a voice recorder) I bought on clearance like 4 years ago is still available on eBay. Cheap, too.
666-607: 6th floor apartment of the beast
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?
Besides, the comments would be in a cool gray instead of being in a puke yellow.
perception is reality
I don't have a direct answer to the question posed, so I'll expect the "off-topic" mod'ing, but MP3.com got in trouble for something very similar... they archived *samples* of most of the songs out there. Where they aired was in copying copyrighted materials without permission. Unless the person's carrying the recorders sign an initial waiver, technically, anything they record is their personal property and your *sampling* it is a violation. What happens, for example, when the ambient noise of a guy getting it on with his girlfriend is recorded. If you sample that, the girlfriend can then sue you for invasion of privacy, even if you don't distribute the recordings. Sounds like a potentially sticky legal issue if you ask me.
.bat.
For a more on-topic answer, a simply shell script with a sleep command would probably do the trick. I personally do all my CD burning on Linux via the command line and pipes. So a shell script that accepts the recording as standard in with 30 second sleep statements and outputting to a recording device would probably work and not cost much of anything at all.
Want a Windows version? Use cygwin or take the same shell script and write it as a
The IT section has an awful color scheme (actually, has it changed, slightly? it looks a little bit easier to read). And why does this article belong in this section, anyway? I thought IT was like a department in a business. I'd expect to see articles there about hiring practices, outsourcing, office software, Microsoft products and open replacements, and maybe general development issues. Do MP3s really fit into that section?
Secession is the right of all sentient beings.
> What would it entail to develop such a program (for Windows)?.
I think it is some intersection of 'immortal' and 'soul'.
Well... you can still use windows, just install Cygwin, and there you go! Perl, sox, shell scripts, whatever. Get 'er done!
To answer the question directly, it should be quite simple to write a script under Linux or Mac OS X, quite likely utilizing mp3splitter, to achieve this task - it should be possible under Windows, too, but probably easier and certainly stabler and more secure under Linux or Mac OS X.
To answer the question obliquely, I would suggest that you may be able to write a script to run on a portable recording device utilizing an open source system to automate recording in your desired sample format.
To answer your question with a completely different approach than that requested, I would suggest that you could simply continue using your custom chip solution, since it's developed and functional, with one change - stock up now on a supply of the devices sufficient to last for the life of your project. That would prevent your having to develop any new solutions whatsoever.
You ask a person to carry an 18 hour voice recorder... I'm just curious what batteries you use.
Since you're working at a university you should try to find a student at an electronic studio (studies in electronic music) and perhaps take a look at MAX/MSP made by cycling74. That's a graphical programming 'language' for realtime electronic music (and visuals). Ask the student about this program - it is extremely easy and intuitive to do this kind of stuff in this language.
Then why did they reject my story on how to pop up a dialog box in Windows?
Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
... the reason why I couldn't handle college and dropped out. Dumb ass profs like this... Please explain the value of this? What happened to teaching people things they could use? Geez, and I wonder why other countries kick our asses when it comes to education??? /rolls eyes
> (for Windows)?."you don't want to do that
A flip answer but correct in the sense that this is simply a problem of calculation. You don't need any GUI or any fancy interface. I suggest, since you are at a school anyway, that you swing by the computer science department and get some senior to do this for his independent study project. All it needs to do is take the input sound file and put out the random samples. Requirements: 1. the input file, 2. parameters for how often and for how long to randomly sample (could be in a text file) and 3. the output file. No Windows, (MS, X, or other), required. Heck, it could be a DOS program (depending on the input file sizes).
not 5 lines, and not sure if it even works, and of course you'd have to encode to mp3 (not hard with lame or something).
/dev/dsp > /tmp/recording-`date +"%F-%H-%M"`
#!/bin/sh
SLEEP_TIME=10
RECORD_TIME=10
while $1
do
`sleep $RECORD_TIME && killall -9 cat` &
cat
sleep $SLEEP_TIME
done
I'm not drunk, I'm just in touch with pi.
The recordings exist. Just because you will somehow post process them, I don't think you have really met your standard of not recording the whole day.
Would you submit them under subpeona? Will they be destroyed? When? How?
I think anybody in the CS dept could write the program you require. But I am pretty sure you are going to have to keep coming up with a way to do this "pre-record". And exactly why is it so hard to just buy *enough* recorders?
It'd be fairly easy to write a Csound script to do it, but you'd have to convert it to WAV or AIFF beforehand (not hard).
You could post to the Csound list about how to do it. Would be about 10 lines of code or less, I'd bet.
http://csounds.com/
idealord music
But if you can find an easy way to turn them into .au files (I think there are some programs that will convert multiple files), it's trivial to write a Java program to do it.
Visit my website to contact me if you need further help/code assistance.
~D
This sig has been enciphered with a one-time pad. It could say almost anything.
This is an excellent research field. I may convert section of my recombinant lab to this study. I will urge the head of Oncoproteomics department to do the same thing and cut budget to other projects for this.
I suggest you read Slashdot
May be. http://www.yes333.com/?linux
Record it to tape and give that tape and some scissors to your kids...
Just ask the RIAA. They've got some great software for taking an MP3, extracting bits of the file, and replacing the rest with (loud) white noise. Should be perfect for your needs.
I don't understand why he'd need to change the hardware every six months. Sure, there are new MP3 players, but as long as they've implemented on a model that is sufficient for their work, who cares whether there are newer models out (other than that old models will get cheaper, which is nice).
And the idea of recording an entire day and sampling seems terrible in terms of both privacy and efficiency. If you can record a day's samples in a $75 MP3 flash-based player plus a tiny circuit that randomly presses the record button twice every so often, why bother using a $400 hard-drive based MP3 player, recording an entire day, then copying that day to a desktop computer, then sampling out random tiny bits of the day.
Enable 3D printed prosthetics!
two words:
Anonymous Coward
I'm not drunk, I'm just in touch with pi.
What would it entail to develop such a program (for Windows)?
/.org... we hate Windows. Would you care for getting it done on a Linux platform?
I'm sorry, but this is
"There are already a million monkeys on a million typewriters, and Usenet is NOTHING like Shakespeare." - Blair Houghton
get a microphoned pocketpc with 128mb ram. price = $200 on ebay.
do a little programming, taking care to make note of the fact that you will most likely need to "wake up" the machine from a sleep state, start recording, and shut down. time to program for an experienced pocket pc programmer: 4 hours.
done.
This sounds like a great opportunity for an undergrad student. Most undergrads CS/EE at top universities, etc. would have been able to write this as a freshman in high school. As an undergrad myself, I've been employed at an acoustics lab writing scripts in matlab, C, PHP, etc. to do this sort of thing. Cheap labor, exellent results. They'd love to work for references and beer money and can develop custom idiot-proof software. Just post a flyer or post to the CS newsgroup.
If you tell your users you'll be recording their entire days sounds, that's fine. But from a privacy standpoint, the old solution is less intrusive.
If you're willing to use a mac, this would take maybe 15 minutes or less of applescripting iTunes and quicktime player.
Import the song into iTunes
repeat until end-of-song
select random song chunk
paste into quicktime player
end repeat
save quicktime player document
import back into iTunes
From what I understand, you can sort of do the same thing with that iTunes COM library?
sound a;p le; ... it's so nice when you don't have to worry about the details and just use the library functions!
b=a.CutRandomThirtySecondSnippetsFromSoundSam
writefile(b);
To solve your problem(s) here are a few suggestions.
You are at University.
Is there a music lab?
Is there a Computer Science dept?
Is there an electronics dept?
If you can answer yes to 3 of these question most of your problems can solve themselves.
Talk to the Deans of those departments, explain your needs and suggest that the students in these depts may participate in the construction of what you need for their labs or projects.
I'm sure you would have students banging down the door to work on a project.
My point is, use what you have available.
I read a few posts down that someone "couldn't handle, dropped out of college because of professors like this". Well to me this sounds like a lesson with a deeper meaning than just some sort of useless project.
Perhaps it is an effort to show how even the simplest of experiments present difficult logistical problems.
I am Bennett Haselton! I am Bennett Haselton!
Are you sure these are students?? From my experience, students sleep 18 hours... expecting them to be active and awake for 18 hours...
I'm very suspicious of these "students" now...
I would like to create a similar set up for myself.
I'm particularly interested in recording the conversations around me and possibly creating transcripts from them.
What's the best hardware for the job?
Experiment!
This is the sort of application that screams for a script, rather than some sort of drag-n-drool GUI windows-ish thing
You saying you can't make scripts in "some sort of drag-n-drool GUI windows-ish" environment?
Maybe it's because my background is in the *nix world, but it'd be a half-day project to get this up and running done on a *nix box with something free from sourceforge.
And maybe it is a half-day project for him on Windows if he knew how to work with it better than with a *nix box. Why try and slam someone just because they pick something they like to use compared to your likings in a different OS.
Call it flame bait or not, but this Windows/*nix war is getting pretty tiresom for those who are happy with a working product of their needs. Just like IE vs. Mozilla/Firefox.
a college student.
What if songs on the radio get recorded? Will they want their cut? I know, fair use in all. See you in court.
Rhymes that keep their secrets will unfold behind the clouds.There upon the rainbow is the answer to a neverending story
Try codeproject.com. You can have thousands of indian programmers bid to write you a custom solution and it's probably only cost you $10 when the bidding is done. Damn indian programmers.
sound clip:
(foot steps)
(door closing)
(fan whurring)
UMMMMMMMMM.....
UMMMMMMMMMMMM...... (Plop Plop)
(whoooooshhhhhhhhhhhhhh)
So this guy developed a freakin' microchip rather than go with a software splitter? I must be mis-understanding something here...
- First they ignore you, then they laugh at you, then ???, then profit.
If you are saying that privacy is an issue, why not just keep the user/subject be in complete control. I am assuming there is a pause and record button on this device. So with that in mind, let the user hit record when they are comfortable (like on the bus) and pause when they are not (on the phone with their psychic).
Then when you get back the recordings, run a simple script to slice out small bits of the data and destroy the original copy (either physically or wiping it with a disk wiper a few times).
This way the user is in control and you don't need to worry about privacy issues since they are consenting to whatever they want to have recorded.
...or any other system with GNU head and tail:
head -c*random byte offset* *file.mp3* | tail -c *small number of bytes*
Am I the only one who thinks that this whole article thread could be reduced to about 3 postings and not loose any ideas? Come on guys... read the other postings before you post another "eh, I could script it, but I'm too lazy to actually do it for you" messages...
#!/bin/bash
for i in $(seq n)000
do
- mpg123 -w out$i.wav -k $i -n f source_filename.mp3
doneWhere n is the number of MP3 frames to skip, in thousands, f is the number of frames to extract per iteration, and source_filename.mp3 is your MP3 file. For a 128kbps MP3, if you wish to extract 30s of audio for roughly every 10 minutes, you would use n=22 and f=1100. Output would be in files named out1000.wav, out2000.wav, and so on. Experimentation with the numbers is encouraged when using different bitrates. Please feel free to critique my bash code -- I am a little rusty.
Slashdot's first reaction to VMware
Writing a script for Virtual Dub would do the trick. Just have it mark 30sec and extract with a numerical filename. Implementing the "randomness" might be a bit of a chore.
Virtual Dub script
One easy solution would be to utilze a PDA (either Linux or PocketPC based) that has a built in microphone. Give it plenty of storage via Flash or SD or whatever memory technology it utilizes and have your favorite code-smith write you a snippet of code utilizing the existing MP3/Ogg encoding libraries out there...
Why should model turnover matter?
:)
Do the study participants steal the things? Do they damage them beyond the point of re-use? Is the hardware failing from excess usage? It's not like you need new features every year. Why do you need to keep buying new ones? Does your study not have a plan for exactly how much data you need to collect from how many subjects? If so, buy all the recorders you need at once. You can probably save money with a bulk discount.
I can't imagine someone would want to steal something that they know may start randomly start recording on its own. As for damage I would choose your participants more wisely. If it is usage, find out what models a few local lawyers use to do all their dictation. They can't afford frequent breakage as it cuts into billable hours
And as others have mentioned, collecting all the extra data is too invasive and can lead to easily to abuse.
I'm confused as to what privacy concerns would allow you to post process the sound. The old way, nobody would hear more than a snippet. If this is a medical experiment, I would imagine you are having trouble with identifiable information being accessible - which is exactly what would be the case with the unprocessed sound running on the script on the windows machine. Anyway, software is blindingly easier than modified chips. Good step with this.
He is a professor of social psychology not a software developer - give him a break. For an average developer this would be a very simple task - a few days at the most for a simple command line tool or sparse GUI app (Algorithm would be quite simple and all modern languages would support the features you need). You could look for an online forum where developers bid on projects like this for extra money. Usually these sites (Somebody post one I can't remember any of them now but a google search might help you) are very low cost solutions for simple one-off applications like you need. But, since you are part of a University I would contact the CS or IT department and see if there are any Undergrads who would like a small project to make some extra money and/or put on their resume. This would also help solve the problem of setting up your computer to make sure the code works properly (minor configurations would be necessary). Hope all goes well...
How about using cron to repeat the tast every x minutes?
1. record 30 sec wav and save with timestamp as name
2. turn wav file into MP3 with same timestamp but different extension.
3. delete wav file
4. repeat after x seconds
5. (optional) create new folder every new day
You'd need a PDA with linux and a mic. The only one that comes to mind is the Saurus.
DH
... look here (http://www.wotsit.org/search.asp) and make your own "player".
Privacy is terrorism.
Give him a break. The guy's a psycology prof, not a CS prof. Just let the man get his work done without accosting him for being unwilling to learn a new platform.
& Quicktime Pro. Cheap, easy and highly reliable/flexible to allow you the control you need.
mpg123 -s foo.mp3 | perl -e ' $seconds = 2; ,44100*$seconds*2*4)) { if (rand() < ($percent_chance/100)) { ; /tmp/foo
/tmp/foo -t ossdsp /dev/dsp
$percent_chance = 25
while (read( STDIN, $_
print $_
} }' >|
Breaks it up into 2 second blocks with a 25 percent chance of choosing each block ( which works better with your average mp3 you might have lying around than 30 seconds blocks and 5%)
Output is raw 16 bit signed PCM
sox -s -t raw -c 2 -w -r 44100
will play it
Adding a PCM header, re-mpeging the data and splitting into seprate files is left as a exersice to the reader.
Haha, "drag-n-drool," you are teh funnay, sir!
Seriously, though, do you not realize that Windows has just as much scriptability as *nix, if not more? For instance, you could write a script in JScript, VBScript, or PerlScript using the Windows Scripting Host, or you could write a batch script using cmd.exe. If you need more power, you could install Python, Perl, Ruby, or any number of other scripting languages and have your way. If you must have that *nix environment, you could install Cygwin and get several shells like bash or zsh. Just because Windows has a GUI doesn't mean it doesn't have scripting (wait a second ... Linux has X and GNOME/KDE/etc, does that mean it's "drag-n-drool" as well? hrm ...)
Bingo! It is your background. The same task in Windows would be a half-day project (or less!) for a skilled Windows programmer or admin (don't laugh!). Your skillset obviously doesn't extend to Windows, so it's understandable that you can't see how this could be just as easy, if not easier, in Windows.
See above, where scripting is no more complex in Windows than in *nix. As well, if the guy knows Windows, and works in a Windows environment, using *nix for this one problem is going to add complexity.
The Snack library (homepage here) provides high-level manipulation of a wide variety of audio formats (including MP3) to Python, Tcl and Ruby. It's already been used to write several applications including a sound editor and an MP3 player .
All of the scripting languages I listed also support the Tk widget set so you can get a GUI up and running quickly. Plus, since it's all cross-platform, you'll easily be able to port your work to *nix or MacOS.
Why is it hard to buy enough recorders? Simple. It's because they're using Pocket PCs running their custom software. It seems overly complicated for something that could be accomplished with a hardware recorder and later parsing via software. Why distribute a handful of expensive recorders when you can distribute many cheaper recorders? Academia confuses me sometimes - the objectives seem much less spectacular than the methods proposed to reach such objectives.
To see what I'm talking about, check out the newest model of their EAR at the bottom of the page.
James Pennebaker and I developed the method at the University of Texas at Austin at the end of the last century.
Oh you mean FOUR YEARS AGO? Bunghole.
Bad management trumps ideology - Show the world you want better leadership. http://www.timefornewmanagement.com
They've got some great sound apps. But it's the last 2 words of your post that probably negate these apps - they're for OS X. BUT, if you do check them out, Audio Hijack Pro would probably do what you need. They just released a new version, and it's incredibly feature-rich.
Hello. I work in the radio industry and I'm fairly confident that the program you are talking about has already been done. There are HUGE radio research companies that pay people to have personal audio recorder devices on themselves (web search for "radio research people meter") which identify which radio stations they are talking to based on 'hidden' audio encoded into radio music. This seems to be a very specific type of project along the lines of the one you are embarking on. I also know that radio research companies know the likely hood of when a person is likely to be listening to the radio, so they must have done a fair amount of research into what people do with their days, and what audio they are exposed to. Perhaps (I stress this is very unlikely) if you approach one of these companies they may fund you're project if you can prove you are doing something more valuable than what they've already done?
When Mathius was at UT Austin, I participated in this study. At the time I was living a bit of a wild life... just another dotcom burnout that barely touched a computer for 2 years.
I retreived my records from this project - one 3 day session, and a week long session. After the first couple days I completely forgot I was wearing it, as did my friends.
Now I have some excellent memories stored away:
The first time I hooked up with that alcoholic ex-girlfriend... a friend bitching about coke heads... going out every night when the electronica scene was still strong in Austin... another friend detailing how my roommates and I would all end up with STD's...
The best part of the whole experiment: My neighbors all became convinced I was a narc. Having a little mic pinned to your collar all the time makes some people intimidated...
I've already accepted my fate: there is no such thing as privacy. My life is not important enough for anyone to care about the myriad of questionable activities that I was participating in during that period of my life.
95% of the recordings were background music, heavy breathing while I slept, and other random ambient noise.
I bet the transcriber had a fun time with my recordings. They put a dab of glue on the end of the mic to try and limit the recording radius... that did not work at all.
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.
Sounds like a little bash shell, some /dev/random input and the use of the vulnerable dd command would do what you want.
You could probably do it under cygwin under windows....
Definately a CS Undergrad project.
I suggest, since you are at a school anyway, that you swing by the computer science department and get some senior to do this for his independent study project.
I don't know what kind of school you went to, but it mustn't have been a very good one. If you're allowed to do something so completely trivial for a senior project, then I'd already have 100 degrees from that place.
mpg321 {sourcefile} | cut {put some arguments here}
-I like my women like I like my tea: green-
The SoX utility is quite useful for scripted or automated mangling of audio files. While a dedicated MP3-splitting program would certainly work just fine, SoX has a "trim" command that cuts a certain section out of the file; "sox trim [randomstart] 00:00:30" would grab 30 seconds starting from whenever you want.
Typical Academe. What essential tangible job skills does this exercise teach?
John Kerry is a Joke!
I'll do it for $650, with a VB gui.
Reply to this message with an email addy.
Not to mention that surrepticious electronic recording is a felony in many states(ask Linda Tripp). You may want to contact your law dept. as well as your CS dept. However, I suspect that what you are really studying is slashdot social behaviour and your post is just a ruse to elicit responses. Forget it, we're on to you.
You can't run Open Source code on Windoze without destroying the American way of life!, pinko
use of the vulnerable dd command
venerable?
most people are suggesting something complicated, but this is exactly what the shell and lots of little programs are for.
1. use lame to decode the mp3 file to raw data
$ lame --decode -t input.mp3 source.raw
2. use dd to extract the bytes corresponding to the times you want. assuming you want 1 second clips and the input file is 16 bit 44k stereo, the dd command might look something like this:
$ dd if=source.raw of=second.raw bs=176400 count=1 skip=30
the above command will extract the 30th second from your sound and put it in second.raw
3. if you want to accumulate all the seconds you've extracted, use cat
$ cat second.raw >>total.raw
4. writing a nifty little shell script and reencoding back to your desired format is left as an exercize for the reader. (hint: man sox; man lame; info bash)
You can do all this on windows. just install cygwin. I do a lot of algorithmically generated music and video and i use basically the above approach when all i want to do is make a whole bunch of simple edits of sampled sound. You don't need any sound editing software for what you describe.
dunno why you have a high turnover on the hardware. sounds like the spec is pretty solid. you should just find somehting that works and stick with it. perhaps figure out where they OEM it from and get quantity straight from the manufacturer.
you should solve the sampling at the device and not postprocess. there is the privacy issue, and the operating cost of 18 hours of continuous recording.
ever seen an archos recorder running rockbox? would take little effort to make the code that runs on the archos to do the random sampling. has a built in mic, an mp3 ASIC, an SH1 processor, and a hard drive.
open source firmware for the archos right --here--> http://rockbox.haxx.se
>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).
Almost every recorder has a noise/voice activation mode and most of the ones I've used had a mic or line-in as well. So just have an external mic -> custom chip that cuts it off when needed -> recorder. I suppose you could crack open the player and get between the internal mic if you wanted to as well. Either way the custom bit will never go obsolete. I record lectures I go to and found quality is much better with a good external mic anyway, even if it's a pocket size one like the small Sony conference mics.
Runs in windows natively, highly scriptable, can do eight types of frequency analysis and sample stats as part of the batch (all exportable as clear text)... and you didn't google this first because?
Comment removed based on user account deletion
Why not put a timer on a switch that sits between the microphone jack and the microphone?
> I am a professor for social psychology at the University of Arizona
And I'm doing this research project on insular, mimetically inbred subcultures...
eVillager
Hi Simoniker Please check out www.medleytuner.com I have developed this application to play RANDOM samples (you can specify min and max duration of sample) from any collection of MP3 tracks in a specified target folder on your webserver. For your large MP3 files, it is suggested you do this on a LAN. :-)
Otherwise, medleytuner is already optimized for "streaming" through a
web browser. Let me know if this fits your needs.
- Augustine
Though it's intended for more for video work... Avisynth (www.avisynth.org) is an extremely powerful scripting language for dealing with rich media assets. You can probably whip something up using Avisynth and a CLI encoder like LAME with minimal effort, using a simple shell script to "glue" everything together.
Maybe to get around any privacy issues is to put a "blocker" on the mic. It would work this way.... It would effectively turn off the mic for 50 minutes out of every 60, but still keep recording, then you run it through some software that just deletes the blanks.
$5 / month hosted VPS on linux = awesome!
Is probably Windows Media Format SDK. If I remember correctly, you should use the DeliverTime function (which takes a timespan as an argument), and this will callback OnTime. Then you can just throw your dice and decide whether you wanna keep the sample batch or not. I've used it along with LAME to mix mp3s, it should work just fine.
Contact me if you're stuck anywhere, I might be able to help.
mpgedit (http://mpgedit.org/) is an mp3 frame cutter that can easily handle this job. The size of the input mp3 file does not matter, mpgedit can handle anything you throw at it. You want to use the command line interface in conjunction with something like Perl or Python to pick random edit times and lengths. There are also Python bindings you can call directly if you are programming in Python.
A brief command line example:
mpgedit -e39-44 -e111-137 -e222-244 huge.mp3
Will create huge_1.mp3 huge_2.mp3 and huge_3.mp3, 5, 26 and 22 seconds in length respectively.
The script you need to write will generate a command line similar to this example, generating random time offsets and segment lengths. You can determine the total input file play time by running "mpgedit huge.mp3" and parse the time from the "Track length:" field.
A full recording of the type you propose would still be illegal in many states. And it would be a security/liability problem for your entire University.
You may consider using a standard recorder, but add a small circuit on the audio input to silence the input at all, but the random times you want to sample. Such an addon should be simple to create (probably simpler than the program your thinking about - with the right skills) and would be reusable for other devices. The downside is you would probably double the size of the device.
Since you want to analyze ambient sound, should'nt you be using a lossless codec instead of MP3 ?
:wq
I'm not sure that your proposed solution fits with your previously-mentioned privacy concerns. Sure, you'll only see a given part, but you're still recording the whole thing.
It'd be like having the FBI record your calls 24/7, but only listen to them if something came up, or having police be able to raid your house the moment they suspected you, but not look at what they gathered without a warrant. Even if they were completely honest in carrying it out, it's still too Big Brother-ish.
I think that, if the requirements say you can only record brief snippets, then you can only record brief snippets; not record everything and only listen to brief snippets. While it's the same from your perspective, it's not the same in terms of what's actually happening, and it sounds like it's completely bypassing your privacy concerns.
If you're already designing an external microchip, why not design a whole little recorder?
________________________________________________
suwain_2
and I don't remember a psych department! Fraud, I say!
Oh wait, that's because I was in the CompSci dept and never saw the rest of the school. I was also in the music school (took some piano classes) and started out in engineering, so I know they have a decent electronics dept. (or what I'd call computer engineering).
So yes, of course the UofA has the resources. Just ask that feller who helped JPL send the first mars rover up (and perhaps even the second), or that huge lens they made, or Dr. Weil, or the 1998 Wildcats...or the new Student Union.
Yeah, they have resources.
Scary rescources.
Most folk'll never lose a toe, and then again some folk'll...
Dude, the word Windows does not imply a GUI. It is a statement of the operating system. He is really just saying: don't point me a ELF binaries.
Basically what you want to do is some time compression. You can do that by means of granulation or a FFT. Most audio applications already have time compression/expansion plugins built in to them. Sound Forge, Pro Tools Free, Live and Cool Edit are some of the commercial programs that come to mind. You could also build a stand alone program fairly easily with Csound, Max/MSP or Pure Data. These are audio programming/scripting languages. Csound and Pure Data are free. You just need to know a little about digital audio to make a program with any of those languages.
I can't find anything on his web page about it, but Greg Abowd, a professor at Georgia Tech has been working on continuous capture. He has some pda/cell phone software that his group has been working on which allows for continuous capture of audio. He also knows a lot about the laws regarding such recording. Not all states/provinces allow it, but many do.
I think his goals are more along the lines of automating segmentation and indexing of the audio for easy searching of your entire last day/week/year/decade of conversations with people.
Anyway, you might be interested in the kinds of things he's doing. But actually picking out random snippets of mp3 audio should be a trivial coding task. I'm sure there have already been a dozen libraries/scripting tools/command-line solutions proposed already in previous posts.
Does it make you feel better to come into a conversation only to add nothing at all constructive but merely display your insecurity, as manifested by your need to assert your scholastic superiority to the parent?
Awesome toolkit.
http://mpgtx.sourceforge.net/
I haven't used it on Windows, but on Unix it's been great to me. A very easy way to splice up MP3s, via the command line. Then all you need to do is write a short Perl (or similar) script to splice up the files.
This is what you want:
mpgedit has a -e flag so you could do
mpgedit -e 1:20-1:30 -e 600:20-601:10 -f file.mp3
Would grab from 1 minute 20 seconds to 1 minute 30 seconds, and from minute 600, 20 seconds to minute 601, 10 seconds of file.mp3 into file_1.mp3 and file_2.mp3
I use it to cut the 2 hour mp3 of the bbc news hours into 5 minute chunks so my mp3 player will let me skip segments.
With a bit of scripting you could do random cuts of any size mp3.
It claims to work under windows, but I have not tested it there.
--
Zot O'Connor
How can you miss that joke? That should be the most famous line in VH1 history!
or, on a unix-like system, you can use dd (thanks to the design of the mp3 file format)
If you don't want to go the programming route, Automate v5.5 is a great shareware Windows-based general duty automation program that can easily handle this task and any others you may come up with, so it could be a very valuable tool for you. You don't have to do any coding or programming, so those with little or no programming experience can use it. It does amazing things. It also supports VBA and executable calling style programming if you wish to go in that direction at a later time. 15 day full function trial version: http://www.networkautomation.com/downloads/ or from the PC Magazine web site: http://shareware.pcmag.com/product.php%5Bid%5D4978 %5Bcid%5D62%5BSiteID%5Dpcmag
regards
Have you considered a software-based approach? Many voice recorders have flash firmware, and if you're currently adding a chip to the recorder, you should be able to flash the firmware.
The idea is to reflash the device with a modified Vorbis (.ogg) encoder that only encodes random samples. You can get the base file encoder software via CVS from Xiph at (http://www.xiph.org/cvs.html). You could then, fairly easily, modify the encoder to randomly skip periods of time and only encode the input as a series of randomly selected samples (perhaps separated by short periods of silence or very short "marker" tones so your analysis software has an easier time finding the breaks). You could even include a short bit of code to start a new file every so often (hourly, N times/day, etc...). The beauty of the approach is that, if the software's well written, you should have very little trouble adapting it to new recorder hardware, and the result files are completely open.
If you're looking for assistance in writing the software, your sister institution in Tempe, ASU, has a service you should be able to work with called the "software factory" at (http://sf.asu.edu/) which is set up specifically to assist researchers in creating the software they need to complete their research.
You have been able to manufacture a microchip to control the recorder, and you can't find how to write a simple program like this? Suspicious.
This guy is not a nerd like the rest of us here. He is asking for help and you bash him for asking. What might seem simple to us is unimaginable to him. Sure he might work in on department on the Uni but it's not next door to the computer lab, music lab, and on the way for geeks to notice. You can pull out some whoopee Perl script or a one liner and say it is easy--but how long did it take you to learn how to do that? How long did it take you to learn all about a computer before you got that far? Any how you geeks are really tough! Why bash someone that asks for help? It's not like he asking how to mount a cdrw because he has it in he /mnt dir.
I've never written anything in Python, but I notice that there are libraries for editing MP3s. If you or someone you know someone who uses Debian you can download those libraries easily and if you want a GUI that runs on Windows you should be able to do that as well.
You can do some amazing audio programming with Max/MSP. You should be able to write something that takes the file and cuts it up just right.
Either that or CSound (www.csounds.com) should be able to take care of it (and it's free/multiplatform, and easily expandable in C++)
Tibbon
tibbon.com
This gets you, after you fix the compiler error, *a* chunk. Yes, Perl rocks, but you don't have to mislead people. I guess you could just run it 100 times if you wanted 100 chunks... That ain't right.
You need to specify each of the chunks with something like
added in. Then your code becomes
Maybe you can find a more concise way, but I couldn't get the 'x' operator to build distinct random values. ( e.g. ( rand 10 ) x 5 )
And, btw, 64800 is an 18-hour day. Maybe you intended that, but I bet you just remembered 86400 wrong. I too have bad memory, so I did the calculation.
Here's a broken zsh+mplayer version:
problems: /dev/random is costly and may give you more randomness than you need. consider /dev/urandom or other sources for performance's sake.
* must be run with zsh as far as i know (requires $RANDOM magical variable and
in-shell math using $(()) )
* must have mplayer installed
* you are not guaranteed a fixed number of chunks
* your md5 tool is probably named differently from mine
* each chunk starts at the right time index, but continues until the end of
file! i don't know how to tell mplayer to "play for" (that is, play for
only a specified time, like 30 seconds)
- this is the serious problem with this method
- you can try yourself to find out if mplayer can "play for"
- you can truncate the files using dd, but then you might break frames
(not that big a deal i guess), and you have to know the byte size of the
time you want to truncate to, which i think is not at all trivial
- you might be able to use a timer to HUP mplayer after 30 seconds
caveats:
* the "grade" of 1200 indicates the possible range to leap to the next chunk (in seconds). on average you will leap half way, 600 seconds (10 minutes). you will not, with this method, leap further forward than 20 minutes. this peculiarity should clarify for you that you need to more strictly specify the kind of randomness you want
* seeding with
This is untested code, any warranty of fitness for anything other than amusement is hereby expressly disclaimed.
A version of the zsh program that iterates n times and grabs a chunk from a totally random time during the day, like the Perl program, would be simpler to write. All we need is a good command line tool to get a segment of MP3.
Heck, why not:
Amusingly, Perl can be that great command line tool.
It's late. I apolo
- strange conversations...with no one...
any other ideas?nasty bathroom noises...
"I forgot to turn it off before I got into bed with my girlfriend..."
ambiguously legal/illegal activities...
keyboard typing sounds... all...day...long...
just leave the recorder in a sorority bathroom...
leave the recorder in your bosses desk...hmmmm...
a 30 second blood curdling scream in the middle of a normal day...
a big fat bong hit followed with the next 20 clips of a eating/munchie sounds...
Authority questions you. Return the favor.
...because I'd be really annoyed that my taxes were being spent keeping this "professor" in his work-avoidance program.
Gentoo Linux - another day, another USE flag.
MPEG audio streams are divided into frames. Most players can ignore random data and look for the frame headers, so you could just write a simple program to randomly cut x bytes from the mp3 and it would probably play fine (with a short (1 sec) delay at the start).
The other alternative is to randomly seek into the file and look for the frame header. Slightly more work but still easy. Get a first year programming student to do it.
const int one = 65536; (Silvermoon, Texture.cs)
SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
Obviously, but the guy wasn't saying "windows" as in "a segmented graphical display", but "the operating system". He wants windows-based 'cos he uses windows. Fair enough. That could be a command-line app or anything.
Max/MSP programming environment has what you need - it can process audio.
-.Shaun.-
"killall -9 cat" ?
Are you sure you're not drunk?
Seriously though, don't "kill -9" anything without reason, and especially do not "killall" a common utility like "cat" which might be running invoked from another process at any time.
Stumbling in the dark
I hear slavering of jaws
Eaten by a grue.
mp3splt is a simple command-line/GUI tool for doing this kind of thing. There's a windows version available.
"Police" services should they exist should use this stuff "how about a study in law enforcement etc.." although audio isn't all however teh stochasm of visual elements as well.. although I feel its more a matter of having the directory services available for law enforcement as well. At the same time what about streams from DHS services? perhaps donations of unclassified audio samplings as for the program I'm not aware of any automated samplers however say using a program like CREC creative recording which came with sound plaster live you can choose a record what I hear option and you could just click a few time on say windows media and the clips you hit in the recording would be recorded. The question is what do you plan on doing with the audio clips and how many are there. Where it may be practicle to use the first method for a few "participants" in the case of 308480 samples which are going to be statistically "sampled" digested.. used for statistical characteristics of frequency amplitude time of occurance etc.. etc.. to make a "statistical database" with the sampling being used to reduce overhead of processing another method would proly be prefered. In the case of datasampling for statistical analysis at set ranges you could make a shell for sampling a scipt which you said in english start at 0 sample start a loop go 30 seconds from previous point sample continue until no time is remaining in recording the basic idea of this program would be it should have a codec for the type of sound (wav) that is being used. Wav is the "basic" audio format used in cds etc. Sampling rate and audio type stereo or mono are the basic considerations if you only have one point of sound then its going to be mono and the sampling rate will most likely be the highest audio quality of your sound recording source 41k is around cd quality. Not to turn this into an audio lesson. Its just a matter of being able to know the way data renders playback taking the data chunks at time markers in the data. I actually havnt read how a wav file stores its data and should really do that. here are some links http://ccrma.stanford.edu/courses/422/projects/Wav eFormat/
THIS one is VERY informative on actual simple programming methods
http://www.4front-tech.com/pguide/audio.html
ok if your using bigbrother type system with sounds from everywhere being statistically analyzed perhaps devilishly for specific "fingerprint" sounds like fingerprint visual characteristics of some surveilance systems
it would be something like this
input stream (if backlogged) to storage point
feeder system for loader of data to be processed
sound is processed using dsp system(note that DIGITAL SOUND and ANALOG SOUND are not identical. The human ear processes data in analog at a range of what is said to go up to 20khz however noises of all frequency ranges interact and have harmonic effects (those are stochastic elements) which create effects in audible levels. Not only this however the human body both physically and mentally are effected by these ranges. For instance ultra low or ultrahigh frequencies can have potentially lethal effects. There have been psychoacoustic studies which have displayed that ranges that may not be "perceived" to exist can still very much effect the human. At the same time kinetic energy can create energy exchanges of other types which both effect mental condition and physical condition.
sound is then transfered to a either one sample file. how this file works either as a compliatioln of a group or block of samples or wether it is a whole bunch of very small files or rather what would be 2880 1second clips so 38 minutes per day per individual
the actual source routines I would geuss would depend on the language it was written in and may be dependant on the hardware used.
then each file would be written. If dealing with a LARGE amount of data gigs and gigs of data a good compression system that can take the data and create layering (like mpeg) only the more data (if for storage ) that is used for a "example" from binary to x layer means the more encryption blocks can be made. Which would be something to consider for large amounts of data.
So depending on the project size I could see a bunch of different approaches.
this is a simple piece of code in which you can set the min and max duration of the sample-clips you want to play and it will go into your MP3 track and randomly pick a sample to play. If you loop it, since the MP3 is so long, inevitably it will play different samples from different places and of different durations.
You could do this with a script in Sony Vegas http://mediasoftware.sonypictures.com/products/sho wproduct.asp?pid=914. You could use VB.NET or JavaScript to write a script that loaded your long MP3 on the timeline, diced it up into shorter samples, and rendered back out. You could also apply normalization or companding filters along the way, and even include video showing the time-of-day or whatever.
///d@
...around me!
Slashdot Eds Link Anonymous Posts With Logged Posts
They Are Vermin Feeding On Each Other's Feces.
I Hate \.
I realize onboard soldered electrets may be a problem but if you've got recorders that are using external mics this could work. This is unlikely but I thought I'd mention it anyway. (I wish more "voice recorders" would provice external microphone inputs....) This method would throw away much chance of gathering data on when the recorded snippits were made however- not sure it that would matter.
I don't remember anyone saying that he wanted a GUI or a fancy interface. What he said is that he wants something that runs on the Windows operating system. A Windows program doesn't require a GUI anymore than a Unix program does. In fact, when you start a new "project" in Visual Studio, one of the first things you choose is whether it is to be a GUI app or a console app.
I'd rather be lucky than good.