SoundTrack an AS3 Sound Helper Class – taterboy
January 4th, 2011 | Filed under: ActionScript 3, Audio, Flash, Flex, Free Components/Classes, Games, Tutorials

Working on games and other projects that include many audio streams and sound effects can require a fair amount of code to manage the numerous channels and soundTransforms. This helper class started as a way to provide simple pause, play, stop and resume controls without all the channel mess. Another requirement was to make adjusting the volume and panning easier, maybe even allowing the use of existing tween engines to fade volume which was achieved by using volume as a property, instead of a method or SoundTransform.

Volume and Panning:

?View Code ACTIONSCRIPT
soundTrack.volume = 0; //(Number 0 - 1)
 
soundTrack.pan = -1; //(Number -1 - 1)

Tween engine sample using GTween:

?View Code ACTIONSCRIPT
var tween:GTween = new GTween(soundTrack,2,{volume:0});

note: GTween by Grant Skinner can be found here: http://gskinner.com/libraries/gtween/

Once a sound object is created, it can be place into a SoundTrack.

How to use:

?View Code ACTIONSCRIPT
//create a new sound and soundTrack
var audioFile:Sound = new Sound(new URLRequest("audio.mp3"));
var soundTrack = new SoundTrack(audioFile);

Read More »

Technorati Tags: , , , , , , , ,

| 2 Comments »

Hidden Marvels in Flash: Gapless MP3s – taterboy
September 11th, 2010 | Filed under: Audio, Flash, Flex, Games, Tutorials

Gapless MP3s

Ever try to loop an mp3 file in Flash or Flex? It can be done, but there’s normally an annoying gap every time the audio loops. This gap is just a part of mp3 compression and there’s nothing that can be done about it.

Example:
Take an aiff or wave file, open it in your favorite sound editor and make a loop (remove all gaps at the beginning and end of the file). Now save the file, first as an aif or wave, then as an mp3. Now close the files and reopen them. Notice the mp3 file has a gap at the beginning and end of the waveform, the wave and aiff files do not.



Read More »

Technorati Tags: , , , , , , , ,

| No Comments »

A Microphone And A Baby – Flash AS3 Microphone Class – taterboy
May 21st, 2010 | Filed under: ActionScript 3, Audio, Flex, Tips

Here is a little demo from some recent playing with Flash’s Microphone class.



Real demo is below the fold.

This is basically a microphone level meter that my son and I thought was pretty fun. Don’t wake the baby.
Read More »

Technorati Tags: , , , , , ,

| 6 Comments »

Augmented Reality Sound Mixer Demo – taterboy
October 8th, 2009 | Filed under: ActionScript 3, Audio, Flash, Flex

Here is one of the demos we built recently to show some possible uses of Augmented Reality and Flex. This demo uses the FlarToolKit to detect the instrument patterns and place a 3D plane on screen with Papervision 3D. For the main mixer we use mp3s and 2D animations to show the different audio tracks. 3D is the future, but for now the low polygon count does not stand up to fully illustrated 2D graphics yet. We are using the FlarToolKit more as an input device to turn on and off audio tracks and to change the volume.

The Possibilities:
This sample is just a seed for the possibilities of future technology in live performances, not tied to a computer, how different patterns could create cues for video, audio, lighting and effects. The sample also shows how layering different symbols in different order can change the dynamic of the user experience.

To use this demo you will have to print and cut out the markers from this PDF file.

Included Symbols:
Drum Track
Bass Track
Horn Track
Guitar Track
Volume Fader
Eject (not used)

Note: Make sure you have plenty of black ink, use mat paper or card stock for best results. Depending on the lighting and what is behind you may have to put a piece of white paper behind the marker to force the webcams contrast higher.


click below to launch

To start Jamming, show a track marker to your webcam to display or remove an audio track. You can use the Volume marker to lower the sound to 20% or raise it back to 100%. The first time a marker is shown to the camera, it adds a track or lowers the volume. If you show a marker to the camera again, the previous action from that marker will reverse.

Note: In our demo we start with the drum and bass tracks to build a good rhythm, then add the horn. It sounds OK. Then remove the horn and add the guitar lead. The horn and guitar are both lead tracks and were not really meant to play at the same time, but this is about expression so there are no rules.

Enjoy.

Technorati Tags: , , , , , ,

| No Comments »