Can you get a wave file to play a variable?
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Can you get a wave file to play a variable?

  1. #1
    New Member
    Join Date
    Feb 2002
    Location
    Robert P. Wagner
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Assume I have cell a1 that has a value in it. And, this value is increasing. If it hits (for example), 50, can I have a vb fire off a wav file that says something like "value is 50". and then, if the value in a1 goes up again (say to 75), it says "value is 75" and so forth for all the triggure values I want to code for.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,240
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi rpwagner,

    Yes, this is easy to do, assuming that you have a .wav file for every level you want flagged (I assume you've recorded your own voice here--although for a few thousand bucks you could probably get James Earl Jones or Brittney Spears to do it). Simply put code into the worksheet's Calculate event that checks the value against each of the levels, and plays the appropriate file.

    If you want an example, let me know the levels and .wav file names you intend to use.

    Keep Excelling.

    Damon
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    New Member
    Join Date
    Feb 2002
    Location
    Robert P. Wagner
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for responding. Below, is an excerpt for the code (that works). If Qtr1Percent is > .35, the specific wave file will fire off and play. However, the wave files just says "it is greate than 35 percent when in actuality, it may be 45 percent. I would like the wave file to play whaterver the value of Qtr1Percent actually is (ie. 45 percent). That way, I know realtime exactly how high it is. I do not want to have to code a whole bunch of wave files for all the possible values Qtr1Percent could be. Is this possible (to use a variable in the wave file? Thanks in advance.

    If WhatTime = 15 And .Range("Qtr1Percent").Value > 0.35 Then
    Call PlayWavFile _
    ("C:\Documents and Settings\Robert P Wagner\My Documents\15VolAlert.wav")
    End If


  4. #4
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,240
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi again rpwagner,

    Unfortunately, it is not possible to have a wave file "play a number". You would have to have a different wave file for each number. This is because wave files are just digitized amplitude vs. time data. If you have a voice synthesizer card in your computer such as used by blind people, you could do this--except it wouldn't be a wave file. You would then be passing a string to the voice synthesizer card using the card's software interface (probably a DLL like the one your wave file Play routine uses).

    Regarding the wave file issue, instead of recording 101 wave files (for zero to 100 percent) you could have wave files for the numbers "one" through "nineteen" and also "twenty", "thirty", "forty", etc., and play these in sequence to get all 101 numbers using only about 30 wave files. For example, to get the number 54%, you would play the wave file "fifty" followed by "four" followed by "percent".


    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Don't know if this can help, but the Speech tool does a fairly decent job. Take a look at it.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  6. #6
    New Member
    Join Date
    Feb 2002
    Location
    Robert P. Wagner
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Juan.... I typed speech into the help for both Excel and vba and nothing comes up. Additionally, there is no addin for that (at least from what I can see). Finally, I could not find anything on this forum. Any Suggestions

  7. #7
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Oh, forgot to mention this is a new thing in XP.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  8. #8
    New Member
    Join Date
    Feb 2002
    Location
    Robert P. Wagner
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    I do have xp.. how do I get to it under xp

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com