Coder Social home page Coder Social logo

fluidsynth / fluidsynth Goto Github PK

View Code? Open in Web Editor NEW
1.7K 50.0 242.0 8.71 MB

Software synthesizer based on the SoundFont 2 specifications

Home Page: https://www.fluidsynth.org

License: GNU Lesser General Public License v2.1

CMake 7.63% C 90.26% C++ 1.02% Kotlin 0.08% Shell 0.92% Makefile 0.09%
synthesizer soundfont2-synthesizer-library midi-player soundfont-synthesizers midi fluidsynth soundfonts linux realtime cross-platform midi-files wavetables

fluidsynth's Introduction

FluidSynth

Build Status
Linux (CI) FluidSynth Linux
Linux (Packaging) build result
Alpine (musl) Fluidsynth Alpine
FreeBSD Build Status
Windows Build Status
MacOSX Build Status
Android Build Status

FluidSynth is a cross-platform, real-time software synthesizer based on the Soundfont 2 specification.

FluidSynth generates audio by reading and handling MIDI events from MIDI input devices by using a SoundFont. It is the software analogue of a MIDI synthesizer. FluidSynth can also play MIDI files.

SonarQube Quality Gate Status OHLOH Project Stats

Documentation

The central place for documentation and further links is our wiki here at GitHub:

If you are missing parts of the documentation, let us know by writing to our mailing list. Of course, you are welcome to edit and improve the wiki yourself. All you need is an account at GitHub. Alternatively, you may send an EMail to our mailing list along with your suggested changes. Further information about the mailing list is available in the wiki as well.

Latest information about FluidSynth is also available on the web site at https://www.fluidsynth.org/.

License

The source code for FluidSynth is distributed under the terms of the GNU Lesser General Public License, see the LICENSE file. To better understand the conditions how FluidSynth can be used in e.g. commercial or closed-source projects, please refer to the LicensingFAQ in our wiki.

Building from source

For information on how to build FluidSynth from source, please refer to our wiki.

Links


Historical background

Why did we do it

The synthesizer grew out of a project, started by Samuel Bianchini and Peter Hanappe, and later joined by Johnathan Lee, that aimed at developing a networked multi-user game.

Sound (and music) was considered a very important part of the game. In addition, users had to be able to extend the game with their own sounds and images. Johnathan Lee proposed to use the Soundfont standard combined with intelligent use of midifiles. The arguments were:

  • Wavetable synthesis is low on CPU usage, it is intuitive and it can produce rich sounds

  • Hardware acceleration is possible if the user owns a Soundfont compatible soundcard (important for games!)

  • MIDI files are small and Soundfont2 files can be made small thru the intelligent use of loops and wavetables. Together, they are easier to downloaded than MP3 or audio files.

  • Graphical editors are available for both file format: various Soundfont editors are available on PC and on Linux (Smurf!), and MIDI sequencers are available on all platforms.

It seemed like a good combination to use for an (online) game.

In order to make Soundfonts available on all platforms (Linux, Mac, and Windows) and for all sound cards, we needed a software Soundfont synthesizer. That is why we developed FluidSynth.

Design decisions

The synthesizer was designed to be as self-contained as possible for several reasons:

  • It had to be multi-platform (Linux, macOS, Win32). It was therefore important that the code didn't rely on any platform-specific library.

  • It had to be easy to integrate the synthesizer modules in various environments, as a plugin or as a dynamically loadable object. I wanted to make the synthesizer available as a plugin (jMax, LADSPA, Xmms, WinAmp, Director, ...); develop language bindings (Python, Java, Perl, ...); and integrate it into (game) frameworks (Crystal Space, SDL, ...). For these reasons I've decided it would be easiest if the project stayed very focused on its goal (a Soundfont synthesizer), stayed small (ideally one file) and didn't dependent on external code.

fluidsynth's People

Contributors

albedozero avatar antoineschmitt avatar atsushieno avatar bluca avatar bradhowes avatar carlo-bramini avatar chirs241097 avatar derselbst avatar devingryu avatar diwic avatar element-green avatar fabiangreffrath avatar ftzpetruska avatar hanappe avatar jimhen3ry avatar jjceresa avatar jonlatane avatar komh avatar loki666 avatar luzpaz avatar markh-de avatar mattrtaylor avatar mawe42 avatar mchehab avatar mweseloh avatar pedrolcl avatar realnc avatar stekyne avatar swesterfeld avatar sykhro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluidsynth's Issues

Handle disabling of Velocity to Filter Cutoff modulator in a better manner

Issue posted to fluid-dev by S. Christian Collins

http://lists.gnu.org/archive/html/fluid-dev/2008-01/msg00040.html

Seems this default modulator has changed between SoundFont specifications. In particular, SoundFont version 2.04 drops the amount source switch behavior (which seemed moronic to begin with). FluidSynth should be modified to be smarter about encountering modulators meant to disable this "feature" (turn off this modulator if any velocity to filter cutoff is seen with an amount of 0 and either the amount source is not specified or is a switch velocity source) and also perhaps remove the switch component from the default.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/11

MIDI file player playlist features

The MIDI player has currently a play list that can hold several SMF names. There is currently little functionality for controlling this list. I would like to add some new features for:

- getting the number of queued songs in the play list.

- change the current song giving some arbitrary index.

- delete one song from the play list (there is already an add function.)

- loop mode (off, only one song, the whole queue, ... ).

- add the player functions to the commands interface.

Reported by: pedrolcl

Original Ticket: fluidsynth/tickets/35

MIDI file player ends before all notes have been played.

Originally created by: David Henningsson

Two problems must be addressed:

  • The MIDI player should wait for all voices to terminate after the last MIDI note, plus some extra time for reverb.
  • Client programs (like FluidSynth CLI) should wait for all audio buffers to be played before terminating, it's not enough that the player has finished.

Reference:
http://lists.gnu.org/archive/html/fluid-dev/2009-03/msg00040.html

Reported by: *anonymous

Original Ticket: fluidsynth/tickets/24

fluidsynth segfaults when loading configuration file

Reported on 1.0.8-2, but I can confirm the bug in current SVN. Quoted from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528701

When I try to run fluidsynth letting it to read the configuration from the
file, it segfaults at the first command related to the MIDI router.
If e.g. my config files looks like this:

flsynth.conf:
======================================
load /usr/share/sounds/sf2/FluidR3_GM.sf2
load /usr/share/sounds/sf2/FluidR3_GS.sf2
select 1 0 0 52
select 0 0 0 76
router_clear
router_begin note
router_chan 0 127 0 0
router_par1 36 59 1 0
router_end
router_begin note
router_chan 0 127 0 1
router_par1 60 84 1 0
router_end
=====================================
I get the following messages:

=====================================
$fluidsynth -f flsynth.conf 
cca_open_socket: could not connect to host 'localhost', service '14541'
cca_init: could not connect to server 'localhost' - disabling ladcca
fluidsynth: warning: Failed to pin the sample data to RAM; swapping is
possible.
loaded SoundFont has ID 1
fluidsynth: warning: Failed to pin the sample data to RAM; swapping is
possible.
loaded SoundFont has ID 2
Segmentation fault
=====================================

Reported by: diwic

Original Ticket: fluidsynth/tickets/45

MIDI channel can have their own jack output

Originally created by: dakylla

I would be handy to have multiple jack audio outputs (one per midi channel.

this would permit lots of possibilities like effects on instruments,
record each fluidsynth midi channel output ot once in a daw like ardour,...

Reported by: *anonymous

Original Ticket: fluidsynth/tickets/21

Wrong tempo changes

There is one recent report about this problem in the mailing list:
http://lists.gnu.org/archive/html/fluid-dev/2008-06/msg00013.html

And another one in another bug tracker:
https://bugs.launchpad.net/ubuntu/+source/fluidsynth/+bug/248043

Both users are reporting something that can be easily observed when playing many MIDI files having tempo changes, like this one:
http://www.dreamtheater.net/midi/acos2.mid

The problem seems to be that tempo changes (correctly) read from the SMF are played at wrong places, much early from the point where they should happen.

Reported by: pedrolcl

Original Ticket: fluidsynth/tickets/22

Miscalculations in Volume and Modulation Envelopes

The preset level allows a percentage-based calculation of parameters within its included instruments. FluidSynth seems to mis-calculate these values. The attached file contains a test SoundFont and audio examples, as well as more details on the bug.

From the included documentation:


The soundtrack preset contains three instruments: Soundtrack and two instances of Synth Strings. The Soundtrack instrument achieves its pitch by setting the modulation envelope's “To Pitch” to -2400 cents. This combined with a fast attack and short decay causes the pitch to start low and then quickly rise to its resting pitch, which is determined by the modulation envelope's sustain value. In this case, the sustain value at the instrument level is 100%, and the sustain value at the preset level is 13%. Due to what seems to be a miscalculation, FluidSynth arrives at the wrong resting pitch for the note.

The sweep pad contains two instruments: Synth Strings and Polysynth_2, each of which have both the volume and modulation envelopes' attack set to 0.1 seconds (as reported by Vienna). At the preset level, I perform calculations against these instrument-level numbers to achieve my desired envelope. At the preset level, I set the volume envelope attack of Synth Strings to x2 and of Polysynth_2 to x16, which should give respective attack times of .2 seconds and 1.6 seconds respectively. I also set the modulation envelope attack of Synth Strings to x59.99 and of Polysynth_2 to 69.51, which should give attack times of 6 seconds and 6.95 seconds respectively (the modulation envelope adds to filter cutoff). Both the volume and modulation envelope attack phases take far too long on FluidSynth.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/25

The "Day of the Tentacle" intro sounds strange in ScummVM

ScummVM has had support for FluidSynth for quite some time now. Most things I've tried have sounded pretty good, but the intro to the game Day of the Tentacle sounds wrong. It's always difficult to describe sounds, but there's a kind of "boooiiing" sound at the very beginning, where it bends the pitch of a note. The problem is, it isn't bent as far as if I use my sound card's built-in MIDI synth.

I've mostly tried it in FluidSynth 1.0.7, but I believe it also happens in 1.0.8. At first, I thought I had made a programming error with libfluidsynth, but it also happens if I hook up fluidsynth as an ALSA sequencer, and play it through that.

There is a [demo version] of the game that can be used for testing.

Reported by: eriktorbjorn

Original Ticket: fluidsynth/tickets/12

CoreMIDI driver support

CoreMIDI is not supported in MacOSX in Fluidsynth 1.0.8

This would make it easier to package it for Fink, and more popular for Mac OSX users. And I want this feature, anyway.

Reported by: pedrolcl

Original Ticket: fluidsynth/tickets/18

FluidSynth segfault when playing MIDI files

Reported by Irányossy Knoblauch Artúr on the mailing list:
http://lists.gnu.org/archive/html/fluid-dev/2009-05/msg00024.html

Confirmed crash.

Traceback:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff20ec950 (LWP 2789)]
fluid_dsp_float_interpolate_4th_order (voice=0x60d620) at fluid_dsp_float.c:288
288 short int *dsp_data = voice->sample->data;

(gdb) backtrace

#0 fluid_dsp_float_interpolate_4th_order (voice=0x60d620)

at fluid_dsp_float.c:288

#1 0x00007ffff7d84f3d in fluid_voice_write (voice=0x60d620,

dsp_left_buf=0x70a660, dsp_right_buf=0x70a770, dsp_reverb_buf=0x70a8c0,
dsp_chorus_buf=0x70aae0) at fluid_voice.c:602

#2 0x00007ffff7d7e5b8 in fluid_synth_one_block (synth=0x608c30,

do_not_mix_fx_to_out=0) at fluid_synth.c:1963

#3 0x00007ffff7d7ea7e in fluid_synth_write_float (synth=0x608c30, len=128,

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/43

Server mode not working on Windows

Ken Ellinwood said:
If I remember correctly the server is disabled for the Windows build because the code for this feature uses Unix file descriptors for the sockets and does regular read()/write() on the sockets. None of that works on Windows where a first class socket object must be created and send()/recv() used instead.

Request thread: http://lists.gnu.org/archive/html/fluid-dev/2008-12/msg00018.html

While this is not working FS should show an error message whenever server mode operation is requested on Windows.

Reported by: berarma

Original Ticket: fluidsynth/tickets/20

Effect level clip

Original email to fluid-dev list by David Hilvert:
http://lists.nongnu.org/archive/html/fluid-dev/2007-07/msg00007.html

The following patch moves effect level adjustments prior to the send clip, and
reduces the chorus effect linearly with the number of voices. These changes
seem to make output (volume) levels more uniform; in particular, the phenomenon
of certain instruments with high choral component being several times louder
than those with low choral component seems to be mitigated across a variety of
synthesizer parameter settings.

Notes

- The magnitude of the choral effect for large N is reduced by this patch; some

reduction is also present at smaller N.

- Effect level defaults have been adjusted so that qsynth's center is neutral.

Better might be to balance the scale around 0, with 0 neutral.

- The patch is against version 1.0.7a.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/2

Voice-Allocation Bug When Using Two or More Simultaneous Samples in a Preset

Originally created by: Mr_Bumpy

Under certain circumstances, when out of polyphony, FluidSynth seems to steal newly-created voices if more than one sample is triggered at the same time. This file contains a test SoundFont and audio examples, as well as more details on the bug.

From the included documentation:


I have discovered an apparent voice-allocation bug that reveals itself under the following circumstances:

  1. more than one sample is played with each keypress
  2. the preset's volume envelope has long release values
  3. the sustain pedal is not being held down
  4. enough notes are being played to exhaust Fluidsynth's available polyphony (which causes FluidSynth to choose which existing voices get the axe to make room for the new ones)

What seems to happen is that when FluidSynth runs out of voices and a new note is played, it has to choose an existing note to kill as determined by FluidSynth's voice-stealing logic. Unfortunately, if a note is played that requires more than one voice, FluidSynth seems to steal the first newly allocated voice to give it to the second.

Another way of looking at it is:

  1. FluidSynth is out of notes, and receives an event to trigger a new note.
  2. The new note requires two voices of polyphony.
  3. FluidSynth steals an older voice so that the sample 1 of the new note can play.
  4. FluidSynth steals another voice so that the sample 2 of the new note can play, except that it steals the voice that was just assigned to sample 1 instead, so sample 1 is cut short before it even gets started.

For the final MIDI example, I created a piano preset that uses two samples per key, one panned hard left, and the other hard right and features a long volume envelope release time. The example plays a fast glissando, which causes FluidSynth to run out of polyphony. When that happens, you only hear the left sample playing on new notes, because the right sample is never getting a chance to sound.

Reported by: *anonymous

Original Ticket: fluidsynth/tickets/27

Problems with short duration note events

This issue was originally brought up by Antoine Schmitt on the fluid-dev mailing list. Antoine found that short note durations (around 7ms duration percussion events in his tests) were being lost and would not sound at all. This appears to be a problem with the way in which FluidSynth processes events. Although the internal FluidSynth audio buffer is usually 64 samples, audio drivers typically process segments of audio in much larger chunks, which leads to note on/off events of short notes occuring within the same audio block. A re-design of the event system is likely in order.
Link to start of original thread:
http://lists.gnu.org/archive/html/fluid-dev/2007-05/msg00000.html

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/1

Incorrect Pitch When Alternate Values Used for “Scale Tune”

Originally created by: Mr_Bumpy

The pitch of samples scaled with an alternate "scale tune" setting should have their pitch calculated based on their root key instead of middle-C. This file contains a test SoundFont and audio examples, as well as more details on the bug.

From the included documentation:


The SoundFont “Scale Tune” feature allows the distance between notes to be less than a full half-step (0-100 cents). A scale tune setting of 0 means that every note is the same pitch, and this is the setting used for my tests. I have noticed that while the Creative sound cards calculate the resulting pitch based on the root key assigned to the sample, FluidSynth seems to always calculate based on middle C (note 60). This causes FluidSynth to play many non-pitched presets such as sound effects at the wrong pitch.

The sample used for patches 4 and 5 is of a synth playing a high F#.
Patch 4 (scale tune rk90) has the sample's root key set to note 90 (three F#'s above middle C). With scale tune set to 0, the Audigy plays all notes as a high F#, whereas FluidSynth plays all notes as middle C.

Patch 5 (scale tune rk60) has the sample's root key set to note 60 (middle C). With scale tune set to 0, both the Audigy and FluidSynth play all notes as a high F#.

Reported by: *anonymous

Original Ticket: fluidsynth/tickets/26

Output distortion related to synth gain

Output of FluidSynth seems to distort with some SoundFont files unless gain is set very low, even though output to sound device doesn't appear to be clipping. This problem has been alluded to in the past, by me (Josh Green), but was recently mentioned again on the FluidSynth developers list by Bernat Arlandis i Mañó here:
http://lists.gnu.org/archive/html/fluid-dev/2008-03/msg00002.html

Suspect:

  • Reverb and/or chorus
  • Volume attenuation and mixing

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/13

Implement Sostenuto MIDI controller

As reported by S. Christian Collins on fluid-dev:
http://lists.gnu.org/archive/html/fluid-dev/2009-05/msg00063.html

FluidSynth does not currently implement Sostenuto CC MIDI controller 66.

Sostenuto is a sustain which affects only active voices when it is pressed, which sustain until it is released. The Sustain switch does not affect these voices and additional note events are not affected by the Sostenuto.

Probably should wait until mutex related issues are cleared up with synthesis and MIDI events, since this feature will require looping over all active voices and flagging them for Sostenuto.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/47

Stereo sample groups

FluidSynth should start stereo samples atomically. Currently a stereo pair might be started in two separate audio buffers, leading to a 64 sample delay (default). This is contrary to the SoundFont specification and results in unexpected behavior. API should be added to group voices and trigger them at the same instance.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/46

Muted MIDI channels when receiving undefined bank/program changes

When FluidSynth receives a bank/program change that is not defined by the loaded Sound Fonts, the MIDI channel is muted. This behavior has generated some complains in the mailing list, for instance:
http://lists.gnu.org/archive/html/fluid-dev/2009-01/msg00065.html

Indeed, muting the entire channel is somewhat radical. The Roland GS standard was designed to be compatible with the older GM, specifically stating that if some variation is not provided by an instrument, the base GM patch would be used instead. Similar behavior is observed by other manufacturers.

Reported by: pedrolcl

Original Ticket: fluidsynth/tickets/23

Jack complains "failed to remove SHM segment"

This is a failure to delete the fifo from /dev/shm/jack-1000/default/jack-ack-fifo-xxxxx-x, which is created when fluidsynth starts. Solution could be to check for this when created, store the name in /var/run/xxxx, and check for its deletion on startup. Reported by Shane Richards.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/17

Make FluidSynth percussion/instrument selection more GM/GS friendly

This issue was posted to the FluidSynth mailing list by Jimmy:

http://lists.gnu.org/archive/html/fluid-dev/2008-01/msg00000.html

Possible improvements include:

  • Listen for GM/GS Sysex init messages and change behavior accordingly
  • GM mode should ignore banks altogether
  • FluidSynth state should be reset between MIDI files
  • GM and GS modes should always have a percussion bank selected on channel 10
  • Preset selection should fall back to bank 0, if no valid bank:program is found

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/10

Implement Soft Pedal switch MIDI controller

FluidSynth does not currently implement Soft Pedal Switch CC 67.

The soft pedal switch is supposed to make the affected instrument softer via initial attenuation and filter cutoff parameters in a "pre-defined manner". SoundFont specification is not specific on the details of this manner, so there should probably be some user configurable parameters which are added which determine the amount of change for volume attenuation and filter cutoff.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/48

Build system - CMake

The current build system is based on auto-tools, and it's hard to use in Windows (for instance).

In addition to the current system, it would be nice to include a CMake based one. It would generate Makefiles, XCode and VS project files from the same set of specifications.

In MacOSX: add support for creating universal binaries (PPC+x86) and to build the library as a framework.

Reported by: pedrolcl

Original Ticket: fluidsynth/tickets/38

Oh I'd love some effects!

Hi everyone
Fluidsynth is a lifesaver for command line linux stuff....it's really good and let's me play my soundfonts quickly.
One thing I think would be ace would be if you could incorporate some basic effects into FS...like a delay, flanger,phaser and distortion,overdrive......maybe certain parameters could be changed via simple Midi CCs....

At the moment I can add effects in a sequencer but it sure would be useful to be able to do this from the command line.....it doesn't have to be overly complicated in terms of parameters it might offer the user.....

I came across this problem as I was playing a Rhodes sample and wanted to add a little overdrive and a touch of phasing.....

What do you think everyone? Would this be easy to achieve? Thanks for all your help!

Reported by: blip

Original Ticket: fluidsynth/tickets/7

Add FluidSynth settings for reverb and chorus

Adding FluidSynth settings parameters for reverb and chorus would allow for the valid ranges to be queried and also clean up the command interface (chorus and reverb commands could be deprecated).

Example setting names:

  • synth.reverb.room_size
  • synth.reverb.damp
  • synth.reverb.width
  • synth.reverb.level
  • synth.chorus.nr
  • synth.chorus.level
  • synth.chorus.speed
  • synth.chorus.depth

There is already synth.reverb.active and synth.chorus.active.

Reported by: elementgreen

Original Ticket: fluidsynth/tickets/49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.