Sunday 9 June 2013

Violin metronome

For this piece I'm working on my teacher really wants me to focus on the rit. during this one phrase since I'm not slowing down enough, I'm only really doing the decrescendo. So I decided to write a little metronome program that uses my laptop's PC beep to mark the rhythm and using sleep to create the tempo. Then once it hits the rit. in the phrase I gradually increase the amount of time that it sleeps.

 Here's the source code:

#include <cstdio>
#include <Windows.h>
int main(){
  int sleep=850; // In milliseconds
  for(int beat=0; beat<=15;beat++){
    if(beat>11){
      sleep+=500;
    }
  printf("\a");
  Sleep(sleep);
  }
  printf("\a"); // Just as a reminder to mark the end of the fourth beat
}

No comments:

Post a Comment