| View previous topic :: View next topic |
| Author |
Message |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Thu Mar 19, 2009 3:23 pm Post subject: Playing multiple sounds parallelly or simultaneously |
|
|
Regarding sounds what I know AHK can do are:
1. Playing a normal sound in series with SoundPlay
2. Getting the sounds left and right channel levels with the help of FMOD.
What I am currently looking for is
3. How to play multiple sounds, e.g. 10 .wav files parallelly rather than in series as SoundPlay does?
Application areas could be similar things as SoundTorch minus all its visual gimmicks and extras. |
|
| Back to top |
|
 |
gregster
Joined: 19 Mar 2009 Posts: 9
|
|
| Back to top |
|
 |
Wicked - Guest Guest
|
Posted: Thu Mar 19, 2009 8:25 pm Post subject: |
|
|
| I wrote a function in the Scripts & Functions section that did this. |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Fri Mar 20, 2009 1:14 am Post subject: |
|
|
Wicked I found your posting and Trubbleguy's solution there seems to be the most powerful so far. The limit of 30 sounds at the same time is just o.k. but somehow I did not like the performance yet, I would prefer a much faster reacting solution if possible.
So maybe BASS library works better or FMOD? |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 20, 2009 7:23 am Post subject: |
|
|
[ BASS ]
Pros: low cpu usage (not as low as fmod, but the difference is negligible), beautiful sound quality, great .mo3 oggmod music format, crossplatform
Cons: none
[ FMOD ]
Pros: very low cpu usage, cross platform, excellent .oxm oggmod music format
Cons: sound quality isn't as good as other libraries, slight latency, compatibility issues.
[ GAudio ]
pros: great sound quality
cons: high cpu usage |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Fri Mar 20, 2009 1:15 pm Post subject: |
|
|
According to Guest BASS seems to be the best, especially having now also the BASS Library for AHK. Still featurewise I am not sure if BASS and FMOD can do theoretically all the same things to shorter sounds? I would define shorter sounds as sounds having a length between 0..4s,16bit,stereo,44.1kHz. Musicians would know that would be mainly sounds for sampler use. What I am thinking of here:
1. Mixing sounds in time dimension, meaning the later sound should not cut the previous sound, instead both should play until their sample length ends. As an example let us say 100 samples or sounds.
2. Giving each of these 100 sounds their own place between two (stereo) speakers using panorama parameter. Later maybe also what about 4 or 6 speakers?
3. Changing the volume of each sound. e.g. the sounds in the center could be mixed a little louder than the sounds in the sides, so you could hear still less sounds even if 100 sounds play at the same time. |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Fri Mar 20, 2009 3:09 pm Post subject: |
|
|
| automaticman wrote: | | Trubbleguy's solution there seems to be the most powerful so far. | I should correct myself, the most powerful variant on that page is the solution given by Lexikos. Trubbleguy's method is too slow. |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 20, 2009 7:20 pm Post subject: |
|
|
blabla blablablalala
..and you still didn't bothered to read their respective features. automaticfail |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Fri Mar 20, 2009 9:01 pm Post subject: |
|
|
Everything depends on the priority, so sharing these comments is the priority level for these thoughts. So you can relax again.
For a simple parallel playback Lexikos' solutions seems to be sufficient which is for me currently enough. |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Mon Jun 22, 2009 10:43 am Post subject: AnywhereSoundPlayer |
|
|
This is what I am using currently, which works here and hopefully also there without any problems. Some sound junkies might find this also useful...
AnywhereSoundPlayer.ahk
| Code: | ; plays anywhere a sound file, works in WinDirStat
; dependencies:
; 0. AutoHotkey, http://www.autohotkey.com
; 1. WinDirStat, http://windirstat.info
; how to use:
; - just open WinDirStat in a directory with lots of shorter .wav or .mp3 files and move your mouse
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance Ignore
SetTitleMatchMode, 2
GroupAdd, WinDirStat, WinDirStat
#IfWinActive, ahk_group WinDirStat
{
ReferenceMouseFile := GetStatusBarTextInWindirstat()
Loop
{
Sleep, 400
CurrentMouseFile := GetStatusBarTextInWindirstat()
if (CurrentMouseFile != ReferenceMouseFile)
{
PlaySoundIfOk(CurrentMouseFile)
ReferenceMouseFile := CurrentMouseFile
}
}
return
}
GetSelectedFileName()
{
DateiName =
AlterClipboardInhalt := ClipboardAll ; sichern des Inhaltes von Clipboard
Clipboard =
Send ^c ; Kopiert die Datei
ClipWait, 1 ; Warte auf neuen Inhalt im Clipboard
If (FileExist(ClipBoard)) ; Prüfen, ob es sich um eine existierende
{ ; Datei handelt
DateiName := ClipBoard ; Speichern des Namens zur weiteren Verarbeitung
}
ClipBoard := AlterClipboardInhalt ; Alten Inhalt des Clipboards wiederherstellen
Return DateiName
}
GetStatusBarTextInWindirstat()
{
SetTitleMatchMode, 2
StatusBarGetText, FileUnderMouse, 1, WinDirStat
return FileUnderMouse
}
PlaySound(SoundFile)
{
FileDelete, %A_ScriptDIR%\Sound1.AHK
FileAppend,
(
#NoTrayIcon
SoundPlay, %SoundFile%, Wait
), %A_ScriptDir%\Sound1.AHK
Run, %A_ScriptDIR%\Sound1.AHK
}
PlaySoundIfOk(SoundFile)
{
FileGetSize, SoundFileSize , %SoundFile%, K
SplitPath, SoundFile ,,,SoundFileExtension
if ((SoundFileExtension == "wav" || SoundFileExtension == "WAV") && SoundFileSize < 2000)
{
PlaySound(SoundFile)
}
if ((SoundFileExtension == "mp3" || SoundFileExtension == "MP3") && SoundFileSize < 200)
{
PlaySound(SoundFile)
}
if (SoundFileExtension != "wav" && SoundFileExtension != "mp3")
{
;MsgBox, Sorry, this is not an .mp3 or .wav file. Try another one!
}
} |
|
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Mon Sep 28, 2009 1:10 am Post subject: |
|
|
I know this topic is kinda old, but I found a DLL that is related to this issue.
The DLL and a fairly-easy-to-understand demo source are in this ZIP file, originally provided here.
After a quick look at the demo source, seems like the basic usage is:
1) Load library
2) ConfigureInit or Init (not sure), Activate, OpenChannel, OpenWave
3) Play
4) CloseChannel, FreeWave, CloseSession
5) Free library _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Mon Sep 28, 2009 9:16 am Post subject: |
|
|
Did you try the solution above, it just works using AutoHotkey only, without any additional .dll, also there is no limit to how many audio files can be played back simultaneously.
If any additional .dll's should be used there are powerful solutions like
1. bass.dll
2. fmod.dll |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Mon Sep 28, 2009 10:12 pm Post subject: |
|
|
I didn't really need to play simultaneous sounds and I know about the solutions provided previously. I just wanted to share this find. Also, the AnywhereSoundPlayer.ahk solution requires AutoHotkey installed, which may not be a desired solution if you wish to share your program(s). _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 642
|
Posted: Tue Sep 29, 2009 7:30 am Post subject: |
|
|
| MasterFocus wrote: | | Also, the AnywhereSoundPlayer.ahk solution requires AutoHotkey installed, which may not be a desired solution if you wish to share your program(s). | Yes, but it is also possible to compile .ahk programs to .exe versions, if you want it. Also installing AutoHotkey is maybe one of the best things a Windows user can do to herself.
Windows XP + AutoHotkey >> any ready OS system
>> means "much more powerful", "customized to the user to the maximum".
For those who prefer powerful control and customization of applications and bits installing AutoHotkey is not a bad idea. |
|
| Back to top |
|
 |
|