FlashAmp 是一个比较有趣的软件,使用它,我们可以得到一段声音(音乐)的音量表,通过读取这个表,进行编程我们就可以精确的模拟出口形或者音量的变化,就知道会是什么样子了。
好了,让我们打开 FlashAmp。
看到上面的画面,先选择声音文件,进行下一步:
选
择“对号”,生成数据。
这一步要选择使用这个声音的动画每秒的帧数,默认是15。
选择比例,100足够了,就按照默认的来没错。
后面还有一些步骤,不用太关心,除非你有特别要求。
最后,生成数据文件,我们这个例子里面生成的文件是这个样子的:
amplitude=(23, 30, 30, 24, 24, 30, 28, 23, 16, 34, 62, 60, 51, 42, 34, 30, 28, 32, 31, 28, 22, 19, 19, 17, 25, 30, 29, 27, 43, 71, 71, 58, 47, 37, 35, 32, 28, 23, 29, 36, 36, 34, 27, 25, 25, 28, 30, 42, 70, 72, 59, 53, 48, 39, 27, 31, 37, 37, 32, 26, 26, 22, 27, 36, 38, 39, 35, 38, 39, 36, 35, 36, 53, 57, 50, 49, 48, 53, 52, 44, 30, 27, 31, 25, 33, 32, 41, 60, 55, 54, 51, 47, 42, 43, 52, 50, 44, 31, 20, 18, 31, 48, 51, 45, 31, 46, 65, 63, 66, 61, 56, 58, 47, 30, 31, 45, 47, 49, 44, 33, 32, 32, 33, 26, 41, 63, 59, 51, 39, 33, 30, 32, 41, 43, 44, 36, 34, 36, 37, 39, 34, 36, 37, 37, 48, 48, 41, 33, 32, 33, 32, 33, 24, 29, 42, 45, 42, 33, 30, 25, 20, 17, 34, 55, 52, 44, 33, 24, 20, 21, 30, 32, 28, 22, 18, 24, 33, 47, 51, 46, 38, 45, 62, 62, 58, 57, 51, 39, 27, 21, 24, 37, 48, 48, 42, 33, 28, 22, 16, 13, 30, 56, 59, 51, 40, 29, 24, 16, 18, 25, 24, 21, 15, 15, 13, 19, 26, 28, 28, 18, 19, 23, 22, 21, 19, 19, 15, 5)&Done=1
好,得到每一秒的音量了。下面可以在程序里面应用了。
动画的时间线是这个样子的,注意:要调整成预先设置的帧数,在这里,是15帧/秒。
我们建立一个空白的 MovieClip,给它一个实体名字叫作“control”,然后再制作两个用来表示音量变化的 MovieClip,一个长方形的叫作“bar”,另一个圆形的叫作“cir”。
在 control 上面写下如下的程序:
onClipEvent (load) {
snd = new Array(23, 30, 30, 24, 24, 30, 28, 23, 16, 34, 62, 60, 51, 42, 34, 30, 28, 32, 31, 28, 22, 19, 19, 17, 25, 30, 29, 27, 43, 71, 71, 58, 47, 37, 35, 32, 28, 23, 29, 36, 36, 34, 27, 25, 25, 28, 30, 42, 70, 72, 59, 53, 48, 39, 27, 31, 37, 37, 32, 26, 26, 22, 27, 36, 38, 39, 35, 38, 39, 36, 35, 36, 53, 57, 50, 49, 48, 53, 52, 44, 30, 27, 31, 25, 33, 32, 41, 60, 55, 54, 51, 47, 42, 43, 52, 50, 44, 31, 20, 18, 31, 48, 51, 45, 31, 46, 65, 63, 66, 61, 56, 58, 47, 30, 31, 45, 47, 49, 44, 33, 32, 32, 33, 26, 41, 63, 59, 51, 39, 33, 30, 32, 41, 43, 44, 36, 34, 36, 37, 39, 34, 36, 37, 37, 48, 48, 41, 33, 32, 33, 32, 33, 24, 29, 42, 45, 42, 33, 30, 25, 20, 17, 34, 55, 52, 44, 33, 24, 20, 21, 30, 32, 28, 22, 18, 24, 33, 47, 51, 46, 38, 45, 62, 62, 58, 57, 51, 39, 27, 21, 24, 37, 48, 48, 42, 33, 28, 22, 16, 13, 30, 56, 59, 51, 40, 29, 24, 16, 18, 25, 24, 21, 15, 15, 13, 19, 26, 28, 28, 18, 19, 23, 22, 21, 19, 19, 15, 5);
function go () {
_root.bar._yscale = sndnow;
_root.cir._xscale = sndnow;
_root.cir._yscale = sndnow;
i++;
}
}
onClipEvent (enterFrame) {
sndnow = 100+snd[i]*5;
go();
}
程序很简单,不断的读取音量的值,然后根据这个值来改变 bar 和 cir 的放大比例,这样,就做到实时的音量显示了。效果很棒的。
那么,这种效果可以用再什么地方呢?一个是在 Music Video 里面显示音量,还有一个就是可以真实的模拟动画人物的口形,怎么样?不错吧?还不快试试?