Open timjrd opened 7 years ago
Hi Timothée,
As you suggested, the current version now
volEndTime
and modEndTime
to maximum values of 0.05sec.setTargetAtTime(...)
instead of linearRampToValueAt(...)
to close the gain during the release phase.I've also changed the order in which cancelScheduledValues(...)
is called. Its called as the last function in the closing sequence in all the examples I've seen on the web, so that might make a difference when it comes to avoiding click artifacts. Could you test the current version to see if the clicks have gone away?
You might try your other suggestions again if the clicks are still there:
now = this.ctx.currentTime + 0.05
volEndTime + 0.1
and
volRelease + 1
However, introducing arbitrary constants into the code probably hides underlying problems, so its something that should be avoided if possible. I'm currently digging deep into the parser to see if I can find any relevant parameter(s) that the synth is ignoring. The gree code was a very good start, but there are comments saying that it is incomplete, and its not necessarily bug-free. I'll report back here if/when I find anything pertinent.
I've just completed a detailed review of the code while looking as closely as possible at the SoundFont 2.04 specification. The terminology is a nightmare, but I understand a lot more now, and am confident that the parsing is working correctly. (At least of the variables that are currently being used.) Made a lot of changes to the code, and have given up trying to document the changes I made to the original gree version. The most important/drastic correction was to the way envelope decay times are calculated. The above noteOff function has now become much simpler (!). I've tested this version on the Assistant Performer (using just the Arachno Grand Piano), and on the WebMIDISynthHost (using all the available presets there). It has to be said that the Grand Piano does not yet sound as good as it does on the VirtualMIDISynth, so there's still some work to do. (I think that work would be best done by people who are experts with the Web Audio API.) I've left extensive comments in the code, and think that the soundFont parsing is now complete and substantially bug-free. The tweeking will have to be done in only a few functions: createKeyInfo() in soundFont.js, and the functions in soundFontSynthNote.js (All the necessary variables have been set. It will usually just be a case of deciding what to do with them, and fixing decimal point positions...). Note: There were some artefacts at loop endings when I first tested the French Horn in the WebMIDISynthHost. Second time round, everything was very clean. The code is uncompressed and currently very verbose. Maybe some optimization will have to be done, or compromises made, before this code works perfecly.
Hi :)
I'm experimenting with your ResidentSf2Synth and I was hearing annoying clicks each noteOff event (it's mostly outstanding when you send quickly quite a lot of noteOn/noteOff).
I managed to almost get rid of these clicks by randomly hacking your code, but I didn't send a pull request because I am not sure if it's a good solution, so I'm posting the patched function here :
By the way thank you for this very cool software :) .
My changes are tagged with
timjrd