Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 85801

Summary: FluidSynth 1.0.5 makes a horrible noise after some playing
Product: Gentoo Linux Reporter: Kimmo Sundqvist <kimmo.sundqvist>
Component: Current packagesAssignee: Gentoo Sound Team <sound>
Status: RESOLVED UPSTREAM    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://lists.gnu.org/archive/html/fluid-dev/2005-01/msg00002.html
Whiteboard: Can't reproduce => upstream
Package list:
Runtime testing required: ---

Description Kimmo Sundqvist 2005-03-18 11:10:34 UTC
From the fluid-dev mailing list
> Recently I got a MIDI interface and a keyboard, and I'm
> trying them out with FluidSynth to render the MIDI. For most
> soundfonts I've tried, the first piano instrument (bank 1,
> program 1) works fine. But when I try almost any other
> instrument and play a few notes, FluidSynth ends up producing
> a horrendously loud noise! The only way I can stop it is by
> changing to a new instrument. It's very weird.

Reproducible: Always
Steps to Reproduce:
1. Emerge fluidsynth 1.0.5
2. Load fluidsynth, load a SoundFont
3. Play a midi file to fluidsynth's port

Actual Results:  
I head the horrible noise very soon after starting the playback.  When the
problem was discussed on the mailing list, they found out that:
a) it has nothing to do with output to ALSA, Jack or file - it happens equally
in every case
b) it has nothing to do with the choice of Soundfonts.  I tried this, and this
was also reported on the mailing list.
c) it has nothing to do with the MIDI file.
d) it appears in 1.0.5 but not in 1.0.3.  Will try this out myself soon.

But to save some people from traumatic experiences, I recommend fluidsynth-1.0.5
to be masked until the problem has been solved.  I can tell you that, played
through a HiFi stereo system, the noise is _LOUD_ compared to the music.

Expected Results:  
Flawless music output

Portage 2.0.51.19 (default-linux/x86/2004.0, gcc-3.3.5, glibc-2.3.4.20041102-r1,
2.6.10-gentoo-r2 i686)
=================================================================
System uname: 2.6.10-gentoo-r2 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 17 2005, 18:09:28)]
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r1
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-Os -mcpu=pentium3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -mcpu=pentium3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig distlocks sandbox sfperms"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/
ftp://trumpetti.atm.tut.fi/gentoo/"
LANG="C"
MAKEOPTS="-j2 -s"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X alsa apm arts avi berkdb bitmap-fonts bonobo cdr crypt cups curl dga
emboss encode f77 fam fbcon flac font-server foomaticdb fortran gdbm gif
gimpprint glut gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile imagemagick
imlib ipv6 jack java jikes jpeg jpg junit kde ladcca libg++ libwww mad mikmod
mmx motif mozilla mp3 mpeg mpi nas ncurses nls nptl objc oggvorbis opengl pam
pdflib perl png ppds python qt quicktime readline rtc samba sdl slang sqlite sse
ssl svga tcltk tcpd tiff truetype truetype-fonts type1-fonts unicode wmf x86 xml
xml2 xmms xv xvid zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LC_ALL, LDFLAGS
Comment 1 Frank van de Pol (RETIRED) gentoo-dev 2005-07-11 12:53:44 UTC
I just committed fluidsynth-1.0.6 to portage cvs. According to Josh Green's 
release note[1] it fixed quite some bugs. Could you give it a spin and let me 
know? 
 
thanks. 
 
[1] http://lists.gnu.org/archive/html/fluid-dev/2005-06/msg00008.html 
Comment 2 Kimmo Sundqvist 2005-07-12 09:16:08 UTC
Tested 1.0.6 and it is as if nothing has been fixed.  I loaded the Merlin
soundfont and tried playing a midi file.

pmidi blader.mid -p 128:0

It went ok for two seconds, then came the noise.  After about 10 seconds of
noise, it could produce no output, i.e it was totally silent.  I quitted it,
reloaded it and the Merlin soundfont.  Tried playing sabre_dance.mid.  It was ok
for 10 seconds, then I noticed a clicking that got faster and faster, and
suddenly the noise (screech, scream, positive feedback loop, whatever) was there
again.  It went away after some seconds, and then came back again.  I stopped
pmidi, and fluidsynth segfaulted.

It is as if fluidsynth was doing some kind of echo or chorus, and had a positive
feedback loop somewhere, thus resulting in an overload.  Disabling chorus and
reverb on the cmdline did nothing to help with the feedback, though.

My emerge info is:

Portage 2.0.51.22-r1 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.4.20041102-r1, 2.6.11-ck9 i686)
=================================================================
System uname: 2.6.11-ck9 i686 Pentium III (Coppermine)
Gentoo Base System version 1.6.12
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.10
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -mcpu=pentium3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -mcpu=pentium3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/
ftp://trumpetti.atm.tut.fi/gentoo/"
LANG="C"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl alsa apm arts avi berkdb bitmap-fonts bonobo cdr crypt cups curl dga
eds emboss encode f77 fam fbcon flac foomaticdb fortran gd gdbm gif glut gnome
gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib ipv6 jack java
jikes jpeg jpg junit kde ladcca libg++ libwww mad mikmod mmx motif mp3 mpeg mpi
nas ncurses nls nptl objc ogg oggvorbis opengl pam pdflib perl png ppds python
qt quicktime readline rtc samba sdl slang speex sqlite sse ssl svga tcltk tcpd
tiff truetype truetype-fonts type1-fonts unicode vorbis wmf x86 xine xml xml2
xmms xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS
Comment 3 Kimmo Sundqvist 2005-07-12 10:35:18 UTC
Tried with -O2 instead of -Os, didn't help.  In sabre_dance.mid, the noise only
seems to happen when a certain instrument is playing.  There is something in the
midi file that either changes the program for a channel, enables or disables
chorus or reverb, changes volume or something, that starts and stops the screech.

The screech is caused by different instrument or channel in the midi than the
clicking sound.  The clicking sounds like a vinyl turntable skipping a track.

After some playing, it just segfaults.  And in other midi files, the noise, once
it starts, doesn't stop until I quit fluidsynth, fluidsynth segfaults, or the
noise dies suddenly.  After the sudden silence there is no sound output from
fluidsynth at all until I quit or something triggers a segfault.
Comment 4 Kimmo Sundqvist 2005-07-12 10:57:53 UTC
I know that typing 'settings' in the fluidsynth console lists all settings.  I
see that I can disable both from the cmdline, by --chorus 0 --reverb 0.  But
typing "chorus 0" or "reverb 0" (or on, off or 1) on the fluidsynth's console
doesn't change the settings displayed by typing "settings."

Typing "set synth.chorus.active whoa" sets it to whoa.  I also tried "toilet"
and "toothfairy" and it didn't complain.  Wonder if it was enabled or disabled
really.

Either the synth really doesn't disable chorus and reverb, or it does, but I
have no way to figure out if it indeed has, and the problem is not related to
reverb and chorus after all.

Fluidsynth also randomly, maybe 50% of the time, crashes on startup with

fluidsynth: fluid_ladspa.c:719: fluid_LADSPA_run: Assertion
`fluid_settings_getint(FxUnit->synth->settings, "synth.effects-channels",
&temp)' failed.
Aborted

I'll try disabling ladcca and recompiling.
Comment 5 Kimmo Sundqvist 2005-07-12 11:09:14 UTC
Disabling ladcca in the USE variable didn't help.  Fluidsynth keeps randomly
segfaulting, and after the Sabre dance starts playing, Fluidsynth's CPU usage
slowly (in about 10 seconds, from Gnome system monitor) climbs to 99% and stays
there.

Before anyone says anything about my hardware, I think I should mention that I
can run memtest86 or The Great Internet Mersenne Prime Search's test for 20
hours with no problems.  I'm leaving this alone now.  If anyone has suggestions
or 1.0.7 comes out, I'll maybe have a look and try again.
Comment 6 Frank van de Pol (RETIRED) gentoo-dev 2005-07-17 12:51:26 UTC
Hi Kimmo,   
 
looking at your updates you've tried already  
   
I tried fluidsynth with different soundfounds and different instrument in these 
soundfonts but was  not able to reproduce your problem. Machines used in these 
tests are pentium4 and amd64.  
 
To get this issued nailed down (and hopefully fixed in the 1.0.7 release) you 
might want to explain your problem to the fluidsynth developers. 
(http://savannah.nongnu.org/mail/?group=fluid). 
 
Please update any progress you make to this bug. 
 
 
   
Comment 7 Kimmo Sundqvist 2005-10-09 01:14:12 UTC
Tried installing fluidsynth-1.0.3 and it doesn't have this screech problem. 
Some instruments still sound like they were missing, especially drums can be
heard only in some songs, and CPU usage climbs to 99% with no good reason.

Are the reverb and chorus commands supposed to take action immediately or when?

Will do more tests with 1.0.3 now that I need not be afraid of the noise.
Comment 8 Kimmo Sundqvist 2005-10-09 01:36:41 UTC
Maybe the instruments are not missing, but their relative volumes are seriously
screwed up.

I am comparing fluidsynth to Timidity++ and I have noticed that some songs,
which come out perfectly with Timidity, have their melody missing or barely
audible with fluidsynth, and some background instrument buries everything else.
 Drums and percussion is usually among the first victims.

Still using the Merlin_22 soundfont that has caused me no problems with
Timidity.  All of this is sad, because I can see (hear) that fluidsynth is
really much better at some things than Timidity.
Comment 9 Kimmo Sundqvist 2005-10-15 03:28:24 UTC
I found this inside the ebuild for 1.0.6:

if use sse; then
                myconf="--enable-SSE ${myconf}"
                # If your CFLAGS include optimizations for sse, ie:
                # -march=pentium4 -mfpmath=sse -msse2
                # AND your USE flags include sse, ie: USE=sse,
                # the sounds with fluidsynth will be distorted.
                if [ `is-flag "-march=pentium4"` ]; then
                        filter-flags "-msse2"
                        filter-flags "-mfpmath=sse"
                fi
        fi

I have "-Os -mcpu=pentium3 -pipe"
Comment 10 Matt Finn 2005-12-01 11:46:40 UTC
I have noticed some possibly related issues. These apply to all the builds in
portage, as well the cvs version.

First, I am unable to use the SSE flag. It causes bad aliasing noise on any
notes that are being resampled from their original frequency.

Second, any -march setting pentium3 or pentium4 causes certain notes in several
soundfonts to be played an octave higher than normal when -O is 2 or 3. It does
not happen for me with -Os or -O1 and -march=pentium3.

I remerged fluidsynth with 
   CFLAGS="$CFLAGS -march=pentium2" emerge fluidsynth
or alternatively
   CFLAGS="$CFLAGS -O1" emerge fluidsynth
and it works fine now
Comment 11 Rene Treffer 2006-01-05 13:12:45 UTC
(In reply to comment #10)
> I have noticed some possibly related issues. These apply to all the builds in
> portage, as well the cvs version.
> 
> First, I am unable to use the SSE flag. It causes bad aliasing noise on any
> notes that are being resampled from their original frequency.
> 
> Second, any -march setting pentium3 or pentium4 causes certain notes in several
> soundfonts to be played an octave higher than normal when -O is 2 or 3. It does
> not happen for me with -Os or -O1 and -march=pentium3.
> 
> I remerged fluidsynth with 
>    CFLAGS="$CFLAGS -march=pentium2" emerge fluidsynth
> or alternatively
>    CFLAGS="$CFLAGS -O1" emerge fluidsynth
> and it works fine now
> 

(In reply to comment #9)
> I found this inside the ebuild for 1.0.6:
> 
> if use sse; then
>                 myconf="--enable-SSE ${myconf}"
>                 # If your CFLAGS include optimizations for sse, ie:
>                 # -march=pentium4 -mfpmath=sse -msse2
>                 # AND your USE flags include sse, ie: USE=sse,
>                 # the sounds with fluidsynth will be distorted.
>                 if [ `is-flag "-march=pentium4"` ]; then
>                         filter-flags "-msse2"
>                         filter-flags "-mfpmath=sse"
>                 fi
>         fi
> 
> I have "-Os -mcpu=pentium3 -pipe"

Hi, I had a problem with too aggressive cflags:

CFLAGS="-O2 -mfpmath=sse,387 -march=pentium4 -pipe -fmove-all-movables -freduce-all-givs -frename-registers -fweb -ffast-math -funswitch-loops -funit-at-a-time"

CXXFLAGS="${CFLAGS}"

gcc-3.4.5

note resampling dies...

recompiled fluidsynth with

CFLAGS="" CXXFLAGS="" emerge fluidsynth

and qsynth/fluidsynth worked out of the box! Seems like the useflag-filtering is buggy, too.
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2006-08-04 15:48:21 UTC
Not reproducable, send this upstream if it's still an issue.