GithubHelp home page GithubHelp logo

Segmentation fault about easyabc HOT 23 OPEN

jwdj avatar jwdj commented on June 20, 2024
Segmentation fault

from easyabc.

Comments (23)

jwdj avatar jwdj commented on June 20, 2024

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

Thanks so much for the advice! I do have all of the above installed. Since this is a warning rather than an error, is there a way to make the program run in spite of it? I've noticed easyABC does start if I remove fluidsynth entirely, so if I'm unable to solve this, I'll just remove fluidsynth and use an external midi player.

After googling, I found someone who had a similar problem due to a missing line of code. Do you think the solution from there might work?

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

I'm using FluidSynth 2.1.5, which I installed from a package. I have also tried setting FluidSynth's driver to JACK and ALSA, but strangely enough, the same warning and segmentation fault occur. I checked dependencies, and a number of packages depend on SDL2, including fluidsynth, python3-wxpython, and easyabc itself. Here are my fluidsynth settings, maybe I need to change something here for things to work?

audio.alsa.device default
audio.driver jack
audio.file.endian auto
audio.file.format s16
audio.file.name fluidsynth.wav
audio.file.type auto
audio.jack.autoconnect False
audio.jack.id fluidsynth
audio.jack.multi False
audio.jack.server
audio.oss.device /dev/dsp
audio.period-size 64
audio.periods 16
audio.pulseaudio.adjust-latency True
audio.pulseaudio.device default
audio.pulseaudio.media-role music
audio.pulseaudio.server default
audio.realtime-prio 60
audio.sample-format 16bits
audio.sdl2.device default
midi.alsa.device default
midi.alsa_seq.device default
midi.alsa_seq.id pid
midi.autoconnect False
midi.driver alsa_seq
midi.jack.id fluidsynth-midi
midi.jack.server
midi.oss.device /dev/midi
midi.portname
midi.realtime-prio 50
player.reset-synth True
player.timing-source sample
shell.port 9800
shell.prompt >
synth.audio-channels 1
synth.audio-groups 1
synth.chorus.active True
synth.chorus.depth 8.000
synth.chorus.level 2.000
synth.chorus.nr 3
synth.chorus.speed 0.300
synth.cpu-cores 1
synth.default-soundfont /usr/share/soundfonts/default.sf2
synth.device-id 0
synth.dynamic-sample-loading False
synth.effects-channels 2
synth.effects-groups 1
synth.gain 0.200
synth.ladspa.active False
synth.lock-memory True
synth.midi-bank-select gs
synth.midi-channels 16
synth.min-note-length 10
synth.overflow.age 1000.000
synth.overflow.important 5000.000
synth.overflow.important-channels
synth.overflow.percussion 4000.000
synth.overflow.released -2000.000
synth.overflow.sustained -1000.000
synth.overflow.volume 500.000
synth.polyphony 256
synth.reverb.active True
synth.reverb.damp 0.000
synth.reverb.level 0.900
synth.reverb.room-size 0.200
synth.reverb.width 0.500
synth.sample-rate 44100.000
synth.threadsafe-api True
synth.verbose False

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

I have just noticed that if I run fluidsynth in the terminal, a number of errors are shown, if I run it from the root, however, these errors do not occur. Could these be the cause of the segmentation fault?

When I run fluidsynth from the terminal, it shows:

FluidSynth runtime version 2.1.5
Copyright (C) 2000-2020 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
fluidsynth: warning: Failed to set thread to high priority
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 86611866 byte memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
Cannot use real-time scheduling (RR/10) (1: Operation not permitted)
AcquireSelfRealTime error
Cannot lock down 86611866 byte memory area (Cannot allocate memory)
fluidsynth: Jack sample rate mismatch, adjusting. (synth.sample-rate=44100, jackd=48000)
Cannot use real-time scheduling (RR/5) (1: Operation not permitted)
JackClient::AcquireSelfRealTime error

When I run it from the terminal as root, it shows:

Warning: Unable to initialize SDL2 Audio: Could not setup connection to PulseAudiofluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable
FluidSynth runtime version 2.1.5
Copyright (C) 2000-2020 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
fluidsynth: Jack sample rate mismatch, adjusting. (synth.sample-rate=44100, jackd=48000)

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

The errors that fluidsynth was giving me were related to JACK, and I was able to fix them with this method , unfortunately, this did nothing to fix the segmentation fault with easyABC, so this is another dead end. In any case, running fluidsynth now gives this output

FluidSynth runtime version 2.1.5
Copyright (C) 2000-2020 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
fluidsynth: Jack sample rate mismatch, adjusting. (synth.sample-rate=44100, jackd=48000)
Type 'help' for help topics.

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

Thank you. Running this gave some interesting output:

fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable
Fatal Python error: Segmentation fault

Current thread 0x00007fadab4d2740 (most recent call first):
  File "/usr/share/easyabc/fluidsynth.py", line 65 in setting_setnum
  File "/usr/share/easyabc/fluidsynth.py", line 51 in __init__
  File "/usr/share/easyabc/fluidsynthplayer.py", line 15 in __init__
  File "/usr/share/easyabc/easy_abc.py", line 3698 in __init__
  File "/usr/share/easyabc/easy_abc.py", line 8336 in NewMainFrame
  File "/usr/share/easyabc/easy_abc.py", line 8377 in OnInit
  File "/usr/lib64/python3.8/site-packages/wx/core.py", line 2194 in __init__
  File "/usr/share/easyabc/easy_abc.py", line 8314 in __init__
  File "/usr/share/easyabc/easy_abc.py", line 8385 in <module>
/usr/bin/easyabc: line 2: 28220 Segmentation fault      (core dumped) python3 /usr/share/easyabc/easy_abc.py

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

Hi, I fiddled around with the code a bit, and tried commenting out the non-essential lines that would cause errors. Eventually I ended up with this:

class Synth: # interface for the FluidSynth synthesizer
def init(self, gain=0.2, samplerate=44100.0, bsize=64):
self.settings = F.new_fluid_settings()
# self.setting_setnum('synth.gain', gain)
# self.setting_setnum('synth.sample-rate', samplerate)
# self.setting_setint('audio.period-size', bsize)
# self.setting_setint('audio.periods', 2)
self.synth = F.new_fluid_synth(self.settings)
self.audio_driver = None

at this point, only essential lines were left, but these were still causing errors:

fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable
Fatal Python error: Segmentation fault

Current thread 0x00007f6616c44740 (most recent call first):
File "/usr/share/easyabc/fluidsynth.py", line 55 in init
File "/usr/share/easyabc/fluidsynthplayer.py", line 15 in init
File "/usr/share/easyabc/easy_abc.py", line 3698 in init
File "/usr/share/easyabc/easy_abc.py", line 8336 in NewMainFrame
File "/usr/share/easyabc/easy_abc.py", line 8377 in OnInit
File "/usr/lib64/python3.8/site-packages/wx/core.py", line 2194 in init
File "/usr/share/easyabc/easy_abc.py", line 8314 in init
File "/usr/share/easyabc/easy_abc.py", line 8385 in
/usr/bin/easyabc: line 2: 12047 Segmentation fault (core dumped) python3 /usr/share/easyabc/easy_abc.py

What seems so strange to me here is that the code is able to import the library (there is no import error), but attempting to inintialize fluidsynth causes the program to crash. I haven't been able to find anyone else having similar issues with fluidsynth, and I can't really tell if this is an issue with fluidsynth, the easyabc code, or if something is wrong in my settings.

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

I think I may have found something in the fluidsynth api http://www.fluidsynth.org/api/audio_8h.html

When creating a settings instance with new_fluid_settings(), all audio drivers are initialized once. In the past this has caused segfaults and application crashes due to buggy soundcard drivers.

This could explain why the program would cause a segfault on my computer and not on yours, as we might have different audio drivers installed.

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

from what I can gather here and here, it seems that when fluidsynth is initialized with new_fluid_settings(), it initializes all audio drivers. One of these audio drivers may segfault, causing fluidsynth to crash. It seems that the solution to this is to identify which driver is the culprit and exclude it by using the fluid_audio_driver_register() command.

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

On Linux EasyABC now uses pulseaudio as audio driver for FluidSynth. Does that solve this issue perhaps?

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

Thanks so much - trying it out right now.
Should I leave the "midi player" field blank or put fluidsynth?

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

To be able to use FluidSynth as audio player you should indeed leave the midi player field blank and select a sound font.
Some good SoundFonts are freely available.

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

When I leave the midi player field blank and select a soundfont, I still get a gstreamer error and no playback. If I press play, I get two pop-ups: one says "media playback error: Internal data stream error." and the other says "Unable to load /home/username/.EasyABC/cache/temp.midi: unsupported format?" I tried the workaround with jackd from here, but it gives the same exact result. Oddly enough, if I select fluidsynth as an external player, it works. Is there a way to get more info on those errors and why the program isn't working?

Thanks so much

from easyabc.

jwdj avatar jwdj commented on June 20, 2024

Since your FluidSynth is working as an external player you probably have done: sudo apt install libfluidsynth2 fluid-soundfont-gm
The SoundFont is not used straight away. It requires a restart.
If the fluidsynth library is found and the soundfont exists at startup then it should work. (it shows a warning if FluidSynth can't be loaded/found)

from easyabc.

PigeonOnTheGate avatar PigeonOnTheGate commented on June 20, 2024

Could be a library issue. My fluidsynth library is now called libfluidsynth3 after an update a few months ago. I'll try to see if I can downgrade it to libfluidsynth2.

from easyabc.

robertmuth avatar robertmuth commented on June 20, 2024

I am see a similar issue after upgrading from ubuntu 21.10 to 22.04 both using pipewire.

The segfault looks like

python3 ./easy_abc.py

Fatal Python error: Segmentation fault

Current thread 0x00007f962ae9f000 (most recent call first):
  File "/home/rm/EasyABC/fluidsynth.py", line 85 in setting_setnum
  File "/home/rm/EasyABC/fluidsynth.py", line 62 in __init__
  File "/home/rm/EasyABC/fluidsynthplayer.py", line 17 in __init__
  File "/home/rm/EasyABC/./easy_abc.py", line 3974 in __init__
  File "/home/rm/EasyABC/./easy_abc.py", line 8710 in NewMainFrame
  File "/home/rm/EasyABC/./easy_abc.py", line 8771 in OnInit
  File "/usr/lib/python3/dist-packages/wx/core.py", line 2137 in __init__
  File "/home/rm/EasyABC/./easy_abc.py", line 8688 in __init__
  File "/home/rm/EasyABC/./easy_abc.py", line 8787 in <module>

Extension modules: wx._core, wx._html, wx._stc (total: 3)
Segmentation fault (core dumped)

When I try to run fluidsynth standalone I get:

fluidsynth

FluidSynth runtime version 2.2.5
Copyright (C) 2000-2022 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
fluidsynth: error: Failed to open the "default" audio device
Failed to create the audio driver. Giving up.
fluidsynth: warning: Failed to set thread to high priority

This gets slightly better via:

fluidsynth -a pulseaudio OR fluidsynth -a jack

FluidSynth runtime version 2.2.5
Copyright (C) 2000-2022 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

fluidsynth: warning: Failed to set thread to high priority
fluidsynth: Using PulseAudio driver
Type 'help' for help topics.

from easyabc.

robertmuth avatar robertmuth commented on June 20, 2024

Looking into this some more it seems that under ubuntu 22.04 python3.10 and libfluidsynth3:amd64 any access to the settings object created by:
self.settings = F.new_fluid_settings()

fails

from easyabc.

robertmuth avatar robertmuth commented on June 20, 2024

inserting the stamza below got rid of the seg-fault

        # start of new code
        L = ["jack", "pulseaudio", None]
        arr = (c_char_p * len(L))()
        arr[:] = L
        F.fluid_audio_driver_register(arr)
        # end of new code
        self.settings = F.new_fluid_settings()

However, there is a new problem with Gstreamer that results in annoying alert-boxes:

12:22:05 PM: Media playback error: Resource not found.
12:22:05 PM: Media playback error: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.

from easyabc.

robertmuth avatar robertmuth commented on June 20, 2024

My last problem could be solved by commenting out the lines like:

mc.Load('NONEXISTANT_FILE____.mid')

based on:

https://sourceforge.net/p/easyabc/discussion/general/thread/524f3f9c/?limit=25

from easyabc.

Redmattski avatar Redmattski commented on June 20, 2024

inserting the stamza below got rid of the seg-fault

        # start of new code
        L = ["jack", "pulseaudio", None]
        arr = (c_char_p * len(L))()
        arr[:] = L
        F.fluid_audio_driver_register(arr)
        # end of new code
        self.settings = F.new_fluid_settings()

I can confirm this solution is working on Arch Linux and resolves the Seg Fault.

from easyabc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.