• 沒有找到結果。

由上一章的效能比較讓我們可以清楚知道,以 SA 為基準的 client-server 系 統(SSAS),在 JavaOL 的表現上比傳統 MPEG-4 SAOL 在效能上好很多。而在 SSAS 的架構上,也可以實作即時傳輸與撥放的 SA 網路應用程式。因為 SSAS 是用 Java 語言實作的,透過 Java Virtual Machine (JVM),它可以提供給很多不同 作業系統的平台使用。

目前 JavaOL 只適用於一組特定的程式來達到傳送與播放的功能,在未來工 作展望中,我們希望可以整合到多媒體平台,以提供更多樣化的服務。日前,我 們著重於開發 Scream Multimedia Platform (SMP) 這個多媒體驗證平台,它提供 多媒體串流編/解碼器設計者快速測試系統,同時提供 GUI 介面讓 Filter Designer 輕易設計 Filter,也使 Framework User 輕易管理 Filter 間互動,大家將自己的模 組放上來後,可以很方便的跟其他模組做完溝通並及時驗證。下圖是 SMP 的架 構圖。

我們的測試環境是:

i. 硬體環境

A. Intel Pentium4 CPU

B. More than 512MB DDR SDRAM ii. 軟體環境

A. Microsoft Windows XP Professional B. Microsoft .NET 2003

C. Java 2 Platform, Standard Edition 1.5.0

安裝完上面的軟體環境後,到 SCREAM Lab Blog [13] 可下載目前最新的 SMP 版本,下載後解壓縮即會產生一個 FDesigner1.x.x 目錄。利用這個平台開發 出來的模組我們統稱為 filter,每個專案可以開發多個 filter,然後統一封裝在同 一個 DLL 檔裡。當我們要使用這些 filter 時,首先要先將這些 filter 註冊到登錄 檔中。

選取後,我們接著選取我們要註冊的 filter。可按 ctrl 加滑鼠左鍵重複選取多

個 filter 後一次一起註冊。

註冊完後,我們即可透過 Add filter 將我們實作的 filter 給實體化,並且執行 它。

為了讓使用者可以方便並快速的寫出控制參數的介面,SMP 還提供用 XML 寫 Java 元件的功能,即使程式設計師不擅長用 Java 語言寫使用者介面,也可以 利用這個方法來達到目的。呼叫介面的方式是透過呼叫 filter property 來達成。

以上圖為例,這樣一個對話框的 XML 碼[14]如下:

<interface>

<frame name="Binary File Loader" width="400" height="150" >

<label name="label1" caption="目前讀取的檔案是:" gridx="0" gridy="0" />

<label name="label2" caption="" gridx="0" gridy="1" />

<button name="button1" caption="另選讀取檔案" gridx="0" gridy="2" />

</frame>

JavaOL 所設計的 filter,在這樣的系統架構下便可輕易的與其他音訊解碼器 如 mp3 或 aac 結合,也可與視訊解碼器同步播放。SMP 的操作畫面如下圖。

參考文獻

1. Eric D. Scheirer, “The MPEG-4 Structured Audio standard,” in Proc. IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP-98), 1998

2. Scheirer, E. D. & Vercoe, B. L. (1999). SAOL: The MPEG-4 Structured Audio Orchestra Language. ComputerMusic Journal 23(2), 31-51

3. sfront [http://web.media.mit.edu/~eds/mpeg4-old/]

4. SAOLC [http://www.cs.berkeley.edu/~lazzaro/sa/sfman/]

5. Yi-Song Siao, Alvin W.Y. Su, Jia-Lin Yah and Jien-Long Wu, “A Structured Audio System Based On JavaOL”, WOCMAT 2005, Taipei.

6. ISO/IEC JTC 1/SC 29/WG 11 N2503-sec5 1999-3-10, “Information technology – Coding of audio-visual objects, Part 3 : Audio, Section 5 : Structured Audio”.

7. Apple Computer ,Inc. “QuickTime File Format” 2000.

8. The Association of Musical Electronics Industry, “MIDI Media Adaptation Layer for IEEE-1394”, November 30, 2000.

9. Karplus K., and Strong A., “Digital synthesis of plucked-string considered as an electrical transmission line”, J. Acoust. Soc. Am. 8,227-233, 1989

10. Scream Structured Audio Player [http://140.116.82.181/SSA/SSAPlayer.htm]

11. DLS level 1 Specification from www.midi.org [http://www.midi.org/about-midi/dls/dlsspec.shtml]

12. Test song page of the project [http://140.116.82.181/SSA/TestSong.html]

13. SCREAM Lab Blog [http://scream.csie.ncku.edu.tw/Projects/SMP/]

14. XML rule of Java Swing Script.

[http://scream.csie.ncku.edu.tw/Projects/SMP/index.php?/archives/11-SwingScri ptXML-SimpleDOC.html]

APPENDIX A

SASL testing program 0 tempo 60

APPENDIX B

SAOL testing program global {

srate 44100;

krate 100;

}

instr tone () {

asig param[127],paramrun[127];

asig fil, buf;

asig counter, i;

param[0]=7346.000000;

: :

param[126]=6582.000000;

if (counter == 0) {

APPENDIX C

JAVA program converted from SAOL program import SSA.*;

public class KS extends SSA.Instr {

static float[]param;

float[]paramrun;

float fil, buf;

int counter, i=0;

public KS(){

paramrun=(float[])param.clone();

}

public void arate(Bus inputBus,Bus outputBus)

int length=SAVM.activeSAVM.busLength;

for(int x=0;x<length;x++) {

param=new float[127];

param[0]=7346.0f;

APPENDIX D

Fast JAVA program import SSA.*;

public class KSFast extends SSA.Instr {

static float[]param;

float currentSample=0;

Queue queue;

public KSFast(){

queue=new Queue();

queue.setBuffer((float[])param.clone());

}

public void arate(Bus inputBus,Bus outputBus) {

int length=SAVM.activeSAVM.busLength;

for(int x=0;x<length;x++) {

float last=currentSample;

currentSample=queue.getItem(126);

param=new float[127];

param[0]=7346.0f;

final class Queue {

public int bufferLength;

private float[]buffer;

private int topIndex;

public Queue() {

topIndex=0;

}

public Queue(int size) {

topIndex=0;

setBuffer(new float[size]);

}

public void setBuffer(float[]nb) {

buffer=nb;

bufferLength=nb.length;

}

public float getItem(int index) {

int i=index+topIndex+1;

if(i<0){

i+=bufferLength;

}else if(i>=bufferLength){

i-=bufferLength;

}

return buffer[i];

}

public void push(float v) {

buffer[topIndex++]=v;

if(topIndex==bufferLength)topIndex=0;

} }

相關文件