implement onset detecting