GAH. stupid bug in onset detection function!