background image

Parallel Port C Reference Code

A-14

printf (”MySleep (0) consumes %d ticks\n”, overhead);

printf (”One Performance Counter tick = %g seconds\n”, Frequency);

printf (”To wait ten usec, wait for %g ticks\n”, (TEN_USEC/Frequency));

#endif

overhead = total/CALIBRATE_LOOPS;

*tb = time_base;

*ovrhd = overhead;

return_priority=SetPriorityClass(GetCurrentProcess(),NORMAL_PRIOR-

ITY_CLASS);

return(time_base);

}

// This routine can be used to insert a certain amount of delay in micro-
   seconds

void MySleep(unsigned int sleep_time)

{

LARGE_INTEGER PerfCount1, PerfCount2, goal;

int return_priority;

QueryPerformanceCounter(&PerfCount1);

goal.QuadPart = PerfCount1.Qu sleep_time;

do

{

QueryPerformanceCounter(&PerfCount2);

} while (PerfCount2.QuadPart < goal.QuadPart);

return_priority=SetPriorityClass(GetCurrentProcess(),NORMAL_PRIOR-

ITY_CLASS);

}

// RESET the device

void DeviceReset()  {

int control;

control=_inp(2);

_outp(2,control & 0xFB);

Sleep(10);

control=_inp(2);

_outp(2,control | 0x04);

control=_inp(2);

}

// Set the parallel port in the ECP mode

void setECP()  {

_outp(0x402,0x20);

}

Summary of Contents for MSP53C691

Page 1: ...MSP53C691 Speech Synthesizer December 2000 MSDS Speech User s Guide SPSU020 ...

Page 2: ... this warranty Specific testing of all parameters of each device is not necessarily performed except those mandated by government requirements Customers are responsible for their applications using TI components In order to minimize risks associated with the customer s applications adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards ...

Page 3: ...ode development tools and customer information How to Use This Manual This document contains the following chapters Chapter 1 Introduction Chapter 2 MSP53C691 Hardware Description Chapter 3 MSP53C691 Software Description Chapter 4 MSP53C691 Timing Considerations Appendix A Designing the Master Microcontroller Software Appendix B FM Synthesis Appendix C Editing Tools and Data Preparation Appendix D...

Page 4: ...on statement describes a situation that could potentially damage your software or equipment The information in a caution is provided for your protection Please read each caution carefully Related Documentation From Texas Instruments SPSS023B Data sheet MSP50C614 SPSU014 User s guide MSP50C614 SPSS028A Data sheet MSP50C604 SPSU014 User s guide MSP50C604 ...

Page 5: ...Software Overview 3 2 3 2 Commands and Data Streams 3 2 3 3 Sequence of Command Codes and Data Streams 3 3 3 3 1 Command Header 3 3 3 3 2 Parameters 3 4 3 3 3 Return Values 3 4 3 4 Command Codes 3 5 3 5 Description of the Command Codes 3 8 3 5 1 Command Header 1 Configure Internal Registers 3 8 3 5 2 Command Header 2 Set Clear I O Ports PD4 Through PD7 3 10 3 5 3 Command Header 3 Read Contents of ...

Page 6: ...Transfer Write 2 6 2 5 MSP53C691 RESET Diagram 2 7 2 6 Device Initialization 2 8 2 7 Oscillator and PLL Connection 2 9 4 1 MSP53C691 Hardware Interface Connection 4 4 A 1 Program Flow for the Master Main Routine A 3 A 2 Program Flow for an ISR Tied to the Falling Edge of OUTRDY A 4 A 3 Program Flow for an ISR Tied to the Falling Edge of INRDY to Play Mixed Mode A 5 A 4 Routine for Sending Data or ...

Page 7: ...scribes the features hardware and software of the MSP53C691 speech synthesizer Topic Page 1 1 Description 1 2 1 2 Features 1 2 1 3 MSP53C691 Device 1 3 1 4 Pin Assignments and Description 1 4 1 5 D A Information 1 6 1 6 Algorithms Supported 1 6 Chapter 1 ...

Page 8: ...tion MELP coding The MSP53C691 is a special program that runs on the MSP50C604 device For more information about the MSP50C604 please refer to the latest version of the MSP50C604 data sheet literature number SPSS28A and to the MSP50x6x User s Guide literature number SPSU014 1 2 Features The device incorporates a wide range of algorithms on one chip This range allows users to choose from low bit ra...

Page 9: ...our bit wide data transfer protocol The MSP53C691 has two status bits and three control bits which control the communication protocol between the master and the slave The MSP53C691 also has one bit data command which differentiates between command or speech data feeding into the slave The MSP53C691 also supports the 8 bit wide data transfer but support for commands is disabled Switching between 4 ...

Page 10: ...is DATA4 in 8 bit mode or DATA COMMAND in 4 bit mode Table 1 1 MSP53C691 Signal Description NAME PIN NO PAD NO I O DESCRIPTION INRDY 6 6 O An output signal from the slave to the microcontroller A low signal indicates that the MSP53C691 is ready to accept data or command A high signal indicates that the MSP53C691 is busy and the microcontroller must not write any data or command to it OUTRDY 5 5 O ...

Page 11: ...or PLL 13 13 O Output of phase lock loop filter Scan Port Control Signals SCANIN 11 11 I Scan port data input SCANOUT 8 8 O Scan port data output SCANCLK 10 10 I Scan port clock SYNC 9 9 I Scan port synchronization TEST 7 7 I C604 test modes NOTE All these pins must be N C DAC Sound Output DACP 47 33 O Digital to analog output 1 that provides direct speaker drive capability DACM 45 31 O Digital to...

Page 12: ...literature number SPSU014 for more information on the D A and amplifier circuit 1 6 Algorithms Supported MELP Data rates range from 1 kbps to 3 5 kbps at an 8 kHz sample rate CELP Data rates can be selected from 3 kbps to 11 2 kbps at an 8 kHz sample rate ADPCM FM frequency modulation for one channel musical instrument synthesis Mix mode one channel FM synthesis with MELP or CELP ...

Page 13: ...ware including interface initial ization and timing Topic Page 2 1 MSP53C691 Interface Overview 2 2 2 2 Microprocessor Interface Description 2 3 2 3 Read Operation by the Master 2 5 2 4 Write Operation by the Master 2 6 2 5 MSP53C691 Device Initialization 2 7 2 6 Microprocessor Interface Timing 2 8 Chapter 2 ...

Page 14: ...DY high at the rising edge of the STROBE pulse Setting INRDY high indicates that the MSP53C691 is not ready to receive any more data When the MSP53C691 is ready to send data to the microcontroller the MSP53C691 sets OUTRDY low The microcontroller responds by setting R W high and then pulsing STROBE high low high The microcontroller latches the data while STROBE is low This informs the slave that t...

Page 15: ...he speech data or command is transferred on lines DATA0 through DATA3 Figure 2 1 shows the interfacing diagram Figure 2 1 MSP53C691 Interfacing Diagram 4 Bit Mode Master MSP53C691 INRDY OUTRDY DATA 0 3 DATA 0 3 4 4 7 kΩ 4 7 kΩ 4 7 kΩ VDD 100 kΩ each VDD RESET DATA COMMAND 100 kΩ R W STROBE Note STROBE Active low strobe signal from microcontroller R W Read write signal from microcontroller RESET Ac...

Page 16: ...C691 Interfacing Diagram 8 Bit Mode Master MSP53C691 INRDY OUTRDY DATA 0 7 DATA 0 7 8 4 7 kΩ 4 7 kΩ 4 7 kΩ VDD 100 kΩ each VDD RESET R W STROBE Note STROBE Active low strobe signal from microcontroller R W Read write signal from microcontroller RESET Active low reset signal from microcontroller INRDY Active low indicates that the MSP53C691 is ready to accept data OUTRDY Active low indicates that t...

Page 17: ... high to indicate a read operation 4 The microcontroller sets STROBE low The data is available on the exter nal data bus at this point 5 The microcontroller reads the data from the bus 6 The microcontroller sets STROBE high The MSP53C691 also pulls OUTRDY high at the rising edge of STROBE 7 The data is taken off from the external data bus after STROBE goes high The microcontroller must latch or re...

Page 18: ...er 2 The microcontroller sets R W low to indicate a write operation 3 The microcontroller puts the data in the external data bus 4 The microcontroller sets STROBE low after the data is valid 5 The microcontroller sets STROBE high after a minimum of 300 ns The MSP53C691 also pulls INRDY high at the rising edge of STROBE 6 The data is latched in the MSP53C691 at the rising edge of STROBE When the mi...

Page 19: ...meter is received by the slave it goes through the rest of the initialization process and pulls INRDY low when the oscillator is stabilized and the slave is ready to receive data command Note If the slave does not receive the oscillator selection command as the first command when INRDY goes low for the first time or if the slave does not receive the subsequent parameters for the oscillator control...

Page 20: ...igure 2 6 for a timing dia gram of the initialization process Figure 2 6 Device Initialization R W DATA 0 3 DATA4 B 0 1 or 0 2 RESET INRDY STROBE 2 6 Microprocessor Interface Timing The MSP53C691 has a self contained clock generation system This flexible clock generation system enables the software to control the clock over a wide frequency range The implementation uses a phase locked loop PLL cir...

Page 21: ...C PLL 3300 pF 22 pF 22 pF 10 MΩ 10 MΩ 32 768 kHz Keep these components as close as possible to the OSCIN OSCOUT and PLL pins a Crystal Oscillator Operation Connections b Resistor Trim Operation Connections MSP50C691 OSCIN OSCOUT PLL R RTO 470 kΩ 1 C PLL 3300 pF Keep these components as close as possible to the OSCIN OSCOUT and PLL pins ...

Page 22: ...2 10 ...

Page 23: ...er overviews the software and describes the commands used to program the MSP53C691 Topic Page 3 1 Software Overview 3 2 3 2 Commands and Data Streams 3 2 3 3 Sequence of Command Codes and Data Streams 3 3 3 4 Command Codes 3 5 3 5 Description of the Command Codes 3 8 Chapter 3 ...

Page 24: ...e DATA4 DATA COMMAND line is always pulled high to differentiate speech data from a command The DATA4 DATA COMMAND line is always pulled low while sending commands to the MSP53C691 In four bit mode commands can be sent to the MSP53C691 at the beginning of a speech file or at any other time while speaking In eight bit mode commands can only be sent to the MSP53C691 at the beginning of each speech f...

Page 25: ...ce of Command Codes and Data Streams The sequence for sending the command codes and data streams is as follows The sequence for the command codes consists of a command header a level 1 and sometimes a level 2 parameter The command header con trols the operation performed by the MSP53C691 Level 1 and level 2 are two levels of command information that further define the command code Each nibble of t...

Page 26: ...at level the volume is being set to that is low medium or high Also if the command header is Configure Internal Registers one nibble command code 0x1 then the level 1 parameter defines which internal register address to write to two nibbles specifying the address of the register The level 2 parameter is the data written to the internal register four nibbles specifying the word to be written in the...

Page 27: ... the FM buffer N denotes the num ber of FM bytes needed to fill up the FM buffer CAUTION The MSP53C691 waits until all of the four nibbles have been sent to the microcontroller If the microcontroller delays in reading the data from the MSP53C691 the speech operation can be interrupted Therefore the microcontroller must read the data as soon as the OUTRDY goes low 3 4 Command Codes The valid comman...

Page 28: ...D7 PD4 PD7 2 N None None Upper four bits for port D Note Configuration of port D4 7 as output is required Read Contents of I O Ports Port address Value 3 N1N2 None N1N2N3N4 Returns the port value Start Speaking 4 1 None None Speak CELP MELP or ADPCM in four bit data transfer 4 2 None None Speak CELP MELP or ADPCM in eight bit data transfer 4 3 None None Test mode 4 4 none None Play FM Music in fou...

Page 29: ...leep see Table 2 3 of SPSU014 8 3 None None Deep sleep see Table 2 3 of SPSU014 Wake up from sleep mode can be performed by putting dummy data in the bus and pulsing STROBE Receive FM Data 9 N None None Receive FM data N number of FM bytes the master is going to send Perform Speed Pitch Shift A 0 N1N2N3N4 None Slow down MELP A 1 N1N2N3N4 None Speed up MELP A 2 N1N2N3N4 None Pitch shift in MELP A 3...

Page 30: ...DATA2 DATA1 DATA0 0 0 0 0 1 3 The MSP53C691 pulls INRDY low again to request level 1 parameters The level 1 parameter that defines the address of the internal register is two nibbles long in this case see the following examples Most significant first nibble Least significant Second nibble X X 4 The master sends the two nibbles back to back in response to the two consecutive lowerings of INRDY Note...

Page 31: ...ts long If there are less than 16 bits to be written to the registers then there should be leading zeroes to make it 16 bits long Example 2 The value to be written to the internal register is 0xA0 then the four nibbles 16 bits are written as 0x00A0 MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 Perform the following write operation by writing the four nibbles 16 bits...

Page 32: ...gh The PD4 7 pins are defined as general purpose I O pins in the MSP53C691 Before sending the command it is necessary to configure the port pins to the appropriate state INPUT or OUTPUT by configuring the internal control registers This command causes the following sequence of events 1 The MSP53C691 pulls INRDY low requesting command or data The master sends the command header 0x2 for toggling I O...

Page 33: ...f the port to be read is two nibbles long This command causes the following sequence of events 1 The MSP53C691 pulls INRDY low to request a command or data 2 The master sends the command header 0x3 to read the port as follows WRITE OPERATION FOR READ CONTENTS OF I O PORTS DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 0 1 1 3 The MSP53C691 pulls INRDY low again to receive the level 1 parameters The ...

Page 34: ...er are sent MSB first LSB last to the microcon troller 6 After receiving the level 1 command parameter port address the MSP53C691 pulls OUTRDY low four times to return the contents of the port to the master Each lowering of OUTRDY transfers a nibble DATA0 DATA3 to the master the first being the most significant nibble CAUTION The MSP53C691 waits until all of the four nibbles have been sent to the ...

Page 35: ...3C691 speaks The command header is one nibble long and is written 0100 as shown in the following table The DATA4 bit is low while sending this nibble WRITE OPERATION FOR START SPEAKING DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 1 0 0 The command header 0100 is followed by a level 1 parameter that is one nibble long and instructs the MSP53C691 to perform the functions defined in the following tab...

Page 36: ...f events takes place while playing CELP MELP or ADPCM in four bit mode 1 The MSP53C691 pulls INRDY low and waits for a command from the master 2 The master sends the command header 0x4 command header for speak ing in four bit mode on the data bus Note that writing 0x04 to the data bus ensures that the DATA4 line is low indicating that value on data lines DATA0 DATA3 is a command Most Significant D...

Page 37: ...starts sending a command then it must send all the parameters of the command back to back in re sponse to each lowering of INRDY before reverting back to sending the rest of the speech file data again 9 After sending the last nibble of speech data the master can send dummy data 0xFF to the slave in response to each consecutive lowering of INRDY until the slave detects the end of speech data 10 Whe...

Page 38: ...er to indicate the eight bit transfer mode for CELP MELP or ADPCM as follows Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 0 1 0 Level 1 parameter sent 5 The MSP53C691 interprets the command and initializes itself to get ready to speak 6 The MSP53C691 pulls INRDY low indicating that it is ready to receive speech data 7 The master can now start sending speech data from a file in res...

Page 39: ... a certain mode of data transfer is se lected four bit or eight bit the first few bytes of the speech file set up the MSP53C691 to play the speech file at the proper speed for the synthesizer algorithm After the speech file is finished the MSP53C691 goes back to run ning at 8 MIPS 3 5 4 3 Test Mode If the test mode is selected data is transferred to and from the MSP53C691 one nibble at a time The ...

Page 40: ...ising edge of STROBE and the MSP53C691 pulls INRDY high Note that the data is sent on DATA0 DATA3 lines only Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 X X X X X First nibble sent 8 When the data is latched into the MSP53C691 the MSP53C691 pulls OUTRDY low 9 The master then must pull R W high and pull STROBE low 10 The master then must read the data from data lines DATA4 DATA7 Note ...

Page 41: ...d from the mas ter 2 The master sends the command header 0x04 to the MSP53C691 Note that writing 0x04 to the data bus ensures that the DATA4 line is low indicat ing that the value on data lines DATA0 DATA3 is a command Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 1 0 0 First command header sent 3 After receiving the header the MSP53C691 pulls INRDY low to expect the level 1 parame...

Page 42: ... 1 X X X X First nibble sent 1 X X X X Second through X nibbles sent Least Significant 1 X X X X Last 24X2 48th nibble sent Note It is very important to note that the master must send the exact number of FM data bytes initially requested by the MSP53C691 while filling up the buffer If the master has finished sending the exact number of FM data bytes as requested by the MSP53C691 to initially fill ...

Page 43: ...d 9 as a command 0x09 letting the MSP53C691 know that master is going to send FM data Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 1 0 0 1 Command header sent 14 After receiving the 9 command the MSP53C691 lowers INRDY again In response the master must send another nibble as level 1 parameter letting the MSP53C691 know how many bytes of FM data it is going to send This number must b...

Page 44: ...ding a total of four nibbles 0 0 5 and 5 if the speaking of the phrase was successful 19 Then INRDY goes low again indicating that the MSP53C691 is ready to receive a new command 3 5 4 5 Playing Mixed Mode in 4 Bit Transfer Mode In mixed mode the single channel FM is played in the background and CELP MELP is spoken in the foreground The MSP53C691 can play mixed mode in four bit transfer mode This ...

Page 45: ... The master must start sending the CELP MELP data to the MSP53C691 from the speech file The MSP53C691 first fills up the buffer with the CELP MELP data before starting to speak the phrase The master must send the CELP MELP to the MSP53C691 in response to each INRDY low to fill up the buffer The buffer to store CELP MELP data in the MSP53C691 is 68 bytes long Note that the DATA4 line must be high w...

Page 46: ... DATA4 line must be high while sending FM indicating that FM data is being sent For instance to send the FM data byte 0x38 to the MSP53C691 the master must put 0x13 on the data bus in response to the lowering of INRDY When the MSP53C691 is ready to receive the next nibble the master puts 0x18 on the data bus Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 1 X X X X First nibble sent 1 X ...

Page 47: ...t Significant DATA LINES DATA3 DATA2 DATA1 DATA0 0 0 0 0 First nibble sent X X X X Second nibble sent 0 0 1 0 Third nibble sent Least Significant 0 0 1 1 Fourth nibble sent 12 The MSP53C691 pulls INRDY low again after sending the four nibbles re questing the FM data from the master 13 In response the master must send 9 as a command 0x09 letting the MSP53C691 know that master is going to send FM da...

Page 48: ...eeds more FM data it pulls OUTRDY low and the process of step 7 is repeated Note If the master starts sending a command it must send all the nibbles of the command back to back before starting to send CELP MELP data or respond ing to an FM request 17 If the master has sent the last nibble of a file to the MSP53C691 buffer then it can send dummy commands 0x00 in response to INRDY low if it is not s...

Page 49: ...The master must send the speech data as long as the INRDY is being pulled low When the buffer is full the MSP53C691 pulls OUTRDY low to request for more FM data Note It is very important that the master sends all the speech data to fill up the buff er as fast as possible in order to avoid interruption in the playing of FM Most Significant DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 1 X X X X First ni...

Page 50: ...the CELP MELP files have ended the MSP53C691 sends four more nibbles 0 0 5 and 5 to the master to indicate that the playing for mixed mode has ended 31 After that INRDY goes low indicating that the MSP53C691 is ready for a new command Note The master cannot restart a new FM file after an FM file has finished playing while a speech file is in progress However the master can issue a new com mand to ...

Page 51: ...its DAC pins 3 5 5 Command Header 5 Stop Speaking The MSP53C691 can stop speaking at any time while speaking either CELP MELP only in four bit mode playing FM only in four bit mode or speaking both CELP MELP and FM in mixed mode The sequence of events for stopping speaking while playing CELP MELP or FM only is as follows 1 The MSP53C691 pulls INRDY low while speaking a phrase requesting a command ...

Page 52: ...a 2 The master sends a command header 0x5 to the MSP53C691 The DATA COMMAND line is pulled low while sending the header to indicate a command DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 1 0 1 Command header set 3 The MSP53C691 pulls INRDY low again requesting the level 1 command 4 The master sends the level 1 command 0x2 to the MSP53C691 if it is ready to stop speaking CELP MELP but must continue...

Page 53: ...aking a phrase or FM or in mixed mode The sequence of events for sending the volume command is as follows 1 The MSP53C691 pulls INRDY low to receive a command or CELP MELP data The master sends the command header 0x6 for volume control DATA LINES DATA4 DATA3 DATA2 DATA1 DATA0 0 0 1 1 0 2 When the command header is latched into the MSP53C691 the MSP53C691 pulls INRDY low again requesting the level ...

Page 54: ...1 DATA0 0 0 0 X X 5 In return the MSP53C691 pulls OUTRDY low to send a nibble back to the master The master reads the nibble from the MSP53C691 The MSP53C691 pulls OUTRDY low again sending a total of four nibbles 0 0 X1 and X2 X1X2 represent the number of empty bytes in the buffer in hexadecimal format 3 5 8 Command Header 8 Initiate Sleep The MSP53C691 can be put into sleep mode when it is not sp...

Page 55: ...M data to the MSP53C691 For detailed description of the command see the Playing Mixed Mode in Four Bit Mode section 3 5 10 Command Header A Perform Speed Shift or Pitch Shift This command changes the speed or the pitch of a file being played in MELP The speed or pitch shift gives a very interesting flavor to the audio quality of MELP See Appendix D Speed and Pitch Shifting in 6xx MELP The sequence...

Page 56: ...questing the first of the four nibbles characterizing the amount of speed or pitch shift needed level 2 command The MSP53C691 pulls INRDY low again three more times after that requesting the remaining three nibbles 5 After all the four nibbles has been received the MSP53C691 changes the pitch or speed of the speech file as requested 6 After that the MSP53C691 pulls INRDY low again to request anoth...

Page 57: ...P53C691 Timing Considerations MSP53C691 Timing Considerations This chapter discusses general timing constrains and waveforms Topic Page 4 1 General Constraints 4 2 4 2 MSP53C391 Timing Waveforms 4 3 Chapter 4 ...

Page 58: ...or most efficient data transfer A polling method can be used to find the status of the INRDY and OUTRDY pins however it is not a suggested method for mix mode operation or for playing high bit rate CELP or ADPCM The master can send commands to the slave in four bit mode while speaking However this feature makes the precise characterization of timing more diffi cult because of the widely varied com...

Page 59: ...ated before starting to send speech data again It is recommended that the master send the commands at the even bound ary of the speech nibbles Use pullup resistors in the data bus to keep the data bus from floating Ensure that the master to the slave have a common ground connection 4 2 MSP53C391 Timing Waveforms The data request frequency of the slave depends upon the bit rate and the type of synt...

Page 60: ...ransfer for mixed mode for speaking CELP and FM is 30 5 µS The average time between INRDY low for speech data transfer mixed mode for speaking MELP and FM is 91 5 µS NOTE The time between INRDY low is less than the stated average while a command is being transferred The parallel port MSP53C691 hardware interface connection is shown in Fig ure 4 1 Figure 4 1 MSP53C691 Hardware Interface Connection ...

Page 61: ...ter Microcontroller Software Designing the Master Microcontroller Software This chapter covers the master microcontroller software design Topic Page A 1 Master Code Flow A 2 A 2 Parallel Port C Reference Code A 9 Appendix A ...

Page 62: ...g and initializing the slave It is also responsible for selecting the oscillator by sending the oscillator selection command The main loop can be set up to send the first command along with its parameter Typically this first command would be a SPEAK command The main loop can then go into an infinite loop while waiting for an interrupt to send or receive data The ISR triggered by the falling edge o...

Page 63: ...gning the Master Microcontroller Software Figure A 1 Program Flow for the Master Main Routine Start Pull Reset Low Pull Reset High Send 0xB Using Crystal Trim Send 0x1 Send 0x2 Enable Inready Outready Interrupt Mainloop Yes No ...

Page 64: ... 2 Program Flow for an ISR Tied to the Falling Edge of OUTRDY Start Raise R W Lower Strobe Read Value From Databus and Store It Is This the Fourth Nibble Raise Strobe End Interpret Return Value and Set Flags for Acting on It No Yes ...

Page 65: ...rt Need to Send Has Slave Been Put to Sleep Need to Send Command Volume Port I O etc Need to Send FM Need to Restart Speech Send Speech Nibble End Send 0x46 Need to Send 9x Send Command Nibble Send FM Nibble Send 9x Send 4 First Wakeup Condition Reached Send 0x0 No No No No No Yes Yes Yes Yes No Yes No Yes Command Header 4 and Level 1 Paremeter 5 and Then 5 ...

Page 66: ...Master Code Flow A 6 Figure A 4 Routine for Sending Data or Commands to the Slave Start Lower R W Place Data on Databus Lower Strobe Raise Strobe Stop Driving Raise R W End Data Bus ...

Page 67: ... only is a subset of playing mixed mode The previous flowcharts handle speech only The simplified ISR associated with INRDY low is shown in Figure A 5 Figure A 5 Program Flow for ISR Tied to the Falling Edge of INRDY to Play CELP MELP Only Start Need to Send 4 Has Slave Been Put to Sleep Need to Send Command Volume Port I O etc End Send Command Nibble Send 4 Wakeup Condition Reached Send 0x0 No Ye...

Page 68: ...Connect parallel port hardware with the MSP53C691 as described Also provide power and oscillator circuit to the MSP53C691 and connect a speaker or audio amplifier to the DAC pins of the MSP53C691 There are two low cost hardware boards avail able through authorized TI distributors These boards allow users to con nect their PC s parallel port to the MSP53C691 Details about the hard ware boards the c...

Page 69: ...ADPCM 8 Define bit masks for R W and CE define RW 0x02 define CE 0x01 Define masks for use when writing The mnemonics have two parts The first part gives the state of R W and the second gives the state of CE They are masked and inverted to produce the desired values when used with the parallel port control register define RWHCEH 0xFB define RWHCEL 0xFB CE define RWLCEH 0xFB RW define RWLCEL 0xFB R...

Page 70: ... off with RW and CE both high calibrate timebasecount overheadcount calibrate the timecount wait30us 3 timebasecount overheadcount timeout 500000 Check the number of arguments given if argc 2 printf Usage 604pc binspeechfile n exit 0 strcpy binfname argv argc 1 Open the file if inbin fopen binfname rb NULL printf Error opening binary file s n binfname exit 0 Read the number of bytes from the file ...

Page 71: ...CurrentProcess NORMAL_PRIORITY_CLASS return 0 int speak int i hi int stat short int OUTRDY1 OUTRDY2 OUTRDY3 OUTRDY4 hi 1 Wait for INRDY to go low loop here as long as INRDY is high do stat _inp ParStatus 0x30 while stat 0x10 0x10 INRDY low OUTRDY high sendbyte CMDSPEAK send speak command Wait for INRDY to go low loop here as long as INRDY is high do stat _inp ParStatus 0x30 while stat 0x10 0x10 IN...

Page 72: ...TRDY2 OUTRDY1 OUTRDY1 4 Wait for OUTRDY to go low again do stat _inp ParStatus 0x30 while stat 0x20 0x0 OUTRDY3 recvbyte read 3rd nibble OUTRDY1 OUTRDY1 OUTRDY3 OUTRDY1 OUTRDY1 4 Wait for OUTRDY to go low again do stat _inp ParStatus 0x30 while stat 0x20 0x0 OUTRDY4 recvbyte read 4th nibble OUTRDY1 OUTRDY1 OUTRDY4 printf status returned x n OUTRDY1 break Check if INRDY is low if stat 0x10 0x10 if ...

Page 73: ...the MySleep routine doesn t have much use for this code but can be used with very fast PC to insert delays for microsecond precision int calibrate int tb int ovrhd LARGE_INTEGER PerfCount1 PerfCount2 PerfFreq double Frequency unsigned int time_base overhead total i return_priority QueryPerformanceFrequency PerfFreq if PerfFreq QuadPart 0 printf This machine does not support high performance counte...

Page 74: ...f delay in micro seconds void MySleep unsigned int sleep_time LARGE_INTEGER PerfCount1 PerfCount2 goal int return_priority QueryPerformanceCounter PerfCount1 goal QuadPart PerfCount1 QuadPart sleep_time do QueryPerformanceCounter PerfCount2 while PerfCount2 QuadPart goal QuadPart return_priority SetPriorityClass GetCurrentProcess NORMAL_PRIOR ITY_CLASS RESET the device void DeviceReset int control...

Page 75: ...ynthesis This appendix discusses FM synthesis Topic Page B 1 FM Synthesis Overview B 2 B 2 FM Synthesis Format and Data Preparation B 2 B 3 Data Preparation of FM Synthesis B 6 B 4 FM II Constant Definitions B 9 Appendix B ...

Page 76: ... or more mo difying parameters For example to transpose a section of a song up by a semitone the following command would be written BYTE RTRNS 1 In this example RTRNS is the command and 1 is the modifying parameter As another example to play a note use the following command BYTE C1 n4 n4 127 This example commands the synthesizer to play a C note for a quarter note duration at the maximum volume Th...

Page 77: ...s for BPM are defined in the pro gramming code included at the end of this appendix An example is bpm62 which indicates 62 beats per minute TimeSig defines the time signature of the songs TS44 sets the time signa ture to 4 4 time EnvelopeLen defines the length of the note envelope ENVOK sets the envelope length to normal i e lasting for a whole note B 2 4 Transposition Two commands are available f...

Page 78: ...desirable to incrementally change the texture of the sound quality in the song This can be done by changing the modulation index to get a more or less brighter tonal quality This can be done by using the following commands BYTE MIX1 Set the modulation index scale to 1 BYTE MIX2 Set the modulation index scale to 2 BYTE MIX3 Set the modulation index scale to 3 BYTE MIX4 Set the modulation index scal...

Page 79: ... Transpose Down an Octave ATRANS Transpose command NUM Set the channel transpose to a signed offset Transpose Format BYTE RTRNS NUM Example BYTE RTRNS 7 Add 7 Semitones to the channel s transpose offset RTRNS Transpose command NUM Add a signed offset to the channel transpose value Fade control Format BYTE FADER InitialFaderValue FaderInc Example BYTE FADER f100p 32 word FADER Fader command InitalF...

Page 80: ...the MCU program for FM synthesis B 3 1 MD2FM Software MD2FM converts a MIDI format file to FM data accepted by MSP53C691 With this routine users can compose or translate music base on the MIDI format This routine runs under the DOS environment and uses the following syntax md2fm songt1 songt1_1 c1 t1 input songt1 mid MIDI format output songt1_1 inc FM format c1 channel 1 to be decoded t1 track 1 t...

Page 81: ...S2 equ 128 2 FM brass tone 2 fast attack PatchBRS3 equ 128 3 FM brass tone 3 slow attack PatchTRM1 equ 128 4 FM brass tone trombone 1 slow attack PatchTRM2 equ 128 5 FM brass tone trombone 2 med slow attack PatchCLR1 equ 128 6 FM clarinet tone 1 PatchCLR2 equ 128 7 FM clarinet tone 2 brighter than CLR1 PatchMT1a equ 128 8 FM metallic tone 1a For example the line defining the instruments should be ...

Page 82: ... INC file This file can be supplied to the MSP53C691 as an FM file Note If you need an ASCII representation of the binary FM file run the executable BINBYTE EXEwith the binary file as input The executable creates an output file which is an ASCII representations of the binary file This ASCII file can be included in your microcontroller assembly code if the assembler of your microcontroller converts...

Page 83: ...13 equ 2000 10 0000 0000 0000 Initialization defaults default gain value MAXGAIN equ 24 default value also MAX do not exceed default Master Modulation Index Scale values DEFSCLMIX equ 96 like a tone control Song interval delay values ONESEC equ 1 10 TWOSECS equ 2 10 THREESECS equ 3 10 FOURSECS equ 4 10 FIVESECS equ 5 10 TENSECS equ 10 10 FM channel Automated Fader calculations Coded as BYTE FADER ...

Page 84: ... C0 equ 0 Cs0 equ 1 Db0 equ 1 D0 equ 2 Ds0 equ 3 Eb0 equ 3 E0 equ 4 F0 equ 5 Fs0 equ 6 Gb0 equ 6 G0 equ 7 Gs0 equ 8 Ab0 equ 8 A0 equ 9 As0 equ 10 Bb0 equ 10 B0 equ 11 C1 equ 12 Cs1 equ 13 Db1 equ 13 D1 equ 14 Ds1 equ 15 Eb1 equ 15 E1 equ 16 F1 equ 17 Fs1 equ 18 Gb1 equ 18 G1 equ 19 Gs1 equ 20 Ab1 equ 20 A1 equ 21 As1 equ 22 Bb1 equ 22 B1 equ 23 C2 equ 24 Cs2 equ 25 Db2 equ 25 D2 equ 26 Ds2 equ 27 ...

Page 85: ...equ 37 D3 equ 38 Ds3 equ 39 Eb3 equ 39 E3 equ 40 F3 equ 41 Fs3 equ 42 Gb3 equ 42 G3 equ 43 Gs3 equ 44 Ab3 equ 44 A3 equ 45 As3 equ 46 Bb3 equ 46 B3 equ 47 C4 equ 48 Cs4 equ 49 Db4 equ 49 D4 equ 50 Ds4 equ 51 Eb4 equ 51 E4 equ 52 F4 equ 53 Fs4 equ 54 Gb4 equ 54 G4 equ 55 Gs4 equ 56 Ab4 equ 56 A4 equ 57 As4 equ 58 Bb4 equ 58 B4 equ 59 C5 equ 60 Cs5 equ 61 Db5 equ 61 D5 equ 62 Ds5 equ 63 ...

Page 86: ...equ 128 12 FM Metallic tone 2b PatchMT2c equ 128 13 FM Metallic tone 2c PatchMT3a equ 128 14 FM Metallic tone 3a PatchMT3b equ 128 15 FM Metallic tone 3b PatchMT3c equ 128 16 FM Metallic tone 3c PatchMT4a equ 128 17 FM Metallic tone 4a PatchMT4b equ 128 18 FM Metallic tone 4b PatchMT4c equ 128 19 FM Metallic tone 4c PatchMT5a equ 128 20 FM Metallic tone 5a PatchMT5b equ 128 21 FM Metallic tone 5b ...

Page 87: ...u 128 54 FM Oboe 1 PatchHRN1 equ 128 55 FM French Horn 1 PatchBSN1 equ 128 56 FM Bassoon 1 PatchTBA1 equ 128 57 FM Tuba 1 PatchTRB1 equ 128 58 FM Trombone 1 PatchTPT1 equ 128 59 FM Trumpet 1 PatchVLN1 equ 128 60 FM Violin 1 PatchEBS1 equ 128 61 FM Electric Bass 1 Max of patch codes is 64 CONTROL equ 80 is NOTE data are commands and controls Codes 80 to BF are reserved for Patch Codes packed BYTE P...

Page 88: ...y 4X BEGMULTI5 equ FC Control code for Start MULTI Play 5X BEGMULTI6 equ FD Control code for Start MULTI Play 6X BEGMULTI7 equ FE Control code for Start MULTI Play 7X BEGMULTI8 equ FF Control code for Start MULTI Play 8X Tempo values as 1 4 notes Beats Per Minute 12 Clocks per Beat Index MyPsc Exact_BPM Beat_Prd Exact_Tmr Timer BPM61 equ 0 20 61 035156 0 983040 196 608000 197 BPM67 equ 1 22 67 138...

Page 89: ...6 865234 0 209157 41 831489 42 BPM293 equ 38 96 292 968750 0 204800 40 960000 41 BPM299 equ 39 98 299 072266 0 200620 40 124082 40 BPM305 equ 40 100 305 175781 0 196608 39 321600 39 Time Signature constants as Negative UP Counter values Qnote equ 12 12 clocks per 1 4 note 1 4 1 Beat TS24 equ 2 Qnote 2 beats per Measure TS34 equ 3 Qnote 3 beats per Measure TS44 equ 4 Qnote 4 beats per Measure TS54 ...

Page 90: ...6 equ 16 make Envelope length Longer by 16 ENVL18 equ 18 make Envelope length Longer by 18 ENVL20 equ 20 make Envelope length Longer by 20 Musical Note Time value definitions FM ngrc equ 1 Grace Note use with n8m etc n163 equ 2 1 16 note triplet n16 equ 3 1 16 note n83 equ 4 1 8 note triplet n8m equ 5 1 8 note off beat use for Shuffle feel n8 equ 6 1 8 note n8p equ 7 1 8 note on beat use for Shuff...

Page 91: ...ation Editing Tools and Data Preparation This appendix discusses the SDS6000 software editing tool and data prepara tion for the MSP53C691 using different algorithms Topic Page C 1 Editing Tools C 2 C 2 Data Preparation C 3 Appendix C ...

Page 92: ...ardware see the developmental tool section in the TI s main web page www ti com for details 2 A personal computer running Windows 95 98 3 One 32 Ω speaker if wanting to connect direct drive with its own enclo sure or an 8 Ω speaker with its own amplifier and enclosure an 8 Ω speaker with its own enclosure if wanting to use the onboard LM386 or the four transistor amplifiers of the hardware Downloa...

Page 93: ...ompressed file Please see the HELP in SDS6000 for details The sound files must start and stop at a level close to zero errors may result otherwise The volume of the sound files must also be adjusted to a peak to peak level around 0 5 V to 0 5 V assume full scale is 1 V to 1 V Clipping may result if the sound file is too loud after the encoding Additionally if the wave file is sampled at a higher r...

Page 94: ...o communicate with the hardware 4 When the software is running select Open a New Project Select the files you want to compress then click the button to select the compression technique you want to use MELP CELP or ADPCM 5 The status of the encoding process is displayed in the messages window You can play the encoded file through your connected audio circuit by right clicking the mouse button on th...

Page 95: ... 3 FM Music can be coded manually or can be converted from MIDI files For manual coding refer to Appendix B for the data format of FM synthesis If the song is composed in MIDI format mid it can be converted to FM by the DOS execut able routine MD2FM EXE Several limitations are imposed on the MIDI files processed by the MD2FM program For details about the process of converting MIDI files into FM fi...

Page 96: ...C 6 ...

Page 97: ... Pitch and Speed Shifting for 6xx MELP Pitch and Speed Shifting for 6xx MELP This appendix discusses MELP speech pitch and speed shifting Topic Page D 1 Pitch Shifting D 2 D 2 Speed Shifting D 3 Appendix D ...

Page 98: ...allow Thus if the pitch is 10 and the pitch shift bias is 11 10 11 1 the pitch is decoded using a table offset of 0 The same applies to the upper bound length of the pitch decoding table Since pitch shifting affects the pitch every time a frame is decoded it can be performed once every frame For uncompressed speech new changes to the pitch can occur every 15 ms For compressed speech new pitch chan...

Page 99: ...tion of the increase or decrease in speed is determined by the num ber of skipped or repeated subframes The 6xx MELP algorithm only allows lengthening the speech by two repeat every other subframe or to reducing it by half skip every other subframe In other words the fastest increase in speed is twice as fast as the normal speech and the slowest decrease in speed is twice as slow as normal Use the...

Page 100: ...er can range from 0x2 to 0x7FFF While in creasing the speed the parameter 0x2 represents the highest speed Similar ly while decreasing the speed the parameter 0x2 represents the slowest speed To detect noticeable difference in the speed the range of the second parameter must be between 0x2 and 0x20 To increase the speed by 100 use the following sequence of commands in cluding the parameter A 1 0 0...

Page 101: ...ording techniques and equipment and input sig nal processing Topic Page E 1 Voice Talent Selection E 2 E 2 Auditions E 2 E 3 Speech Rate and Pausing E 4 E 4 Reference Numbers E 4 E 5 Recording E 4 E 6 Preprocessing the Input Signal E 6 E 7 Processing Speech on the SDS6000 E 7 E 8 Editing Speech on the SDS6000 E 7 E 9 Hardware Considerations in Product Design E 10 Appendix E ...

Page 102: ...ycles This voice quality is used in Arabic and Swedish speech sounds and it often occurs in English at the end of an utterance Dialect The voice talent must be a native speaker of the standard dialect of a given language that is the dialect spoken by anchor persons reporting the news on radio or television Examples of standard dialects are the London dialect of British English the Madrid dialect o...

Page 103: ...e the rate of vocal fold vibration decreases as an utterance is terminated resulting in partial unvoicing and vocal glottal fry which sounds like a squeaky door opening or closing The first sound in utterance initial position especially a voiced stop b d g as in ball doll and gall may also be distorted Put a neutral vowel before the first sound in the utterance such as a ball uh a doll uh a gall u...

Page 104: ...irection before the voice talent says each item The voice talent should say whatever is placed within quotation marks or on the recording script E 5 Recording Sound Booth Recording in a sound booth anechoic chamber is essential for high quality synthetic speech The larger the sound booth the better Eliminate any sources of ventilation or environmental noise Prevent reverberation by making sure tha...

Page 105: ...nal during recording anywhere from around 3 dB to 12 dB depending on the con tent to be recorded Do not apply equalization filtering etc at this point since the aim is to get a very clean unclipped signal Voice Talent Direction The voice talent must be instructed to avoid extra neous noise such as page shuffling scratching etc while speaking Ask the voice talent to practice reading the script whil...

Page 106: ...e quality of the results depends upon the quality of the filter Editing the Wave File Border editing i e deleting silence at the beginning and end of the signal must also be performed with a wave editing tool The following editing steps can be applied Remove artifacts such as transients etc and extraneous noise from the signal Replace unacceptable speech sounds such as slurred or distorted sounds ...

Page 107: ...r a large portion of the file s you have some options J Make selective amplitude adjustments J Use a little graphic equalization on the WAV file J Ask the voice talent to adjust his her voice quality J Use a different voice talent J Change some aspect s of the recording setup such as microphone microphone placement etc E 8 Editing Speech on the SDS6000 E 8 1 General Rules for Speech Editing Observ...

Page 108: ...especially with a high degree of compression Three parameters can be edited in the text editor for coded MELP Gain Energy or A0 value refers to the loudness of the signal Pitch F0 or T0 value refers to the frequency of a sound Voicing BPVC Band pass voicing refers to the degree of voicing in a frame A value of 1 or 2 is close to unvoiced 0 while 3 is moderate voicing and 4 or 5 are voiced Also Sen...

Page 109: ...d The commands in the Modify menu can also be used Zero Out Linear Interpolation Change and Compress The commands Select Copy Cut and Paste are also available for editing MELP All of these commands work just like they do for LPC editing For uncoded MELP the text editor contains the following parameters Pitch F0 or T0 value refers to the frequency of a sound Gain Energy or A0 value refers to the lo...

Page 110: ... the complete system Each speaker has unique characteristics for example its frequency response and it is important to understand how a speaker sounds in your product The speaker characteristics are likely to change from speaker to speaker during the manufacturing process We recommend being proactive in the speaker selection for your product and not to change the speaker without a careful evaluati...

Page 111: ...ples into a continuous representation of the analog signal The MSP53C691 has the capability to directly drive a 32 Ω speaker The speaker is connected between two push pull outputs Each of these outputs can toggle between ground and the supply voltage The DAC circuit controls when the outputs toggle When the sample is zero both outputs are in the same state If the sample is positive the output that...

Page 112: ... used The cost and availability of the nonpolar capacitor may be the major disadvantage to this circuit The LM386 is another common audio amplifier used with TI speech devices Implementing a good low pass filter and analog volume control is easy and cost effective when using this audio amplifier E 9 4 Impact of Batteries on Speech Quality All batteries have an associated source impedance This impe...

Reviews: