Okay go out and get yourself a qbasic compiler www.qbasic.com compile and run this code. I didn't even know this could be done!
Printable View
Okay go out and get yourself a qbasic compiler www.qbasic.com compile and run this code. I didn't even know this could be done!
I can't run it cause I'm using Linux right now. Read the source though at seems really simple. Music notes are just sound waves at certain frequencys. Someone took the time to convert the musical notation (sheet music) to the appropriate frequency. They created a long data list of frequency (musical note) and duration(lenght note is played for) pairs and used the sound function to cycle through them. Quite simple, but I'm sure it sounds cool. It would be really neat if someone rewrote the program to sample a sound, from a wav file, and then used that instead of the system beep tone.
Imagine Bach's # 4 sampled with cats meowing or something similar. Would be kinda funny.
DeafLamb
Man there's a huge error in your coding
DefInt A-Z ' declare all variables integer type
READ (FREQUENCY), Duration ' read first Frequency and Duration pair
While Frequency <> -1 ' keep playing notes until the end of song
DELAY 0.05 ' general delay for music clarity
If Frequency = 0 Then
Your Frequency is wrong
i would fix it but i doing other things, other then that it looks good.
Cheers
It isn't my code, and it compiles just fine. Go ahead and try it. And as for cool...it is rad. My system speaker was tearing some ass!
If you are interested in doing musical programming looking into c-sound... It is designed to work with music and you can program things in terms of scales and notes instead of frequencies.
QBasic also has the "play" syntax...
there are also some timing/pitch modifiers that work with the play syntax...Code:Play "ABCGFE"
look at the help file for more info...
it liked it, just i had to make a few modifications, like having an exit command, and displaying something on the screen while the notes played....good code, though
slick
ive been having a ball with it, compiled it to music.exe
psexec \\freind_mach -c music.exe
here's the exe if anyone wants it
That's cool!!!! I couldn't get it to run with qbasic, it had a syntax error on the
DELAY .05
part. Thanks Lansing_Banda for posting it and thanks Tedob1 for the .exe so I could actually use it.
Thanks Lansing_ and Tedob1 - Oz, my dog, is packing his bags and leaving the house - it freaks him out. Cool!
Elmore