No announcement yet.

Question on wavs

  • Filter
  • Time
  • Show
Clear All
new posts

  • Question on wavs

    I found this in the forums for playing wav files. I was thrilled to hear a Cobra Mustang doing a burnout while my bitmapped tachometer climbed crazily through 8000 rpm! (with help from Perfect Sync's Grafix Tools. Love it)

    SUB PlayWave(BYVAL File$)
    LOCAL zWav AS ASCIIZ * 256
    zWav = File$
    CALL PlaySound(zWav, BYVAL NULL%, %SND_ASYNC)

    Anybody know how to let a wav file play, but in the middle of it, suddenly change the sampling rate without starting the wav over again? Would love to take a 2 or 3 second sound clip of an engine at a constant speed and change the sampling rate repeatedly while it's playing, to make the tone gradually change up and down. Is this possible? Flightsim 98 does this, I think. I'm new to the wav thing, so please, be gentle!
    Praying hard, Todd
    P.S. Would Charles Petzold's book have answers to this kind of thing?

    [This message has been edited by Todd Wasson (edited February 04, 2000).]
    Todd Wasson
    PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:

  • #2
    To accomplish this, you'll probably need to access the low-level multimedia API's directly, such as the MCIxxxxxx API's. Check out MSDN and search for "Win32 Multimedia Programmer's Reference" or related phrases.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


    • #3
      I've been looking through the forums myself to find code for playing
      MP3's/WAV's. My questions are: when using MCISendString() and
      PlaySound(), is there any way to stop them from playing the sound
      files before they're at the end of the files? Will both functions
      play both MP3's and WAV's?

      I run a TriBBS 11.3 BBS system (16-bit DOS-based system), and
      for sysops running multinode setups under a multitasker (i.e.,
      32-bit Windows), I want to write a 32-bit EXE that will be a
      replacement for the sysop pager, and I want it to include the
      ability to play MP3's/WAV's for the sysop notification alert.
      Well, the sysops who use my program would probably be VERY
      annoyed if a whole 3- or 4-minute song played, when the normal
      sysop pager alert is 30 seconds in duration. 'Course, I *could*
      say in my docs to make SURE that the source sound files are no
      longer than 30 seconds in duration. But, still, I'd like to
      have the option.



      • #4
        Disregard my last reply. I found most of the answers I needed by
        looking through the other topics on the subject. The answers I
        didn't find, I'm sure I can figure out myself via empirical



        • #5
          The sndPlaySound() API provides a way to halt playback... check it out at

          From memory, it goes somthing like:
          CALL SndPlaySound(BYVAL %NULL, %NULL)
          Note that the sound would need to have been asynchronously played with the %SND_ASYNC parameter.

          MciSendString also provides a STOP clause if I remember correctly. Search the BBS for "mcisendstring" and you should locate some discussions on this.

          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          mailto:[email protected]


          • #6
            todd --

            you can find what you want in petzold. you have to play the wav
            the hard way (using the waveout-api). for an example of wavout
            see forums/forum7/html/000446.html.
            i think i have an example of playing a wav-file (the hard way) somewhere.
            please mail me if you want me to look for it.




            • #7
              Todd,Try the unlimited opportunities =dsound= (DirectSound).

              -- Vladimir

              Spherical Panorama Inc. Virtual Reality for: Real Estate, Tourism Advertisment.


              • #8
                Vladimir and Peter,

                I abandoned the sound issues quite some time ago and have
                been developing a more complex physics engine for video game/simulation
                use. When the time is right for my own sim, FastGraph and DirectX
                may be the way to go. I've been reading up on DirectX and it doesn't seem
                quite the monster many folks have made it out to be, but of course,
                I haven't written anything with it yet. That'll have to be a
                VC++ thing (I'm MUCH better with PowerBasic, so that puts things in
                perspective). I do have DirectDraw for PowerBasic and have played
                a bit with that, but I don't know anybody that has converted the
                DirectSound, Direct3D, etc., headers to PowerBasic yet. Perhaps
                FastGraph 6.0 includes this? For now, I'm going with no sound and
                wrote a GUI based wireframe 3-D engine to test with. DirectSound
                will be my route eventually, although it would be nice to know how
                the low level functions work also.

                Getting closer...

                Todd Wasson
                Performance Simulations
                Drag Racing and Top Speed Prediction Software http://PerformanceSimulations.Com


                [This message has been edited by Todd Wasson (edited August 17, 2000).]
                Todd Wasson
                PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http: