FluidSynth / fluidsynth

Software synthesizer based on the SoundFont 2 specifications
https://www.fluidsynth.org
GNU Lesser General Public License v2.1
1.89k stars 259 forks source link

multi channel output not working again #323

Closed mqnc closed 6 years ago

mqnc commented 6 years ago

Hi!

I already had this issue back in #225, and it worked when I added the -G 16 flag. Now I have a new computer, I installed fluidsynth 1.1.9, ran it with

fluidsynth -i -f fluidsynthcfg.tmp -m jack -a jack -r 44100 -R 0 -C 0 -g 2.0 -s -G 16 -o shell.port=9800 -o midi.jack.id='fluidsynth' -o audio.jack.id='fluidsynth' -o synth.midi-bank-select='mma' -o audio.jack.multi='yes' -o synth.audio-channels=16 -o synth.audio-groups=16

and it doesn't work again. It only creates the channels "left" and "right". I downgraded to 1.1.7 (where it worked on my old machine) and still, only "left" and "right". Am I missing something? Was there some special compile flag?

mawe42 commented 6 years ago

That's weird. I just tested 1.1.9 on my Ubuntu 17.10 with jack 1.9.10 and it creates 16 2 audio and 2 2 effect channels. How are you checking the channel count? And are you seeing any error messages when Fluidsynth is starting up?

mqnc commented 6 years ago

I have Ubuntu Studio 17.10 with low latency kernel and jack 1.9.11. I check the connections in Qjackctl. In the Audio tab, I expand fluidsynth and I see "left" and "right".

My old computer (where it works) has regular Ubuntu 16.04.

derselbst commented 6 years ago

Works fine for me as well. Please post fluidsynth --version and most importantly: what's in your fluidsynthcfg.tmp?

mqnc commented 6 years ago

Content of fluidsynthcfg.tmp:

load /home/mqnc/soundfonts/FluidR3_GM.sf2 1 0
load '/home/mqnc/soundfonts/GeneralUser GS v1.471.sf2' 1 200
load '/home/mqnc/soundfonts/FS Ibanez Electric Bass Guitar.sf2' 1 400
load '/home/mqnc/soundfonts/FS Fender Jaguar Electric Guitar Both Pickups and Amp.sf2' 1 1000

fonts

Output of fluidsynth --version:

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

FluidSynth 1.1.9

Output of my command:

fluidsynth -i -f fluidsynthcfg.tmp -m jack -a jack -r 44100 -R 0 -C 0 -g 2.0 -s -G 16 -o shell.port=9800 -o midi.jack.id='fluidsynth' -o audio.jack.id='fluidsynth' -o synth.midi-bank-select='mma' -o audio.jack.multi='yes' -o synth.audio-channels=16 -o synth.audio-groups=16

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

loaded SoundFont has ID 1
loaded SoundFont has ID 2
loaded SoundFont has ID 3
loaded SoundFont has ID 4
ID  Name
 4  /home/mqnc/soundfonts/FS Fender Jaguar Electric Guitar Both Pickups and Amp.sf2
 3  /home/mqnc/soundfonts/FS Ibanez Electric Bass Guitar.sf2
 2  /home/mqnc/soundfonts/GeneralUser GS v1.471.sf2
 1  /home/mqnc/soundfonts/FluidR3_GM.sf2
mqnc commented 6 years ago

If my machine is the only one world-wide where this happens, I can also help debugging by placing some printfs in the code. But it would be nice if you can provide some indication where to start.

mawe42 commented 6 years ago

Do you start jack before running fluidsynth? And if so, how do you start it?

derselbst commented 6 years ago

Did you compile fluidsynth yourself?

Case yes: Did you manually modify fluidsynth? Can you post cmake command + output?

Case no: From which package repo did you get it?

Which version of glib have you installed?

derselbst commented 6 years ago

Pls start fluidsynth with it's shell, type info audio.jack.multi and post output.

mawe42 commented 6 years ago

I check the connections in Qjackctl. In the Audio tab, I expand fluidsynth and I see "left" and "right".

I did the same and accidentally used the patchbay window for that. On that screen, I only saw left and right, because I had a stored config. When I opened the "connections" window, I saw all channels.

mqnc commented 6 years ago

I compiled fluidsynth myself (since I think the apt-get version is 1.1.6 and I needed a newer one), did not modify any code.

CMake:

cmake ..

-- The C compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether system has ANSI C header files
-- Looking for 8 include files dlfcn.h, ..., float.h
-- Looking for 8 include files dlfcn.h, ..., float.h - found
-- Performing Test memchrExists
-- Performing Test memchrExists - Success
-- Performing Test freeExists
-- Performing Test freeExists - Success
-- ANSI C header files - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for DIR in sys/stat.h;sys/types.h;dirent.h
-- Looking for DIR in sys/stat.h;sys/types.h;dirent.h - found
-- Looking for stdio.h
-- Looking for stdio.h - found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for stdarg.h
-- Looking for stdarg.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - found
-- Looking for netinet/tcp.h
-- Looking for netinet/tcp.h - found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - found
-- Looking for limits.h
-- Looking for limits.h - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Performing Test _have_inline
-- Performing Test _have_inline - Success
-- Performing Test _have_vla
-- Performing Test _have_vla - Success
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for modules 'glib-2.0>=2.6.5;gthread-2.0>=2.6.5'
--   Found glib-2.0, version 2.54.1
--   Found gthread-2.0, version 2.54.1
-- Checking for module 'sndfile>=1.0.0'
--   No package 'sndfile' found
-- Checking for module 'libpulse-simple>=0.9.8'
--   No package 'libpulse-simple' found
-- Checking for module 'alsa>=0.9.1'
--   No package 'alsa' found
-- Checking for module 'jack'
--   No package 'jack' found
-- Checking for module 'lash-1.0>=0.3'
--   No package 'lash-1.0' found
-- Checking for module 'dbus-1>=1.0.0'
--   No package 'dbus-1' found
-- Could NOT find READLINE (missing: READLINE_INCLUDE_DIR READLINE_LIBRARIES) 
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components:  doxygen missing components:  dot

**************************************************************
Summary:
Build type:            RelWithDebInfo
libsndfile:            no (raw audio file rendering only)
D-Bus:                 no
PulseAudio:            no
JACK:                  no
ALSA:                  no
PortAudio:             no
OSS:                   yes
MidiShare:             no
CoreAudio:             no
CoreMIDI:              no
Windows:               no
LADSPA support:        no
LASH support:          no
LADCCA support:        no
OS/2 DART support:     no
Audio to file driver:  yes
IPV6 Support :         yes
Readline:              no
Samples type=float:    no (using double)
Profiling:             no
Debug:                 no
Trap on FPE (debug):   no
Check FPE (debug):     no
**************************************************************

-- Configuring done
-- Generating done
-- Build files have been written to: /home/mqnc/development/fluidsynth-1.1.9/build2

I didn't actually remember so many "no"s being there... but I figured since it compiled nicely, everything's fine. Also, I haven't actually tried if the "left" and "right" channels produce some sound but complained here right away.

ldd --version
ldd (Ubuntu GLIBC 2.26-0ubuntu2) 2.26
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
fluidsynth -f fluidsynthcfg.tmp -m jack -a jack -r 44100 -R 0 -C 0 -g 2.0 -s -G 16 -o shell.port=9800 -o midi.jack.id='fluidsynth' -o audio.jack.id='fluidsynth' -o synth.midi-bank-select='mma' -o audio.jack.multi='yes' -o synth.audio-channels=16 -o synth.audio-groups=16
FluidSynth version 1.1.9
Copyright (C) 2000-2018 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Type 'help' for help topics.

> info audio.jack.multi
audio.jack.multi:
Type:          boolean
Value:         True
Default value: False
Real-time:     no
> 

I'm sure I checked connections and not patchbay.

mqnc commented 6 years ago

Ah, and yes I started jack before. With this: jackd -P 95 -d alsa -d hw:PCH -n 2 -p 256 -r 44100 & (this is how I usually start jack from within my python script (which also starts fluidsynth btw), but for the output I generated above, I just started it from qjackctl)

derselbst commented 6 years ago

Why doesn't cmake find jack??

-- Checking for module 'jack'
--   No package 'jack' found
JACK:                  no

I'm sure I checked connections and not patchbay.

Pls double check. info audio.jack.multi is correct. For me it also works fine when start jack manually.

derselbst commented 6 years ago

And pls check whether fluidsynth is really using jack at all:

info audio.driver

mqnc commented 6 years ago

https://ibb.co/kf1ABm

info audio.driver audio.driver: Type: string Value: jack Default value: jack Options: alsa, file, jack, oss, pulseaudio Real-time: no

mqnc commented 6 years ago

I ran sudo apt-get install jack libjack-jackd2-dev, now cmake says -- Checking for module 'jack' -- Found jack, version 1.9.11 recompiled, reinstalled, no change.

derselbst commented 6 years ago

So if you compiled fluidsynth on your own, but hadnt installed libjack-dev before, fluidsynth was built without jack support, so jack shouldnt have worked at all. The fact that it DID worked before as well makes me believe that you have a libfluidsynth.so.1.1.6 installed and the while the fluidsynth executable is of version 1.1.9 it uses that old outdated libfluidsynth.so.

Run ldd fluidsynth | grep fluid and make sure the libfluidsynth.so printed there is the same as where make install installed it to. I bet they are different, so you need to cleanup your environment.

derselbst commented 6 years ago

I'm absolutely sure I'm correct. Anyway leave this ticket open, I'll change fluidsynth --version that it also prints the version of libfluidsynth.

mqnc commented 6 years ago

mirko@abakus:~/development/fluidsynth-1.1.9/build2$ sudo make install [ 94%] Built target libfluidsynth [100%] Built target fluidsynth Install the project... -- Install configuration: "RelWithDebInfo" -- Installing: /usr/local/lib64/pkgconfig/fluidsynth.pc -- Installing: /usr/local/bin/fluidsynth -- Set runtime path of "/usr/local/bin/fluidsynth" to "" -- Installing: /usr/local/lib64/libfluidsynth.so.1.7.0 -- Up-to-date: /usr/local/lib64/libfluidsynth.so.1 -- Up-to-date: /usr/local/lib64/libfluidsynth.so -- Up-to-date: /usr/local/include/fluidsynth.h -- Up-to-date: /usr/local/include/fluidsynth/audio.h -- Up-to-date: /usr/local/include/fluidsynth/event.h -- Up-to-date: /usr/local/include/fluidsynth/gen.h -- Up-to-date: /usr/local/include/fluidsynth/log.h -- Up-to-date: /usr/local/include/fluidsynth/midi.h -- Up-to-date: /usr/local/include/fluidsynth/misc.h -- Up-to-date: /usr/local/include/fluidsynth/mod.h -- Up-to-date: /usr/local/include/fluidsynth/ramsfont.h -- Up-to-date: /usr/local/include/fluidsynth/seq.h -- Up-to-date: /usr/local/include/fluidsynth/seqbind.h -- Up-to-date: /usr/local/include/fluidsynth/settings.h -- Up-to-date: /usr/local/include/fluidsynth/sfont.h -- Up-to-date: /usr/local/include/fluidsynth/shell.h -- Up-to-date: /usr/local/include/fluidsynth/synth.h -- Up-to-date: /usr/local/include/fluidsynth/types.h -- Up-to-date: /usr/local/include/fluidsynth/voice.h -- Installing: /usr/local/include/fluidsynth/version.h -- Up-to-date: /usr/local/share/man/man1/fluidsynth.1

mirko@abakus:~$ ldd /usr/local/bin/fluidsynth | grep fluid libfluidsynth.so.1 => /usr/lib/x86_64-linux-gnu/libfluidsynth.so.1 (0x00007f0259c2a000)

I had fluidsynth 1.1.6 installed before, it came with ubuntu studio. Why did this happen? What did I do wrong during the installation? How do I make it use the up-to-date library? Should I just delete the files it uses and reinstall? Is it because cmake found them and misconfigured stuff?

mqnc commented 6 years ago

Overwrote /usr/lib/x86_64-linux-gnu/libfluidsynth.so.1 with /usr/local/lib64/libfluidsynth.so.1.7.0. Now it works. Although I think it's an ugly hack. But what part of working in linux isn't :p Thanks for your help again, I really appreciate it. I'm sorry in case I caused unnecessary trouble by doing some rookie mistake here.

derselbst commented 6 years ago

I guess /usr/local/lib64/ is not in your LD_LIBRARY_PATH. Either add it to it or tell cmake where to install to, e.g. with -DCMAKE_INSTALL_PREFIX=/usr. Or simply make sure you dont have multiple versions of a software installed.

derselbst commented 6 years ago

Addressed in 37218ba4b426c129dbbe1aceb1b150bfd035eb7b. Closing.