Sign in to follow this  
Followers 0
CyberSlug

PLAY "Music" through PC Speaker

18 posts in this topic

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!

Share this post


Link to post
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}>

Share this post


Link to post
Share on other sites

BTW When will the polyphonic version be ready? :lmao:

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Oops, a slight error. Thanks for the correction.


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

Share this post


Link to post
Share on other sites

Very cute, sluggie :lmao:

.. does anyone know if it's possible to programmatically set the volume of the pc-speaker? (And if so .. how?)

TIA

Share this post


Link to post
Share on other sites

CyberSlug really cool!

Share this post


Link to post
Share on other sites

trids, do you mean SoundSetWaveVolume?

i like this, very neat CS! :lmao:


FootbaG

Share this post


Link to post
Share on other sites

trids, do you mean SoundSetWaveVolume?

<{POST_SNAPBACK}>

Like SoundSetWaveVolume, perhaps.

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

:lmao:

Share this post


Link to post
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

Share this post


Link to post
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"...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

#)

Share this post


Link to post
Share on other sites

Cyberslug... could you please take a look at my topic?

http://www.autoitscript.com/forum/index.ph...c=34271&hl=

I am trying to make a very simple musical keyboard that does not beep repeatedly when you hold down a button. I want it to hold the pitch rather than make the sound over and over. Do you think this is possible?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0