Attract-Mode Support Forum

Attract-Mode Support => General => Topic started by: matchiz on November 23, 2020, 03:11:58 PM

Title: Background (Ambient) Music Sounds Random Selection ?
Post by: matchiz on November 23, 2020, 03:11:58 PM

I have searched through this forum and have come to a dead end. I am hoping to either find a script or an option to enable that will allow attract mode to choose from a folder of music options.

I know there is an option of choosing a single audio file, but I would like that single audio file to be random.
Title: Re: Background (Ambient) Music Sounds Random Selection ?
Post by: hermine.potter on November 25, 2020, 03:26:47 AM
the problem is, that attract.exe blocks that file.
so you can't change it on the fly, if attract.exe is running (idea was to change that file after a few seconds via external software (batch, autoit, AHK,.. in background/besides attract)

I don't have a attractmode integrated solution.
but this quick and dirty solution via external software like autoit:

start this autoit script along with attract.exe:
Code: [Select]
#include <file.au3>

while 1

$sourceFolder = "C:\attract\sounds"
$aFileList = _FileListToArray($sourceFolder, "*.mp3", 1)
$iRandom = Random(1,$aFileList[0],1)

If ProcessExists ("vlc.exe") Then

if ProcessExists ("mame.exe") Then

If ProcessExists ("notepad.exe") Then

run ('C:\Program Files\VideoLAN\VLC\vlc.exe --quiet --qt-start-minimized --play-and-exit ' & $sourceFolder & "\" & $aFileList[$iRandom] & ' vlc://quit')


-disable Windows Popup VLC Notification in vlc.exe : Here (
-script choose a random .mp3 file from a specific folder (here : C:\attract\sounds )
-when song ends, next random .mp3 starts
-sound playing stops, if Editor/notepad.exe or Mame/mame.exe starts