Jump to content

Playing 2 sounds at the same time with different Volumes


dost0011
 Share

Recommended Posts

Hi,

I have a really big problem:

I have to play 2 Sounds at the same time with different volumes.

The Volumes must be changeable.

I know, this is not a specific autoit Problem. But do anybody know, how to do this ?

Something like a DJ Studio ?

Many thanks !

Link to comment
Share on other sites

Uhmm, maybe try to download virtual dj, you go to piratebay, download there a torrent and open it with a torrent downloader (µtorrent maybe?)..than instal ur virtual dj and woops, you can play 2 tracks at a diffrent volume and you can mix it toghter en save it, and you can even putt some effects in it :) atomix virtual dj 5.2 is the newest

Let me know if the was helpfull

Link to comment
Share on other sites

Uhmm, maybe try to download virtual dj, you go to piratebay, download there a torrent and open it with a torrent downloader (µtorrent maybe?)..than instal ur virtual dj and woops, you can play 2 tracks at a diffrent volume and you can mix it toghter en save it, and you can even putt some effects in it >_< atomix virtual dj 5.2 is the newest

Let me know if the was helpfull

Hi,

of course you couldn't help me with this comment :)

I don't need virtual dj. I wrote a Halloween program, that creates at any time several sounds and I want to set the Volume for each "track" at running time (not mix it together offline)

Is there anybody out there, who knows how to do this ?

Thanks

Link to comment
Share on other sites

;===============================================================================


;===============================================================================

; include "wmp.au3"

Global $oPlayer1 = ObjCreate("WMPlayer.OCX")
Global $oPlayer2 = ObjCreate("WMPlayer.OCX")

$song1 = @ScriptDir & "\test1.mp3" ; requires full path name ...
$song2 = @ScriptDir & "\test2.mp3" ; requires full path name ...

$rc = WMLoadFile($oPlayer1, $song1)
MsgBox(0, "1 rc", $rc)

$rc = WMLoadFile($oPlayer2, $song2)
MsgBox(0, "2 rc", $rc)



$rc = WMGetDuration($oPlayer1);
MsgBox(0, "2 rc", $rc)

; turns the volume down and back up slowly... song 1
For $i = 100 To 0 Step - 1
    WMSetVolume($oPlayer1, $i)
    Sleep(10)
Next
For $i = 0 To 100
    WMSetVolume($oPlayer1, $i)
    Sleep(10)
Next

; turns the volume down and back up slowly... song2
For $i = 100 To 0 Step - 1
    WMSetVolume($oPlayer2, $i)
    Sleep(10)
Next
For $i = 0 To 100
    WMSetVolume($oPlayer2, $i)
    Sleep(10)
Next



MsgBox(0, "pause", "")

WMPause($oPlayer1)

Sleep(300)

MsgBox(0, "play", "")


$rc = WMGetPosition($oPlayer1)
MsgBox(0, "POS", $rc)


WMPlay($oPlayer1)

Sleep(3000)

MsgBox(0, "stop","")
WMStop($oPlayer1)
WMStop($oPlayer2)

exit ; ----------------------------


; some functions
Func WMLoadFile($wm_obj, $sFilename)
    $wm_obj.url = $sFilename
    While Not WMGetState($wm_obj) = "Playing"
        Sleep(100)
    WEnd
EndFunc   ;==>WMLoadFile

Func WMSetVolume($wm_obj, $iVol)
    ;iVol can be between 0 and 100
    $wm_obj.settings.volume = $iVol
EndFunc   ;==>WMSetVolume

Func WMFastForward($wm_obj)
    $wm_obj.controls.fastForward()
EndFunc   ;==>WMFastForward

Func WMReverse($wm_obj)
    $wm_obj.controls.fastReverse()
EndFunc   ;==>WMReverse

Func WMPause($wm_obj)
    $wm_obj.controls.pause()
EndFunc   ;==>WMPause

Func WMPlay($wm_obj)
    $wm_obj.controls.play()
EndFunc   ;==>WMPlay

Func WMStop($wm_obj)
    $wm_obj.controls.stop()
EndFunc   ;==>WMStop

Func WMGetPosition($wm_obj)
    local $pos
    $pos = $wm_obj.controls.currentPosition ()
    return $pos
EndFunc   ;==>WMGetPosition

Func WMGetDuration($wm_obj)
    Local $len
    $len = $wm_obj.currentMedia.duration
    Return $len

EndFunc   ;==>WMGetDuration



Func WMGetState($wm_obj)
    local $sStates = "Undefined,Stopped,Paused,Playing,ScanForward,ScanReverse,Buffering,"
    $sStates &= "Waiting,MediaEnded,Transitioning,Ready,Reconnecting"
    local $aStates = StringSplit($sStates, ",")
    $iState = $wm_obj.playState ()
    Return $aStates[$iState]
EndFunc   ;==>WMGetState

Link to comment
Share on other sites

  • 1 month later...

Next Problem:

Is there any possibility to change the Balance (Left channel/Right Channel) ONLY for this player ?

For example:

I have 2 Stereo Samples playing at the same Time. The User changes now Sample 1 to left channel und Sample 2 to Right Channel...

Many Thanks !

Link to comment
Share on other sites

Use the UDF that n3nE linked to.

_SoundPanLeft() and _SoundPanRight() is what you are looking for.

This won't help here I don't think.

Func WMSetBalance($wm_obj, $iBal)
 $wm_obj.settings.balance = $iBal 
 EndFunc
Edited by weaponx
Link to comment
Share on other sites

This won't help here I don't think.

Func WMSetBalance($wm_obj, $iBal)
 $wm_obj.settings.balance = $iBal 
 EndFunc
Depends on how you want to make it in the end.

If you wish to stay using the WMPlayer Object then your code is what should be used.

I just tried explaining what it was n3nE had linked to, and using the _Sound UDF is also a perfectly viable method. Of course you would need to rewrite the script with those functions instead of the WMPlayer Object ones.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...