Unsupported sampling flex/actionscript

落花浮王杯 提交于 2019-12-07 09:15:04

问题


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>

回答1:


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




回答2:


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 .



来源:https://stackoverflow.com/questions/4690285/unsupported-sampling-flex-actionscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!