feedback

Introduction

What is Sonoport?

Sonoport is a dynamic sound library that provides code-generated sounds and tools to manipulate mp3s. It aims to provide easy and quick way to add sounds and encourages developers to think of creative ways to ‘sonify’ their projects by using its dynamic sound library.

You can use the dynamic generated sounds as it-is in your projects by just tweaking several parameters.

Pre-requisites

This manual assumes basic knowledge of ActionScript 3.0 and mathematics required to program motions in animation. You do not need to have any knowledge of sound generating algorithms. You may consult Google or Wikipedia on topics on how to do animation in ActionScript 3.0 if you are unfamiliar with it. A book by Keith Peters, “Foundation ActionScript 3.0 Animation: Making Things Move!” will be a good starting point.

All you need is a good sense of sound usage and unlimited creativity to get going.

About Dynamic Sound

Basic concepts

Instead of the static nature of just playing and repeating a same sound file for an animated movement in Flash. It is a tedious process to make the sound dynamic in Flash as substantial knowledge of sound generation algorithms is needed. Hence, we intend to make usage of dynamic sound as easy as possible.

Sound mapping

Involves some calculation of the rate of change of the object that is moving on the stage and mapping it to the sound properties

Sound model

Refers to a sound generated by pure code or code+mp3.
Each sound model has a list of unique properties which is tied to a specific sound effect. Each parameter has its own set of range of values e.g. (0 to 1) where you can reset to produce the kind of effect you need.

Action sounds

Sounds produce by a "shake" movement or known as "shaker" sound.
These require either values from the distance of the user "shaking" the mouse or an animation of an object shaking.

Ambience sounds

Sounds that play for an indefinite period of time with no fixed duration until it is called to be stop playing.

Impact sounds

These sounds have a fixed playing duration. Playing of such sounds is usually called during an event of user input to trigger an event or a collision hit between two objects.

Universal sound properties – Gain and Pan

All the sound models in the Sonoport Collection library including the MP3 manipulation tools all have gain and pan as part of their properties. By default, the gain property is set to 0.7 and has a range from 0 to 1. The pan property is set to 0, and has a range from -1 to 1.

Previewing sounds from the Sonoport Player

You can hear all of the shipping sounds and test out the MP3 manipulation tools via the Sonoport Player.

It is encouraged for you to listen and play with the properties of each sound so that you can get familiarize with SonoportCollection1 libray.

Maximum and minimum values of each sound’s properties

You can find out the maximum and minimum values of each sound’s properties from the Sonoport Player. When you click reset in the player, it will display the default values being defined in each of the sound models.

You do not need to write any code to limit the values you pass to the sound’s properties. It will limit the values for you when your values that you have passed exceed the maximum/minimum ranges of values.

Installation

Installing the Sonoport component MXP library

Read Installation for Flash for more information.

Installing the SonoportCollection1 SDK
  1. Download the Sonoport SDK package.
  2. Put SonoportCollection1.swc in the same project folder that you are working or another folder where the external libraries are placed.
  3. Add the SWC to the library path of the your project in either Flash IDE or Flex/Flash Builder.

For adding library path for Flex/Flash Builder, read Installation for Flex.

Declaring a sound tutorial

Declaring a sound model object

Each sound model is a class on it own so it can be called by importing the SonoportCollection1 library into your project.

import com.sonoport.*;

Create an instance of the sound model class by declaring a new class object.

import com.sonoport.SpaceShipAmbience;

var _spaceShipSnd:SpaceShipAmbience = new SpaceShipAmbience();

Playing a sound

A sound model will normally play a sound after calling the function play(). Make sure your speakers are on and not on mute.

_spaceShipSnd.play();

You will hear a sound after your have compiled and run your program.

Setting sound parameters

Each of the sound models has it own unique parameters and each parameter already has its own default value programmed when it is being created. You are strongly encouraged to reset the default values of these parameters to suit the mood of the project you are working on.

Find out the default value by tracing the parameter.

trace(_spaceShipSnd.clarity); // returns 0.5

Resetting the default value.

_spaceShipSnd.clarity = 0.3;

You can also find out the default set values, maximum and minimum values of each parameters of one sound model in the Sonoport Player.

/** 
 * Example code listing all the properties of SpaceShipAmbience and
 * resetting it with some values. 
 **/
_spaceShipSnd.gain = 1.0;
_spaceShipSnd.pan = 0;
_spaceShipSnd.speed = 3;
_spaceShipSnd.clarity = 0.6;

Stopping a sound

When you need to stop or mute the sound, you can called the function stop() or hardStop().

_ambientRing.stop() will gradually stop sound will a slight fade out;
_ambientRing.hardStop() will stop the sound abruptly without any fade out.

Sound mapping

Mapping sound variables to animated movements

In order to use dynamic sound in animated movements, you will need to write some code to sync the movement to the sound.

Each of the properties of the sound is tied to range of values where you can define to sound to play from and to.

Taking the example of the alien demo, you can create the dynamic panning of the sound from left to right by defining this formula as below.

// Dynamic panning
// Pan the sound left and right
var pan:Number = (_alien.x - wSWF/2)/(wSWF/2);
_spaceShipSnd.pan = pan;

This code will make SpaceShipAmbience to pan from left to right as the alien moves in the same direction.

You can also use a Tweening engine such as TweenLite/TweenMax from greensock to as a quick way to ‘tween’ your sounds if deriving a formula takes a bit too much time.

MP3 Manipulation

About

Tools that allow the use of a sound file (e.g. mp3) as a source file and based on it to create different sound effects.

They are done using sample based sound manipulation to create different effects. Detailed technical information is not discussed in this manual; as such knowledge is not needed in order to use these tools. You can read up more about this by searching through Google and Wikipedia.

Usage of these tools is similar to the sound models in terms of playing and stopping.
Note: as these tools need an mp3 sound file as a base, it will not play any sound if an audio file is undefined.

How to choose a sound sample

The sound file format for the tools to work need to be in MP3 format, 44.1khz, mono/stereo and any bitrates from 8 to 320kbps.

For AudioStretch and Extender, it is advisable for you to choose a sound file longer than 10 seconds. It can be a normal music or song file that usually runs for (~4 minutes).

For Scrubber, ScrubberPitchLock, Trigger and TriggerRepeat, choose a sound effect file that is less than 8 seconds. Preferably, a 2 to 5 seconds sound file should suffice.

Latest update: 16th September 2011