Arduino + Musical Instrument Shield

When you do note on you record a time, zero or anything and clear a counter.
When the counter reach a value you turn the note of.

This isn't easy to explain, give me some help any one?