do re mi fa so la si frequency
hi.. thank you.. i found another way to generate tones.. hehe..
here is the code in C, i've tried it
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#define data 0x0378
#define status data+1
#define control data+2
#define doo 100
#define re 90
#define mi 80
#define fa 75
#define sol 68
#define la 60
#define si 54
#define od 51
int high=0xff, low=0x00;
void delay2(int x){
int i,j;
for(i=0;i<x;i++){
for(j=0;j<30000;j++);
}
}
void n(int doremi, int lama){
int i;
for(i=0;i<lama;i++){
outportb(data,high);
delay2(doremi);
outportb(data,low);
delay2(doremi);
}
}
void main(){
int i,j,input;
clrscr();
textmode(C80);
gotoxy(25,1);textcolor(BLUE);cprintf("PROGRAM GENERATE TONES");
gotoxy(24,2);textcolor(RED);cprintf("========================");
gotoxy(1,3);printf("1. do\n2. re\n3. mi\n4. fa\n5. so\n6. la\n7. si\n8. do!\nEsc. Exit");
outportb(data,low);
while(1){
fflush(stdin);
input = getch();
if(input == 27) _exit(0);
switch(input) {
case '1': n(doo,100); break;
case '2': n(re,105); break;
case '3': n(mi,110); break;
case '4': n(fa,115); break;
case '5': n(sol,120); break;
case '6': n(la,125); break;
case '7': n(si,130); break;
case '8': n(od,135); break;
case '9': n(doo,100); n(doo,100); n(re,180); n(doo,190); n(fa,200); n(mi,300);delay(250);
n(doo,100); n(doo,100); n(re,180); n(doo,190); n(sol,200); n(fa,300);
break;
}
}
}