Friday, February 1, 2013

Playing large audio files in java ( Update #3 )

I will start this entry by showing you the API in action. Here is a small demo of the api in its current development.







I noticed a small bug while deleting the label: After manually adjusting the label's position, the "delete" label doesn't seem to work. Hence, I added "time precision" which can be adjusted as below:

int digits_after_decimal = 4;
myAudio.getDisplay(AudioDisplay.TYPE.WAVEFORM).setTimePrecision(digits_after_decimal);
//The default value of the precision is set to 2 digits after decimal.


Every manipulation, here after would respect the time precision  (I will show in a demo what I mean).  Therefore, if you want too concerned about the precision.You need to adjust the time precision at the very start.
For example,
        audFile = Utility.getFileFromUI(myPanel, Utility.wavFileFilter);
        myAudio.setAudioFile(audFile);
        myAudio.getDisplay(AudioDisplay.TYPE.WAVEFORM).setCrosshairLen(20);
        myAudio.getDisplay(AudioDisplay.TYPE.WAVEFORM).setZoomLevel(7);;
        myAudio.getDisplay(AudioDisplay.TYPE.WAVEFORM).showCursor(false);
        myAudio.getDisplay(AudioDisplay.TYPE.WAVEFORM).setTimePrecision(4);

WARNING: 
It has to be noted that the decrease of time precision might lead to irreversible lose of precision!


Here is the demo






No comments: