Re: Stuck Notes
Re: Stuck Notes
- Subject: Re: Stuck Notes
- From: "John Lazzaro" <email@hidden>
- Date: Sat, 27 Mar 2004 09:41:15 -0800
"James Chandler Jr" <email@hidden> writes:
If you receive two identical note-on's in realtime, before receiving a
note-off,
how can your software make an 'instant' decision whether this is a
hardware
error versus intentional user input?
If I had a requirement to handle these out-of-spec keyboards,
what I would do is:
[1] Keep a reference count for each note on each channel --
i.e. # NoteOn's - # NoteOffs. This can be represented in a
sparse or bit-packed data structure if space is an issue.
[2] The first time you see the reference count go above 1,
be paranoid, and the next time you see a NoteOff, and issue
two NoteOffs to return the reference count back to 0. If
later on a second NoteOff arrives from the source, make
a note of the fact that the source seems is sending multiple
paired NoteOn/NoteOffs, and stop issuing extra NoteOffs
to zero the reference count in the future.
This is a simplistic algorithm, in practice you'd make it
more robust, and make the transient artifacts introduced
by the initial paranoid behavior sound as unobjectionable
as possible.
---
John Lazzaro
http://www.cs.berkeley.edu/~lazzaro
lazzaro [at] cs [dot] berkeley [dot] edu
---
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.