Comments (10)
@frabert The fix ended up ignoring notes in the sustained state as well, instead of just the release state in note_off... My explanation above was correct but sadly not the code. Sigh...
Third time's the charm?
Thanks again for testing!!
from tinysoundfont.
@schellingb The last commit seems to have fixed the behavior!
from tinysoundfont.
Hey there!
Thanks for all your great inputs.
What do you think of my recent commit b9a4de3:
Handle note_on/off more like the MIDI standard suggests:
- Change note_on with a velocity of 0 to be handled as note_off
- Change note_on so it doesn't cancel previous note_on of the same preset/key
- Change note_off so it only stops a single corresponding note_on and not all notes playing on the same preset/key
The previous behavior of note_on/off was taken over from SFZero which does not seem to match the MIDI standard descriptions I can find. They require a corresponding note_off for every note_on. My change ends up stopping only the voices of the first played note_on. I was unsure if it would be better to stop the most recent one. Didn't find a ruling on that part. Funnily not even FluidSynth seems to do it correctly...
The handling of v->region->group (which you #ifdef'd out as well) is still untouched as it matches the description in the SF2 specs:
This parameter provides the capability for a key depression in a given instrument to
terminate the playback of other instruments. This is particularly useful for
percussive instruments such as a hi-hat cymbal. An exclusive class value of zero
indicates no exclusive class; no special action is taken. Any other value indicates
that when this note is initiated, any other sounding note with the same exclusive class
value should be rapidly terminated. The exclusive class generator can only appear at
the instrument level. The scope of the exclusive class is the entire preset. In other
words, any other instrument zone within the same preset holding a corresponding
exclusive class will be terminated.
Does that change do anything good for your test?
Thanks again for using the lib!
\ Bernhard
from tinysoundfont.
@schellingb The last commit introduced a lot of notes getting "stuck" playing, whereas before I had no issues
from tinysoundfont.
@frabert Interesting... I assume you don't have a note_off for every single note_on? Or maybe there is a bug... I'll look into it and hope to get back soon with either an option to make the note_off behave as before or a fix. Sorry for the inconvenience!
from tinysoundfont.
I generate the note_off programmatically, so there should never be note_ons without note_off
from tinysoundfont.
@frabert Oh man, sorry for my accusation...
Turned out to be a bug (or rather complete oversight) in the new note_off handling. Of course note_off can't just end the earliest playing voice without checking its state because even after ending it is still playing the release envelope. It should be good now.
Glad you popped in here :-)
Thanks!!
from tinysoundfont.
@schellingb No problem man, no offense taken! Thank you very much for the snappy responses and support!
from tinysoundfont.
UPDATE: Unfortunately I can still reproduce the problem...
from tinysoundfont.
Awesome. Closing this one then!
from tinysoundfont.
Related Issues (20)
- Line 59 of tsf.h HOT 1
- "conversion may change the value [-Werror=conversion]" compilation errors on MCST lcc compiler HOT 2
- Volume curve HOT 2
- this library wrote 3300 seconds of PCM audio in 4.9 seconds. (nice work) HOT 1
- Is it possible to use this library with SDL_mixer?
- How I can stop a note by fading the volume? HOT 2
- How many channels does this support? HOT 2
- white noise unexpected sound when playing the files HOT 2
- Stuck instrument with Windows XP onestop.mid HOT 1
- Incompatibility with ISO C++ HOT 2
- `TSF_MALLOC(...)` without non-NULL check/error handling HOT 3
- Design issue: having playback handling and soundfont in same structure incentivizes people to write memory hogs(?) HOT 3
- `tsf_set_max_voices()` should actually be enforced HOT 2
- Unicode open HOT 1
- Would be possible to sustain a note? HOT 2
- Is .sfz support something devs consider also thank you for the library HOT 6
- voices active for slightly longer than they should be
- Reading samples directly at runtime (port to STM32) HOT 1
- MIDI latency HOT 1
- Likely memory leak in use of TSF_REALLOC in new sf3 code in out of memory conditions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinysoundfont.