Changing the volume of a .wav file in VB6

Posted on 2006-04-10
Last Modified: 2008-03-17
I am using this code to play a .wav file in VB6:
This worked for me...notice I'm using PlaySound()...not sndPlaySound()...

Option Explicit

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_PURGE = &H40

Private Sub Command1_Click()
    PlayWav "C:\Documents and Settings\Michael\My Documents\007.wav"
End Sub

Private Sub Command2_Click()
End Sub

Private Sub PlayWav(ByVal fileName As String)
    PlaySound fileName, ByVal 0&, SND_ASYNC Or SND_NODEFAULT
End Sub

Private Sub StopWav()
    PlaySound vbNullString, ByVal 0&, SND_PURGE
End Sub

How do I go about being able to change the volume of the wav file as it's being played?
Question by:dtucker
    1 Comment
    LVL 9

    Accepted Solution

    you cannot change the volume for a single file but instead you could chnage it for the os or change the tempo or pitch of the wav file

    you can further get some help from this link

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    VBA Code Error 3 54
    use like in If/Then vba 4 44
    VBA color chart bars 12 51
    VBA open file from excel cell 4 29
    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now