In this paper, we propose a new scheme for transcribing sung or hummed queries into a sequence of pitch and duration pairs automatically for efficient music retrieval. More specifically, we present two novel methods called WAE (Windowed Average Energy) and dynamic threshold method for ADF onsets for note segmentation and onset/offset detection in acoustic signal, respectively. The former improves previous energy-based approaches such as AE by defining small but coherent windows with local and global threshold values. The latter also improves the traditional global/local threshold method. By performing various experiments on our prototype music retrieval system, we show the effectiveness of our proposed scheme.