MIDI Synthesizer with FluidSynth

Collaborate on tools, libraries, and applications beyond the IDE

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
prometheus
Posts: 40
Joined: Sun Dec 13, 2015 6:05 pm

MIDI Synthesizer with FluidSynth

Post by prometheus » Fri Oct 30, 2020 12:54 am

LCB lib to wrap FLuidSynth (already working)




Repo: https://github.com/Ferruslogic/lcb_fluidSynth

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: MIDI Synthesizer with FluidSynth

Post by sphere » Tue Nov 03, 2020 7:30 pm

Nice!
Going to check it out.

Thanks a lot.

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Thu Nov 12, 2020 9:36 pm

I forked that repo on GitHub and started adding to the wrapper. https://github.com/PaulMcClernan/lcb_fluidSynth
I got the macOS version of libFluidSynth working (at least it works on macOS 10.12.6 on my laptop).
I added binding for more stuff like PitchBend and MIDI File Playback.
I trimmed the SoundFont SF2 folder down to just a few smaller files including a 1.2MB General MIDI Sound set. That means 128 different sounds to play with, plus drum kits, from just a 1.2MB file. There are very larger, high quality SoundFonts around on the internet, but figured it would be good to keep to small files in the GitHub repo. I also added the "HyperCard" sounds SoundFonts because I wanted to, they're 1980s tiny, just a few KB.
Also added a few MIDI song files to test playback with.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Thu Nov 12, 2020 9:49 pm

Also, your read me page points to the version 1.3 of my Piano Widget. There was a mistake in that version where "lock to scale/mode" doesn't accept "3H","WH", or "HW" for 3 half-steps in the scale/mode formula so some scales (Blues Scale) don't get set properly in that format (if you set it with Note-Names instead of the formula format, that works). The version in my GitHub repo fixes the problem.
https://github.com/PaulMcClernan/LCB_PianoWidget
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Mon Nov 16, 2020 11:14 pm

I just got back to work and tested. The macOS build in my GitHub repo has now been tested on 10.14.6 (non-admin account without any Homebrew/MacPorts packages installed), another (my son's Mac) 10.14.6, and two other mac's running 10.12.6 and 10.10.5. Everything seems to work so far except for loading DLS (DownLoadable Soundbank) format files, I haven't tried SF3 ( Vorbis compressed SoundFonts). I did compiled the Mac version of libinstrumpatch that is require for DLS but FluidSynth doesn't seem to be linking to it. They're both newer Soundbank formats that aren't as common as SF2 anyway (although the macOS built-in Roland GM Soundbank is in DLS format).

At any rate, I've only built the macOS version so that I can work on the wrapper without booting into Windoze (I'm not a fan), if you're building something for macOS (10.7+) or iOS (8+) that needs to play music via SF2 or DLS sound banks ( As well as Logic/GarageBand EXS and straight raw sound files), then I recommend using my other Apple specific LCB Wrappers instead of FluidSynth:
https://github.com/PaulMcClernan/LCB_Ap ... dioSampler
If you just need basic MIDI/SoundFont playback functionality then use:
https://github.com/PaulMcClernan/LCB_AppleAVMidiPlayer
Or if you're adventurous, you could try this one that can load ANY AudioUnit Software Synth Music Instrument plug-ins
*** Warning this is a bit unstable / work in progress *** :
https://github.com/PaulMcClernan/LCB_Ap ... Instrument
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Wed Nov 25, 2020 1:37 am

prometheus wrote:
Fri Oct 30, 2020 12:54 am
MIDI Synthesizer with FluidSynthQuote prometheus
by prometheus » Thu Oct 29, 2020 7:54 pm
LCB lib to wrap FLuidSynth (already working)
I've pushed this a bit further in my repo:
https://github.com/PaulMcClernan/lcb_fluidSynth

I Made a video of the progress I've made!
NOTE: That the hard crash at the end is related to the Piano Widget and the Script Engine Widget<->to LC<->LCB message queuing error (Bug in LC?), the FluidSynth wrapper itself seems to work OK with the stack/graphic object version of the on-screen piano pretty well (although I have had a couple of random crashes with that as well, but it's much more stable than trying to animate the MIDI-input with the widget version.
Also note that I was just figuring out "Another One Bites the Dust" on my bass guitar and was trying to figure it out on the piano keys, by no means is this to be considered a performance, LOL.
Viddy this:
https://www.youtube.com/watch?v=psR1dJ0PiNA
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: MIDI Synthesizer with FluidSynth

Post by sphere » Wed Dec 02, 2020 3:46 pm

Great work. WOuld be nice if we could build VST's with LC.

golife
Posts: 103
Joined: Fri Apr 02, 2010 12:10 pm

Re: MIDI Synthesizer with FluidSynth

Post by golife » Thu Dec 03, 2020 5:14 pm

Since I do not use Macintosh or Apple products, how hard is it to have an cross-platform version, at least supporting Windows? As a aspiring musician (Piano) I am very much interested in this work.

Thank you
Golife

prometheus
Posts: 40
Joined: Sun Dec 13, 2015 6:05 pm

Re: MIDI Synthesizer with FluidSynth

Post by prometheus » Fri Dec 04, 2020 2:02 am

Hi golife, I started this lib working on windows with the basic functions (on my free time), PaulDaMacMan made some really great improvements (working on Mac), but basically it should work on windows, not sure if the new improvements made by PaulDaMacMan are compatible, but I will dedicate some time to it on Christmas free days.

golife
Posts: 103
Joined: Fri Apr 02, 2010 12:10 pm

Re: MIDI Synthesizer with FluidSynth

Post by golife » Fri Dec 04, 2020 1:01 pm

Oh, thank you. If you need some testing on Windows, I will be glad helping as well within my abilities. Thanks for to all of you.

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Fri Dec 04, 2020 10:02 pm

prometheus wrote:
Fri Dec 04, 2020 2:02 am
Hi golife, I started this lib working on windows with the basic functions (on my free time), PaulDaMacMan made some really great improvements (working on Mac), but basically it should work on windows, not sure if the new improvements made by PaulDaMacMan are compatible, but I will dedicate some time to it on Christmas free days.
The improvements I made to the wrapper (in my GitHub repo) should all work on Windows, as well as other platforms like Android/Linux that have compiled binary LibFluidSynth libraries and LiveCode support). There's actually a few minor features that I can't seem to get working on macOS (such as loading .DLS or SoundFont 3 format sound banks) that work fine in my limited testing on Windows 10.

I basically just compiled the macOS version of FluidSynth and added a macOS X86_64 folder to @prometheus project folder (after some finagling to the dynamic lib search paths), so I could work on the wrapper on macOS (my preferred OS). All of the improvements have been just wrapping more of the FluidSynth library in LCB, adding to the test LC UI Stack, and testing callbacks from LCB to the script engine (which gets a bit crashy).

One thing I really haven't gotten a chance to test, because I've never really done MIDI stuff on Windoze, is MIDI-In, which I have sort of working on macOS. Inter-Application MIDI is something that has been built-in to macOS X virtually since it's beginning, but is completely absent from the Windows OS (you have to install a 3rd party loop-back MIDI driver for that on Windows but there are several free ones on the net). It should work, I just haven't put any effort into getting MIDI in working on Windows. If some Windows user like @golife want's to test it on Windows, that would be fantastic! Please let me know how that goes!
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Fri Dec 04, 2020 10:17 pm

sphere wrote:
Wed Dec 02, 2020 3:46 pm
Great work. WOuld be nice if we could build VST's with LC.
if you want to use FluidSynth as a VST Plug-in, this guy already wrapped fluidSynth as a VST with the JUCE library, available free here:
https://github.com/Birch-san/juicysfplugin

If someone would want to wrap Windows plug-in API or maybe the JUCE library in LCB then you could load VST's into LC!
I have done some work on an LCB wrapper that taps macOS AudioUnit (AU) plug-ins (instruments only so far).
https://www.youtube.com/watch?v=E0ByYriKI3M

Interestingly, with Apple's newer Audio Units 3 system, AUv3 plug-ins run in their own process, and can work as standalone apps too, and so basically, theoretically, you could make a AUv3 plug-in with LiveCode, might even be just a matter off editing some of the info.plist xml in your app.
Last edited by PaulDaMacMan on Sat Dec 19, 2020 12:11 am, edited 1 time in total.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: MIDI Synthesizer with FluidSynth

Post by sphere » Sat Dec 05, 2020 3:13 pm

Great!
Thanks for the links.

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Sat Dec 19, 2020 12:29 am

Just an update for anyone interested:
I've just added Reverb and Chorus FXs handlers (effects applied to all channels) for those two built-in FXs, it looks like there is also a built-in Low-Pass/High-pass filter that can be used but I did not yet add that to the LCB wrapper. WARNING!!! I take no responsibility if you blow out your ear-drums while playing around with these!
I've now got a good chunk of libFluidSynth wrapped up with LCB, at least most of the more commonly used features. It all seems to mostly play nice with LiveCode, with the exception of MIDI-In which does work but tends to crash the LC engine (at least on macOS) when too many messages are received in rapid succession.
In-line mark-up documentation needs to be added for display in the LC dictionary as I've neglected to do that along the way.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: MIDI Synthesizer with FluidSynth

Post by PaulDaMacMan » Tue Dec 22, 2020 6:38 pm

OK, so I got SoundFont 3 format (unofficial format OGG/Vorbis compressed) sound banks loading AND MIDI-to-WAVE working on macOS (10.12.6) HOWEVER, I had to revert to an earlier version of libFluidSynth (loads as 2.0.5 instead of current 2.1.5, which is actually 2.3.5... don't ask me, I don't understand the FluidSynth team's version numbering system), which is the latest MacPorts build (Oct. 2019). I'm not sure what else changed between the two versions.

One of the versions I was testing with I had built myself with CMake because I was trying (unsuccessfully) to use the libinstpatch.dylib, that is not available in either the HomeBrew nor MacPorts builds of libFluidSynth, which I believe is required for using DLS format SoundBanks. I may have not built it correctly, I'm not sure.

DLS is NOT fully supported by FS, and it's a much less common SoundBank format anyway. DLS loading DOES seem to work on the Windows build (which was already there when I forked this project). If you want to use DLS on macOS it is probably better to use my other project LCB_AppleAVAudioSampler which uses Apple's DLS/SoundFont AudioUnit that is built into macOS (since 10.7).

I only did very brief testing on Windows 10, but it seems that I'm only getting raw PCM sound file output from the MIDI-to-WAVE function, which probably means that the secondary/optional libSndFile library is not loading (which was actually the main problem I was having with the macOS version). There is of course other software around that can convert RAW PCM to Wave.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Locked

Return to “Community Projects”