Jump to content

PLAY "Music" through PC Speaker


CyberSlug
 Share

Recommended Posts

Based on QBasic syntax, but any differences were hacked out instead of being thought out :lmao:

Download the attachment if the example interests you:

; CyberSlug - 1 Feb 2005
;-----------------------
;Put a space between each note and rest
;Use uppercase letters to denote the pitches
;Use "r" to denote rest
;Follow pitch with "#" or "+" to denote sharp; use "b" or "-" to denote flat
;Precede the pitch with a number to denote duration 1=whole, 2=half, 4=quarter(DEFAULT), 8=eight, 16=sixteenth
;Specify octave in the format "o7"; default octave is "o4"
;Specify tempo in the format "t100"; that means 100 quarter notes per minute; range 32 - 255

Play("t240 E D C D E E E r D D D r E G G r")
Play("t240 E D C D E E E E D D E D C")
Play("2r")
Play("o5 E E 2E E E 2E E G C D 2E")
Play("2r")
Play("C D E F G A B o5 C o4 B A G F E D C")
Play("2r")
Play("t255 C C# D D# E F F# G G# A A# B B# < C")
Play("2r")
Play("t255 o4 C > Cb B Bb A Ab G Gb F E Eb D Db C")

music_wrapper.au3

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Well done CyberSlug.

I'll grab this now and make use of it.

Used sparingly, sound is a great way to add character, humour and personality to a script.

Many thanks,

DW

Based on QBasic syntax, but any differences were hacked out instead of being thought out  :lmao:

Download the attachment if the example interests you:

; CyberSlug - 1 Feb 2005
;-----------------------
;Put a space between each note and rest
;Use uppercase letters to denote the pitches
;Use "r" to denote rest
;Follow pitch with "#" or "+" to denote sharp; use "b" or "-" to denote flat
;Precede the pitch with a number to denote duration 1=whole, 2=half, 4=quarter(DEFAULT), 8=eight, 16=sixteenth
;Specify octave in the format "o7"; default octave is "o4"
;Specify tempo in the format "t100"; that means 100 quarter notes per minute; range 32 - 255

Play("t240 E D C D E E E r D D D r E G G r")
Play("t240 E D C D E E E E D D E D C")
Play("2r")
Play("o5 E E 2E E E 2E E G C D 2E")
Play("2r")
Play("C D E F G A B o5 C o4 B A G F E D C")
Play("2r")
Play("t255 C C# D D# E F F# G G# A A# B B# < C")
Play("2r")
Play("t255 o4 C > Cb B Bb A Ab G Gb F E Eb D Db C")

<{POST_SNAPBACK}>

Link to comment
Share on other sites

I'm kind of curious. How would one go about creating anything polymorphic with au3? I am very used to the interface form of polymorphism in oOp but not exactly sure how one could pull off true polymorphism over au3. If you know please share your methods.

-I am the giver of life and the bringer of death.

Link to comment
Share on other sites

I'm kind of curious. How would one go about creating anything polymorphic with au3? I am very used to the interface form of polymorphism in oOp but not exactly sure how one could pull off true polymorphism over au3. If you know please share your methods.

<{POST_SNAPBACK}>

polyphonic, as in more than one note playing at the same time. I don't think the PC speaker supports it anyway.
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Like SoundSetWaveVolume, perhaps.

But this function doesn't affect the pc speaker. Which is why I'm asking if it's even possible.

:lmao:

<{POST_SNAPBACK}>

Well, it's a bit dusty, but if memory serves me right, the PC speaker DOES have a volume control within the windows GUI. 3 or 4 settings, I believe... Off, Low, Medium and High. So ... Theroetically speaking.....

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Why it doesn't work under Windows 98? It worked fine on XP but didn't on 98, although I found the "kernel32.dll"...

<{POST_SNAPBACK}>

Hmm, it might be a Windows 9x feature: http://support.microsoft.com/kb/199030/
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • 1 year later...

Very nice thing so far, good job.

But i wonder, if it would be possible to play a sound as long as you press a button.

Something like that.

If _isPressed(%%) Then
StartBeep($freq)
EndIf

While _isPressed(%%)
Wend

StopBeep

So that you don't have to put duration before you start playing the note.

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Link to comment
Share on other sites

Oooo.... an old thread...

But i wonder, if it would be possible to play a sound as long as you press a button.

Yes you can.

Next time you have a support question, post it in the v3 Support fourms.

#)

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...