Embed mp3 in actioncript 3 not working

I have a problem with actionscript 3, especially when using the embed tag. I have this code:

[Embed(source = "sound.mp3")]
private static var soundClip:Class;

...

var sound: Sound = (new soundClip ()) as Sound;
trace (sound.length);

When I test the movie, I get the following output: 4501,923 What is the length of the .mp3 sound in milliseconds. However, the original sound is 13,000 milliseconds.

How is this possible, can someone help me?

Thanks.

+7
source share
3 answers

The Embed process involves transcoding (done by the compiler), if the sound does not fit into the supported sound format of the Flash Player, you may get unexpected results, such as a reduction in length. Make sure that the sounds you insert are at a frequency of 44100 Hz, this is a supported sample rate that will not cause any problems.

Hooray!

+1
source

Your audio may have a problem with transcoding due to its sampling rate. A good standard is 44100 Hz, but I had 11025Hz work perfectly. you can easily change the sampling rate in seconds on almost any sound file through Audacity, which is free and quite powerful, but hardly intuitive.

0
source

I donโ€™t think you can download MP3 that way, you need to put it in SWF first, then load SWF, and then specify the sound. Look here and here .

-3
source

All Articles