本文介绍了不支持的采样 flex/actionscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在动作脚本中我需要
Loading configuration file /opt/flex/frameworks/flex-config.xml
t3.mxml(10): Error: unsupported sampling rate (24000Hz)
[Embed(source="music.mp3")]
t3.mxml(10): Error: Unable to transcode music.mp3.
[Embed(source="music.mp3")]
代码是
<?xml version="1.0"?>
<!-- embed/EmbedSound.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.media.*;
[Embed(source="sample.mp3")]
[Bindable]
public var sndCls:Class;
public var snd:Sound = new sndCls() as Sound;
public var sndChannel:SoundChannel;
public function playSound():void {
sndChannel=snd.play();
}
public function stopSound():void {
sndChannel.stop();
}
]]>
</mx:Script>
<mx:HBox>
<mx:Button label="play" click="playSound();"/>
<mx:Button label="stop" click="stopSound();"/>
</mx:HBox>
</mx:Application>
推荐答案
来自 livedocs:
"Flash 可以以 11、22 或 44 kHz 的采样率导入 8 位或 16 位声音.以不是 11 kHz 倍数(例如 8、32 或 96 kHz)的格式录制的声音在导入 Flash 时会重新采样.Flash 可以在导出时将声音转换为较低的采样率."
Flex Builder 不会为您执行此操作,因此您需要对music.mp3"进行下采样.使用前手动将文件调至 22kHz.
Flex Builder will not do it for you so you need to downsample the "music.mp3" file to 22kHz manually before using it.
我找不到合适的文档,但这里它说:
I can't find proper documentation but here it says:
"声音采样率 - 以 Hz 为单位,这是第一次录制声音文件时固定的,Flash .SWF 文件只允许四种采样率.
Flash SWF 格式的采样率为:
The Flash SWF format has sampling rates of:
5500 赫兹
11025 赫兹
22050 赫兹
44100 Hz(首选设置)"
44100 Hz (preferred setting)"
这篇关于不支持的采样 flex/actionscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!