Great work on the javaFlacEncoder project, its really a life-saver and very cool!
I'm creating an Android app for blind people and am using your javaFlacEncoder to help me create the app. I have encountered a small problem and wondered if you can help point me in the the right direction to rectify / handle it.
Overview of exactly what I'm doing with javaFlacEncoder:
Using javaFlacEncoder in an Android environment, so have modified your source (javaFlacEncoder-0.3.1-all), to handle the fact that javax.sound.sampled does not work / exist on Android.
I'm recording raw PCM files in real-time, saving / converting them to 2 file / formats (recorded-file.pcm / recorded-file.wav); manually adding the WAV header to the raw PCM to create the WAV file.
Note: all files formats I'm recording / converting - to / from are: 16 Sample Size, 8000 Sample Rate, 1 Channel, Frame Size 2, Signed, not Big Endian.
After saving the files, I'm using a slightly modified version of your FLAC_FileEncoder and AudioStreamEncoder classes to convert from the WAV format to FLAC.
This works great, apart from one small problem ... after the conversion process, on the newly created FLAC file, there is an additional, very small piece of audio signal at the very start; which plays back as a glitch / pop / crackle for a few MS before the converted sample (which sounds just fine) starts playing.
So I'm trying to figure out where / how this additional piece of unwanted audio signal is getting created and added from. After that I need to to find a way to remove / prevent it from getting inserted at all, during the conversion process.
The changes I've made to the FLAC_FileEncoder and AudioStreamEncoder classes are to:
Hard-code in the parameters to support the conversion format (16 Sample Size, 8000 Sample Rate, 1 Channel, Frame Size 2, Signed, not Big Endian).
Replaced the AudioInputStream with a FileInputStream instead.
(Note: I'll look at ways to make the code more usable for Android later, if can fix this current conversion issue I'm having.)
Basically I cannot complete the Android app as I would like, if I cannot get this working; so am trying to figure it out. I've spent some time looking through your source code and must admit that a lot of it is beyond my current skill / knowledge level; so I really need your assistance if possible.
I've uploaded two example audio files, that I'm working with here:
(Edited to remove file links, as problem fixed now.)
So that's it ... can you please help?
Best Regards,
Will
Last edit: Will Lingard 2013-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Will,
I'll do what I can to help, and am glad to see the code being used. I decoded the flac file to wav and noticed it is 44 bytes longer than the original. Looking at it in a hex editor, it appears that the flac file has the wav header encoded as sound data. Without seeing and testing the code, I can't say for sure, but I imagine the problem is the wav header not being skipped over as you're reading in samples. If your files are guaranteed to be the same format every time, then you should be able to just skip the first 44 bytes and read in the rest. Hope this helps,
Preston
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the fast reply and helping me pinpoint exactly what was happening.. simply skipping the first 44 bytes has indeed fixed the problem.
I thought the WAV header problem you indicated was happening, however I tried skipping the first 40 bytes before (doh!) ... instead of 44 bytes, not taking into the int value for the data size, so it wasn't working.
All good now though.. thanks again for your help!
Best Regards,
Will
Last edit: Will Lingard 2013-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Preston,
Great work on the javaFlacEncoder project, its really a life-saver and very cool!
I'm creating an Android app for blind people and am using your javaFlacEncoder to help me create the app. I have encountered a small problem and wondered if you can help point me in the the right direction to rectify / handle it.
Overview of exactly what I'm doing with javaFlacEncoder:
(Note: I'll look at ways to make the code more usable for Android later, if can fix this current conversion issue I'm having.)
Basically I cannot complete the Android app as I would like, if I cannot get this working; so am trying to figure it out. I've spent some time looking through your source code and must admit that a lot of it is beyond my current skill / knowledge level; so I really need your assistance if possible.
I've uploaded two example audio files, that I'm working with here:
(Edited to remove file links, as problem fixed now.)
So that's it ... can you please help?
Best Regards,
Will
Last edit: Will Lingard 2013-06-16
Hello Will,
I'll do what I can to help, and am glad to see the code being used. I decoded the flac file to wav and noticed it is 44 bytes longer than the original. Looking at it in a hex editor, it appears that the flac file has the wav header encoded as sound data. Without seeing and testing the code, I can't say for sure, but I imagine the problem is the wav header not being skipped over as you're reading in samples. If your files are guaranteed to be the same format every time, then you should be able to just skip the first 44 bytes and read in the rest. Hope this helps,
Preston
Hi Preston,
Thanks for the fast reply and helping me pinpoint exactly what was happening.. simply skipping the first 44 bytes has indeed fixed the problem.
I thought the WAV header problem you indicated was happening, however I tried skipping the first 40 bytes before (doh!) ... instead of 44 bytes, not taking into the int value for the data size, so it wasn't working.
All good now though.. thanks again for your help!
Best Regards,
Will
Last edit: Will Lingard 2013-06-16
Dear Preston and Will
i'm also having problem javax.sound.sampled does not work / exist on Android
Can you show me how you got it work ?
Thanks so much !
Hello Preston and Will,
I'm trying to convert from the wav file to flac format by using javaFlacEncoder, I'm having the problems with javax.sound.sampled.
Could you help me for converting? I need javaFlacEncoder updated.
Looking forward to hear from you as soon.
Best Regards,
Wang
Hi Will, can you share your source code with me?
Thanks