Audio Triggering + Mouse Event latency
rene.micout at numericable.com
Tue Nov 16 04:26:25 EST 2010
I just returned from a trip and I discovered the discussion. For months (years...) I work on this problem and the best solution I've found in terms of responsiveness is to use PlayCommand Agent X (see Jacqueline web site for that) which controls the QuickTime synthesizer via AppleScript. I have a (Mac) prototype in progress (for iPad in final) called "Exapad" which is based on the principles you have mentioned and which uses "MouseDown" to start the sound and "MouseUp" to stop it. Hare are scripts extremely simplified (because in application chords can be played and arpeggiated) :
global vgVolumeGénéral,vgTimbre -- settings with slider and menu
hsJouerNotes the cpNoteBase of the target -- custom property of the note or sound (target = image or button)
hsArrêtNotes the cpNoteBase of the target
private command hsJouerNotes vpFondam
private command hsArrêtNotes vpFondam
command SBstartNote vpI,vpP,vpV
do ("tell application"&"e& "PlayCommand Agent X" "e && "to" && "play note instrument" && quote & vpI & quote && "pitch" && vpP && "velocity" && vpV) as AppleScript
command SBstopNote vpI,vpP
do ("tell application" && quote & "PlayCommand Agent X" & quote && "to" && "play note instrument"&& quote & vpI & quote && "pitch" && vpP && "velocity" && 0) as AppleScript
No latency. Percussion sounds possible...
I stop because I have no more place...
Bon souvenir de Paris
Le 16 nov. 2010 à 05:59, Anthony Howe a écrit :
> Hiya Folks,
> Further to our recent emails on this...
> I've now just implemented the same functionality using keyboard on keyDown events for each sound instead of the mouseDown event with startling (positive) results. (thanks Jacqueline for suggestion!)
> It seems that the keyDown event arrives into LC much faster than a mouseDown event does for the purpose of triggering audio on a real time basis. Slightly less responsive on WinXP, but fantastic on OSX.
> I've even been able to nest the keyDown handler at the card level and run a conditional before triggering the sound in order to get the right one, without affecting playback too much.
> Whilst this is still not an ideal UI position to be in, and will limit the features we can provide onscreen, at least it's clearer that the issue probably revolves around considerable internal latency with capture of the mouseDown event, in comparison to its 'keyDown' counterpart.
> If there's any way of tweaking the mouseDown event speed into LC, (assuming that IS actually the problem) it'd be great to provide this dual benefit to our users.
> Looks like we may be able to avoid the flash/swf implementation by using keyboard events directly into LC though.... so a solution seems close.
> Any thoughts based on that discovery folks?
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode