Bug and a testing proposed patch: Hear an occasional whistle in the background of 24 KHz MP3 audio playbook

43 views
Skip to first unread message

مُحَمَّد النَّقِيْب

unread,
May 16, 2012, 7:35:59 PM5/16/12
to zekr...@googlegroups.com
In the name of Allah,
Assalamu Alykum,

Bug Description:
Component: javazoom BasicPlayer
Zekr version: 1.0.0

Steps to reproduce:
2. add recitation to zekr 
3. play on zekr and you will hear  an ocassional whistle in the background
4. open any mp3 file from the recitation with  a media player that implement upsampling as vlc 2 or windows media player 12 or 
Demo JavaFX 2.0 MP3 Player :
and  with any of these ,you will not hear the whistle at all.
5.(optional) open the same file with a media player that does not implement upsampling as mpc-hc (media player classic - home cinema) or 
javazoom jlgui:
or  JM Studio  which is inside Java Media framework avaible for download from Oracle website
and with any of these you will hear the ocassional whistle again .

Note: Please test and reply with confirmation  if you find this bug reproducible.



Bug Analysis:

 I hear an occasional  whistle in the background of Audio. A whistle  is heard once or more in every aya . It is apparent at high sound volume. It's duration is less than seconds , but every some second it plays   . I think this a problem in audio player API used , i.e., Javazoom BasicPlayer . I confirmed that the problem is related to basic player by  testing the audio on JLGUI player which is based on BasicPlayer (link below) , while this problem is not related  to java runtime environment by testing yhe audio on  a sample javafx 2 mp3 player (link below).

 Why BasicPlayer have this problem?  I assume this is due to that the software player passes a relatively low sampling rate (24 KHz) to a hardware low pass filter  which is not sharp enough to filter correctly. A common solution is upsampling the audio signal before filtering. This makes it much easier for the hardware to correctly filter the signal.

Propsed Solutions:

Solution 1: Implement upsampling:.
May be this is a direct solution ,but it is not easy. either patch tritonus to use upsampling by default or modify basic player to call tritonus upsampling. Tritonus offers sample rate conversion in 'Tritonus miscellaneous' plug-in , see:
 but it is very limited . it only offers PCM to PCM sample rate conversion. I tried to program -using this plugin - decoding MP3 to PCM  then converting sampling rate, but i failed .I was hit by that tritonus can't extract media information by get methods and triggers an exception. I quitted trying because i felt tritonus buggy and limited.

Solution 2: use a differrent API other than javazoom basic player that upsamples by default:
This may be easier. Example APIs are JavaFX2 and jvlc. 
JavaFX 2 is pure java library developed by Oracle , open sourced as openJFX , and interoperable with SWT and support most media types. It is now released generally for Windows and MacOS X and as developer preview foe Linux: 


First proposed patch:

I am attaching a first proposed patch. It uses JavaFX2 media player for audio playback. It requires Java 6 update 26 or later and JavaFX 2.0 or later .
please use this patch to assure if the ocassional whistle disappears from playback audio  , and reply  to me  , then I will - if Allah wills- fix issues in this patch.
the patch is two modified java files. please replace the original files in code with the modified and compile and test audio quality. 
In order to compile please add to dependencies  , the library:  jfxrt.jar .On windows, I have it  installed by javafx 2 installer in:
  C:\Program Files (x86)\Oracle\JavaFX 2.1 SDK\rt\lib

Known Issues in this patch:
1-playback stops after each audio file . please navigate manually while testing this patch
first press play
then press play 
then navigate to next aya by next button

2-progress bar doesn't work
3-Recitation reader window  size is doubled . The added half of the window is blank .

  Looking forward to  hear from  you testing results and comments -if Allah wills-.

Jazkum Allahu Khairan ,

Muhammad AnNaqeeb


 







DefaultPlayerController.java
AudioPlayerForm.java

Mohsen Saboorian

unread,
May 17, 2012, 12:16:12 AM5/17/12
to zekr...@googlegroups.com
Dear Muhammad,

Wa Alaikumassalaam wr wb,

First of all, thank you very much for your well-documented bug report. I've just boosted with a lot of energy as there was a long time we had no such highly constructive message around.

I accept issues with Javazoom's library and I'm very eager to replace it with any other pure-java option. If you look at older Zekr versions, we used first an .swf flash file for audio playback, but we had issues with that and a lot of complaints from our Linux users. Now with Javazoom library although more people are able to listen to Quran with Zekr, again there are some missing functionalities and bugs with IcedTea JMF support.

Javazoom and Tritonus are all now dead projects. No more development or bug fixes. I reported a bug about JavaZoom's basiclayer 3 years ago but no response yet.

I'll test your patch soon inshaAllah but before that please provide me with the following info about JavaFX, as I don't have any experience with it.

1. Does JavaFX work on all Windows, Mac and Linux seamlessly? I see that there is only a dev preview available for Linux. Did you test it on Linux?

2. Can we distribute JavaFX libs it along with Zekr on Windows/Mac (so that users do not need to install first JRE and then JavaFX)? I mean is having JavaFX a matter of setting its runtime library in the classpath or it requires some manipulations in user's JRE directory?

3. Is it completely open source? If yes is there any such package on Linux distributions yet (so that we can depend our package to it)? I don't see any stable release yet by OpenJfx project.

4. Which audio codecs are supported by JavaFX? On its FAQ it is suggests a very commonly using list of codecs, which is completely acceptable. By does it play MP3 on Linux?

Regards,
Mohsen




 







--
You received this message because you are subscribed to the Google Groups "zekr-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/zekr-dev/-/2F94FIsFsGEJ.
To post to this group, send email to zekr...@googlegroups.com.
To unsubscribe from this group, send email to zekr-dev+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zekr-dev?hl=en.

محمد النقيب

unread,
Jul 12, 2012, 12:37:12 AM7/12/12
to zekr...@googlegroups.com
Dear Mohsen,
Thank you for your welcoming reply and I am sorry to reply too late.
 
1- yes, JavaFx should work seamless on all windows , mac and Linux
In fact, beforeyour reply, I diddn't test except on windows 7
after your reply , i tested zekr on windows xp and it worked the same.
for linux test,both oracle JDK and  openJDK crashed when i tried to
press play button in zekr  ; so I tried to test a simpler application
that only plays an mp3 file, then I noticed that it worked without
crash but the audio quality was inferior , exactly simmilar to the
quality without the javafx patch.
 
In fact , I find that strange ; because Javafx uses libavcodec ,
exactly as VLC; but VLC doesn't suffer this audio quality problem.
 
2-this is 2 parts question :
Legally:
you can distribute JavaFx older than 2.0.2 , and you can't distribute
developer previews
 
technically: yes it works by settting classpath , and it also offers
two new distribution options:
first is download on demand ,i.e if you packafe it as jar file for web
start , javafx 2 will be auto downloaded ,or users will be directed to
download site to download it.
second: native packaging that doesn't require javafx no java to be installed:
 
3- it is open source with the classpath exception ,exactly as java is
; but i am not aware of any project that implements it's classpath as
with icedtea for jdk
if you mean binary package for linux :only dev packages , stable
packages will be available with javafx 2.2 in shaaa in the second half of 2012
if you mean deb and rpm : yet there is no packages
 
4-In fact, i didn't test except mp3 and wav .
yes it plays mp3 and wav on linux.
it requires on ubuntu :
libavcodec52, libavfilter52 on older ubuntu
libavcodec53, libavfiter53 on newer ubuntu
although libavfilter is not documented as a requirement on javafx website - only libavfilter is documented -,it is required as observed by tests. i made these tst on sabily 11.10 and javafx 2.2 dev preview
 
At last ,i would like to say javafx 2 is completely different from javafx1 , javafx1 was developed in javafxscript , a language that was developed expressly for it , also it ran on all os, including mobile phones, javafx2 is developed in java not javascript ,and runs only on windows and macos x and in shaa Allah Linux , but no announced plan for mobile currently.
 
Regards,
Muhammad
 
 
2012/5/17, Mohsen Saboorian <moh...@gmail.com>:
> Dear Muhammad,
>
> Wa Alaikumassalaam wr wb,
>
> First of all, thank you very much for your well-documented bug report. I've
> just boosted with a lot of energy as there was a long time we had no such
> highly constructive message around.
>
> I accept issues with Javazoom's library and I'm very eager to replace it
> with any other pure-java option. If you look at older Zekr versions, we
> used first an .swf flash file for audio playback, but we had issues with
> that and a lot of complaints from our Linux users. Now with Javazoom
> library although more people are able to listen to Quran with Zekr, again
> there are some missing functionalities and bugs with IcedTea JMF support.
>
> Javazoom and Tritonus are all now dead projects. No more development or bug
> fixes. I reported a bug about JavaZoom's basiclayer 3 years ago but no
> response yet.
>
> I'll test your patch soon inshaAllah but before that please provide me with
> the following info about JavaFX, as I don't have any experience with it.
>
> 1. Does JavaFX work on all Windows, Mac and Linux seamlessly? I see that
> there is only a dev
> for Linux. Did you test it on Linux?
>
> 2. Can we distribute JavaFX libs it along with Zekr on Windows/Mac (so that
> users do not need to install first JRE and then JavaFX)? I mean is having
> JavaFX a matter of setting its runtime library in the classpath or it
> requires some manipulations in user's JRE directory?
>
> 3. Is it completely open source? If yes is there any such package on Linux
> distributions yet (so that we can depend our package to it)? I don't see
> any stable release yet by OpenJfx
> .
>
> 4. Which audio codecs are supported by JavaFX? On its
> is suggests a very commonly using list of codecs, which is completely
> acceptable. By does it play MP3 on Linux?
>
> Regards,
> Mohsen
>
>
> On Thu, May 17, 2012 at 4:05 AM, مُحَمَّد النَّقِيْب
>
>> In the name of Allah,
>> Assalamu Alykum,
>>
>> *Bug Description:*
>> Component: javazoom BasicPlayer
>> Zekr version: 1.0.0
>>
>> *Steps to reproduce:*
>> 1. download offline recitation from:
>> 2. add recitation to zekr
>> 3. play on zekr and you will hear  an ocassional whistle in the background
>> 4. open any mp3 file from the recitation with  a media player that
>> implement upsampling as vlc 2 or windows media player 12 or
>> Demo JavaFX 2.0 MP3 Player :
>>
>> and  with any of these ,you will not hear the whistle at all.
>> 5.(optional) open the same file with a media player that does not
>> implement upsampling as mpc-hc (media player classic - home cinema) or
>> javazoom jlgui:
>> or  JM Studio  which is inside Java Media framework avaible for download
>> from Oracle website
>> and with any of these you will hear the ocassional whistle again .
>>
>> Note: Please test and reply with confirmation  if you find this bug
>> reproducible.
>>
>>
>>
>> *Bug Analysis:*
>>
>>  I hear an occasional  whistle in the background of Audio. A whistle  is
>> heard once or more in every aya . It is apparent at high sound volume.
>> It's
>> duration is less than seconds , but every some second it plays   . I think
>> this a problem in audio player API used , i.e., Javazoom BasicPlayer . I
>> confirmed that the problem is related to basic player by  testing the
>> audio
>> on JLGUI player which is based on BasicPlayer (link below) , while this
>> problem is not related  to java runtime environment by testing yhe audio
>> on
>>  a sample javafx 2 mp3 player (link below).
>>
>>  Why BasicPlayer have this problem?  I assume this is due to that the
>> software player passes a relatively low sampling rate (24 KHz) to a
>> hardware low pass filter  which is not sharp enough to filter correctly. A
>> common solution is upsampling the audio signal before filtering. This
>> makes
>> it much easier for the hardware to correctly filter the signal.
>> see:
>>
>> *Propsed Solutions:*
>>
>> Solution 1: Implement upsampling:.
>> May be this is a direct solution ,but it is not easy. either patch
>> tritonus to use upsampling by default or modify basic player to call
>> tritonus upsampling. Tritonus offers sample rate conversion in 'Tritonus
>> miscellaneous' plug-in , see:
>>  but it is very limited . it only offers PCM to PCM sample rate
>> conversion. I tried to program -using this plugin - decoding MP3 to PCM
>>  then converting sampling rate, but i failed .I was hit by that tritonus
>> can't extract media information by get methods and triggers an exception.
>> I
>> quitted trying because i felt tritonus buggy and limited.
>>
>> Solution 2: use a differrent API other than javazoom basic player that
>> upsamples by default:
>> This may be easier. Example APIs are JavaFX2 and jvlc.
>> JavaFX 2 is pure java library developed by Oracle , open sourced as
>> openJFX , and interoperable with SWT and support most media types. It is
>> now released generally for Windows and MacOS X and as developer preview
>> foe
>> Linux:
>>
>>
>>
>>
>> *First proposed patch:*
>>
>> I am attaching a first proposed patch. It uses JavaFX2 media player for
>> audio playback. It requires Java 6 update 26 or later and JavaFX 2.0 or
>> later .
>> please use this patch to assure if the ocassional whistle disappears from
>> playback audio  , and reply  to me  , then I will - if Allah wills- fix
>> issues in this patch.
>> the patch is two modified java files. please replace the original files in
>> code with the modified and compile and test audio quality.
>> In order to compile please add to dependencies  , the library:  jfxrt.jar
>> .On windows, I have it  installed by javafx 2 installer in:
>>   C:\Program Files (x86)\Oracle\JavaFX 2.1 SDK\rt\lib
>>
>> *Known Issues in this patch:*
--
محمد النقيب
 
Reply all
Reply to author
Forward
0 new messages