Home
SPCE SACM MS02 User`s Manual v1.0
Contents
1. II HU B5 please use Page Up or Page Music Simulator tonelib demo CAProgram Files Sunplus Sunmidiar Sample project demo demo tpj IM EE 3 il SPCESO0A_6CH 3 BRT L Em X 43 demo H DQBch mid amp mbdancer mid amp swan mid amp top amp ch mid amp wiok mid wa mid on range is 0 97 Britepiano MW Select new qualified section EGpiano Chorused Piano ne Name e Pitch j itc lope SizetB R Pom SizeBY Harpsichord gm000 45 A3 45 A 4 58 76 60 908 gm000 55 G4 55 A457 76 37 310 Clavinet e amp 4002 mid H amp jbnew mid won Oh O oC N ra gm000_62 D5 62 A 5 70 76 26 172 gmo00_69 A5 69 C 6 73 84 45 700 10 musicbox am000 77 F6 77 A 6 82 76 6 412 marimba 9m000 84 C7 84 t DE Sa Nn II UNN cs BS 1 4 Export MIDI binary file and tone color library Sunplus Technology Co Ltd PAGE 39 May 05 2003 PRELIMINARY SPCE SACM MS02 User s Manual v1 0 3 SUNPLUS 4 1 chick on the seventh icon MIDI and Sil export configurations on the tool bar 4 2 Select the export folder and give names to the export file Make sure that in Exporting group box both MIDI files and instruments library are checked 4 3 Click on OK and then click on PC icon on tool bar The PC icon is on the right of the IC body SPCE061A list box 4 4 Chick on the sixth icon
2. OOUMMMU Sunplus Technology Co Ltd PAGE 5 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 2 Type of Speech Compression Algorithm 2 1 Summary Audio Present Algorithm Title Data rate Application SACM A1600 12 16 24 Kbps Audio SACM A2000 16 20 24 Kbps Audio SACM A3200 32 36 40 44 48 Kbps Audio SACM A3200 2Ch 32 36 40 44 48 Kbps Audio 2 Channel Speech Present Algorithm Title Data rate Application SACM S200 0 8K 0 9K 1K 1 2K 1 4K 1 6K Speech 1 8k 2K 2 4K 2 8 Kbps SACM S240 5120 24 Kbps SACM SA80 ST20 48 7 2 Kbps SACM S530 5 3K 5 96K 6 63K 7 29K 7 95 Kbps Speech Melody Present Algorithm Title Type Channel Application SACM MS01 MANX e 4 FM 2 ADPCM Music Synthesizer SACM MS02 Wave Table 4 SPCE500A 8 SPCE061A Music Synthesizer Recording Present Algorithm Title Data rate Channel Application SACM A3200 32 36 IMO 44 48 Kbps SACM A3200 20h _ 32 36 40 44 48 Kbps 1 SACM DVR for A2000 16Kbps data rate with 8Kbps sample rate from ADC for recording Recording 2 2 Naming convention SACM Xnnn SACM Speech Audio Coding Method X A Audio S Speech MS Melody nnn Data rate for X A or S Sunplus Technology Co Ltd PAGE 6 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 Synthesizer type for X MS 01 FM 02 Wave tabl
3. musicbox F 4 54 F 4 54 E HI aen A4 57 B4 59 B4 59 AS 69 AS 69 B6 83 A 8 106 e 4002 mid H amp jbnew mid won C Ql lt C N ra marimba USCS 4 MIDI Instruments IANA O 5 Done The Song binary file and tone library Tle can now be used in MS02 project Eh Sunplus Technology Co Ltd PAGE 41 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 9 API V S RESOURCE The following list shows the hardware resources used by SACM APIs For example the value of hardware port such as P TimerA Ctrl P TimerA Data etc will be modified by SACM A2000 Initial The P INT Ctrl and P TimerA Data will be changed by SACM A2000 Play etc Moreover all hardware requests in an API are public for user s reference in sacmv32 asm For instance the function F SACH A2000 Init is hardware setting for F SACM A2000 Initial Hardware Unit Word Functions Used Register SACM A1600 Initial IP SystemClock SACM A2000 Initial P TimerA Ctrl P TimerB Ctrl SACM A3200 Initial P TimerA Data P TimerB Data SACM 2Ch A3200 Initial P DAC Ctrl SACM 5480 Initial PANT Clear SACM 5530 Initial SACM 5240 Initial SACM 5200 Initial SACM MS01 Initial SACM MSOZ Initial SACM DVR Initial SACM A1600 Play P INT Ctrl SACM A2000 Play P INT Clear SACM A3200 Play P TimerA Data SACM A3200 Ch Play SACM A3200 Ch2 Play
4. 24 5 HARDWARE DEPENDENT API IN SACMVXX ASM OPEN SOURCE 25 5 1 RAMP FUNCTIONS n 25 5 1 1 Function Ramp up DAC L 29 5 1 2 Function Ra RUR DAC 2 A EE 29 5 1 3 Function RYUNPNDDACT WT EE WR HE 29 5 1 4 FUNCTIOQPARARIBUD DAC A2 MLN EE 26 92 CEE fie VG HN E 26 9 2 LIENFICBOn Initial QUERE J E 26 5 2 2 Function Obtain a word from oueue nnn nnn nans 26 5 2 3 Function Fill a word fooueue aenea nen nnn enama 27 Wo i EMORY FCC Aaa TIONS AAA AAA AAA AAA 27 5 3 1 Function C 8 ASM Fetch song data from resource in ROM See u nsp Assembly MANOS del re 27 6 HOW TO ADAPT YOUR OLD PROJECT FOR NEW LIBRARY enm mH Hmmm 28 6 1 THE SACM PROJECT ARCHITECTURE eem eeheetet en sememete rire teme ec rereme e nana Kaa nana peperere pipere eas 28 6 2 STEP BY STEP PROCEDURE anname aan a nana anne annan aan reri iiri reme iiri sere is wanakana nana 29 7 HOWTO USE THE SACM LIBRARY NNN 30 7 1 THE PROGRAMMING FLOW IN AUTO MODE III Rhe kaa a aak ana eaa terere aan aa terere terere wanunua reperi 30 7 2 QUICK START STEP BY STEP INSTRUCTIONS anna nene vanana avaneva vaene naene avane re eis 30 7 2 1 OPEN a Sample PIOJEEL scant o EE Ae 30 7 2 2 Link the libraries to user s program 31 Sunplus Technology Co Ltd PAGE 3 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Man
5. 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 05 16 2003 SUNPLUS TECHNOLOGY CO reserves the right to change this documentation without prior notice Information provided by SUNPLUS TECHNOLOGY CO is believed to be accurate and reliable However SUNPLUS TECHNOLOGY CO makes no warranty for any errors which may appear in this document Contact SUNPLUS TECHNOLOGY CO to obtain the latest version of device specifications before placing your order No responsibility is assumed by SUNPLUS TECHNOLOGY CO for any infringement of patent or other rights of third parties which may result from its use In addition SUNPLUS products are not authorized for use as critical components in life support devices systems or aviation devices systems where a malfunction or failure of the product may reasonably be expected to result in significant injury to the user without the express written approval of Sunplus SUNPLUS TECHNOLOGY CO LTD 19 Innovation First Road Science Based Industrial Park Hsin Chu Taiwan R O C a 886 3 578 6005 886 3 578 4418 gy WWW sunplus com tw gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 0 Table of Content 0 TABLE OP CONTIENT AWA 2 1 REVISION HISTORY ccc c cenen 5 1 1 DOCUMENT HISTORY e 5 Lo EIBRART IS TOR Rm S 2 TYPE OF SPEECH COMPRESSION ALGORITHM eene tu nendeni Banana vananev vana en hwa 6 21 SUMMARY a PIISAA Win SARINE TRU mS 6 2 2 NAMING CONVENTION MEET 6 3 BASICS
6. SACM 3530 Play SACM S480 Play SACM 5240 Play SACM 5200 Play SACM MS01 Play SACM MS02 Play SACM MS01 InitDecoder SACM DVR Play SACM DVR InitDecoder SACM DVR Record P ADC Ctrl SACM DVR InitEncoder P TimerA Data P INT Ctrl SACM A1600 Stop P ADC Ctrl SACM A2000 Stop SACM A3200 Stop Sunplus Technology Co Ltd PAGE 42 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 Functions Used Register SACM A3200 Ch1 Stop SACM A3200 Ch2 Stop SACM 8530 Stop SACM 58480 Stop SACM 58240 Stop SACM 58200 Stop SACM MS01 Stop SACM MS02 Stop SACM DVR Stop SACM A1600 ServiceLoop P INT Ctrl SACM A2000 ServiceLoop P INT Clear SACM 58530 ServiceLoop SACM 5480 ServiceLoop SACM 240 ServiceLoop SACM 200 ServiceLoop SACM MS01 ServiceLoop SACM MS02 ServiceLoop SACM MS01 Decoder SACM DVR ServiceLoop SACM DVR Encoder SACM DVR Decoder F ISR Service SACM A1600 F ISR Service SACM A2000 F ISR Service SACM A3200 F ISR Service SACM A3200 Ch1 F ISR Service SACM A3200 Ch2 F ISR Service SACM 85530 F ISR Service SACM S480 F ISR Service SACM S240 F ISR Service SACM S200 F FIA Service SAGM lt sMS01 F ISR Services SACM MS02 F ISR Service SACM DVR Sunplus Technology Co Ltd PAGE 43 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 Resources List of SACM algorithm
7. 10 1 TABLE 1 RAM Size Unit Decimal Word IRAM ISRAM SRAM ORAM OSRAM A1600 Oo jo T pm A2000 A3200 A3200 2Ch 5530 Note DVR includes both A2000 Encoder and A2000 Decoder algorithm Eh Sunplus Technology Co Ltd PAGE 44 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 2 TABLE 2 ROM Size Unit Decimal Word A1600 NENNEN A2000 A3200 A3200 2Ch 5530 S480 S720 Eh Sunplus Technology Co Ltd PAGE 45 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 3 TABLE 3 Hardware Resources VS Library Interrupt Timer Setting 5530 TMA FIQ 8 KHz 12 KHz 5480 8720 TMA FIQ 16 KHz TMA FIQ 20 KHz TMA FIQ 16 KHz AC em e jp RP IRQ4 1KHz ADPGM 28K 32K 36K 40 KHz DVR mus FIQ 16 KHz Play 20 KHz Rec ADC DAC Eh Sunplus Technology Co Ltd PAGE 46 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 4 TABLE 4 CPU Usage Rate approximate SPCE500A CPU Usage Rate 24 MHz SPCE061A CPU Usage Rate 49 MHz A1600 A2000 A3200 A3200 2Ch S530 39 8KHZ 5 3Kbps 14 08KHz 5 3Kbps 48 010KHz 6 6Kbps 19 10KHz 6 6Kbps 57 012KHz 7 9Kbps 24 12KHz 7 9Kbps 31 8KHZ 4 8Kbps 12 8KHz 4 8Kbps 34 8KHz 7 2Kbps 13 8KHz 7 2Kbps 5240 32 1ChO 16KHz 32 2Ch ADPCM 13 1Ch 16KHz 12 2Ch ADPCM 38 2Ch 16KHz 32 2Ch ADPCM 16 2Ch 16KHz 12 2Ch ADPCM 44 3Ch 16KHz 32 2Ch ADPCM
8. 15 4 3 7 Function Enable one of channels for SACM MS02 melody playing 16 4 3 8 Function Disable one of channels for SACM MS02 melody playing 16 4 3 9 Function Hold one of channels for SACM MS02 melody playing 17 4 3 10 Function Release one of channels for SACM MS02 melody playing 17 Sunplus Technology Co Ltd PAGE 2 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 4 3 11 Function Change the instrument on one of the SACM MS02 channels 17 4 3 12 Function Key Change for SACM MS02 melody playing 18 4 3 13 Function Tempo Change for SACM MS02 melody playing 18 4 3 14 Function Reset to Default Tempo for SACM MS02 melody playing 19 4 3 15 Function Change instrument in a MIDI channel for SACM MS02 melody playing 19 4 3 16 Function Change instrument set tone color library for SACM MS02 melody playing 19 4 3 17 Function Play an note when SACH MSOZ is running an ee 20 4 4 ISR FUNCTIONS INTERRUPT SERVICE ROUTINE FOR SACM MS02 NEEN 21 4 5 USER FUNCTIONS FOR SACM MS02 PLAYBACK n0nnnnnnnv ER 22 4 5 1 Function Song event notification Eeer 22 4 5 2 Function Set start address for SACM MS02 song data ee 24 4 5 3 Function Fetch the SACM MS02 song data from user s storage
9. A1600 OVERLAP A1600 SRAM BLOCK ORAM OVERLAP A1600 RAM BLOCK ORAM A2000 OVERLAP A2000 SRAM BLOCK ORAM OVERLAP A2000 RAM BLOCK ORAM A3200 M JOVERLAP 43200 RAM BLOCK ORAM 2Channel A3200 OVERLAP A3200 2CH SRAM BLOCK ORAM OVERLAP 5530 RAM BLOCK O sso lt k O sag var CT VS S20 ovERIAPIS240 RAM BLOCK ORAM 22 o KAAN H A We Aan EE Msoi OVERLAP MSOT SRAM BLOCK OSRAM OVERCAP MS04 gt RAM BLOCK ORAM EE pp JoveRLAP DVR SRAM BLOCK ORAM N OVERLAPYDVR RAM BLOCK ORAM Note see map in detail r 11 111111 111iiltlll1o Sunplus Technology Co Ltd PAGE 52 May 05 2003
10. Export on tool bar to export binary files Music Simulator tonelib demo CAProgram Files Sunplus Sunmidiar Sample project demo demo t MAERA ler son m ei Sms N i Midi and Sil Export Configuration 555 demo ER DO8ch mid amp mbdancer mid Britepiano amp swan mid Ga EGpiano amp top8ch mid d i amp wlok mid 5 43 Instruments ChorusedPiano E CER e Na Ba Envelope 7 Sizet N Harpsichord E e PUE P D 2224 Clavinet EG A002 mid c2 36 A 2 34 FRANS HE cron s N D3 38 Dx38 musicbox E3 40 EX40 36 642 F 3 42 F 3 42 A3 45 AX45 C4 48 CA 48 C 4 49 CRAS arem marsm cs BS Lem marimba TTI ISS PA e E N ha 1 m ER p T E n N m K ere E ra WW L M tone calor A ll W v agi HUT AV VA 1 RAE 4 y Y N TR 1 d amp 9 NW Gei Al ee TA h A U N An a us Ja i VY d K 4 b X gt 4 h w Eh Sunplus Technology Co Ltd PAGE 40 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 ds zeman s RIE L TRI E SE demo g DO8ch mid d section range is 0 54 Britepiano EGpiano amp top8ch mid wiok mid ELO Instruments amp mbdancer mid 1 swan mid v Select new qualified section Chorused Piano ase Pitch Max Pitch Harpsichord C4 48 C4 48 Clavinet c 4 49 Cit4 49 D450 D4 50 D 4 51 DAA SI
11. Parameters MIDI Channel 0 15 Return Value None Library lt SacmVxx LIB gt Remark 1 The MIDI channel information can be knew from the original MIDI information User can refer to the original MIDI for channel setting and polyphony details 4 3 8 Function Disable one of channels for SACM MS02 melody playing Syntax C void SACM MS02 ChannelOff int MIDI Channel ASM R1 Channel Call F SACM MS02 ChannelOff Parameters MIDI Channel 0 15 Return Value None Sunplus Technology Co Ltd PAGE 16 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 Library lt SacmVxx LIB gt Remark 4 3 9 Function Hold one of channels for SACM MS02 melody playing Syntax C void SACM MS02 HoldChannel int MIDI Channel ASM R1 Channel Call F SACH MS02 HoldChannel Parameters MIDI Channel 0 15 Return Value None Library lt SacmVxx LIB gt Remark 1 For the channel held the note events coming up from this channel will not be allocated dynamically and always go into the designated channel 4 3 10 Function Release one of channels for SACM MS02 melody playing Syntax C void SACM MS02 ReleaseChannel int MIDI Channel ASM R1 Channel Call FE SACH MS02 ReleaseChannel Parameters MIDI Channel 0 15 Return Value None Library lt SacmVxx LIB gt Remark 1 Forthe channel held this function allows the note events designated to this channel to be alloc
12. CM BIN sa seg RES CM BIN sa RES CM BIN EA DN offset RES CM BIN ea seg RES CM BIN ea RES TONE LIB SA DN offset RES TONE LIB sa seg RES TONE LIB sa RES TONE LIB EA DW offset RES TONE LIB ea seg RES TONE LIB ea Ea Resource File Find in Files 1 X Find in Files 2 For Help press F1 Ln 1 Col 0 NUM m l 6 K RIG Pshshieh 3JMSO B SPCES C vnsP 1 47107 Reb a 40152 7 2 5 Arrange Song Speech sequence in the Song Speech table in resource asm User will needs to arrange the speech song sequence in the T SACH MS02 SongTable and the sequence of tone color library in T SACM MS02 InstrumentSet Sunplus Technology Co Ltd PAGE 33 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 9 u nSP IDE Editor Resource asm File Edit View Project Build Tools Window Help tel x S i S Ss SD OR D ale SEE sPCEO60A 061A Debug Weil 3 43 Source Files ps AA AA AA SE SE E isr asm SACM MSOZ Song Table User nees to add in the song speech ff for playback based on the RES Table above LE AA AA A E WA E CS public T SACM MS02 SongTable public T SACH MS02 InstrumentSet T SACH MS02 SongTable L sacmv33 asm L SP lib asm A spce asm System asm Dam bed El dw RES MB2 BIN SA Chl Ch2 un za 4 d EE eme dw RES CM BIN SA Chi Ch2 Ch3 Ch4 Ch10 in P RA BIN SA J
13. FOR SACM MS02 KN KN KN KN KN KN na KN na na na nan d lae n B Ae Leaf nananana nnam 8 3 1 DYNAMIC ALLOCATED POLYPHONIC CHANNELS LAN A 2 8 3 2 TONE COLOR LIBRARY Am A E 4 Noam aaa aenea naene aenea nananana 8 3 3 AUTO MANUAL MODE A Meere HH RA mme n nananana nene reni 8 3 4 PLAY RATE SERVICE RATE AND PTG RANGE Ba 9 3 5 SAMPLING RATE MEER An AA SP 9111 PITSIN 9 3 6 CPU LOADING SE E W avane n hene erento sese te secat sese se sepes serre reas 9 4 API FOR SACM MS02 gt gaan A T a E 11 4 1 HARDWARE DEPENDENT FUNCTIONS FUNCTION INITIALIZES SACM MS0O2 wea 11 4 1 1 Function Initialize SACM MS02 module sets Interrupt source Timer and play mode Manual Auto mode before playing 11 4 24 SERVICE LOOP FUNCTIONS SERVICE LOOP TO FILL SACM MS02 SONG DATA TO SEQUENCER 12 4 2 1 Function Foreground service loop 12 4 3 PLAYBACK FUNCTIONS PLAYBACK CONTROL arena nnn enini rh renun nnn sienne stern rennes 12 4 3 1 Function Begin to play an SACH MSOZmelody sees 12 4 3 2 Function Stop playing SACM MS02 melodhy esses 14 4 3 3 Function Pause playing SACM MS02 melody essere 14 4 3 4 Function Resume the paused SACM MS02 melody esee 15 4 3 5 Function Main volume control for SACM MS02 melody playing 15 4 3 6 Function Obtain the status of the SACH MS02 module
14. MS01 Initial and to set the interrupt in F SACM MSO Initial Aflag in the F ISR Service SACM MS02 will block the code after stopping playing Using this function with user s function in the same FIQ is possible EX _IRQ1 call F ISR Service SACM MS02 MS02 ISR service loop call F User ISR reti EX IRQ1 Sunplus Technology Co Ltd PAGE 21 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 ISR Service SACM MS02 MS02 ISR service loop 5 The F ISR Service SACM MS02 must be hooked on the EIO IRQ1 IRQ2 label see isr asm in MS02 example before use this function 4 5 User Functions for SACM MS02 playback 4 5 1 Function Song event notification Syntax C User defined ASM R1 Event Value F SACM MS02 SongEvent Parameters R1 return value bit 15 12 0x0 End Event bit 15 12 0x1 Note Event bit 15 12 0x2 Instrument Event bit 15 12 0x3 Volume Event bit 15 12 0x4 Pan Event bit 15 12 0x6 Tempo Event bit 15 12 Ox7 Pitch Bend Event bit 15 12 0x8 Other Controller Event bit 11 8 Channel 0 7 End Event bit 7 0 Unused Note Event bit 7 0 Pitch Instrument Event bit 7 0 GM Instrument Sunplus Technology Co Ltd PAGE 22 May 05 2003 SUNPLUS Volume Event bit 7 0 Volume Pan Event bit 7 0 Pan Tempo Event bit 7 0 Unused PRELIMINARY SPCE SACM MS02 User s Manual v1 0 Extend
15. RES CM BIN SA dw RES RA BIN SA I SACM MS02 Instrument Set Table User can incorporate multiple tone color set II and change tone color at run time if necessary T SACH MS02 InstrumentSet dw RES TONE4 BIN SA R InterruptStuaus A public interrupt control register in spce asm for SPCE500A Programmers may share the interrupt source with SACM library A register R InterrruptStatus is reserved for sharing the interrupt source This register records the status of occupied interrupt by library therefore it is an interface to identify which interrupt is used by library If a content of Ox2000 is in the R InterruptStatus it means the Timer A FIA is being used by library subroutines at this moment For example the R InterruptStatus will be changed from 0x0000 to Ox2000 when SACM MS02 Play is called In contrast SACM MS02 Stop will not change the INT setting from Ox2000 to 0x0000 when SACM MS02 is called Every interrupt setting must follow the rule to share the interrupt resource The following is an example to enable IRQ4 while SACM MS02 speech is playing R1 0 At beginning R InterruptStatus 0x0000 Call F SACH MS02 Play The R InterruptStatus change to 0x2000 by Sunplus Technology Co Ltd PAGE 35 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 JE SACM A2000 Play TimerA FIQ enable and the speech playing Af BODY TYPE SPCE061A R1 P INT Mask Get
16. current interrupt setting status from P INT Mask if for SPCE061A endif if BODY TYPE SPCE500A R1 R InterruptStatus Get current interrupt setting status from R InterruptStatus if for SPCE500A endif Enable IRQ2 at this moment R1 0x0400 Set Timer B IRQ2 R InterruptStatus R1 Update R InterruptStatus to 0x2400 P INT Ctrl R1 Set interrupt control port 0x7010 For SPCE061 a new hardware port P INT Mask 702DH serves the purpose as well and itis advised for users to take advantage of it In SPCE inc The BODY TYPE definition determines the SPCE body type and as a result program can know whether R InterruptStatus or P INT Mask should be refered in sacmVxx asm Eh Sunplus Technology Co Ltd PAGE 36 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 8 How to use Sunmidiar to export the MIDI and Tone color library Sunplus Sunmidiar offers a great convenience for users to process MIDI data and generates the required melody binary file and tone color library For SACM MS02 on SPCE Sunmidiar can walk user through the tone color making to MIDI processing Sunmidiar also supports ICE downloading to facilitate composing MS02 applications For the Sunmidiar operation details please refer to Sunmidiar user manual Here are the easy step by step instructions 1 Open a new project 1 1 menu gt file gt new dialogue pop up 1 2 Type in user project name 1 3 Select project path
17. is correct Sunplus Technology Co Ltd PAGE 30 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 C u nSP IDE Editor Ele Edit View Project Build Tools Help CE CEE EIE Je spcE0604 0614 Debug Taam GE E Te E ga Mso2 ASPCE120 H E Sou SPCE250 4 D Hea SPCE380A 7 Ext SPCES00A SPCP650A s i u nSP IDE Copyright C 1999 2003 Sunplus Technology ep eue oea h ane y ea For Help press Fl II mNm meme 6304 OG eege BISPCE S C us 0 85 FF 01 33 7 2 2 Link the libraries to user s program Go to Project gt Setting gt Link and Check if library is correctly typed here i e sacmvXXXX lib to the library modules text box General Option Link section Redefine Hardware z TT 2 mall ra bres Output Output file name Release M502 TSK k 155 Generate Interrupt vector Table H Include Start Up Code M Align all resources with lo V Generate Initial Table External Symbol Files Library modules cMacro lib MS02_ 1 ib lr NE spce in W m Jl External D joa Sunplus Technology Co Ltd PAGE 31 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 7 2 3 Add resources to user s program Click on resource tab in work space window move mouse to Porject Resources in this case MS02 Resources Click on right button and choose Add Fi
18. setting to tempo change table as follows Sunplus Technology Co Ltd PAGE 18 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 Tempo Factor 43 12 11 Multiplier tempo Factor 4 2 alala el 7 o 10 0 12 49 va Multiplier Example If original tempo is 100 BPM and user sets the Tempofactor as 10 the new tempo will be 100 1 92 192 If original tempo is 100 BPM and user sets the Tempofactor as 10 the new tempo will be 100 0 53 53 4 3 14 Function Reset to Default Tempo for SACM MS02 melody playing Syntax C void SACM MS02 Resetlempo ASM call E SACM MS02 ResetTempo Parameters N A Return Value N A Library lt SacmVxx LIB gt Remark 4 3 15 Function Change instrument in a MIDI channel for SACM MS02 melody playing Syntax C void SACM MS02 Changelnstru int MIDI Channel int Instrument ASM R1 MIDI4 Channel R2 Instrument call F SACH MS02 Changelnstru Parameters MIDI Channel 0 15 MIDI channel Instrument 0 127 MIDI instrument Return Value N A Library lt SacmVxx LIB gt Remark 1 This function allows user to change instrument at run time but the selected instrument must also be included in the tone color library 4 3 16 Function Change instrument set tone color library for SACM MS02 Sunplus Technology Co Ltd PAGE 19 May 05 2003 SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 me
19. the song data in the external memory storage and access the song data by manual mode The manual mode call back functions can be referred at sacm user asm Users have to implement the memory access functions based on the storage type 3 4 Play Rate Service Rate and Pitch Range MS02 also offers a great flexibility that allows users adjust the play rate which is the frequency by which PCM data is delivered to DAC The play rate adjusting implemented via passing parameters can make trade offs between CPU loading and sound quality The benefit users can get from this feature is that this trade off can carry out without the need to re make the tone color library That is the initial sampling rate won t affect the play rate For CPU loading information please refer to appendix In SACM MSO2 service rate is 3 times the play rate Service rate means the frequency of processing the sound data The certain section in an instrument tone color Can synthesized a certain pitch range The Pitch Range is determined by the following formula Sample rate service rate pow 2 max pitch base pitch 12 lt 1 The pitch range of a certain section has an upper limit maximal pitch range but no minimal pitch However if the pitch synthesized is deviated from the base pitch too far the sound fidelity to the instrument will be degraded 3 5 Sampling rate There is no limitation to SACM MS02 tone color sampling rate The only concern is the CPU l
20. triggered by timer 5 This function utilizes a register R InterruptStatus spce asm to keep track of interrupt setting with user s program for SPCE500A It uses P INT Mask instead for SPCE 061A 060A 4 2 Service Loop Functions Service loop to fill SACM MS02 song data to sequencer 4 2 1 Function Foreground service loop Syntax C void SACM MS02 ServiceLoop void ASM call F SACM MS02 ServiceLoop Parameters None Return Value None Library lt SacmVxx LIB gt Remark 1 In this function the MIDI events are parsedrand processed for sequencer 4 3 Playback Functions Playback control 4 3 1 Function Begin to play an SACM MS02 melody Syntax C int SACM MS02 Play int Song Index int Channel int Ramp Set ASM R1 Song Index R2 Channle R3 Ramp Set Call F SACM MS02 Play Parameters Song Index 0 max speech index Auto Mode 1 Manula Mode Channel 1 To DAC1 Sunplus Technology Co Ltd PAGE 12 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 2 To DAC2 3 To both DAC1 and DAC2 Ramp Set 0 Disable both ramp up and down 1 Enable ramp up only 2 Enable ramp down only 3 Enable both ramp up and down Return Value N A Library lt SacmVxx LIB gt Remark 1 The SACM MS02 provides eight dynamic channels each Or which maps to a MIDI channel 2 The song data can be played externally by user function 3 The Song Index is the speech sequence of fy SACM
21. 1 User can also use the help of Sunmidiar to test the pitch range Please refer to Sunplus Technology Co Ltd PAGE 20 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 Sunmidiar for details 4 Velocity is a factor to the output volume of the note played It affects the volume of the note played and meanwhile the volume of other channels is unchanged 5 To make this API functional user have to compose a dummy MIDI with the desired tone color and then play this dummy song in MS02 before this API is called 6 The note played will be dynamically allocated to one of the polyphonic channels by the same rules in other MS02 polyphonic channels 7 Ifthe MIDI channel specified is not used the default channel will be set as channel O 4 4 ISR Functions Interrupt service routine for SACM MS02 The ISR service routine will synthesize the song data from service loop subroutine SACM MSo02 ServiceLoop The audio output will be sent to DAC Syntax C ASM Parameters Return Value Library Remark Void ISR Service SACM MSO2 Void F ISR Service SACM MS02 None None lt SacmVxx LIB gt ISR service for SACM MS02 Hook the interrupt service routine on one of FIQ TMA IRQ1 TMA or IRQ2 TMB The play rate of in SACM MS02 can offer 10 options 8KHz 10 KHz 12 KHz 16 KHz 20 KHz 24 KHz 28 KHz 32 KHz 36 KHz and 40 KHz User needs to select the desired play rate in SACM
22. 1 4 Set body type as SPCE061 1 5 Check file type as project Music Simulator tonelib demo Britepiano 1 2 EGpiano 5 3 4 5 Chorused Piano 2 6 Harpsichord 2 7 Clavinet 2 8 A 5 70 76 26 172 9 C6 73 84 45 700 10 musicbox 3 A 6 82 76 6 412 11 Vibes 2 C 8 97 76 4 912 12 marimba 3 LSE IO NUN EST NN 2 2 Import MIDI Sunplus Technology Co Ltd PAGE 37 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 2 1 menu gt import MIDI gt dialogue pop up 2 2 choose file type as midi and select the MIDI file Music Simulator tonelib demo CAProgram Files Sunplus SunmidiaSample projec demoidemotpi ME Ctrl N Ctrl 5 SPCESOOA BCH ale m gt the selected section range is 0 58 1 Britepiano 5 IZ Select new qualified section 2 EGpiano 5 3 Y 4 ag A002 mid 5 Chorused Piano 2 H amp jbnew mid Tone Name Base Pi MaxPitch 6 Harpsichord 2 7 Clavinet 2 gm000 55 8 gm000_62 D5 62 A 5 70 76 9 gm000 69 A5 69 C6 73 84 45 700 10 musicbox 3 gm000 77 F6 77 A 6 82 76 6 412 gm000 84 C7 84 C 8 97 76 4 912 12 marimba 3 t tatistics 952 MIDI Instruments i cs BS Wm 3 Edit MIDI 3 1 Go to the MIDI instruments window on the left and unfold the MIDI instruments and drums 3 2 Check out if alkinstruments and drums are mapped to a instrument that is provide
23. 19 3ChO016KHz 12 2Ch ADPCM 52 4Ch 16KHz 32 2Ch ADPCM 22 4Ch 16KHz 12 2Ch ADPCM 47 1Ch 24KHz 32 2ChADPCM 20 1ChO 24KHz 12 2Ch ADPCM 57 2Ch 24KHz 32 2Ch ADPCM 24 2Ch 24KHz 12 2Ch ADPCM 67 3Ch 24KHz 32 2Ch ADPCM 29 3Ch 24KHz 12 2Ch ADPCM 77 4Ch 24KHz 32 2Ch ADPCM 34 4Ch 24KHz 12 2Ch ADPCM Note DVR is including both A2000 Encoder and A2000 Decoder algorithm MS02 Maximum 8 channels Tempo 250 Channels DAC 28KHz DAC 20 KHz DAC 16 KHz SPCES00A CPU loading for MS02 at 24 576MHz Channels DAC 20KHzZ DAC 16KHz 59 06 49 37 13 07 60 58 88 00 70 25 80 06 58 33 43 60 36 31 e 66 67 49 60 40 76 72 78 54 80 45 22 80 56 60 80 49 68 s ses 6560 5414 Sunplus Technology Co Ltd PAGE 47 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 CPU loading MS02 on SPCE061A 100 00 90 00 80 00 70 00 60 00 50 00 40 00 30 00 20 00 10 00 0 00 CPU loading Channels DAC 28KHz 8 DAC 20 KHz amp DAC 16 KHz CPU loading for MS02 on SPCE500A 100 00 90 00 80 00 70 00 60 00 50 00 40 00 30 00 20 00 10 00 0 00 CPU loading Channels DAC 16KHz amp DAC 20KHz Eh Sunplus Technology Co Ltd PAGE 48 May 05 2003 PRELIMINARY 3
24. 63 ONS dw RES MA A A A 2 TEE SACH MS02 Instrument Set Table User can incorporate multiple tone color set ff and change tone color at run time if necessary fj 7 T SACH MS02 InstrumentSet dw RES TONE LIB SA Ma Resource File Build Debug X Findin Files 1 Findin Files 2 For Help press FI Ln 1 Col0 NUM sape emu KM 76 Gshshieh 27MS02 BsPCES e u nSP T 47705 Add EA FF 0145 7 3 Asimple example include sacmv33 h Main SACM_MS02_Initial MSO2 DAC 28K 8 Initialization for playing SACM MS02 Play Song Index DAC1 DAC2 Ramp UpDn On While 1 SACM MS02 ServiceLoop Fill Data to Queue Return 0 Note The Song Index is the sequence in speech table i e T SACM MS02 SpngTable in resource asm Sunplus Technology Co Ltd PAGE 34 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 _IRQ1 push R1 R5 to sp call F ISR Service SACM MS02 MS02 ISR service loop R1 C IRQ1 TMA P INT Clear R1 pop R1 R5 from sp RETI Resource asm SACM MS02 Song Table User nees to add in the song speech II for playback based on the RES Table above public T SACH MS02 Song Tapie public T SACH MS02 InstrumentSet T SACH MS02 SongTable dw RES MB2 BIN SA dw
25. AC void call F RampUpDAC1 None None opened in sacmVxx asm Program must stop sending data to DAC1 while executing this function Function Ramp up DAC2 void SP RampUpDAC2 void call F RampUpDAC2 None None opened in sacmVxx asm Program must stop sending data to DAC2 while executing this function Function Ramp up DAC1 void SP_RampDnDAC1 void call F RampDnDAC1 None None opened in hardware asm Programmers must stop sending data to DAC1 while executing this function Sunplus Technology Co Ltd PAGE 25 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 5 1 4 Function Ramp up DAC2 Syntax C void SP RampDnDAC2 void ASM call F RampDnDAC2 Parameters None Return Value None Library opened in sacmVxx asm Remark Programmers must stop sending data to DAC2 while executing this function 5 2 Queue Functions 5 2 1 Function Initial Queue Syntax ASM call F SP _InitQueue Parameters None Return Value A word song data Library opened in sacmVxx asm Remark 1 Manual use only 2 For each song compression module e g SACM A2000 SACM 5240 it has its own function named F SP InitQueue A2000 F SP InitQueue S240 therefore making two independent queues for each module is possible 5 2 2 Function Obtain a word from queue Syntax ASM call F SP ReadQueue Parameters None Return Value A word data Library opened in sacmVxx asm Remark 1
26. MS02 SongTable in resource asm 4 The F ISR Service SACM MS02 must be hooked to the corresponding FIA IRQ1 IRQ2 label before using this function 5 The Timer interrupt is working at the rate specified by the initial function SACM MS02 Initial int Play Rate int Channel Example Plays a SACM MS02 melody with auto end in auto mode a In main c include sacmV33 h int Songlndex 0 Main t SACH MS02 Initial MS02 DAC 16K 4 DAC 16K 4 Channels SACH MS02 Play Songlndex DAC1 DAC2 Ramp UpDn On Play 1 speech on both DAC1 82 while SACM MS02 Status amp 0x01 d SACM MS02 ServiceLoop b In isr asm Sunplus Technology Co Ltd PAGE 13 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 _IRQ1 push R1 R5 to sp call F ISR Service SACM MS02 MS02 ISR service loop R1 C IRQ1 TMA P INT Clear R1 pop R1 R5 from sp RETI 4 3 2 Function Stop playing SACM MS02 melody Syntax C void SACM MS02 Stop void ASM Call F SACM MS02 Stop Parameters None Return Value None Library lt SacmVxx LIB gt Remark This function will not change the interrupt setting 4 3 3 Function Pause playing SACM MS02 melody Syntax C void SACH MS02 Pause void ASM Calif SACM MS02 Pause Parameters None Return Value None Library lt SacmVxx LIB gt Remark Sunplus Technology Co Ltd PAGE 14 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM
27. MS02 User s Manual v1 0 4 3 4 Function Resume the paused SACM MS02 melody Syntax C void SACM MS02 Resume void ASM Call F SACM MS02 Resume Parameters None Return Value None Library lt SacmVxx LIB gt Remark 4 3 5 Function Main volume control for SACM MS02 melody playing Syntax C void SACM MS02 Volume int Volume Index ASM R1 Volume Index Call F SACM MS02 Volume Parameters Volume Index 0 15 0 Min volume 15 Max volume Return Value None Library lt SacmVxx LIB gt Remark 4 3 6 Function Obtain the status of the SACM MS02 module Syntax C unsigned int SACM MS02 Status void ASM Call F SACM MS02 Status Return Value R1 Parameters None Return Value bit 0 0 Song ended 1 Song Playing bit 1 0 Song not Paused 1 Song Paused Sunplus Technology Co Ltd PAGE 15 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 bit 2 0 DAC 1 MS02 output disable 1 DAC1 MS02 output enable bit 3 0 DAC2 MS02 output disable 1 DAC2 MS02 output enable bit 4 0 DAC Ramp up disable 1 DAC Ramp up enable bit 5 0 DAC Ramp down disable 1 DAC Ramp down enable bit 6 0 Manual 1 Auto bit 7 0 Stereo Disable 1 Stereo Enable Library lt SacmVxx LIB gt Remark None 4 3 7 Function Enable one of channels for SACM MS02 melody playing Syntax C void SACM MS02 ChannelOn int MIDI Channel ASM R1 MIDI Channel Call F SACM MS02 ChannelOn
28. Manual use only 2 Same as remake2 of F SP InitQueue Sunplus Technology Co Ltd PAGE 26 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 5 2 3 Function Fill a word to queue Syntax ASM F SP WriteQueue Parameters None Return Value None Library opened in sacmVxx asm Remark 1 Manual use only 2 Same as remake2 of F SP InitQueue 5 3 Memory Access Functions 5 3 1 Function C amp ASM Fetch song data from resource in ROM See u nsp Assembly Manual for details Syntax C unsigned int GetResource long ASM F GetResource Parameters None Return Value A word song data Library opened in sacmVxx asm Remark 1 Manual use only 2 Long type parameter includes 16 bit address and 6 bit page index Sunplus Technology Co Ltd PAGE 27 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 6 How to adapt your old project for new library 6 1 The SACM project architecture Since SACMV32 the library has some minor changes over its architecture so that the project architecture has a minor adjustment as well main c sacmVnn h sp lib h A User sacm user asm sacmVnn lib sacmVnn asm sp lib asm isr asm spce asm system asm Mo
29. SUNPLUS SPCE SACM MS02 User s Manual v1 0 MS02 Lite Maximum 4 channels Tempo 250 DAC 20KHz SPCE061A at 49 152MHz SPCESOOA at 24 576MHz 22 80 47 62 33 20 74 21 39 20 85 71 Channels Note 1 MSO2 ib is an 8 channel MS02 library MS02 Lite is a 4channel MS02 library specifically for concurrent algorithms User can opt to MS02 or MS02 Lite for SPCE061A or SPCESOOA based on the application need Fro example for 4 channel application MS02 Lite is more desirable than MS02 since it takes less CPU loading For SPCE500 it is possible to run MS02 lib at up to 6 channels if the tempo is slow and DAC rate is set low The measure of actual CPU load should be an ad hoc 2 The CPU loading of MS02 Lite lib is lighter than MS02 4ib in the same condition but it can deliver only up to 4 polyphonic channels 3 CPU loading is measured by timing the service loopsand the SReservice routine and then user calculate its percentage in the certain amount of time Eh Sunplus Technology Co Ltd PAGE 49 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 5 TABLE 5 Timing Limitation approximate Service Loop Time Limit 24MHz u nSP v1 0 Service Loop Time Limit 49MHz u nSP v1 1 6 ms 16 ms 2 4ms 7 5 ms 5 3Kbps 0 88ms 7 5 ms 5 3Kbps 2 4ms 5 8 ms 6 6Kbps 0 90ms 6 ms 6 6Kbps 2 4ms 5 0 ms 7 2Kbps 0 96ms 5 ms 7 2Kbps 1 4ms 7 4 ms 0 52ms 7 5 m
30. annels on SPCE061A and it is advised that user use fewer than 6 polyphonic channels typical 4 channels on SPCE500A For concurrent algorithm applications the use of 4 channels MS02 along with other speech audio algorithmis recommended When a MIDI song is playing by MS02 theschannel dynamic allocation mechanism will assign a note to an available channel when a note on event comes up The next note will be allocated to another available channel automatically In case that all channels are taken certain rules will be applied to decide which channel shall be cut off This case can be avoidedin advance when composing the MIDI 3 2 Tone color library MSO2 also grants users the option to make the trade off between music quality and memory size The size of tonescolor library implies the sound quality of instruments used Sunmidiar offers an extensive assistance for developers from tone color editing to MIDI analyzing and converting For details please refer to Sunmidiar user manual Users can make custom tone colors on their own by the Sunplus patch editor The tone color library can be changed at run time Due to the reliability issue tone color library does not support manual mode 3 3 Auto Manual Mode MS02 supports manual mode for MIDI Song The manual mode for tone color library is not supported User can Sunplus Technology Co Ltd PAGE 8 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 place
31. ated dynamically again 4 3 11 Function Change the instrument on one of the SACM MS02 channels Syntax C SACM MS02 Changelnstru int MIDI Channel int Instrument ASM R1 MIDI Channel R2 Instrument Sunplus Technology Co Ltd PAGE 17 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 call F SACM MS02 Changelnstru Parameters MIDI Channel 0 15 Instrument 0 Max Instrument Return Value None Library lt SacmVxx LIB gt Remark 1 The instrument argument is the mapped instrument index It is decided when the MIDI and tone color are exported from Sunmidiar 4 3 12 Function Key Change for SACM MS02 melody playing Syntax C void SACM MS02 KeyShift int Key Shift Index ASM R1 Key Shift Index call F SACM MS02 KeyShift Parameters Key Shift Index number of keys to shift Return Value None Library lt SacmVxx LIB gt Remark 1 The key shiftrange is bound by the current pitch and maximal pitch that the tone color can synthesize 48 13 Function Tempo Change for SACM MS02 melody playing Syntax C void SACM MS02 ChangeTempo int TempoFactor ASM R1 TempoFactor call F SACM MS02 ChangeTempo Parameters TempoFactor 14 13 14 1 slow 0 normal 0 13 fast Return Value None Library lt SacmVxx LIB gt Remark 1 The tempo is changed in a comparative manner by this function The MIDI tempo event is not supported yet 2 The tempo factor
32. d in the right window Instruments and drum set Instrument mapping can be done by left click on instrumentunder MIDI e g Acpiano choose the Inst Mapping and map it to an existing instrument in the right window 3 3 check the edit window in the middle and see if the each section of each instrument is well adjusted to cover the pitch range shown on the piano key below The pitch range is shown by 2 short vertical red lines on the lower piano key Sunplus Technology Co Ltd PAGE 38 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 Music Simulator tonelib_demo C Program Files Sunplus Sunmidiar Samp e project demo demo tpj M EE P SPCESOOA ET gt EM X E demo E N Li ER DO8ch mid erate the ction range is 0 54 ER amp mbdancer mid 1 Britepiano 5 SP Gas vi M Select new qualified section 2 EGpiano 5 H B d z wlok mid p El wa mid BS Instruments 5 Chorused Piano 2 Koi h Leelee II Tote ame Sase Fien p Mex tien Envelope Size 6 Harpsichord 2 2 Drums 7 Clavinet 2 e 8 zoue mid Eoo E Hl amp jbnew mid SARVE 8 C 3 37 C 3 37 36 3 746 9 D3 38 _D3 38 36 14 418 10 musicbox E3 40 E3 40 36 7 642 F 3 42 F 3 42 36 5 070 marimba A3 45 A3 45 36 D48 C448 C448 36 C4 49 C 4 49 36 Ds nafon
33. dules Resource m Spce Inc spce inc ES spce inc spce inc Annn inc spce inc sp lib inc spce inc SPCe INC Fig A typical SACM project architecture In the SACM examples user shall see an architecture like the demonstration above User will also notice that the hardware asm and key asm if applicatble are disappeared In the hardware asm there are 3 types of information included SPCE port definition SACM related functions initializations queue and hardware dependent functions and SPCE dependent APIs For the purpose of modulization it is split since SACMv32 lib Hardware asm is now split and some header files are also arranged into 3 modules 1 spce inc SPCE port definition spce asm R InterruptStatus for SPCE500A to keep tack of interrupt setting status 2 SACMVnn asm Library initializations queue functions and ramp up down hardware dependent functions SACMVnn h C function declarations for SACM APIs Annn inc s200 inc s240 inc s480 inc s530 inc A1600 inc A2000 inc A3200 inc A32002Ch inc MS02 and DVR inc Assembly function declarations for each algorithm 3 sp lib asm General APIs for SPCE key scan and I O configuration function Sunplus Technology Co Ltd PAGE 28 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 6 2 Step by step procedure For a programmer to update old projects to und
34. e DVR Digital Voice Recording Example SACM A2000 stands for Sunplus audio algorithm with nominal data rate 20Kbps The actual data rate will depend on the options that algorithm provides and the sampling rate adopted BE Sunplus Technology Co Ltd PAGE 7 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 3 Basics for SACM MS02 MS02 is Sunplus MIDI music synthesizer The backbone technology wave table allows the rich presentation of MIDI music to fit on an SPCE embedded system via SACM MS02 Musical Instrument Digital Interface MIDI is a widely adopted music format which is easy to access and convenient to process for users User simply needs to use Sunplus music tool Sunmidiar to convert the MIDI songs into the MS02 song and tone color resource files required for the SACM MS02 playback The MIDI music can then be played in users applications through SACM MS02 Please be aware that due to the embedded system concern not all MIDI events are parsed and processed in MS02 The polyphonic channel numbers song attribute tempo score and etc and DAC play rate are 3 major factors on CPU loading 3 1 Dynamic allocated Polyphonic channels MS02 can support up to 8 polyphonic channels each of which can deliver an intact note envelope without being intervened by another note in most cases by taking advantage of dynamic allocation Due to the performance issue MS02 can supports up to 8 polyphonic ch
35. er files spce inc Annn inc and sacmVnn h to project 6 Open spce inc to check out the Body Type definition on the top of the file Change the definition according to the body used 7 Check the project content and see if the library API is still supported in new library structure If not modify the program structure according to the examples foreground background auto mode manual mode and SACM user asm User will see that the new SACM library structure is more accessible It will take some efforts to change form old version project to new one User can contact Sunplus representative for technical support through Sunplus web site http www sunplus com tw Sunplus Technology Co Ltd PAGE 29 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 7 How to use the SACM library 71 The programming flow in auto mode a Auto Mode Initialization Play b The programming flow in manual mode ISR Initialization ISR User functions Service Loop 7 2 Quick start Step by Step Instructions The easiest way to start your SACM application is start from a sample project enclosed in the SACM library package Here we provide the step by step instructions for users to launch the project development 7 2 1 Open a sample project Open the sample project by the IC body and the SACM library you wanted to use And make sure that the body type
36. er new SACM library structure the procedures are 1 Find each line include hardware inc inside assembly files in project 2 Check the files where the line include hardware inc presents 2 1 If SPCE port definition is used in the module then add include spce inc on the top of the file 2 2 If any key function is used in the module then add include sp lib inc on the top of the file 2 3 If any SACM library function is used in the module then add include Annn inc on the top of the file Where Annn inc can be s200 inc s240 inc s480 inc s530 inc A16004nc A2000 inc A3200 inc A32002Ch inc MS02 inc or DVR inc 2 4 If R InterruptStatus is used add external R InterruptStatus to the top of the file 39 99 3 Find each line include hardware h inside C files in project 55 4 Check the file where the line include hardware h presents 2 1 If SPCE port definition is used in the module then add Zinclude spce h on the top of the file 59 2 2 If any key function is used in the module then add Zinclude sp lib h on the top of the file 2 3 If any SACM library function is used in the module then add include SACMVnnn h on the top of the file 5 Remove hardware asm hareware inc key asm if applicable key inc if applicable from project and add in source files sacmVnn asm spce asm sp lib asm sacm user asm if applicable and head
37. ing Argument R2 bit 15 0 beat per minute Pitch Bend Event bit 7 0 Unused Extending Argument R2 bit 15 14 zero Extending Argument R2 bit 13 7 pitehMsb Extending Argument R2 bit 6 0 pitchLsb Other Controller Event bit 15 0 Unused Return Value None Library lt SacmVxx kLIB gt sacm_user asm Remark 1 User can implement the function based on the event value passed in The action should not take too long to block the melody playing 2 When library calls back this function the parameter in R1 carries different composition of information about the event details depending on the event types indicated in b15 b12 of R1 R2 also serve as an auxiliary argument if the event is a tempo or pitch bend event bit 15 12 0x0 bit 15 12 0x1 bit 15 12 0x2 bit 15 12 0x3 bit 15 12 0x4 bit 15 12 0x6 bit 15 12 Ox7 bit 15 12 0x8 End Event Note Event Instrument Event Volume Event Pan Event Tempo Event Pitch Bend Event Other Controller Event 3 If user prefers to implement the function in C programming languish user can call a C Sunplus Technology Co Ltd PAGE 23 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 function from this F SACH MS02 SongEvent The price would be the extra overhead However this function should not block program flow too long otherwise the MS02 will not play smoothly 4 5 2 Functio
38. les to Folder e Add compressed audio or speech file into the folder C unSP IDE Editor File Edit View Project Build Tools Help J lgi PTT cma LB srcE0604 0614 Debu l El Gla cp RES RA sin New Folder 6 RES 162 BIN o Ad Eles Ce de 0 CS 199 RES cM BIN FS I RES Tone L1 Hide Properties une IDE Copyrieht C 1999 2005 Sunplus Technology el sa SA e ieh QJMSO2_ ISPCE S E u nSP T 04 Bod Ga Y 01 40 7 2 4 Rebuild project After user rebuild the project the user will see the resource table has been generated with updated resource information in the resource asm Sunplus Technology Co Ltd PAGE 32 May 05 2003 SPCE SACM MS02 User s Manual v1 0 PRELIMINARY 3 SUNPLUS 9 u nSP IDE Editor Resource asm File Edit View Project Build Tools Window Help a xl BLS e cmm S a ll SEE sPcEO60A 061A Debug MEN ee JI 5 Resource asm RES Table EHE M502 files 343 Source Files A isr asm main c A Resource asm sacm user asm A sacmV33 asm SP lib asm A spce asm System asm Head Files External Dependencies _RES RA BIN SA DW offset RES RA BIN sa seg RES RA BIN sa _RES RA BIN EA DN offset RES RA BIN ea seg RES RA BIN ea RES MB2 BIN SA DN offset RES MB2 BIN sa seg RES MB2 BIN sa RES MB2 BIN EA DW offset RES MB2 BIN ea seg RES MB2 BIN ea RES CM BIN SA DW offset RES
39. lody playing Syntax C ASM Parameters Return Value Library Remark void SACM MS02 ChangelnstruSet int InstruSetlndex R1 InstruSetlndex call F SACM MS02 ChangelnstruSet InstruSetindex The index of Instrument Set in tone color library N A lt SacmVxx LIB gt 1 This function allows user to change instrument set at run time The index is the sequence in T SACH MS02 InstrumentSet in resource asm 4 3 17 Function Play an note when SACM MS02 is running Syntax C ASM Parameters Return Value Library Remark void SACM MS02 PlayNote int MIDI Channel int Pitch int Velocity int Duration R1 MIDI Channel R2 Pitch R3 Velocity R4 Duration call F SACH MS02 Play MIDI Channel 0 15 Pitch 0 127 Velocity 0 127 Duration 0 65535 tickers where a ticker typically 5ms long None lt SacmVxx LIB gt 1 For more details on MIDI please refer to sources on Web or publications on MIDI 2 MIDI channel decides the MIDI channel by which the note is delivered and as a result also decides which instrument tone color will carry out the note 3 MIDI Pitch is from 0 to127 The lowest note name is then CO note number 0 and the highest possible note name is G10 note number 127 Not all MIDI notes can be played Each tone color has its pitch range and limited by the formulas Sample rate service rate pow 2 max pitch base pitch 12
40. lus Technology Co Ltd PAGE 10 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 4 API for SACM MS02 4 1 Hardware Dependent Functions Function Initializes SACM MS02 4 1 4 Function Initialize SACM MS02 module sets Interrupt source Timer and play mode Manual Auto mode before playing Syntax C int SACM MS02 Initial int Play Rate int Channel ASM R1 Play Rate R2 Channel Call F SACM MSOZ Initial Parameters Play Rate 0 1 co N ohu A CO N DAC for 8K play rate DAC for 10K play rate DAC for 12K play rate DAC for 16K play rate DAC for 20K play rate DAC for 24K play rate DAC for 28K play rate DAC for 32K play rate DAC for 36K play rate 9 DAC for 40K play rate Channel 078 for SPCE061A 060A 040A 0 4 for SPCE500A 380A 250A 120A Return Value N A Library lt SacmVxx LIB gt Remark 1 This function initializes the decoder of MS02 It also initializes the system clock Timer A Timer B DAC and enables the Timer A FIQ IRQ1 or Timer B FIA IRQ2 User can select which timer to use accordingly in E SACM MS02 Init 2 The hardware setting is opened for user s reference see F SACM MS02 Init function in sacmVxx asm 3 All channels will be enabled after initialization Sunplus Technology Co Ltd PAGE 11 May 05 2003 gt SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 4 The play rate of SACM MS02 is the interrupt
41. n Set start address for SACM MS02 song data Syntax C USER SetStartAddr ASM call F USER SetStartAddr Parameters User defined Return Value User defined Library lt SacmVxx LIB gt sacm user asm Remark 1 Manual mode only 2 User implements the function based on the storage type The memory interface has to be constructed in advance if user intends to access the data from external storage e g SRAM FLASH 4 5 3 Function Fetch the SACM MS02 song data from user s storage Syntax C User defined ASM call E USER MSO0O2 GetSongData Parameters User defined Return Value R1 lt data Library SacmVxx LIB sacm user asm Remark 1 Manual mode use only 2 User implements the function based on the storage type The memory interface has to be constructed in advance if user intends to access the data from external storage e g SRAM FLASH or mask ROM 3 The SACM MS02 library will fetch a word data through this function where R1 hosts the data Sunplus Technology Co Ltd PAGE 24 May 05 2003 zm SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 5 Hardware dependent API in SACMVxx asm Open source 5 1 Ramp Functions 5 1 1 Syntax C ASM Parameters Return Value Library Remark 5 1 2 Syntax C ASM Parameters Return Value Library Remark ASM Parameters Return Value Library Remark Function Ramp up DAC1 void SP RampUpD
42. oading We would advise coding engineers that the sampling rate should be bounded in between 8KHz to 25KHz to ensure the availability of 8 polyphonic channels 3 6 CPU loading The CPU loading estimation for SACM MS02 is an ad hoc It varies by the factors channel numbers song attribute tempo score and etc and DAC play rate If channel number is higher CPU loading is also higher The faster the tempo the higher the CPU loading The higher DAC play rate the higher CPU loading Please refer to appendix for CPU loading information For SACM MS02 the CPU loading can be measured by taking the service loop time and ISR time into account The MIDI composing techniques and hardware settings can help to lower the CPU loading and to grant user applications more flexibility Sunplus Technology Co Ltd PAGE 9 May 05 2003 SUNPLUS PRELIMINARY SPCE SACM MS02 User s Manual v1 0 SACM MS02 features Up to 8 dynamic channels Play rate DAC rate options 8K 10K 12K 16K 20K 24K 28K 32K 36K 40 KHz Tempo Key adjustable at playback Instrument Tone color run time change Auto Manual Mode supported MIDI compatible SACM MS02 Technical basics Variable sampling rate for tone color from 8KHz to 25KHz Foreground background Service loop 1 timer required for playback ROM requirement 4596 words TEXT 3954 CODE 642 RAM requirement 291 words RAM section shared via ORAM section OVERLAP MS02 RAM BLOCK Sunp
43. s 1 2 ms 5 2ms 0 5ms T Sms 9200 13 ms 15ms 4 3ms 15ms DVR Note 1 The first number is the time taken to execute service loop second number is the maximum interval in which the program have to execute service loop These figures are measured with SACM v32 lib 2 For example the E SACM4A2000 ServiceLoop must be called each 1 33ms in user s main loop main t SACH MS02 Initial MS02 DAC 28K 6 Play rate 28KHz 6 channels SACM MS02 Play 0 3 3 Song 0 DAC1 DAC2 Ramp up Ramp Down While 1 t User Function SACM MS02 ServiceLoop lt Go here in each 50 us BS Sunplus Technology Co Ltd PAGE 50 May 05 2003 3 SUNPLUS MS02 Service loop time limit Channels DAC 28KHz DAC 20 KHz DAC 16 KHz 6 256us 36us_ 256us 50us 25 6us 62 8us 8 basis 316us Sdus 31 6us 628us MS02 Lite Service loop time limit MS02 Lite Service loop Time Limit DAC 20KHz PRELIMINARY SPCE SACM MS02 User s Manual v1 0 Service loop Time Limit on SPCE500A Channels 1 2 3 4 Br 44us 50us 43 2us 62 5us DAC 20KHz DAC 16KHz E 28 8us 50 8us 28 8us 63us 36 4us 50 8us 36us 62 4us 50us 62 4us Note The service loop timing varies as the DAC rate changes Sunplus Technology Co Ltd PAGE 51 May 05 2003 PRELIMINARY 3 SUNPLUS SPCE SACM MS02 User s Manual v1 0 10 6 TABLE 6 Name of Overlap RAM in the library Overlap SRAM definition Overlap RAM definition
44. ual v1 0 7 2 3 Add resources to user s program 32 7472 RCD Ee ee NET 32 7 2 5 Arrange Song Speech sequence in the Song Speech table in resource asm 33 r WE Ric A 34 8 HOW TO USE SUNMIDIAR TO EXPORT THE MIDI AND TONE COLOR LIBRARY 37 9 APFV Ss RE SOR Kee 42 10 RESOURCES LIST OF SACM ALGORITHM mnnvannnnnnnsnnnnnas n ennu anna nene n ks 44 10 1 TABLE 1 RAM SIZE UNIT DECIMAL Woppo UMR AR ea 44 10 2 TABLE 2 ROM SIZE UNIT DECIMAL WORD EE 45 10 3 TABLE 3 HARDWARE RESOURCES VS LIBRARY L A L 46 10 4 TABLE 4 CPU USAGE RATE APPROXIMATE center tenen ndn nae RT penne nnne nnne nnn nnns 47 10 5 TABLE 5 TIMING LIMITATION APPROXIMATE Ml nnne denen nnne nennen nnns nnns 50 10 6 TABLE 6 NAME OF OVERLAP RAM IN THE LIBRARY AE 02 Sunplus Technology Co Ltd PAGE 4 May 05 2003 PRELIMINARY SUNPLUS SPCE SACM MS02 User s Manual v1 0 1 Revision History 1 1 Document History Revision Date By Remark vin 03 44 2003 Arthur Shieh MS02 1 2 Library History B Remark Revision Date y V1 0 05 05 2003 Pao Hwa Hsieh MS02 8 channel MS02 Lite A Channel Version Arthur Shieh 02 24 2003 Adamcar Tseng MS02 8bit version n EUO DMEMUMMMMUMMMUMEMM MEUM UMUMEMMUMUME
Download Pdf Manuals
Related Search
Related Contents
MANUAL DO USUÁRIO FIREFOX/ICEWEASEL Owners Manual Bushranger BRC40 Chipper Couleur Falun 12 - Décembre 2011 [pdf 製品安全データシート - バイエル クロップサイエンス TKAL LED FAROL 取扱説明書(PDF版) IPG Commercial Mono Laserjet A3 Datasheet pour créer la meilleure solution de mur d`images BioAccessIP Copyright © All rights reserved.
Failed to retrieve file