|
Documentation
Usage Guide.
IntroductionThe plugin wraps around the jsfx (https://github.com/egonelbre/jsfx) tone generator library. Sound samples are stored as JavaScript arrays of parameters that the generator uses to produce WAVs. This plugin allows loading of these sound samples into a webpage so that the page's elements can be enriched with sound. DetailsInstallationgrails install-plugin grails-js-sound-fx-0.1.zip ConfigurationDuring installation of the plugin, a file called audioSampleLibrary.js will be created under web-app/js This contains some example sound samples organised in 'collections'. You can use the Demo page at http://www.egonelbre.com/js/jsfx/ to generate more sounds and copy+paste them into this file. UsageIn your GSP you first need to include the javascript resources: <jsfx:includes/> This will also load the default collection called defaultAudioSamples. To load any other collection: <jsfx:loadCollection collection="beeps"/> You can initiate the sound to play using: <jsfx:play sound="test"/> or if in non-default collection: <jsfx:play sound="beep" collection="beeps"/> You can create a link that will play a sound on click: <jsfx:createLink sound="whirr" collection="whirrs">Click me</jsfx:createLink> or you could create a 'zone' that plays a sound when the mouse hovers over it: <jsfx:soundZone sound="test">
<div style="border: 1px solid red; width: 10em;">
<h2>Hover over this</h2>
</div>
</jsfx:soundZone>
|