如何在 Flash 中跟踪音频文件在时间轴上的位置

发布于 2024-10-19 21:25:12 字数 478 浏览 6 评论 0原文

我正在做一个动画项目。我不是程序员。我正在使用 Flash CS3。我制作了一个动画,需要输出音轨的位置以供后期声音人员使用。录音结束后,我的音响师给了我一个大文件,里面有我所有的音频。我必须将我想要的每个剪辑擦到音轨上的正确位置。

现在我的动画已完成,我的音频已全部就位,但我需要记录它在 Flash 时间轴中的位置,以便我可以将其提供给我的后期声音人员,以便他可以在他的声音中重建它。声音编辑软件。

我想知道是否有一种方法可以运行跟踪或生成一些文本文件来执行以下操作:

  1. 列出主时间线上音频剪辑的开始位置(关键帧)(返回从开始处开始的绝对帧号)影片时间线)
  2. 剪辑播放的时间(帧数)
  3. 关键帧上的任何注释
  4. 符号名称/音频剪辑文件名
  5. 在该选择中播放的音频剪辑文件中的位置。

大约 4 年前,我参加了 Actionscript 3.0 的速成课程,但这就是我的经验范围,所以请保持友善。

I am working on an animation project. I'm not a programmer. I'm working in Flash CS3. I've an animation that I've produced that I need to output the placement of my audio track for use by the post-sound guy. After my recording session, my sound guy gave me one large file that had all my audio on it. I've had to scrub to the correct position on the audio track for each clip I wanted.

Now that my animation is completed, I've got my audio all in place, but I need a record of where it's at in the Flash Timeline so that I can give that to my post-sound guy so that he can rebuild it in his sound editing software.

What I'm wondering is if there is a way to run a trace or generate something of a text file that will do the following:

  1. list where the audio clip begins (key frame) on the main timeline (returns absolulte frame number from beginning of movie timeline)
  2. how long the clip plays for (number of frames)
  3. any notes on the key frame
  4. the symbol name/audio clip file name
  5. position within the audio clip file that is played in that selection.

I did a crash course in Actionscript 3.0 about 4 years back, but that's about the extent of my experience, so please be nice.

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

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

发布评论

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

评论(3

眼趣 2024-10-26 21:25:12

JSFL 可能是实现这一目标的最佳方法。

您可以使用 File > 创建一个新的 JSFL 文件新...>> Flash JavaScript 文件

然后,您可以使用脚本编辑器中的播放按钮运行脚本。

此帮助页面显示配置目录的常见位置如果您想将脚本保存为命令。

我还整理了一系列可能有用的教程:

这是一个示例脚本,它将输出当前时间轴中的音频位置当前文档:

fl.outputPanel.clear();
var dom = fl.getDocumentDOM();
fl.trace('Timeline sound for ' + dom.name);
fl.trace('-------------------');
var divider = ' \t\t ';
var tl = dom.getTimeline();
for(var i=0; i < tl.layerCount; i++){
    var tLayer = tl.layers[i];
    for(var j=0; j < tLayer.frameCount; j++){
        var tFrame = tLayer.frames[j];
        if(tFrame == undefined) {
            break;
        }
        if(tFrame.startFrame == j) { //only run on keyframes
            if(tFrame.soundLibraryItem != null && tFrame.soundName.length > 0) {
                var seconds = j * dom.frameRate;
                //output info
                fl.trace('layer: ' + tLayer.name + divider + 'start (frame): ' + j + 1 + divider + ' start (sec): ' + seconds + divider + 'sound file: ' + tFrame.soundName);
            }
        } else { //skip to next keyframe
            j = tFrame.startFrame + tFrame.duration - 1;
            continue;
        }
    }
}
fl.trace('-------------------');
fl.trace('Output complete.');

输出将如下所示:

Timeline sound for testAudio2.fla
-------------------
layer: audio 2   start (frame): 31    start (sec): 36    sound file: BUMMER.WAV
layer: audio 2   start (frame): 131       start (sec): 156   sound file: COOL_F.WAV
layer: audio 2   start (frame): 411       start (sec): 492   sound file: preparetodie.wav
layer: audio 2   start (frame): 2721      start (sec): 3264      sound file: mcc_hello.mp3
layer: audio 2   start (frame): 2971      start (sec): 3564      sound file: mcc_seriously.mp3
layer: audio 2   start (frame): 3301      start (sec): 3960      sound file: point.wav
layer: audio 2   start (frame): 4321      start (sec): 5184      sound file: happy5.wav
-------------------
Output complete.

根据您的需要进行自定义。例如,如果您想搜索所有时间轴或多个文档,则需要修改它。

JSFL is probably the best way to do this.

You can create a new JSFL file with File > New... > Flash JavaScript File.

You can then run the script using the play button in the Script Editor.

This help page shows the common locations for the Configuration directory if you'd like to save your script as a Command.

I'm also putting together a series of tutorials that might be helpful:

Here's a sample script that will output the locations of audio in the current Timeline of the current document:

fl.outputPanel.clear();
var dom = fl.getDocumentDOM();
fl.trace('Timeline sound for ' + dom.name);
fl.trace('-------------------');
var divider = ' \t\t ';
var tl = dom.getTimeline();
for(var i=0; i < tl.layerCount; i++){
    var tLayer = tl.layers[i];
    for(var j=0; j < tLayer.frameCount; j++){
        var tFrame = tLayer.frames[j];
        if(tFrame == undefined) {
            break;
        }
        if(tFrame.startFrame == j) { //only run on keyframes
            if(tFrame.soundLibraryItem != null && tFrame.soundName.length > 0) {
                var seconds = j * dom.frameRate;
                //output info
                fl.trace('layer: ' + tLayer.name + divider + 'start (frame): ' + j + 1 + divider + ' start (sec): ' + seconds + divider + 'sound file: ' + tFrame.soundName);
            }
        } else { //skip to next keyframe
            j = tFrame.startFrame + tFrame.duration - 1;
            continue;
        }
    }
}
fl.trace('-------------------');
fl.trace('Output complete.');

The output will look something like this:

Timeline sound for testAudio2.fla
-------------------
layer: audio 2   start (frame): 31    start (sec): 36    sound file: BUMMER.WAV
layer: audio 2   start (frame): 131       start (sec): 156   sound file: COOL_F.WAV
layer: audio 2   start (frame): 411       start (sec): 492   sound file: preparetodie.wav
layer: audio 2   start (frame): 2721      start (sec): 3264      sound file: mcc_hello.mp3
layer: audio 2   start (frame): 2971      start (sec): 3564      sound file: mcc_seriously.mp3
layer: audio 2   start (frame): 3301      start (sec): 3960      sound file: point.wav
layer: audio 2   start (frame): 4321      start (sec): 5184      sound file: happy5.wav
-------------------
Output complete.

Customize as you see fit. You would need to modify it if you want to search all Timelines or multiple documents, for instance.

彡翼 2024-10-26 21:25:12

不是来自 ActionScript 内部,不是。时间线上的声音是一个臭名昭著的黑匣子,充满了令人讨厌的陷阱,其中之一是你真的没有办法知道时间线声音在运行时“生活”在哪里。不过,您可以使用 JSFL 脚本来完成此操作。 JSFL 是一种“Javascript”,可让您操作和检查 .fla 内容,以及将消息输出到跟踪窗口。

需要明确的是,JSFL 是您在“创作时间”针对 Flash 创作工具本身执行的东西。它不是运行时语言。它不适用于 swf 文件。

这是 JSFL 上的文档。

http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash /WS5b3ccc516d4fbf351e63e3d118a9024f3f-7fe8.html

Not from within ActionScript, no. Sounds on timelines are a notorious black-box that is full of nasty gotchas, among them being that you really have no way to know where a timeline sound "lives" at runtime. This might be something you can use a JSFL script to do, however. JSFL is a kind of "Javascript" that lets you manipulate and examine the .fla contents, as well as output messages to the trace window.

Just to be clear, JSFL is something that you execute against the flash authoring tool itself, during "authoring time". It is not a runtime language. It does not apply to swf files.

Here's the docs on JSFL.

http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/WS5b3ccc516d4fbf351e63e3d118a9024f3f-7fe8.html

追星践月 2024-10-26 21:25:12

很难确切地说出你是如何设置这一切的,但根据你所说的,我会尝试这样的事情。将以下代码放置在动画时间轴的第一帧上:

var movieFrameRate:Number = 20;  //frame rate of your movie
var totalFramesOfMovie:Number = this.totalFrames;

var startingFrameOfSoundClip:Number;
var endingFrameOfSoundClip:Number;

var startingMilSecsOfSoundClip:Number;
var endingMilSecsOfSoundClip:Number;

var currentClipName:String;

function findMilSecsFromStart(startingFrameOfSoundClip:Number):Number
{
    var MilSecs:Number = (startingFrameOfSoundClip / movieFrameRate) * 1000;

    return MilSecs;
}

function findFramesFromStart(startingFrameOfSoundClip:Number):Number
{
    var frames:Number = startingFrameOfSoundClip;

    return frames;
}

function durationInFrames(startingFrame, endingFrame):Number
{
    var durationInFrames:Number = endingFrame - startingFrame;

    return durationInFrames;
}

function durationInMilliseconds(startingFrame, endingFrame):Number
{
    var durationInMilSecs:Number = ((endingFrame - startingFrame) / movieFrameRate) * 1000;

    return durationInMilSecs;
}


function collectInitialInfo():void
{
    trace("Clip Name: " + currentClipName);
    trace("Number of frames from beginning: " + findFramesFromStart(startingFrameOfSoundClip));
    trace("Time from beginning in MilSecs: " + findMilSecsFromStart(startingFrameOfSoundClip));
}

function collectFinalInfo():void
{
    trace("Duration of sound clip in frames: " + durationInFrames(startingFrameOfSoundClip, endingFrameOfSoundClip));
    trace("Duration of sound clip in milSecs: " + durationInMilliseconds(startingFrameOfSoundClip, endingFrameOfSoundClip));
    trace("----------------------------------------------------------");
} 

然后在声音剪辑开始的每个帧上放置以下代码,其中 mySoundClip_1 始终是从此处开始的声音剪辑的实例名称:

currentClipName = 'mySoundClip_1';
startingFrameOfSoundClip = this.currentFrame;
collectInitialInfo();

然后声音结束的每一帧,放置以下代码:

endingFrameOfSoundClip = this.currentFrame;

collectFinalInfo();

我制作了一个时间轴,其中包含一个简单的正方形影片剪辑的多个实例,以模仿您所描述的声音剪辑的放置,实例名称为 mySoundClip_1、mySoundClip_2< /strong> 等。

我已经测试过它,它在输出窗口中生成以下跟踪:

Clip Name: mySoundClip_1
Number of frames from beginning: 4
Time from beginning in MilSecs: 200
Duration of sound clip in frames: 35
Duration of sound clip in milSecs: 1750
----------------------------------------------------------
Clip Name: mySoundClip_2
Number of frames from beginning: 75
Time from beginning in MilSecs: 3750
Duration of sound clip in frames: 55
Duration of sound clip in milSecs: 2750
----------------------------------------------------------
Clip Name: mySoundClip_3
Number of frames from beginning: 179
Time from beginning in MilSecs: 8950
Duration of sound clip in frames: 18
Duration of sound clip in milSecs: 900
----------------------------------------------------------
Clip Name: mySoundClip_4
Number of frames from beginning: 219
Time from beginning in MilSecs: 10950
Duration of sound clip in frames: 56
Duration of sound clip in milSecs: 2800
----------------------------------------------------------
Clip Name: mySoundClip_5
Number of frames from beginning: 289
Time from beginning in MilSecs: 14450
Duration of sound clip in frames: 32
Duration of sound clip in milSecs: 1600
----------------------------------------------------------

Its hard to tell exactly how you have this all set up but based on what you have said I'd try something like this. Place the following code on the first frame of your animation timeline:

var movieFrameRate:Number = 20;  //frame rate of your movie
var totalFramesOfMovie:Number = this.totalFrames;

var startingFrameOfSoundClip:Number;
var endingFrameOfSoundClip:Number;

var startingMilSecsOfSoundClip:Number;
var endingMilSecsOfSoundClip:Number;

var currentClipName:String;

function findMilSecsFromStart(startingFrameOfSoundClip:Number):Number
{
    var MilSecs:Number = (startingFrameOfSoundClip / movieFrameRate) * 1000;

    return MilSecs;
}

function findFramesFromStart(startingFrameOfSoundClip:Number):Number
{
    var frames:Number = startingFrameOfSoundClip;

    return frames;
}

function durationInFrames(startingFrame, endingFrame):Number
{
    var durationInFrames:Number = endingFrame - startingFrame;

    return durationInFrames;
}

function durationInMilliseconds(startingFrame, endingFrame):Number
{
    var durationInMilSecs:Number = ((endingFrame - startingFrame) / movieFrameRate) * 1000;

    return durationInMilSecs;
}


function collectInitialInfo():void
{
    trace("Clip Name: " + currentClipName);
    trace("Number of frames from beginning: " + findFramesFromStart(startingFrameOfSoundClip));
    trace("Time from beginning in MilSecs: " + findMilSecsFromStart(startingFrameOfSoundClip));
}

function collectFinalInfo():void
{
    trace("Duration of sound clip in frames: " + durationInFrames(startingFrameOfSoundClip, endingFrameOfSoundClip));
    trace("Duration of sound clip in milSecs: " + durationInMilliseconds(startingFrameOfSoundClip, endingFrameOfSoundClip));
    trace("----------------------------------------------------------");
} 

Then on each frame where a sound clip starts place the following, where mySoundClip_1 is always the instance name of the sound clip starting there:

currentClipName = 'mySoundClip_1';
startingFrameOfSoundClip = this.currentFrame;
collectInitialInfo();

and then on each frame where a sound ends, place the following code:

endingFrameOfSoundClip = this.currentFrame;

collectFinalInfo();

I have made a timeline, with multiple instances of a simple movieclip of a square to mimic the placement of sound clips as you have described, with instance names mySoundClip_1, mySoundClip_2 etc.

I have tested it and it generates the following trace in the output window:

Clip Name: mySoundClip_1
Number of frames from beginning: 4
Time from beginning in MilSecs: 200
Duration of sound clip in frames: 35
Duration of sound clip in milSecs: 1750
----------------------------------------------------------
Clip Name: mySoundClip_2
Number of frames from beginning: 75
Time from beginning in MilSecs: 3750
Duration of sound clip in frames: 55
Duration of sound clip in milSecs: 2750
----------------------------------------------------------
Clip Name: mySoundClip_3
Number of frames from beginning: 179
Time from beginning in MilSecs: 8950
Duration of sound clip in frames: 18
Duration of sound clip in milSecs: 900
----------------------------------------------------------
Clip Name: mySoundClip_4
Number of frames from beginning: 219
Time from beginning in MilSecs: 10950
Duration of sound clip in frames: 56
Duration of sound clip in milSecs: 2800
----------------------------------------------------------
Clip Name: mySoundClip_5
Number of frames from beginning: 289
Time from beginning in MilSecs: 14450
Duration of sound clip in frames: 32
Duration of sound clip in milSecs: 1600
----------------------------------------------------------
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文