AutoHotkey Community

It is currently May 26th, 2012, 3:41 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: March 19th, 2009, 4:23 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 4:35 pm 
Offline

Joined: March 19th, 2009, 4:04 pm
Posts: 9
Should be possible with different streams on the BASS dll, at least that is my assumption after playing a little bit around with it.

BASS:
http://www.autohotkey.com/forum/viewtopic.php?t=37092


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2009, 9:25 pm 
I wrote a function in the Scripts & Functions section that did this.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 2:14 am 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 8:23 am 
[ 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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 2:15 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 4:09 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 8:20 pm 
blabla blablablalala
..and you still didn't bothered to read their respective features. automaticfail


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 10:01 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
:)
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AnywhereSoundPlayer
PostPosted: June 22nd, 2009, 11:43 am 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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!
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2009, 2:10 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2009, 10:16 am 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2009, 11:12 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2009, 8:30 am 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group