onset detection code sample