Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 Internal audio player

Kangas_Sound_Editor
closed
nobody
GUI (4) 4.1.0 (2)
5
2014-05-06
2010-11-21
PaulNorthYorks
No

Presently, there is only an option for an external audio player in the Kangas Sound Editor/QI software, such as Windows Media Player. This enhancement would provide a Java-based internal audio player to the Kangas Sound Editor/QI, and would be useful in situations where existing external audio players are deficient in some way (e.g. they load the track, but don't play it automatically).

This internal media player would be in addition to the existing external audio player functionality, rather than a replacement of it.

Discussion

  • PaulNorthYorks
    PaulNorthYorks
    2013-11-29

    I would expect the standard controls in such a player, i.e. play, pause, rewind, volume control. It would also be useful if the name of the file currently being played, or last played, were displayed.

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-02

    Hi Miroslav,

    Thank you for your post.

    I have tested your player on some .WAV files generated by the Kangas Sound Editor, and can confirm that it played them successfully.

    Would you be willing to add pause and rewind controls as well as a volume control to a Java library extracted from your player? I think the pause function is almost there in your player, it just needs a pause icon to show when the sound is playing, and the play icon to show when the sound is paused or stopped. Rewind would just need a single button to rewind to the start of the sound, this could be a stop button.

    I look forward to your reply.

    Paul

     

  • Anonymous
    2013-12-02

    Well, I tried to do some fast changes, but there is still some issue with synchronization / rendering. I would have to look more deeper into it when I will have more time. Also it can now open mono wav files.
    http://xbup.org/files/XBSEditor_svn_20131202.zip

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-02

    Hi Miroslav, thank you for your efforts so far! I look forward to hearing from you when you get round to dealing with the issues you mentioned. I'll try out the file you sent me when I get the chance.

    Regards
    Paul

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-05

    Hello again Miroslav, I have now had a look at your latest effort, which is definitely moving in the right direction!

    There are a couple more things I would need before I can use it:

    • The stop button needs a little more work; in particular the tooltip to say 'Stop', the action of pressing it to move the scrollbar back to the start, and reset the time elapsed to 0:00
    • I would need a library interface so I can launch the player with a method call, e.g. XBSEditor.play(String audioFileName), that loads the audio file passed as a parameter and straight away plays it. I am not keen on invoking the player with 'java -jar XBSEditor soundfile.wav' which is likely to be slower as another JVM process must be started.

    Would you be agreeable to doing these extra items?

    Thanks and regards
    Paul

     
  • Miroslav Hajda
    Miroslav Hajda
    2013-12-05

    Hi, I believe I was able to fix issues I mentioned, not sure if the difference will be noticeable. Time showing is still broken.
    http://xbup.org/files/XBSEditor_svn_20131206.zip
    Next I will try to strip it for you to basic functions during weekend and you can of course modify it later to suit your needs. I hope LGPL is acceptable for you..?

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-06

    Hi Miroslav,

    Thanks, that sounds great. Kangas Sound Editor uses GPL, but I don't think there would be any licensing problems with it using a LGPL library, unless you know any different?

    Paul

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-06

    Hello again Miroslav,

    There is another potential problem I have come across. I noticed in your readme.txt file, that Java 1.7 is a requirement. Although Kangas Sound Editor is fine with 1.7 on Windows and Linux, it is built to work with Java 1.6 on Mac OS X, as Java 1.7 has poorer availability on Mac OS X.

    Any ideas?

    Paul

     
    • Miroslav Hajda
      Miroslav Hajda
      2013-12-06

      This shouldn't be problem. I switched my project to 1.7 recently, but code is mostly still in 1.6 or could be simply converted via semi-automatic process. I will provide it as 1.6 java sources for you.

       
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-07

    Thank you very much for this Miroslav! I'm working on something else at the moment, but I will have a go at integrating this into the Kangas Sound Editor as soon as I've finished my current task.

    I'll let you know how I get on with integrating and testing it.

    Regards
    Paul

     
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-27

    Hi Miroslav,

    I have made a few minor changes to your WavePlayer as part of integration with the Kangas Sound Editor. These include a new method 'play' in WavePlayer.java, which is the entry point from the Kangas Sound Editor, a change of thrown exception class RuntimeException (which wasn't caught) to UnsupportedAudioException (which is caught), stopping any sound from continuing to play once the WavePlayer is closed, and getting a change of volume by the user dragging the volume slider while no sound is playing to work. The attached WavePlayer.zip incorporates these changes, if you'd like to check it out.

    Should you have the time and inclination, what would be really nice is for some additional sample rates (the Kangas Sound Editor can be configured for 11025, 22050 and 88200 as well as the default 44100) and additional bits per sample (KSE can be configured from 8 bits to 32 bits, with default 16). It would also be very desirable for the scrollbar to act as a seek, i.e. with the displayed elapsed time and position in audio stream changing as the scrollbar is adjusted by the user. Is this hard to implement?

    Thank you again for your help on this. Have a happy new year!

    Paul

     
    Attachments
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-27

    Hello again, Miroslav. Thank you for your latest changes, much appreciated.

    I believe I have hit a thread deadlock issue in the WavePlayer, that I could do with your help to resolve. The issue occurs if you try to drag the scrollbar while a sound is playing, and results in the player hanging. On debugging, the Event Dispatch Thread stack trace has method adjustmentValueChanged calling synchronized method seekPlaying, which calls stopPlaying, which calls WavePaintThread.terminate where it goes into an infinite loop as the 'drawing' variable is always true. The WavePaintThread is stuck trying to call synchronized method repaintWave, and is effectively waiting for the Event Dispatch Thread to exit synchronized method seekPlaying, which can't happen while the 'drawing' variable is true.

    The two threads are both using the same synchronizing lock object, an AudioPanel instance. Should there be different synchronized lock objects for these (ie seekPlaying and repaintWave) methods, or would this likely cause another problem?

    Regards
    Paul

     
    • Miroslav Hajda
      Miroslav Hajda
      2013-12-28

      I tried to fix this issue multiple times, but it seems, that synchronizing 4 threads is probably more than I can manage. I did some change, not sure if it solved the problem or at least made it less likely to happen.

      http://xbup.org/files/Kangasound_WavePlayer_20131228.zip

      It was not priority for this tool/editor, so seeking barely works - there should be signaling to interrupt wait/sleep in painting thread to reduce lag during seek. If you have more experiences with java threads, maybe you can fix that - after many unsuccessful attempts to handle this, I don't feel qualified to give you any advice regarding this.

       
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-28

    Hi Miroslav,

    I have tested your latest WavePlayer, and scrolling while a sound is playing is working a lot better, no hung program to report! Thank you very much for this.

    I have added you as a developer to this project, reflecting your now significant contribution to it. I intend to include your WavePlayer in the version 4 release of the Kangas Sound Editor, which I hope to release in Spring 2014.

    Just one more question: How much work would it be to deal with 8-bit unsigned PCM? I followed the WAV file specification https://ccrma.stanford.edu/courses/422/projects/WaveFormat/, which mentions that 8 bit samples are stored as unsigned bytes in the WAV file format.

    If it is a fair bit of work, never mind, we can always leave it to a future release beyond version 4 if there is demand for it.

    Best regards
    Paul

     
    • Miroslav Hajda
      Miroslav Hajda
      2013-12-29

      Well, it's only a small change.
      http://xbup.org/files/Kangasound_WavePlayer_20131229.zip

      Also please don't list me as developer to your project. It was only small task and even as I'm interested in audio synthesis to some degree, I wouldn't rather wish to be associated with your project, mostly because of the overall look and policy.

       
      Last edit: Miroslav Hajda 2013-12-29
  • PaulNorthYorks
    PaulNorthYorks
    2013-12-29

    No problem Miroslav, I have taken you off the developer list for this project.

    I have attached the latest version of WavePlayer, which has minor tweaks from the last version you sent me.

    In version 4 of the Kangas Sound Editor the overall look won't change much, but I intend to make changes to the functionality to enable users to become more productive at using the software. Having a decent internal audio player is one such change.

    Anyway, thanks again for your help, and all the best for 2014.

    Regards
    Paul

     
    Last edit: PaulNorthYorks 2013-12-29
    Attachments
  • PaulNorthYorks
    PaulNorthYorks
    2014-05-06

    Release 4.1.0 of the Kangas Sound Editor/QI includes WavePlayer as the internal audio player.

     


Anonymous


Cancel   Add attachments