SoundBooth的免费替代品,可将提示点添加到MP3 for Flash中吗?

时间:2010-11-17 13:09:12

标签: flash mp3

是否有免费的Soundbooth替代方案,可以在Flash音轨中添加提示点?我似乎记得你可以将它们添加到文件本身(我想)。我知道你可以用FLV做到这一点。

在我买SB之前检查..

2 个答案:

答案 0 :(得分:1)

必须有一些免费的应用程序,但你想要做的事情有点简单。我只是为你准备了一个简单的'app'。我说app,它实际上是一个允许执行以下操作的swf:

  1. 加载MP3文件
  2. 擦洗它
  3. 添加/删除/拖动标记
  4. 导出这些标记的FLV提示点
  5. 以下是您使用它的方式:

    • 双击舞台加载mp3
    • 点击并拖动进行擦洗 - 黑线将显示为“播放头”
    • ALT +点击添加标记,然后可以拖动
    • Shift +单击以删除标记
    • Shift +双击以获取剪贴板中的提示点。声音将停止播放作为确认。

    您可以调整swf的大小以获得更大的擦洗区域。

    这是我现在最基本的方法,不是很花哨,不是很干净, 但它应该做的工作。此外,您可以根据需要扩展它,调整xml / output / etc.

    您需要做的就是抓住FlexibleFactory's audiofx Library, 我用来从FileReference加载MP3并编译代码:

    package {
        import org.audiofx.mp3.MP3FileReferenceLoader;
        import org.audiofx.mp3.MP3SoundEvent;
    
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.geom.Rectangle;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.net.FileFilter;
        import flash.net.FileReference;
        import flash.system.System;
        /**
         * @author George Profenza
         */
        public class MiniMark extends Sprite{
    
            private var w:Number,h:Number,pos:Number;
            private var pressed:Boolean = false;
            private var file:FileReference;
            private var formats:FileFilter;
            private var sound:Sound;
            private var channel:SoundChannel;
            private var dragRect:Rectangle;
            private var markers:Vector.<Sprite>;
    
            public function MiniMark(){
                init();
            }   
            private function init():void {
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.doubleClickEnabled = true;
                w = stage.stageWidth;
                h = stage.stageHeight;
                dragRect = new Rectangle(0, 0, w, 0);
                markers = new Vector.<Sprite>();
    
                file = new FileReference();
                file.addEventListener(Event.SELECT, fileSelected);
                formats = new FileFilter("MP3s (*.mp3)","*.mp3"); 
    
                sound = new Sound();
    
                stage.addEventListener(MouseEvent.MOUSE_DOWN, onPress);
                stage.addEventListener(MouseEvent.MOUSE_UP, onRelease);
                stage.addEventListener(MouseEvent.DOUBLE_CLICK, selectFile);
                stage.addEventListener(Event.RESIZE, onResize);
                this.addEventListener(Event.ENTER_FRAME, update);
            }
    
            private function onResize(event : Event) : void {
                w = stage.stageWidth;
                h = stage.stageHeight;
                dragRect.width = w;
            }
    
            private function selectFile(event : MouseEvent) : void {
                if(event.shiftKey) exportCues();
                else             file.browse([formats]);
            }
    
            private function exportCues() : void {
                var values : Array = [];
                for (var i : int = 0 ; i < numChildren; i++) values[i] = markers[i].x;
                values.sort(Array.NUMERIC);
                var cues : XML = <FLVCoreCuePoints Version="1" />;
                for (i = 0 ; i < numChildren; i++) {
                    cues.appendChild(<CuePoint><Time /><Type>event</Type><Name /></CuePoint>);
                    cues.CuePoint[i].Name.appendChild("Marker"+(i+1));
                    cues.CuePoint[i].Time.appendChild((values[i] / w) * sound.length);
                }
                trace(cues.toXMLString());
                System.setClipboard(cues.toXMLString());
                if(channel) channel.stop();
            }
            private function fileSelected(event : Event) : void {
                var mp3loader:MP3FileReferenceLoader = new MP3FileReferenceLoader();
                    mp3loader.addEventListener(MP3SoundEvent.COMPLETE,soundReady);
                    mp3loader.getSound(file);
            }
    
            private function soundReady(event : MP3SoundEvent) : void {
                sound = event.sound;
            }
            private function onPress(event : MouseEvent) : void {
                pressed = true;
                if (event.altKey && channel) addMarker();
            }
    
            private function onRelease(event : MouseEvent) : void {
                pressed = false;
                dropMarkers(event);
            }
    
            private function update(event : Event) : void {
                if (pressed){
                    if (sound.length) {
                        if (channel) channel.stop();
                        channel = sound.play(sound.length * (mouseX/w));
                    }
                }
                drawPlayhead();
            }
            private function drawPlayhead():void{
                graphics.clear();
                graphics.lineStyle(1);
                pos = mouseX;
                if (!pressed && channel) pos = (channel.position / sound.length) * w;  
                graphics.moveTo(pos, 0);
                graphics.lineTo(pos,h); 
            }
    
            private function addMarker():Sprite{
                var marker : Sprite = new Sprite();
                marker.graphics.beginFill(0x009900,.5);
                marker.graphics.drawRect(-1, 0, 2, h);
                marker.graphics.endFill();
                marker.x = mouseX;
                marker.buttonMode = true;
                marker.addEventListener(MouseEvent.MOUSE_DOWN, dragMarker);
                addChild(marker);
                markers.push(marker);
                return marker;
            }
            private function removeMarker(marker:Sprite):void{
                for (var i:int = 0 ; i < numChildren ; i++) {
                    if (markers[i] == marker) {
                        markers.splice(i, 1);
                        removeChildAt(i);
                    }
                }   
            }
            private function dragMarker(event : MouseEvent) : void {
                if(event.shiftKey) removeMarker(event.currentTarget as Sprite);
                else              event.currentTarget.startDrag(false, dragRect);
            }
    
            private function dropMarkers(event : MouseEvent) : void {
                for (var i : int = 0 ; i < numChildren; i++) markers[i].stopDrag();     
            }
    
        }
    }
    

    HTH

答案 1 :(得分:0)

你只能将提示点嵌入到flv文件而不是mp3中。

我也注意到闪光灯本身无法正确读取这些点!确保在购买之前测试它