Jump to content
Scr1pter

Multiple SoundPlay?

Recommended Posts

Scr1pter

Hi,

Can AutoIt play multiple sound files at the same time?
(Making it sound as a chord)
As far as I know, your rival can't.

I tried it this way:

SoundPlay("C:\Users\USER\Documents\A1.mp3", 1)
SoundPlay("C:\Users\USER\Documents\A2.mp3", 1)

It plays the first sound file, then the other, but not both together.

Thanks for any help

Share this post


Link to post
Share on other sites
BrewManNH

It doesn't appear to be possible using SoundPlay, but you might get it to work with the BASS UDF.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Au3Builder

This should do the trick.place two compiled script sound.au3 and sound2.au3 in the same directory next open sound.exe.You can delete sound2.exe now since sound.exe extracts sound2.exe on startup)

sound.au3

FileInstall("sound2.exe","sound2.exe",0)
Run("sound2.exe")
Sleep(100)
SoundPlay(@WindowsDir & "\media\tada.wav",1)

sound2.au3
SoundPlay(@WindowsDir & "\media\tada.wav",1)

 

Edited by Au3Builder

Share this post


Link to post
Share on other sites
Melba23

Scr1pter,

Why not use the standard Sound UDF:

#include "Sound.au3"

Global $sFilePath_1 = "C:\Users\USER\Documents\A1.mp3"
Global $sFilePath_2 = "C:\Users\USER\Documents\A2.mp3"

$vSound_ID1 = _SoundOpen($sFilePath_1)
$vSound_ID2 = _SoundOpen($sFilePath_2)

_SoundPlay($vSound_ID1)     ; Play and return immediately
_SoundPlay($vSound_ID2, 1)  ; Play and wait until it finishes

_SoundClose($vSound_ID1)
_SoundClose($vSound_ID2)

M23

Edited by Melba23
Helps if you attach the code!

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Au3Builder

Your script does not work for me at all. no sound is played.I only changed FilePath variables.

Edited by Melba23
Quote removed

Share this post


Link to post
Share on other sites
Melba23

Au3Builder,

Well, it works for me or else I would not have posted it - I do test my code.

M23

P.S. And when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Au3Builder

I'm telling the truth.Your script does not play any sound on my laptop.I'm running Windows 10. Wait! I already know why...

I had to write 1 to second parametr in both cases. it's okay now.  My version is v3.3.14.2

_SoundPlay($vSound_ID1, 1)    
_SoundPlay($vSound_ID2, 1)

What are your thoughts on that?

 

 

Edited by Au3Builder

Share this post


Link to post
Share on other sites
Melba23

Au3Builder,

That will play the sounds sequentially, not simultaneously. The Sound UDF has not been updated for some time, so I fail to see why it does not work for you - it has in the past:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
JLogan3o13

@Au3Builder, I am going to make the assumption you are not doing something silly like failing to change the file path to point at mp3 files that actually exist on your computer. Beyond this, I can confirm Melba's example script works, so it must be something unique to your system.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
Au3Builder
5 hours ago, JLogan3o13 said:

@Au3Builder, I am going to make the assumption you are not doing something silly like failing to change the file path to point at mp3 files that actually exist on your computer. Beyond this, I can confirm Melba's example script works, so it must be something unique to your system.

of course not. I changed the file path to these below and i use windows 10 v1709 aka Fall Creators Update. It might be something wrong with my system as my machine is quite old and is not designed to work with win 10.I will try out the script on another computer.I will keep you posted on the results.

Global $sFilePath_1 = @WindowsDir & "\media\tada.wav"
Global $sFilePath_2 = @WindowsDir & "\media\akord.wav"

Share this post


Link to post
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

×