LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel XP x Playing Sounds

Thank you very much! it's working!

Also: would it be possible to play a two-frequency tone with the Beep
function?

Thank you
Paulo Borelli.

"Tom Ogilvy" wrote in message
...
Here is a possibility that you might be able to adapt to your needs. This
is an old post I made:

From: Tom Ogilvy )
Subject: N beeps per second
View: Complete Thread (6 articles)
Original Format
Newsgroups: microsoft.public.excel.programming
Date: 2003-01-02 20:11:28 PST

I checked this in the API reference. The below will work for Win NT, Win
2000 and Win XP, but in Win 95/ Win 98/ and ME, the two arguments are
ignored - so it won't work in those versions.

Regards,
Tom Ogilvy

Tom Ogilvy wrote in message
news:#0KbU5qsCHA.1776@TK2MSFTNGP09...
This worked in Windows 2000

Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal

dwDuration
As Long) As Long

Sub Beep1()
Dim num As Single
Dim num1 As Long
Dim numLoops As Single
num = 0.5
NumSeconds = 4
numLoops = (NumSeconds * num * 2) / 2
If numLoops < 1 Then
numLoops = 1
End If
num1 = 1000 / (num * 2)

For i = 1 To numLoops
Beep 500, num1
Beep 10000, num1
Next
End Sub


The arguments to Beep are Frequency and Duration. 1000 is 1 second for
duration. I beep twice - one with in an audible frequency (500 to 3000)

and
once with an inaudible frequency. Num represents the number of times

per
second (you can add an input box to get this). If the number of times

a
second is 1, I would see the sound as being half a second since it must

be
accompanied by an addition half second of quiet. Like wise, if number

per
second is 2, the duration would be a quarter second (quarter tone,

quarter
quiet, quarter tone, quarter quite). Anyway, I think that is the way it
behaves.

Regards,
Tom Ogilvy
"Jason Kanter" wrote in message
news:uXHH2zgsCHA.2448@TK2MSFTNGP09...
I need to make a macro that will force Excel to beep (or make some

sound,
which I would like to choose) x times per second. The x might be

anything
from 0.5 to 20 (though an upper limit of 15 would also work for my
purposes). I would want to click a button, have a dialog box ask

how
many
per second, enter the number and have the ticking start and

continue
until I
hit escape or click a Stop button. (This is for use in piano

tuning.)
Suggestions? /Thanks

--
..........
. jason kanter . .
...............................

"Paulo de Arruda Borelli" wrote in message
...
I need to play some very simple sounds on Excel XP. All that I need is

to
supply Excel with a frequency and a duration. That's all. How can this

be
done? The Visual Basic Help under Excel tells me that the sound

functions
have been removed from Excel! The only one that remained is beep, which

is
far from what I need.

Thank you!
Paulo.






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting the actual playing or NOT playing of a WAV file Bajbaj Excel Discussion (Misc queries) 0 October 24th 07 09:16 PM
HOW DO I PUT SOUNDS IN EXCEL Kellsangel1952 Excel Discussion (Misc queries) 2 May 8th 07 05:11 PM
Excel Sounds donpauleon Excel Discussion (Misc queries) 2 July 25th 06 07:49 AM
Excel Sounds Trojan Excel Discussion (Misc queries) 5 November 20th 05 09:42 AM
Macros for playing sounds NAWBUS Excel Discussion (Misc queries) 3 December 15th 04 12:30 PM


All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"