add sound switch, modify scale algorithm