Basic Code That Everyone Must Run!
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Basic Code That Everyone Must Run!

  1. #1
    Senior Member
    Join Date
    Sep 2003
    Posts
    500

    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!

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Posts
    179
    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

  3. #3
    Banned
    Join Date
    Oct 2003
    Posts
    68
    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

  4. #4
    Senior Member
    Join Date
    Sep 2003
    Posts
    500
    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.
    -Walt Whitman-

  5. #5
    Senior Member
    Join Date
    Oct 2001
    Posts
    748
    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.

  6. #6
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    QBasic also has the "play" syntax...

    Code:
     Play "ABCGFE"
    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...

  7. #7
    Senior Member
    Join Date
    May 2003
    Posts
    407
    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
    \"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

  8. #8
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    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.’”

  9. #9
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    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.

  10. #10
    Junior Member
    Join Date
    Sep 2003
    Posts
    27
    Thanks Lansing_ and Tedob1 - Oz, my dog, is packing his bags and leaving the house - it freaks him out. Cool!

    Elmore

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •