Recently, some studies have placed emphasis on statistical analysis in music information retrieval (MIR). The paper is concerned with applying a linear hidden Markov model (HMM) with three kinds of states, S, C and D, as the matching mechanism for a query by a humming system. Note segmentation, pitch tracking and the database of the system are briefly introduced. The paper analyzes six probable errors in humming and proposes the SCD HMM to model each song. Each of the states, S, C and D, represents two of the six errors. The SCD HMM describes all kinds of possibilities of errors in a hummed query. Each query can find a most probable state sequence in a SCD HMM and get a probability score that determines the similarity between the query and the candidate songs. The retrieval system contains about 1000 Chinese folk songs. Experimental results show that the model is robust to the six errors and generally a 90% matching accuracy (listed on top 5) can be achieved.