[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#929960: marked as done (libfluidsynth1: Sample rate capped at 96kHz; causes bad output when JACK running at 192kHz)



Your message dated Wed, 04 Mar 2020 20:50:05 +0000
with message-id <E1j9axx-000Fcp-Uc@fasolo.debian.org>
and subject line Bug#929960: fixed in fluidsynth 2.1.1-2
has caused the Debian Bug report #929960,
regarding libfluidsynth1: Sample rate capped at 96kHz; causes bad output when JACK running at 192kHz
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
929960: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929960
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libfluidsynth1
Version: 1.1.6-4
Severity: normal
Tags: patch

When recording, I run JACK with a 192kHz sample rate, to match my audio
interface, so as to minimize the cumulative errors through the audio
processing chain.  Fluidsynth-based instruments appear to work, but
produce bad-sounding audio pitched an octave higher than intended.
Also, a log message is printed

| fluidsynth: Jack sample rate mismatch, adjusting. (synth.sample-rate=96000, jackd=192000)

The underlying cause is that, for some reason, Fluidsynth's
`synth.sample-rate' parameter must be between 8kHz and 96kHz, and values
beyond these bounds are /silently/ clamped to these bounds.

If I start Fluidsynth with `-r192000', then it pretends to accept that,
but internally clamps the sample rate to 96kHz.  The JACK client code
then notices that JACK is really running at 192kHz, prints the message
above, and tries to reconfigure the synthesizer's sample rate to 192kHz.
Again, this is silently clamped back to 96kHz.

In this state, Fluidsynth is essentially writing samples twice as
quickly as they should be, resulting in the octave pitch shift I
reported.  But this also adversely affects the instrument timbre (e.g.,
violin vibrato is unpleasantly rapid; piano attack sounds like a cheap
imitation).

My patch just raises the upper sample-rate bound to 192kHz, which is
enough for my purposes.  With this change, Fluidsynth sounds pretty good
agin.  I don't know whether the library actually needs an upper bound
here at all; if not, it should probably be removed.  I've also not done
anything about the silent clamping; at least Fluidsynth should print
some log message here.

This patch applies to current sid (which is also affected).  Indeed, I
originally fumbled dgit and mistakenly patched sid; so I had to rebase
the change, which was trivial.


diff --git a/doc/fluidsynth-v10-devdoc.xml b/doc/fluidsynth-v10-devdoc.xml
index d20ba1a..47c6d1d 100644
--- a/doc/fluidsynth-v10-devdoc.xml
+++ b/doc/fluidsynth-v10-devdoc.xml
@@ -235,7 +235,7 @@ saturation of the output when random MIDI files are played.<
 <row>
   <entry></entry>
   <entry>Min-Max</entry>
-  <entry>22050-96000</entry>
+  <entry>22050-192000</entry>
 </row>
 <row>
   <entry></entry>
diff --git a/doc/fluidsynth-v11-devdoc.txt b/doc/fluidsynth-v11-devdoc.txt
index 381ef80..56ebe1a 100644
--- a/doc/fluidsynth-v11-devdoc.txt
+++ b/doc/fluidsynth-v11-devdoc.txt
@@ -589,7 +589,7 @@ in rendering-to-file scenarios where underruns is not an iss
   <tr>
     <td></td>
     <td>Min-Max</td>
-    <td>22050-96000</td>
+    <td>22050-192000</td>
   </tr>
   <tr>
     <td></td>
diff --git a/doc/fluidsynth.1 b/doc/fluidsynth.1
index 389532f..e788a82 100644
--- a/doc/fluidsynth.1
+++ b/doc/fluidsynth.1
@@ -212,7 +212,7 @@ Voice polyphony count (number of simultaneous voices allowed
 .B synth.reverb.active      BOOL  [def=True]
 Reverb effect enable toggle.
 .TP
-.B synth.sample\-rate       FLOAT [min=22050.000, max=96000.000, def=44100.000]
+.B synth.sample\-rate       FLOAT [min=22050.000, max=192000.000, def=44100.000
 Synthesizer sample rate.
 .TP
 .B synth.threadsafe-api     BOOL  [def=True]
diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
index 1e782f1..10f579d 100644
--- a/src/synth/fluid_synth.c
+++ b/src/synth/fluid_synth.c
@@ -202,7 +202,7 @@ void fluid_synth_settings(fluid_settings_t* settings)
   fluid_settings_register_int(settings, "synth.effects-channels",
                              2, 2, 2, 0, NULL, NULL);
   fluid_settings_register_num(settings, "synth.sample-rate",
-                             44100.0f, 8000.0f, 96000.0f,
+                             44100.0f, 8000.0f, 192000.0f,
                              0, NULL, NULL);
   fluid_settings_register_int(settings, "synth.device-id",
                              0, 0, 126, 0, NULL, NULL);
@@ -590,7 +590,7 @@ new_fluid_synth(fluid_settings_t *settings)

   /* register the callbacks */
   fluid_settings_register_num(settings, "synth.sample-rate",
-                             44100.0f, 8000.0f, 96000.0f, 0,
+                             44100.0f, 8000.0f, 192000.0f, 0,
                              (fluid_num_update_t) fluid_synth_update_sample_rat
   fluid_settings_register_num(settings, "synth.gain",
                              0.2f, 0.0f, 10.0f, 0,
@@ -2139,7 +2139,7 @@ fluid_synth_set_sample_rate(fluid_synth_t* synth, float sa
   int i;
   fluid_return_if_fail (synth != NULL);
   fluid_synth_api_enter(synth);
-  fluid_clip (sample_rate, 8000.0f, 96000.0f);
+  fluid_clip (sample_rate, 8000.0f, 192000.0f);
   synth->sample_rate = sample_rate;

   fluid_settings_getint(synth->settings, "synth.min-note-length", &i);


-- System Information:
Debian Release: 9.9
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates')
Architecture: i386 (i686)
Foreign Architectures: amd64

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages libfluidsynth1 depends on:
ii  libasound2                1.1.3-5
ii  libc6                     2.24-11+deb9u4
ii  libglib2.0-0              2.50.3-2
ii  libjack0 [libjack-0.125]  1:0.125.0-2
ii  libpulse0                 10.0-1+deb9u1
ii  libreadline7              7.0-3
ii  libsndfile1               1.0.27-3

libfluidsynth1 recommends no packages.

libfluidsynth1 suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: fluidsynth
Source-Version: 2.1.1-2
Done: Fabian Greffrath <fabian@debian.org>

We believe that the bug you reported is fixed in the latest version of
fluidsynth, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 929960@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Fabian Greffrath <fabian@debian.org> (supplier of updated fluidsynth package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 04 Mar 2020 21:20:05 +0100
Source: fluidsynth
Architecture: source
Version: 2.1.1-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Changed-By: Fabian Greffrath <fabian@debian.org>
Closes: 929960
Changes:
 fluidsynth (2.1.1-2) unstable; urgency=medium
 .
   * Team upload.
 .
   * Allow stderr-output during the build test, as the new SDL2 module
     will complain that it is not yet initialized.
   * Apply two commits from the upstream GIT repository:
     + Turn SDL2 initialization message into a warning.
     + Exit with error when invalid commandline arguments are
       supplied, e.g. invalid sample rates (Closes: #929960).
Checksums-Sha1:
 e9f32db81cc9f6580098e19a83b4dab2f2baf785 2506 fluidsynth_2.1.1-2.dsc
 42ca1dee43b84b4756833be5f32d02103772578c 19488 fluidsynth_2.1.1-2.debian.tar.xz
 75bc92a20388d4525b0ea934a67987169c32e73e 12683 fluidsynth_2.1.1-2_amd64.buildinfo
Checksums-Sha256:
 e727c4d95c06c3c64f33f26197baeff5ecf333a3d1bc78d46d6895d8149cfb81 2506 fluidsynth_2.1.1-2.dsc
 5741315a7a2564570c3d1927fea665d5ad6905352f5e5ae20245084d5f1c1f23 19488 fluidsynth_2.1.1-2.debian.tar.xz
 78e848c5be797f7270550f0337b113837f7d7364495a47c14fbf57b3b5953d3b 12683 fluidsynth_2.1.1-2_amd64.buildinfo
Files:
 1289790ab85ec329990d4a8c99de3ac1 2506 sound optional fluidsynth_2.1.1-2.dsc
 27cfc9247dcca480f7d2c9664f350f64 19488 sound optional fluidsynth_2.1.1-2.debian.tar.xz
 81fbc5b9058057844ffb60a79afb7fc9 12683 sound optional fluidsynth_2.1.1-2_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJGBAEBCAAwFiEEIsF2SKlSa4TfGRyWy+qOlwzNWd8FAl5gDqQSHGZhYmlhbkBk
ZWJpYW4ub3JnAAoJEMvqjpcMzVnf0vkP/jjTno2s7p1tUyPLIC1FQyr9xYHa/B4l
b1kkMebMxcVx5MsGZMg/7g43wFTqtf6xfuVLnnQTvBPJeXQl1rjoKN7LL2up15m7
Vw5wX+jAUW/LrjgVdG88qvxqyidYh2+YWKOoA/R8AOblj0gEMhwHP64uvFtv8AYn
AiluYL+PB1mqKAb9QQbGIvKT8RD4Uo8AJ+7ewZfB0bSzvFOatWi2h+XEKYpr78gZ
jk8MRtSGGDhfXNmQ/NlF/Dd+Ko0K6XjAAMJSZaGG/iWVU2EtrWMVeiVb91s4nG4T
ddjIjTbgXgKD09HFBfTtbkMekhGMkuJwhfsxRlA6MSecPXiFnUbUWn1ZKOxkSnoB
xIIgg4K8oAPs1Mf+b4Lulfo4grM7hSqzohb9er9wXLM+HrYef+DM+RAK+DUKy1g9
tUWqB+q4VJgrIrVQLLie7QLNzc+2jVIAxUoMM6YCUsSx6sEfkmbwCzXpuSmoSOLW
EEFUDSMdMJmmSV+bg+q/vuAx/IpCV2HdAdlZ0TzQ/O3wQzPuoDc9dXVplx/eaByH
g5oBz9SvgnxPAQulcwyShw7pQo1O5Q0/7U9KIWKGDQRdcRSVtThvey5bFdDTW6TX
20pz2ZzCdiMsAWBrm+N7Og4PFCD/OHHGO7JeeZnjomjDrKYV/aBY2RFINPkdF3GZ
RvTP7lsHHpI/
=Voyq
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: