helio-fm / helio-sequencer

Libre music sequencer for desktop and mobile platforms
https://helio.fm
GNU General Public License v3.0
3.13k stars 115 forks source link

SFZ support #78

Open MuradMathematics opened 6 years ago

MuradMathematics commented 6 years ago

Having the open SFZ standard supported would be a nice feature.

peterrudenko commented 6 years ago

Thanks for suggestion! Personally I'm not using soundfonts, so this is clearly a very low priority task for me. But in case anyone else ever wants to implement this, one could look at existing SFZ reader implementation for JUCE to add another built-in plugin format like this one: https://github.com/helio-fm/helio-workstation/blob/5158f38a2b65c1394ba6b680e4248515a5475663/Source/Core/Audio/BuiltIn/BuiltInSynthFormat.cpp#L24

MuradMathematics commented 6 years ago

I am currently using Helm, or if I need SFZs I use Sforzando (loads SFZ as VSTs) so this has lower importancy.

MessyBookshelf commented 4 years ago

I wonder, if .SFZ (maybe .SF2) support could still be on an Android Build, then it would open up quite a lot of possibilities. I'm coming with a viewpoint from a user of an app called "Caustic 3" from "Single cell software".

Not a lot of DAW's for Android have such support, the before mentioned "Casutic 3" has only .sf2. I don't think plugins will be a thing for android for a while (just my opinion), thus having support would open up possibilities for such users.

Just suggesting, I'll continue learning C++, so I could help out these type of projects

Thank you and good luck. ^^

peterrudenko commented 4 years ago

@MessyBookshelf, I had a branch a while ago where I was playing with SFZero code to add a built-in instrument, which could load custom SFZ/SF2 and also provide a couple of built-in soundfonts to replace my default piano sampler.

I got stuck when I was trying to find a soundfont, which a) is freely licensed, b) has really small size, c) still sounds awesome; the main issue is that most of them are huge. Do you happen to know any soundfont that would meet such criteria?

trebmuh commented 4 years ago

Just letting you guys know that there is a new, very promising, actively developed SFZ lib & soft : https://github.com/sfztools/sfizz/

unfa commented 4 years ago

I believe "Soundfont" is a brand name for SF2 format. SFZ is just a sampler instrument format. It's completely open and very flexible.

You could contact the Sfizz devs to integrate an SFZ player into Helio. I think it'd be a very powerful feature, especially that there's a bunch of wonderful CC-0 SFZ instruments available online (also excellent CC-BY-NC and paid ones by Karoryfer Lecolds).

paulfd commented 4 years ago

I could help integrating yes. As I told unfa on a chat, a longer effort that could be "interesting" through would be to refactor, somehow, the file reading part of sfizz that uses libsndfile to use the juce file readers instead of duplicating this functionality.

0atman commented 3 years ago

Regarding small soundfonts, my man @daveyarwood bundles https://github.com/FluidSynth/fluidsynth with https://github.com/alda-lang/alda which allows a small but good-sounding GM set for the project by default. I think the goals of Alda and Helio are the same - sketching out musical ideas, rather than full production, so having a bunch of built-in sounds ready for users to hear their sketches played with would be great!

frink commented 2 years ago

@paulfd what are the steps that need to be re-implemented for sound file reading? Is it as simple as wrapping a few things or are you tapping deep down into the core of libsndfile to do your disk stream stuff? I've not had a chance to look at your code yet...

paulfd commented 2 years ago

Hi! Actually due to needing to support BSD-compatible static builds, we ended up making libsndfile optional. In the process we actually built a set of wrappers around other file reading libraries. Either we rewrap JUCE's primitives in the same, which should be easy enough, or we accomodate with the possibly duplicated functionality. Maybe the best would be that we discuss this directly after the holidays?

frink commented 2 years ago

@paulfd If you were to include JUCE you should wrap it like you already have with the two other libs.

However, I'm not sure that's the best coarse of action.

Adding that flag would license contaminate your code to GPL 3.0. (there's no linking exception for JUCE...) I'm also thinking about speed and memory management. Chances are the smaller dr_libs is faster. So with all that I can't see a reason to add another library in... - "Don't write code because you can."

I'd rather see cycles spent on integrating Sfizz into Helio so that we have a better composer experience.

paulfd commented 2 years ago

I don't think it'd contaminate the upstream project because we wouldn't distribute JUCE linked binaries, and the functionality would be opt-in anyway. The main downside might be that it complicates the build process on our side though... Helio is already distributed under the GPL so it would be the same.

Looking at your microtonal examples, I think this will be the most problematic interfacing part "as is". SFZ really has 12 tones deeply ingrained, we can load up alternative 12-tone scales but we didn't go beyond yet :)

frink commented 2 years ago

12 tone vs micro-tonal is more of a format issue from what I understand. 99% of the user base isn't going to be doing micro-tonal so I wouldn't worry about that just yet.

I think dr_libs should work just fine. The only real reasons for JUCE over dr_libs is speed and cross platform comparability. Helio runs on mobile and Sfizz doesn't. (I think this is build script related and not really a limitation of the platform...) Including Sfizz should not limit the mobile builds.

That's the only other thing I can think of that might be a problem with the integration as it stands.

paulfd commented 2 years ago

I never tested on iOS but sfizz runs on Android (and there's really no reason iOS would be an enormous problem given that we have a large platform coverage).

frink commented 2 years ago

So based on everything we've talked about it seems like sfizz is the right tool for the job. There's two parts to this. The JUCE interface to show the loaded stuff and the actual Sfizz player doing the heavy lifting. @paulfd do you need someone to jump in on the JUCE side or do you got that too?

karmasyde commented 2 years ago

I got stuck when I was trying to find a soundfont, which a) is freely licensed, b) has really small size, c) still sounds awesome; the main issue is that most of them are huge. Do you happen to know any soundfont that would meet such criteria?

Have you already seen MuseScore's list of downloadable SF2’s? They come in a variety of sizes. I haven’t checked if the options with appropriate licensing also meet the sound quality criteria.

I’m not familiar with options for a general soundset in SF3 format, which supports Vorbis compression. I do see that Musical Artifacts hosts a repository of sounds. I would say their licensing provenances should be scrutinized though.

I see that Sfizz is being touted as the most suitable SoundFont library for Helio. Have Juicy SF VST and vanilla FluidSynth failed to compete?

frink commented 2 years ago

@karmasyde SoundFont is very different than SFZ. Not even close to the same thing.