不支持采样 flex/actionscript

发布于 2024-10-12 04:13:35 字数 1121 浏览 2 评论 0原文

在操作脚本中我需要

  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>

In action script i need

  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")]

The code is

         <?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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空心空情空意 2024-10-19 04:13:35

来自 livedocs

“Flash 可以以 11、22 或 44 kHz 的采样率导入 8 位或 16 位声音。以不是 11 kHz 倍数的格式(例如 8、32 或 96 kHz)录制的声音导入 Flash 时重新采样。导出时 Fl​​ash 可以将声音转换为较低的采样率。”

Flex Builder 不会为您执行此操作,因此您需要在使用前将“music.mp3”文件手动下采样至 22kHz。

编辑:
我找不到正确的文档,但这里说:

“声音采样率 - 以 Hz 为单位测量,首次录制声音文件时这是固定的,Flash .SWF 文件仅允许四种速率。

Flash SWF 格式的采样率为:

5500赫兹

11025赫兹

22050赫兹

44100 Hz(首选设置)”

From livedocs:

"Flash can import either 8- or 16-bit sounds at sample rates of 11, 22, or 44 kHz. Sounds recorded in formats that are not multiples of 11 kHz (such as 8, 32, or 96 kHz) are resampled when imported into Flash. Flash can convert sounds to lower sample rates on export."

Flex Builder will not do it for you so you need to downsample the "music.mp3" file to 22kHz manually before using it.

Edit:
I can't find proper documentation but here it says:

"Sound Sample Rate - measured in Hz, this is fixed when the sound file is first recorded, and Flash .SWF files only allow four rates.

The Flash SWF format has sampling rates of:

5500 Hz

11025 Hz

22050 Hz

44100 Hz (preferred setting)"

吃不饱 2024-10-19 04:13:35

您可以删除 ID3v2 标签,它应该可以工作。我认为是APIC。
因此,任何在嵌入 MP3 文件时遇到问题的人,请下载 ID3 Remover: http://sourceforge.net/projects/id3remover/files/id3remover/v1.2/ID3Remover_1_2.zip/download

You can remove the ID3v2 tag, and it should work. I think it's the APIC.
So anyone who is facing problems embedding MP3 files, download ID3 Remover: http://sourceforge.net/projects/id3remover/files/id3remover/v1.2/ID3Remover_1_2.zip/download .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文