001package music;
002class Music {
003        private static double pitch = 440;
004        /** play note at the current pitch for the given duration
005      in milliseconds (the initial pitch is A = 440 Hz) */
006        public static void play(int duration) {
007                System.out.println("play for " + duration/1000.0 + ": " + pitch );
008        }
009        /** rest for given duration */
010        public static void rest(int duration) {
011                System.out.println("rest for " + duration/1000.0);
012        }
013        /** multiply the pitch frequency by the given factor
014      (a factor less than one will lower the pitch) */
015        public static void scalePitch(double factor) {
016                pitch *= factor;
017        }
018        /** reset the pitch to note A = 440 Hz */
019        public static void reset() {
020                pitch = 440;
021        }
022}