I have some code which converts 16bit audio from byte data to short arrays (or any type of arrays) for processing. Once all sorts of possible processing is done, it is then converted back to a byte array for playback. I've attached the code which does this initial conversion at the bottom of this email.
I've recently starting using the jlayer, mp3spi, and tritonus_share libraries. So far i'm able to get metadata from the mp3 files easily, however i'm struggling to get the audio converted into a format that's playable by my software. When i use: int bytesread = din.read(bytes, 0, (int) bufSize);
'bytesread' is only 4068 regardless of the mp3 file, or the values of bufSize/the size of the bytes array. When using 16bit wavs, bytesread is the same size as bufSize and bytes. All the audio which comes out after conversion from a byte array (from the code below) is silent/has a value of 0.
Can anyone let me know why i can't 'access' this raw byte data for conversion?
'din' is the decoded audioInputStream, you can see the 'standard' audio code here:
When i try to use 'int bytesread = audioInputStream.read(bytes, 0, (int) bufSize); - all i get is white noise!
Joined: Mar 22, 2005
No idea what's going on, but I still think you would have an easier time using JMF. Is there a particular reason you want to use MP3SPI?
1) With MP3SPI, you can simply reuse all the javasound code, which i have already implemented
2) With MP3SPI, i believe i can access the raw byte data, convert it using the code above (i.e. treat it like a wav), and then convert it back to 16bit byte data for play back - all using the same mechanisms as i am familar with - i.e. the javasound API. The software i'm coding for is not a small app that simply requires an mp3 playing in the background, or anything like that.
Please correct me if i'm wrong, or if i can do this with JMF!