Introduction
Some days ago I needed a metronome for something. I had none available so I downloaded an app from the App Store. The app had a size of 71 MB!!!
71 MB for making tic-toc...?!
So code-golf came into my mind and I was wondering if some of you guys could improve this.
Challenge
Golf some code that outputs some sound. It's pretty irrelevant what kind of sound. If required create some sound file... but a System beep will do the job as well. (Here is some sound I created... nothing special.)
Input: The beats per minute the metronome outputs.
Example
This is a non-golfed Java-version! It's just to show you the task.
public class Metronome {
public static void main(String[] args) throws InterruptedException {
int bpm = Integer.valueOf(args[0]);
int interval = 60000 / bpm;
while(true) {
java.awt.Toolkit.getDefaultToolkit().beep();
// or start playing the sound
Thread.sleep(interval);
System.out.println("Beep!");
}
}
}
Rules
You may not use external libaries, only tools of the language itself are allowed.
Only the bytes of the source code count... not the sound file.
This is code-golf, so the submission with the least amount of bytes wins!
EDIT:
Example output: So something like this would be the output for 120 bps: link
beep()
and console output aren't exactly instant IIRC. Neithersleep()
is known for beeing accurate. \$\endgroup\$