Array

Playing Back Audio

Must Read

College Loan Repayment – The Help You Need

People know how education is important and most people aim for that. People have a goal in life one...

Refinance Home Mortgage Loan – Locking in a Low Rate

When you're shopping for a new refinance mortgage, it's important to find and secure the lowest interest rate possible....

What You Need to Know When You Refinance a Home Loan

Are you thinking about refinancing your home loan? Do you have nagging bills that you want to get paid?...
Admin
test

Create a sound object and a listener to read the samples stored in ByteArray. You must set the position on the first bytes to rewind to the beginning of the recording.

Audio data is made of samples; 8,192 samples is the maximum amount of data that can be written to a sound at one time. If you try to play more samples, you will get a runtime error. If you provide fewer than 2,048 samples, the application will assume the sound reached its end and will stop:

import flash.media.Sound;
if (bytes.length > 0) {
bytes.position = 0;
var sound:Sound = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playback);
sound.play();
}
function playback(event:SampleDataEvent):void {
var sample:Number;
for (var i:int = 0; i < 8192; i++) {
if (bytes.bytesAvailable > 0) {
sample = bytes.readFloat();
event.data.writeFloat(sample); // channel left
event.data.writeFloat(sample); // channel right
}
}
}

Note that even though the microphone is monophonic in Flash, sound data needs to be written to both left and right output channels. If you don’t do this, the recording playback will be twice the speed at which it was recorded because two samples will run in one stereo sample of the sound object.

 

Previous articleRecording Audio
Next articleSaving a Recording

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest News

Underlight As Accent, For Power and The Main Light for Photography

Underlighting, in which fill or accent light comes from under the topic, is not widely used technique in the traditional Portraits,...

How To Fix Overexposure As A Creative Tool, The Complete Guide

As an creative tool, overexposure is sort of underrated. What I’m close to propose could be a deliberate and well thought out technique for...

7D Mark II is Canon’s best DSLR cameras without full-frame sensor.

The expected long-awaited Canon EOS 7D Mark II are shipping in November for $ 1,799 without a lens. With a higher price tag, you...

Low key photography and How to isolate your subject.

Low key photography doesn’t depend on underexposure to make its point; the key to low key is that the majority of tones, even correctly...

High Key Lighting Techniques for Professional Photographers

I’ve written many times about high key lighting techniques and how to achieve them. The term “high key” is a bit misleading. As I’ve...

More Articles Like This