Menu

Problems with playing and print preview on Linux - how to debug

Bodo
2018-10-15
2018-10-25
  • Bodo

    Bodo - 2018-10-15

    I tried to use EasyABC on two different Linux systems with different problems. One is an older Linux Mint (I have to check the version), the other Ubuntu 16.04 LTS.
    IIRC playing music worked on the Linux Mint system, but the program was aborted in the print preview with a division by 0. I have to check again for details.

    I tried the packages from http://abcplus.sourceforge.net/ first, I also tried to copy the files from https://github.com/jwdj/EasyABC over the installation location.
    On Ubuntu 16.04 the scaling in the print preview is wrong, the staves are wider than the paper. Printing to a PDF file seems to work.
    On start of the program I get an error message popup "GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure."
    When I try to play the music I get two different error messages"Resource not found." (I think) and "Your GStreamer installation is missing a plug-in".
    Unfortunately I don't get any context information. [Which operation triggered this error? (I guess it is related to MIDI playing.) Which plugin seems to be missing? Which version of gstreamer does it actually use? (In case there are different versions installed somewhere.)
    On this system gstreamer1.0 is installed. There seems to be also a version 0.10 available, but I think it is not installed. I think I installed all plugin packages.

    Can someone guide me how to debug the problems? Can I activate a log file or debug output? Can I find out which code line (if it's in the Python code) or which external program was executed when the error occurred?
    I'm not specifically experienced with Python or gstreamer, but I'm a software developer.

    Best regards,
    Bodo

     
    • J.W. de Jong

      J.W. de Jong - 2018-10-17

      Hello Bodo,

      Nice to meet a software developer. I am a software developer myself
      (mostly C#) and try to improve EasyABC in my spare time (not much spare
      time though).

      There seem to be some problems with GStreamer on Linux. Especially when
      using Linux in a VM like VirtualBox.
      That is why I started switching to using FluidSynth. I have this working
      in Windows but have not tried it in Linux yet.
      In order to use it you need to download a sound font (many free sound
      fonts available. for example FluidR3Mono_GM.sf2)
      You can get the latest source from https://github.com/jwdj/EasyABC
      That is not the complete source, so first get the source from
      sourceforge (see link below) and overwrite it with the source from GitHub.
      https://sourceforge.net/projects/easyabc/files/EasyABC/1.3.7.7/easyabc_source_code_1.3.7.7.zip/download

      Printing is a known problem in EasyABC. Some people get many empty pages
      when printing. But you are the first to report Print preview issues.
      Like yourself I use export to PDF mostly to work around the printing
      problem.

      I never had Python experience before I started on EasyABC but the
      language is not that difficult.
      I'm using Visual Studio Code as programming environment for Python
      nowadays, but PyCharm is also okay.

      If you want to help getting FluidSynth working on Linux (or Mac) your
      help is most welcome.
      But also if you would like to have a look at the printing part your help
      is appreciated.

      Most of the code can be found in EasyABC.py
      It should work both with Python 2 and 3 so just pick one.

      The source contains also a text file on how to get EasyABC working on
      Linux. (see using_EasyABC_in_Linux.txt)
      Feel free to ask for debugging assistance. The first time it can be
      cumbersome to get it working.

      Jan Wybren

      On 15-10-2018 13:49, Bodo wrote:

      I tried to use EasyABC on two different Linux systems with different
      problems. One is an older Linux Mint (I have to check the version),
      the other Ubuntu 16.04 LTS.
      IIRC playing music worked on the Linux Mint system, but the program
      was aborted in the print preview with a division by 0. I have to check
      again for details.

      I tried the packages from http://abcplus.sourceforge.net/ first, I
      also tried to copy the files from https://github.com/jwdj/EasyABC over
      the installation location.
      On Ubuntu 16.04 the scaling in the print preview is wrong, the staves
      are wider than the paper. Printing to a PDF file seems to work.
      On start of the program I get an error message popup "GStreamer error:
      state change failed and some element failed to post a proper error
      message with the reason for the failure."
      When I try to play the music I get two different error
      messages"Resource not found." (I think) and "Your GStreamer
      installation is missing a plug-in".
      Unfortunately I don't get any context information. [Which operation
      triggered this error? (I guess it is related to MIDI playing.) Which
      plugin seems to be missing? Which version of gstreamer does it
      actually use? (In case there are different versions installed somewhere.)
      On this system gstreamer1.0 is installed. There seems to be also a
      version 0.10 available, but I think it is not installed. I think I
      installed all plugin packages.

      Can someone guide me how to debug the problems? Can I activate a log
      file or debug output? Can I find out which code line (if it's in the
      Python code) or which external program was executed when the error
      occurred?
      I'm not specifically experienced with Python or gstreamer, but I'm a
      software developer.

      Best regards,
      Bodo


      Problems with playing and print preview on Linux - how to debug
      https://sourceforge.net/p/easyabc/discussion/general/thread/2591444c38/?limit=25#e58a


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/easyabc/discussion/general/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Bodo

        Bodo - 2018-10-18

        Zitat von "J.W. de Jong" jwdejong@users.sourceforge.net:

        There seem to be some problems with GStreamer on Linux. Especially when
        using Linux in a VM like VirtualBox.

        Hello Jan Wybren,

        I used normal PCs only, not a VM. IIRC my system was able to play the
        music, on my friend's system I get error messages related to gstreamer.

        That is why I started switching to using FluidSynth. I have this working
        in Windows but have not tried it in Linux yet.

        I will try to get it working. (See below)

        You can get the latest source from https://github.com/jwdj/EasyABC
        That is not the complete source, so first get the source from
        sourceforge (see link below) and overwrite it with the source from GitHub.

        Wouldn't it be a good idea to add the complete source code to the Git
        repository?
        Or what's the reason to omit some parts?

        Printing is a known problem in EasyABC. Some people get many empty pages
        when printing. But you are the first to report Print preview issues.
        Like yourself I use export to PDF mostly to work around the printing
        problem.

        In my case I didn't try printing to a real printer because I'm still
        trying to get EasyABC working. On my friend's system the staves were
        too wide for the preview window as if the page had been prepared for
        landscape format while the preview was in portrait format. I used
        printing to file to create a PDF file. There is no printer available
        on this PC.
        On my Linux Mint PC, where I cannot currently run EasyABC, originally
        had some division by 0 error when trying the print preview. IIRC I
        found that some wx function returned 0 width and height for the
        preview window. i fixed this with a quick hack that replaces 0 by 1,
        obviously leading to a wrong scaling. I will dig into this later.

        I'm using Visual Studio Code as programming environment for Python
        nowadays, but PyCharm is also okay.

        I will try this on Linux. Maybe running easy_abc.py in a debugger will
        help to find the problems.

        I tried your latest version with fluidsynth today. My previous test
        still used the version from the previous commit
        https://github.com/jwdj/EasyABC/commit/f071c15958c4fc37902df230778e759294007ff8

        When I first tried to run easyabc I got the error "Couldn't find the
        FluidSynth library in the program directory." The same after
        symlinking libfluidsynth.so.1.5.2 to the program directory. Actually
        CDLL('./libfluidsynth.so.1.5.2') doesn't search the file in the
        program directory but in the current working directory which is not
        necessarily the same as the program directory. After fixing this I got
        some other error not related to fluidsynth.
        I think I have to re-start from a clean version and check which change
        introduced the other problem.

        In the file fluidsynth.py i noticed the comment header "Copyright
        2012, Willem Vree" ... "partially copied from pyFluidSynth, Copyright
        2008 Nathan Whitehead". This seems to be a fairly old version and has
        the problem finding the library. I don't know what are the
        modifications from the original version at this time.

        I found that there is active development of the original version at
        https://github.com/nwhitehead/pyfluidsynth and a fork with some fixes
        for 64bit-Windows https://github.com/reedjones/pyfluidsynth
        I did not yet test this version, but the code to find the dynamic
        library seems to be more flexible. Maybe there are other improvements.

        BTW: Are you in contact with Guido Gonzato who provides Linux packages
        on http://abcplus.sourceforge.net/?

        Best regards,
        Bodo

         
        • J.W. de Jong

          J.W. de Jong - 2018-10-18

          Hello Bodo,

          Willem Vree has made some modifications to FluidSynth so that it could
          be used in Python and has accurate midi positioning. I have used his
          testplayer to get it working in EasyABC (with his consent, he even made
          it especially for EasyABC).
          You can find his code and binaries on:
          https://wim.vree.org/svgParse/testplayer.html
          If you can get his testplayer working, then it should be a small step to
          get it working in EasyABC.

          SourceForge has always been the home of EasyABC (as far as I know) and
          the GitHub version is just my own copy of it.
          I'll see if I can make it complete one day.

          Yes. Guido Gonzato always keeps everything up-to-date (thank you for
          that if you are reading this). Chuck Boody keeps him informed of new
          versions of EasyABC.

          I have used Linux Mint 18 using VirtualBox and EasyABC works fine here,
          accept for the gstreamer issues (so no sound).

          Greetings,
          Jan Wybren

          On 18-10-2018 11:56, Bodo wrote:

          Zitat von "J.W. de Jong" jwdejong@users.sourceforge.net
          jwdejong@users.sourceforge.net:

          There seem to be some problems with GStreamer on Linux. Especially
          when
          using Linux in a VM like VirtualBox.
          

          Hello Jan Wybren,

          I used normal PCs only, not a VM. IIRC my system was able to play the
          music, on my friend's system I get error messages related to gstreamer.

          That is why I started switching to using FluidSynth. I have this
          working
          in Windows but have not tried it in Linux yet.
          

          I will try to get it working. (See below)

          You can get the latest source from https://github.com/jwdj/EasyABC
          That is not the complete source, so first get the source from
          sourceforge (see link below) and overwrite it with the source from
          GitHub.
          

          Wouldn't it be a good idea to add the complete source code to the Git
          repository?
          Or what's the reason to omit some parts?

          Printing is a known problem in EasyABC. Some people get many empty
          pages
          when printing. But you are the first to report Print preview issues.
          Like yourself I use export to PDF mostly to work around the printing
          problem.
          

          In my case I didn't try printing to a real printer because I'm still
          trying to get EasyABC working. On my friend's system the staves were
          too wide for the preview window as if the page had been prepared for
          landscape format while the preview was in portrait format. I used
          printing to file to create a PDF file. There is no printer available
          on this PC.
          On my Linux Mint PC, where I cannot currently run EasyABC, originally
          had some division by 0 error when trying the print preview. IIRC I
          found that some wx function returned 0 width and height for the
          preview window. i fixed this with a quick hack that replaces 0 by 1,
          obviously leading to a wrong scaling. I will dig into this later.

          I'm using Visual Studio Code as programming environment for Python
          nowadays, but PyCharm is also okay.
          

          I will try this on Linux. Maybe running easy_abc.py in a debugger will
          help to find the problems.

          I tried your latest version with fluidsynth today. My previous test
          still used the version from the previous commit
          https://github.com/jwdj/EasyABC/commit/f071c15958c4fc37902df230778e759294007ff8

          When I first tried to run easyabc I got the error "Couldn't find the
          FluidSynth library in the program directory." The same after
          symlinking libfluidsynth.so.1.5.2 to the program directory. Actually
          CDLL('./libfluidsynth.so.1.5.2') doesn't search the file in the
          program directory but in the current working directory which is not
          necessarily the same as the program directory. After fixing this I got
          some other error not related to fluidsynth.
          I think I have to re-start from a clean version and check which change
          introduced the other problem.

          In the file fluidsynth.py i noticed the comment header "Copyright
          2012, Willem Vree" ... "partially copied from pyFluidSynth, Copyright
          2008 Nathan Whitehead". This seems to be a fairly old version and has
          the problem finding the library. I don't know what are the
          modifications from the original version at this time.

          I found that there is active development of the original version at
          https://github.com/nwhitehead/pyfluidsynth and a fork with some fixes
          for 64bit-Windows https://github.com/reedjones/pyfluidsynth
          I did not yet test this version, but the code to find the dynamic
          library seems to be more flexible. Maybe there are other improvements.

          BTW: Are you in contact with Guido Gonzato who provides Linux packages
          on http://abcplus.sourceforge.net/?

          Best regards,
          Bodo


          Problems with playing and print preview on Linux - how to debug
          https://sourceforge.net/p/easyabc/discussion/general/thread/2591444c38/?limit=25#e58a/8718/346e


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/easyabc/discussion/general/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

           
  • Bodo

    Bodo - 2018-10-22

    Hello Hello Jan Wybren,

    my main problem is the music playing on my friend's Ubuntu (IIRC 16.10) system, but I only occasionally have access to it.
    I tried again on my Linux Mint 17 Qiana Cinnamon 64-bit with a fresh start.
    I removed EasyABC and re-installed the easyabc_1.3.7.7-1_all.deb package provided on http://abcplus.sourceforge.net/

    Music play/pause works.

    When I try the print preview I get an empty page and on the console I get this error message:
    Traceback (most recent call last):
    File "/usr/share/easyabc/easy_abc.py", line 1911, in OnPrintPage
    scaleX = float(w) / maxX
    ZeroDivisionError: float division by zero
    I remember that I once already found out that maxX and maxY (page size) are both 0.
    Code snippet:

            renderer = SvgRenderer(self.can_draw_sharps_and_flats)
            try:
                page = renderer.svg_to_page(svg)
    
                width = page.svg_width
                height = page.svg_height
    
                maxX = width
                maxY = height
    
                # Let's have at least 0 device units margin
                marginX = 0
                marginY = 0
    
                # Add the margin to the graphic size
                maxX += 2 * marginX
                maxY += 2 * marginY
    

    So there must be something wrong with the SVG renderer.
    For debug purposes I added

                if maxX == 0:
                    maxX = 1
                if maxY == 0:
                    maxY = 1
    

    Now I get a preview which looks as if height and width of the score are approx double the page size.

    Can you tell me what is used to create the print preview.
    In case it's related to something with wx, this is what I have installed:

    un  libgl1-mesa-swx11                <none>                <none>                (no description available)
    un  libgl1-mesa-swx11-dev            <none>                <none>                (no description available)
    ii  libwxbase2.8-0:amd64             2.8.12.1+dfsg-2ubuntu amd64                 wxBase library (runtime) - non-GUI support classes of wxWidgets toolki
    ii  libwxbase2.8-dev                 2.8.12.1+dfsg-2ubuntu amd64                 wxBase library (development) - non-GUI support classes of wxWidgets to
    ii  libwxbase3.0-0:amd64             3.0.0-2               amd64                 wxBase library (runtime) - non-GUI support classes of wxWidgets toolki
    ii  libwxgtk-media2.8-0:amd64        2.8.12.1+dfsg-2ubuntu amd64                 wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library runtime)
    un  libwxgtk2.6-0-python             <none>                <none>                (no description available)
    ii  libwxgtk2.8-0:amd64              2.8.12.1+dfsg-2ubuntu amd64                 wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime)
    ii  libwxgtk2.8-dev                  2.8.12.1+dfsg-2ubuntu amd64                 wxWidgets Cross-platform C++ GUI toolkit (GTK+ development)
    un  python-wxaddons                  <none>                <none>                (no description available)
    un  python-wxgtk                     <none>                <none>                (no description available)
    un  python-wxgtk2.6                  <none>                <none>                (no description available)
    ii  python-wxgtk2.8                  2.8.12.1+dfsg-2ubuntu amd64                 wxWidgets Cross-platform C++ GUI toolkit (wxPython binding)
    ii  python-wxversion                 2.8.12.1+dfsg-2ubuntu all                   wxWidgets Cross-platform C++ GUI toolkit (wxPython version selector)
    un  python2.7-wxgtk2.8               <none>                <none>                (no description available)
    ii  wx-common                        3.0.0-2               amd64                 wxWidgets Cross-platform C++ GUI toolkit (common support files)
    un  wx2.8-doc                        <none>                <none>                (no description available)
    un  wx2.8-examples                   <none>                <none>                (no description available)
    ii  wx2.8-headers                    2.8.12.1+dfsg-2ubuntu amd64                 wxWidgets Cross-platform C++ GUI toolkit (header files)
    un  wxpython2.6-0                    <none>                <none>                (no description available)
    

    I have just seen that I have both gstreamer0.10 and gstreamer1.0 packages installed. On the Ubuntu system where playing does not work I have gstreamer1.0 only.
    Maybe EasyABC uses gstreamer0.10?

    On my Mint system I also have package "python-gst0.10 0.10.22-3ubuntu2 amd64 generic media-playing framework (Python bindings)" installed, but not python-gst-1.0
    I have tho check what's installed on the Ubuntu system with non-working sound.

    I just tested that playing also works when I install python-gst-1.0 and uninstall python-gst0.10 or when I uninstall both of them, so I guess EasyABC doesn't uses any of these packages.

    This is the package contents:

    losira%bodo ~> dpkg -L python-gst0.10
    /.
    /usr
    /usr/include
    /usr/include/gstreamer-0.10
    /usr/include/gstreamer-0.10/gst
    /usr/share
    /usr/share/gst-python
    /usr/share/gst-python/0.10
    /usr/share/gst-python/0.10/defs
    /usr/share/doc
    /usr/share/doc/python-gst0.10
    /usr/share/doc/python-gst0.10/NEWS.gz
    /usr/share/doc/python-gst0.10/gst-python.doap.gz
    /usr/share/doc/python-gst0.10/copyright
    /usr/share/doc/python-gst0.10/changelog.Debian.gz
    /usr/share/doc/python-gst0.10/RELEASE
    /usr/lib
    /usr/lib/gstreamer-0.10
    /usr/lib/gstreamer-0.10/libgstpython.so
    /usr/lib/pkgconfig
    /usr/lib/python2.7
    /usr/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages/pygst.py
    /usr/lib/python2.7/dist-packages/pygst.pth
    /usr/lib/python2.7/dist-packages/gstoption.so
    /usr/lib/python2.7/dist-packages/gst-0.10
    /usr/lib/python2.7/dist-packages/gst-0.10/gst
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/audio.so
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/pbutils.so
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/video.so
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/interfaces.so
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/leveller.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/sources.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/jukebox.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/utils.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/__init__.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/pygobject.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/extend/discoverer.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/__init__.py
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/tag.so
    /usr/lib/python2.7/dist-packages/gst-0.10/gst/_gst.so
    ------------------------------------------------------------------
    losira%bodo ~> dpkg -L python-gst-1.0
    /.
    /usr
    /usr/lib
    /usr/lib/python2.7
    /usr/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages/gi
    /usr/lib/python2.7/dist-packages/gi/overrides
    /usr/lib/python2.7/dist-packages/gi/overrides/_gi_gst.so
    /usr/lib/python2.7/dist-packages/gi/overrides/GstPbutils.py
    /usr/lib/python2.7/dist-packages/gi/overrides/Gst.py
    /usr/share
    /usr/share/doc
    /usr/share/doc/python-gst-1.0
    /usr/share/doc/python-gst-1.0/copyright
    /usr/share/doc/python-gst-1.0/changelog.Debian.gz
    

    Can you tell me which files/libraries are needed for EasyABC to access gstreamer.

    Best regards,
    Bodo

     
  • Bodo

    Bodo - 2018-10-25

    Hello Jan Wybren,

    I'm in contact with Willem Vree about libfluidsynth. Since Sep 14, 2018 fluidsynth version 2.0.x is available which adds a slightly modified version of Willem's changes. He wasn't aware of this.
    I'm trying to help with testing the new version of the library.
    I also asked on the debian-multimedia mailing list about plans to package fluidsynth 2.0.x.
    I hope to get libfluidsynth2 running and integrated in the Linux distributions which might allow using the system's library instead of a modified local copy.

    Best regards,
    Bodo

     

Log in to post a comment.