Page 1 of 2

pgSoundLoader() for dummies

PostPosted: Mon Oct 06, 2014 12:58 pm
by Robert Stevenson
I simply need the student to be able to click a wee button and play a 3 second .mp3 file. Could some one point me to a graphic that would show the AE setup for such a thing ... I don't want an audioplayer to show ... simply want to link to an .mp3 in a directory "audio".

Re: pgSoundLoader() for dummies

PostPosted: Mon Oct 06, 2014 3:22 pm
by Clifton
What you need in this scenario is to play your audio transparently. This means that you assign a url and a name to your audio, but the name parameter does not point to any object on the ToolBook page. This tells the function to assign the name to the audio so you can control it with pgSoundControl() if needed, but to only use this name as a reference in memory. In this case no controls will be visible to the user. They will just hear is the audio playing.

Here is a typical setup where clicking the button will play a sound transparently:

Image 1.png
Transparent Audio Playback
Image 1.png (77.01 KiB) Viewed 1386 times

NOTE: In this example, you will need to put all your sounds in a [sounds] directory and flag that folder for inclusion with the export of your book Using the DHTML Export Tree Manager (PowerPac menu > Add Folders to Export Tree). Inside the sounds folder on your hard drive you would place all your mp3 files.

The name parameter can be any name you choose. It can be left blank if you will never need to control the audio with pgSoundControl(). I recommend always assigning a name to keep track of things because you can use pgSoundLoader() to play multiple audio files at the same time (e.g.: background music with foreground voice over audio).

Re: pgSoundLoader() for dummies

PostPosted: Mon Oct 06, 2014 4:20 pm
by Robert Stevenson
Looks good. Once again ... I am rescued.

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 12:24 pm
by Robert Stevenson
I knew it couldn't be that easy. All I have in the "playmp3" button is the url_playList parameter of "...sounds/ammonium.mp3"
I have flagged the "sounds" folder to be included on export. When exported however I don't the file to play.

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 12:50 pm
by Clifton
You may need to put your export on a web server if your system security permission prevent playback of local sound files.
You can change this behavior by visiting this url:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

Make sure the settings look link this:

Image 3.png
Flash Player Security Setting for local file playback
Image 3.png (44.34 KiB) Viewed 1384 times

If the sound still doesn't play, check the exported content to ensure that your sound is really in the exported content AND in the location that the PowerPac is expecting it to be.

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 1:25 pm
by Robert Stevenson
I do in fact have it loaded to a server ... but will check the settings as well. Strange.

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 2:03 pm
by Clifton
Looking a little closer at your setup and noticed this is incorrect:
"...sounds/ammonium.mp3"
It should be:
"../sounds/ammonium.mp3"

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 2:16 pm
by Robert Stevenson
Sweet! And that did it!

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 9:00 pm
by Robert Stevenson
Curious if there is something unique about a multiple choice question object out of the catalog and applying audio feedback to the individual buttons ... for some reason I can't seem to get audio feedback working in these cases.

Re: pgSoundLoader() for dummies

PostPosted: Tue Oct 07, 2014 10:22 pm
by Clifton
You cannot use the audio feedback that is provided within ToolBook as it only accepts wav files.

In order to get this working you have to set actions for on question answered OR on question scored for the group of buttons. The answer parameter determines which item was chosen or you can use either name of target in the url_playList parameter or the keyword answer. I used the answer variation below.

Image 5.png
Image 5.png (47.12 KiB) Viewed 1380 times

Of course you have to have an audio file that corresponds to [answer].mp3