Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Software

Sampling Short Sequences From Long MP3 Recordings? 278

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)?."
This discussion has been archived. No new comments can be posted.

Sampling Short Sequences From Long MP3 Recordings?

Comments Filter:
  • Mp3 splitter (Score:3, Informative)

    by Anonymous Coward on Monday August 16, 2004 @04:33PM (#9984499)
    Just get something like mp3 splitter [codevisions.de], cut it into appropriate size chunks, shuffle them and merge them back together. Then cut them to your ideal length.
  • Audacity? (Score:4, Informative)

    by techsoldaten ( 309296 ) on Monday August 16, 2004 @04:33PM (#9984500) Journal
    I don't know if this is really what you are looking for, but Audacity [sourceforge.net] is what I would look at. Perhaps a custom module could be written to handle random samples.

    M
    • by krog ( 25663 ) on Monday August 16, 2004 @04:56PM (#9984739) Homepage
      I think what this guy is looking for is a CS student who will write it for him. This is how academia works.
    • Re:Audacity? (Score:3, Insightful)

      by Anonymous Coward
      while true do
      dd if=/dev/sound bs=[size of 10 second sample] count=1 | gzip -c >> output.raw
      sleep [time between samples]
      done

      Whaddya mean, you must use windows at any cost?
      • Re:Audacity? (Score:5, Insightful)

        by orthogonal ( 588627 ) on Monday August 16, 2004 @08:11PM (#9986438) Journal
        snip four line shell script that pretty much (except converting to mp3 format) accomplishes what is desired by submitter

        What amazes me is that this precisely the sort of thing to do in software, yet the submitter contends that up until now they've done it with a custom designed and custom built chip.

        I mean, the guys at http://rockbox.haxx.se could do it in about 15 minutes, and provide a GUI on the MP3 recorder.

        Naturally, this is easier to do when MP3 recorders are running open source software, so to an extent this is a rant at all the manufacturers of computing appliances who see a competive advantage in closed source: you lost my purchase, and who knows how many purchases from this professor and while requiring him to shell out even more for a custom chip to do in hardware what is ridiculously easy to do in software (as the parent poster shows by using that complex and little-known software technique, calling sleep()).

        I'm not criticizing the parent: his code does the right and the simplest thing; the problem is with manufacturers whose use of closed source precludes such elegantly simple solutions.

        A big part of the reason that the IBM PC took off in such a big way in the early 1980s was becuase it was open source: not the code to MS-DOS, but the architechtural specification of the hardware itself. This cost IBM money when "clone"-makers were able to produce "monkey copies" of the PC, but that very competetion made PCs much more popular, and soon dominant over other (possivly techically superior) brands like Ape or Amiga. The open specs also allowed a myriad of other companies to offer add-on hardware from co-processors to graphics cards, and even allowed software authors to optimize for the IBM-PC (who here is old enough to remember what peripheral's memory was mapped to address B800, and the advantages to manipulating the data there directly?)

        Did opening the IBM-PCs architecture finally cost or benefit IBM. We'll never know. But it is likely that the PC market, and thus the market for home PCs and peripherals, and software for home PCs and the World Wide Web, would never have been near as big without IBM's decision to open the PC even to competitors.

        Manufacturers of closed-source appliances would do well to consider what they gain, and what they lose by preventing customers from fully using their products. (The careful reader will see that the antecedent of "their" in the previous sentence is ambiguous; the astute reader will understand why: just whose product is it, the company that makes it or the customer who buys it?)

  • by BillsPetMonkey ( 654200 ) on Monday August 16, 2004 @04:34PM (#9984516)
    Audacity [sourceforge.net] and a relatively simple plugin. Open source software is good like that.
  • Some tools (Score:3, Interesting)

    by Shant3030 ( 414048 ) * on Monday August 16, 2004 @04:35PM (#9984520)
    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.
  • Simple... (Score:5, Funny)

    by Anonymous Coward on Monday August 16, 2004 @04:35PM (#9984521)

    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

    • Just install Cygwin - about as close as you can get to Linux development environment while still producing Win32 binaries.
  • Easy... (Score:5, Funny)

    by xsupergr0verx ( 758121 ) on Monday August 16, 2004 @04:35PM (#9984523)
    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
  • Use mp3split (Score:5, Informative)

    by mrAgreeable ( 47829 ) on Monday August 16, 2004 @04:35PM (#9984527)
    Sounds like a job for a really simple shell script driving mp3split [sourceforge.net]. Sounds a lot easier than a custom chip!
  • by Drewskee ( 695015 ) on Monday August 16, 2004 @04:36PM (#9984537)
    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.
    • That was one of my issues. First for privacy reasons, they decided to only sample randomly by turning the device off and on for short periods. Then, because it's easier for them, privacy gets tossed and they record the entire day, and sample randomly from that.
      • by Tackhead ( 54550 ) on Monday August 16, 2004 @04:59PM (#9984767)
        > That was one of my issues. First for privacy reasons, they decided to only sample randomly by turning the device off and on for short periods. Then, because it's easier for them, privacy gets tossed and they record the entire day, and sample randomly from that.

        What's the difference? Either way, all you'll end up with is a bunch of MP3s of people saying "Fuck!" and "Goddamnit!" and "Aaw, shit!"...

    • The problem with that is that it wouldn't be a really good social experiment because the person would either forget to press the button or only press the button when there was something that they wanted to record. Maybe what you could do is install a special "privacy button" where if they were on the phone and telling the person something personal (like there SSN) they could hit the button and it would mute the mike. However, I'd still be nervous to include such a thing because I think it would still skew
    • by Anonymous Coward on Monday August 16, 2004 @05:14PM (#9984902)
      It would be pretty embarrasing to have to explain this:
      Voice1: Yeah, I'm the director. I can get you a part.

      Voice2: Really?! This is so exciting!
      Voice1: Of course, you'll need to auditi--
      [snip]
      Voice1: eah baby, suck it. Oh yeah!
      Voice2: Mmmmmffff!
      Voice1: Oh yeah! Oh yes! God yess!!!
      Voice2: Mmmmfff! Mmmf mm!
      Voice1: Yes! Yes! I'm cu--
      [snip]
      Voice1: --s the best ever. Now it's your turn.
      Voice2: Oh, I like a man who returns the favor..
      Voice1: Hey, what's this.. WHAT THE FUCK!?! HOLY SHIT! YOU'RE A GU--
      [snip]
      Voice3: I can't believe you fell for that!
      Voice4: We all knew. Are you fucking blind?
      Voice3: Hahh! hah! ha!
      Voice1: SHUT UP!!
      Voice2: I thought you knew.
      Voice1: Fuck you, dude!!
      Voice3: Did he tell you he's a director?
      Voice2: Yeah, does this mean I'm not getting the part?
      Voice3: HA!! ha ha ha!!
      Voice2: What's so funny?
      Voice4: Dude, he works in a seven ele--
      [snip]
      Voice1: --unches like a guy.
      Voice3: HA!! HA HA!!
  • Perl can (Score:2, Insightful)

    by Anonymous Coward
    Download the MP3 Module, RTFM and do it!
  • by Anonymous Coward on Monday August 16, 2004 @04:37PM (#9984555)
    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 [mp3-tech.org] is one.
    • Jump to a a random offset, look for the sync-word, copy a number of frames, repeat ... you can jump right to the middle and grab a couple of frames without worrying about the rest.

      Expect that mpeg layer 3 audio uses a bit reservoir [wlv.ac.uk], even in constant bitrate encoding (the bits allocated to any one frame of 1152 samples changes).

      The IMDCT used by layer 3 also means that the samples out depend on each frame and the previous frame, even if the bit reservoir feature is not in use.

  • by revscat ( 35618 ) * on Monday August 16, 2004 @04:38PM (#9984556) Journal
    This made it on the front page? Lame.

    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.

    • by Doc Ruby ( 173196 ) on Monday August 16, 2004 @04:41PM (#9984596) Homepage Journal
      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 ;).
    • While it may be simple to you, it may not be to others. Not every slashdot reader is a programmer. This particular article, while being more of an "ask slashdot" article, was interesting in the short explanation of what they are doing, and how they are doing it.

      I would personally be interested in hearing about the results of these studies, and am glad that it was on the front page.
    • by mandos ( 8379 ) on Monday August 16, 2004 @04:54PM (#9984728) Homepage
      Why does this seem absurdly simple to me?

      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 /. 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.
    • by C60 ( 546704 ) *
      Why does this seem absurdly simple? Because it is. A proof of concept for this idea could be developed by even a moderately "okay" programmer in just about any language.

      Oddly enough, I speak from experience, being both an okay programmer, and having done almost exactly this in the past using perl. We were gathering 30 to 60 second samples of tracks off of audio CDs at different offsets (dependant upon the type of music) for online streaming. CDs came in one side of the process, were ripped, sampled, and c
    • by Fastolfe ( 1470 ) on Monday August 16, 2004 @05:26PM (#9985028)
      This made it on the front page? Lame.

      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 [cpan.org]:
      perl -MMP3::Splitter -e 'mp3_split($_,{},[ rand(64800), 30 ], ...) for @ARGV' filename.mp3
    • The reason there are so many Ask Slashdots like this is because simoniker's code for deciding which submission to publish was based on the response to a previous Ask Slashdot, and is as follows.

      10 a = number of submissions
      20 b = INT rand number from 0->1 * a
      30 publish submission number b
    • You know, this isn't all that easy. He wants to get this thing running under windows, so he first has to get WINE up and running and then figure out how to get perl installed...
  • 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.
    • I see now.... (Score:2, Informative)

      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.
    • Doesn't this void your privacy requirements you previously mentioned.

      For those of you with privacy concerns and questioning the use of Windows for the target platform, I'd like to submit that maybe the intent is to let those participating in the study run the program to extract the desired snippets and send them in, which mitigates somewhat the privacy concerns and probably *would* require that the app run on Windows.

      Not trying to point the finger at FerretFrottage...just a convenient reply point...

  • 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 compl
  • Modified PyMP3Cut? (Score:5, Informative)

    by AceMarkE ( 154966 ) on Monday August 16, 2004 @04:38PM (#9984564)
    Perhaps something based off of PyMP3Cut [sourceforge.net]? 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.
  • 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!
  • DON'T DECODE (Score:5, Insightful)

    by interiot ( 50685 ) on Monday August 16, 2004 @04:39PM (#9984583) Homepage
    Whatever solution you choose, just note: YOU CAN DO THIS WITHOUT DECODING AND RE-ENCODING.

    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.

    • Re:DON'T DECODE (Score:2, Interesting)

      by stratjakt ( 596332 )
      it's just a stream. You should be able to use dd, like

      dd if=/home/britney/oops.mp3 of=/home/kazaa/sample.mp3 bs=(not sure?) count=(duration)

      Meh, whatever, you get my point. You specify the frame size in the bs= parameter, the id3,etc, offset in the "where to start" parameter, and go from there.

      Or just use one of the metric assload of utilities out there that already do this.
    • Re:DON'T DECODE (Score:4, Informative)

      by LnxAddct ( 679316 ) <sgk25@drexel.edu> on Monday August 16, 2004 @04:53PM (#9984713)
      Even with the interframe bit reservoir you only need to pull out a maximum of 9 frames to have playable audio.
      Regards,
      Steve
  • 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 e
  • Not difficult (Score:5, Informative)

    by Effugas ( 2378 ) * on Monday August 16, 2004 @04:43PM (#9984620) Homepage
    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:

    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- 0. 08/Frame.pm

    (and most directly speaking to what you're working on)

    http://search.cpan.org/~ilyaz/MP3-Splitter-0.02/ Sp litter.pm

    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/script /p p

    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? :-)
  • 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
    • There is no law that prohibits "invasion of privacy". There are eavesdropping laws, but if I decide I want to carry around a sound recorder, it's my right to do that (in most states).
  • by mantera ( 685223 ) on Monday August 16, 2004 @04:49PM (#9984679)
    You ask a person to carry an 18 hour voice recorder... I'm just curious what batteries you use.
    • That is what the backpack is for.

      DUH!

      actually, there are mp3 players that boast 14 hours of play, im sure there are a few out there than can do well more than that for recording.

      • There are some with much more than that :) For example the Rio Karma gives ~16 hours of mp3 per charge. The new Carbon is over 20 IIRC. I'm sure other manufacturers also make long life players. But you're right about encoding....
  • by barfy ( 256323 ) on Monday August 16, 2004 @04:54PM (#9984725)
    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?
    • 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
    • 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.
  • 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 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.
  • by TrevorB ( 57780 ) on Monday August 16, 2004 @04:56PM (#9984748) Homepage
    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.
  • by laird ( 2705 ) <lairdp@gmail.TWAINcom minus author> on Monday August 16, 2004 @04:58PM (#9984755) Journal
    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.
  • umm,

    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.

  • by kegegg ( 805857 )
    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'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?
  • A few things. (Score:4, Interesting)

    by g0bshiTe ( 596213 ) on Monday August 16, 2004 @05:06PM (#9984823)
    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.
  • What if songs on the radio get recorded? Will they want their cut? I know, fair use in all. See you in court.
  • So this guy developed a freakin' microchip rather than go with a software splitter? I must be mis-understanding something here...
    • Maybe he designed it on older recorders that couldn't hold all the audio it would take to split after the fact. Besides, programming a microcontroller isn't very hard.
  • ...or any other system with GNU head and tail:
    head -c*random byte offset* *file.mp3* | tail -c *small number of bytes*
  • UNIX solution (Score:3, Informative)

    by Equuleus42 ( 723 ) on Monday August 16, 2004 @05:19PM (#9984947) Homepage
    The following solution requires mpg123, GNU shellutils, and an MP3 file to decode. Why come here for a Windows solution? :^)

    #!/bin/bash
    for i in $(seq n)000
    do
    • mpg123 -w out$i.wav -k $i -n f source_filename.mp3
    done

    Where 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.
  • by jonasmit ( 560153 ) on Monday August 16, 2004 @05:27PM (#9985041)
    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...
  • ... look here (http://www.wotsit.org/search.asp) and make your own "player".
  • mpg123 -s foo.mp3 | perl -e ' $seconds = 2;
    $percent_chance = 25
    while (read( STDIN, $_ ,44100*$seconds*2*4)) { if (rand() < ($percent_chance/100)) {
    print $_ ;
    } }' >| /tmp/foo

    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 /tmp/foo -t ossdsp /dev/dsp

    will play it

    Adding a PCM header, re-mpeging the data
  • The Snack library (homepage here [speech.kth.se]) 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 [speech.kth.se] and an MP3 player [sourceforge.net].

    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.

  • by phearlez ( 769961 ) on Monday August 16, 2004 @05:44PM (#9985198)
    simply based on the pretention overload in the first paragraph of the article:

    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.

  • by MadFarmAnimalz ( 460972 ) on Monday August 16, 2004 @05:58PM (#9985327) Homepage
    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'.
  • mpg321 {sourcefile} | cut {put some arguments here}
  • 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.
  • by pocopoco ( 624442 ) on Monday August 16, 2004 @06:39PM (#9985735)
    >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.
  • by SethJohnson ( 112166 ) on Monday August 16, 2004 @08:11PM (#9986437) Homepage Journal


    It sure as hell took that professor a lot of words to state his problem. How about a piece of software that edits out all the unecessary typing and just presents the few snippets needed for this guy to make his point?
  • Use mpgedit... (Score:3, Informative)

    by mpgedit ( 805983 ) on Monday August 16, 2004 @08:21PM (#9986492) Homepage
    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.
  • Side question ... (Score:3, Insightful)

    by Etyenne ( 4915 ) on Monday August 16, 2004 @08:43PM (#9986608)
    Since you want to analyze ambient sound, should'nt you be using a lossless codec instead of MP3 ?
  • Is that legal? (Score:5, Insightful)

    by suwain_2 ( 260792 ) on Monday August 16, 2004 @09:07PM (#9986724) Journal
    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?
  • Ask Greg Abowd (Score:3, Interesting)

    by baxissimo ( 135512 ) on Monday August 16, 2004 @10:05PM (#9987087)
    I can't find anything on his web page about it, but Greg Abowd [gatech.edu], 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.
  • by account_deleted ( 4530225 ) on Tuesday August 17, 2004 @04:22AM (#9988853)
    Comment removed based on user account deletion

"God is a comedian playing to an audience too afraid to laugh." - Voltaire

Working...