[maxmsp] about mxj~ MSPBuffer poke method (and VBR mp3 lengths)
olivier pasquet
olivier.pasquet at ircam.fr
Fri Oct 12 23:16:08 MDT 2007
- Previous message: [maxmsp] [OT -Gig spam} SF Headhone Fest
- Next message: [maxmsp] Re: about mxj~ MSPBuffer poke method (and VBR mp3 lengths)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
A long long long long long long time ago, Ali Momeni wanted to play with mp3's and mxj. There http://www.synthesisters.com/hypermail/max-msp/Nov05/34373.html He wrote : "however, i'm having trouble setting the length of a buffer because the getFrameLength() method of an AudioInputStream seems to always return -1 (!@#$)." And there were no answers. I wanted to give you the result of my searches about this specific subject: 1- Indeed, normal getFrameLength() does not give the length of an audiostream coming from an mp3. It exists a trick to calculate the mp3 length from the file information. However this is useless because you will anyway get problems with VBR mp3s... 2- It _seems_ (not 100% sure) the real trick is to use javazoom.jl.decoder.* ( http://www.javazoom.net/javalayer/ sources.html ) as follow : import javazoom.jl.decoder.*; ........... int nTotalMS = 0; try { Bitstream m_bitstream = new Bitstream(new FileInputStream (your_file)); Header m_header = m_bitstream.readFrame(); int mediaLength = (int)encodedFile.length(); if (mediaLength != AudioSystem.NOT_SPECIFIED) { nTotalMS = Math.round(m_header.total_ms(mediaLength)); } post("Length in ms: " + nTotalMS); } catch(Exception e) { e.printStackTrace(); } } Best, O./
- Previous message: [maxmsp] [OT -Gig spam} SF Headhone Fest
- Next message: [maxmsp] Re: about mxj~ MSPBuffer poke method (and VBR mp3 lengths)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
