October 24th, 2003, 04:54 PM
Basic Code That Everyone Must Run!
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!
October 24th, 2003, 05:11 PM
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.
October 24th, 2003, 06:47 PM
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.
October 24th, 2003, 08:34 PM
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!
You shall no longer take things at second or third hand,
nor look through the eyes of the dead...You shall listen to all
sides and filter them for your self.
October 24th, 2003, 08:40 PM
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.
October 24th, 2003, 08:50 PM
QBasic also has the "play" syntax...
there are also some timing/pitch modifiers that work with the play syntax...
look at the help file for more info...
yeah, I\'m gonna need that by friday...
October 24th, 2003, 09:03 PM
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
\"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller
October 24th, 2003, 09:55 PM
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
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
October 24th, 2003, 10:10 PM
That's cool!!!! I couldn't get it to run with qbasic, it had a syntax error on the
part. Thanks Lansing_Banda for posting it and thanks Tedob1 for the .exe so I could actually use it.
October 24th, 2003, 10:15 PM
Thanks Lansing_ and Tedob1 - Oz, my dog, is packing his bags and leaving the house - it freaks him out. Cool!