1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| typedef struct {
char *nom;
double freq;
} t_note;
t_note notes[]={
{"DO", 261.63},
{"RE", 293.66},
{"MI", 329.63},
{"FA", 349.23},
{"SOL", 392.0},
{"LA", 440.0},
{"SI", 493.88},
};
unsigned short temps[]={100, 200, 300};
unsigned long fib[]={1, 1, 0};
for (unsigned long n = 1; n <= 1000000; n++) {
printf("%s\n", notes[fib[0] % 7].nom);
Beep(notes[fib[0] % 7].freq, temps[fib[0] % 3]); // ou alors Beep(notes[fib[0] % 7].freq, (fib[0] % 3 + 1) * 100) si on est sûr que ces valeurs 100, 200, 300 ne changeront jamais
fib[2]=fib[0] + fib[1];
fib[0]=fib[1];
fib[1]=fib[2];
} |
Partager