Link to home
Start Free TrialLog in
Avatar of LovinSpoonful
LovinSpoonful

asked on

.wav files play too fast, high pitched

VB6, Win2000.  I don't know when / how this happened but Windows Media Player and my VB applications now all play .wav files too fast, and they are pitch-shifted up too.  this is very annoying.  i have the latest Windows Media Player.

It may have happened when I added a media control to my program:
      frm.MMControl1.Command = "close"
      SoundName = "d:\Rise.wav"
      frm.MMControl1.Silent = False
      frm.MMControl1.FileName = SoundName
      frm.MMControl1.DeviceType = "WaveAudio"
      frm.MMControl1.Command = "open"
      frm.MMControl1.Notify = True
      frm.MMControl1.Wait = False
      frm.MMControl1.Command = "play"

the only other thing that I use to run sounds is, I have this function in my global variables module:

Declare Function sndPlaySound Lib "WINMM.DLL" Alias _
   "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
   Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10
     
then i use this:

 
Public Sub SoundTheAlarm()

   'play a sound indicating the connection is lost
      SoundName = "d:\Alarm.wav"
      Dim x%
      x% = sndPlaySound(SoundName, SND_ASYNC)

End Sub

Can anyone tell me why my computer plays all sounds with too high of a pitch, and too fast?

Avatar of vb_elmar
vb_elmar
Flag of Germany image

With the sample below you can choose any speed you want.
(e.g. speed x 1.11 or speed x 0.97),

MediaPlayer control:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Project\Components\Windows Media Player


Form1:
____________________

Dim add#
Private Sub Command1_Click()
add = add + 0.2: MediaPlayer1.Rate = add
MediaPlayer1.Rate = add
Command1.Caption = MediaPlayer1.Rate
End Sub

Private Sub Command2_Click()
add = add - 0.2: MediaPlayer1.Rate = add
Command1.Caption = MediaPlayer1.Rate
End Sub

Private Sub Form_Load()
Command1.Caption = "Faster"
Command2.Caption = "Slower"
add = MediaPlayer1.Rate
MediaPlayer1.FileName = "D:\As.mp3"
End Sub
Avatar of LovinSpoonful
LovinSpoonful

ASKER

I do not have an object called MediaPlayer in my program.
the multi-media control does not have an attribute called rate.  help!
Didnt you find the MediaPlayer control under:
Project\Components\Windows Media Player?

Normal the WMP conrol is available in each VB installation.

It uses the ocx:
C:\Windows\system\MSDXM.OCX
I added a Windows Media Player control to my form and tried:

      frmRealTimeData.WindowsMediaPlayer1.Rate = 1

i get this error:
object doesn't support this property or method
Download Media Player Control (334 kB)

http://www.martin2k.co.uk/vb6/ocxs/msdxm.zip
In the properties window - does your mediaplayer have the method "Rate"?

Image:
=====
http://www.directupload.net/images/050111/4rt27eoE.jpg
>> frmRealTimeData.WindowsMediaPlayer1.Rate = 1

change
frmRealTimeData.WindowsMediaPlayer1.Rate = 1

to
frmRealTimeData.MediaPlayer1.Rate = 1
no, it doesn't have rate.  this is so confusing.  
I do have msdxm.ocx dated 9/17/2003 in my \winnt\system32\ folder, but I can't find it in project:components
 
when I change to

     frmRealTimeData.MediaPlayer1.Rate = 1

it says method not found.  the object is called WindowsMediaPlayer1.
i wish I could find the msdxm.ocx in my list of project:components.  what is its exact name in the list again?
can you send me a screenshot of your VB IDE with this component listed?
thanks for your help
My version is 6.4.07.1121  (size  849.680 kB) from OCT 3. 2004

Maybe you need a newer version.
hold on a second.  i used the browse button to add it to my list.  cool.   now i just have to try your code above....
ASKER CERTIFIED SOLUTION
Avatar of vb_elmar
vb_elmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This works great.  I can set the rate to .9 and in VB my .wav's play correctly now.   It doesn't solve the main problem though, which is, Windows media player still plays things too fast.  It must be some kind of system problem.  but if i want to listen to an Internet radio, it still plays everything too fast, and high pitched.  any ideas?
I think that it is some kind of system problem too.