Posts

Showing posts with the label metronome

Metronome - musical tool.

Image
If you are a musician, one of the most useful tools is a metronome. It graphically displays the beats for you to follow while playing music.One particular program is all text based so it will run on a variety of systems even without a sound card. To invoke the program, you use the program name followed by the speed you want to use. Then the program will start. The program uses a simple cursor to mark the time of the beats. The program seems to do some compensation to keep the metronome accurate. To build the program, you would: $ gcc metronome.c -o metronome Here is the code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdint.h> #include <signal.h> #include <time.h> #include <sys/time.h> struct timeval start, last; inline int64_t tv_to_u(struct timeval s) {     return s.tv_sec * 1000000 + s.tv_usec; } inline struct timeval u_to_tv(int64_t x) {     struct ...