b.sc. multimedia computingmultimedia authoring user interface and multimedia

16
B.Sc. Multimedia Computing Multimedia Authoring User Interface and Multimedia

Post on 22-Dec-2015

238 views

Category:

Documents


0 download

TRANSCRIPT

B.Sc. Multimedia ComputingMultimedia Authoring

User Interface and Multimedia

Agenda

Using Artwork as MovieClips Using and Controlling Sound

B.Sc. Multimedia ComputingMultimedia Authoring

B.Sc. Multimedia ComputingMultimedia Authoring

B.Sc. Multimedia ComputingMultimedia Authoring

Flash Interface Showing Scenario and Related Library Assets

Audio Sound Characteristics Audio samples in specific format Resolution (bits), sample rate (hertz), mono or stereo

More bits, higher sample rate and stereo is best

Compact Disc ‘Red Book Audio’ is = 44100 samples/s × 16 bit / sample × 2 channels

Balance between sound quality and file size Low quality sound easily identified by listener - as compared with low quality visuals - e.g video - viewer more forgiving of lower quality visuals than sound

Popular Sound Formats

Sound formats include .wav, .aif, .mp3,

.wav - (Waveform Audio Format) Lossless uncompressed format best for retaining ‘first generation’ high quality audio sound libraries.

Acquiring, Editing and Creating Sound

Websites see e.g www.pacdv.com Get sound from genre specific or tribute sites

Purchase CD library material (BBC sound archives)

Create you own with audio software

Usually need to edit and compress to use in multimedia scenario

Sound with ActionScript 3.0

Supports sound for audio with the Sound class SoundChannel class and SoundTransform class

Embedded audio and external audio Embedded audio includes many of the popular formats .wav, .aif

External audio must be in the .mp3 format The Sound class provides the facilitates for loading and playing audio.

An audio instance may be modified by accessing properties via the SoundTransform class to modify left and right volume levels and pause playback. Supports up to 32 simultaneous channels

Sound with ActionScript 3.0

// set up buttonsbutton1.addEventListener(MouseEvent.CLICK, playLibrarySound);button2.addEventListener(MouseEvent.CLICK, playExternalSound);

// load external sound so it is readyvar soundTwo:Sound = new Sound();var externalSoundFile:URLRequest = new URLRequest("PlayingSounds.mp3");soundTwo.load(externalSoundFile);

// function to play the library soundfunction playLibrarySound(event:Event) {

var soundOne:SoundOne = new SoundOne();var channel:SoundChannel = soundOne.play();

}

// function to play the external soundfunction playExternalSound(event:Event) {

soundTwo.play();}

Adjusting Sound Volume// load external sound file into a sound objectvar aSound:Sound = new Sound(new URLRequest(song.mp3));

// create a sound channel based on the loaded soundvar soundChannelOne:SoundChannel = aSound.play();

//create a sound channel transform (adjuster)var channelOneControl:SoundTransform = new SoundTransform();

// use the transform to adjust volume levelchannelOneControl.volume = .5 // (0-1);

// assign this adjustment to the sound channel associated with song.mp3soundChannelOne.soundTransform = channelOneControl;

What a Mission!

Techniques for Managing Sound in Games

Load audio into an array and play random sounds for events to add variety

Implement the notion of spatialized sound by increasing / decreasing the volume as objects change their proximity to each other

// create five sound variablesvar soundOne:Sound = new Sound();var soundTwo:Sound = new Sound();var soundThree:Sound = new Sound();var soundFour:Sound = new Sound();var soundFive:Sound = new Sound();

// create variables for the external audio filesvar externalSoundFile1:URLRequest = new URLRequest("./mp3/prime_two_thrown.mp3");var externalSoundFile2:URLRequest = new URLRequest("./mp3/prime_three_thrown.mp3");var externalSoundFile3:URLRequest = new URLRequest("./mp3/prime_five_thrown.mp3");var externalSoundFile4:URLRequest = new URLRequest("./mp3/prime_seven_thrown.mp3");var externalSoundFile5:URLRequest = new URLRequest("./mp3/prime_eleven_thrown.mp3");

//load the external audio into the sound variablessoundOne.load(externalSoundFile1);soundTwo.load(externalSoundFile2);soundThree.load(externalSoundFile3);soundFour.load(externalSoundFile4);soundFive.load(externalSoundFile5);

Declaring Sound Objects and Loading External Sounds (.mp3)

var soundOn:Boolean = false // disable sound by default

// add event listener to interface CheckBox componentsoundCheckBox.addEventListener(MouseEvent.CLICK, switchSound)

// function to toggle sound on or off depending on current state of CheckBox

function switchSound(Event:MouseEvent){if (!soundOn){

soundOn = true}else{

soundOn = false}

};

if (soundOn){ // if the sound is enabled process this clause

switch (diceThrow) {

case 2:soundOne.play();winAmount = 2 * stake;trace('You have won ' + winAmount);break;case 3:soundTwo.play();winAmount = 3 * stake;trace('You have won ' + winAmount);break;case 5:soundThree.play();winAmount = 5 * stake;trace('You have won ' + winAmount);break;case 7:soundFour.play();winAmount = 7 * stake;trace('You have won ' + winAmount);break;case 11: soundFive.play();winAmount = 11 * stake;trace('You have won ' + winAmount);break;

default: trace("No Score");}

}

// sound not enabled so process else clause

else {

switch (diceThrow) {

case 2:winAmount = 2 * stake;trace('You have won ' + winAmount);break;case 3:winAmount = 3 * stake;trace('You have won ' + winAmount);break;case 5:winAmount = 5 * stake;trace('You have won ' + winAmount);break;case 7:winAmount = 7 * stake;trace('You have won ' + winAmount);break;case 11:winAmount = 11 * stake;trace('You have won ' + winAmount);break;

default: trace("No Score");}

}

Sound Editors SoundForge http://www.sonycreativesoftware.com/

(PC only) the best Steinberg Wavelab http://www.steinberg.net/

lines up with Soundforge Audacity http://audacity.sourceforge.net/

cross platform open source new release (beta) now available Excellent support for wide range of audio formats and encoding into .mp3 ( need lame encoder)