UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Warnsis ii : A warning signal identification system for the hard of hearing Dotto, Kim 1995

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-ubc_1995-0214.pdf [ 5.92MB ]
Metadata
JSON: 831-1.0064798.json
JSON-LD: 831-1.0064798-ld.json
RDF/XML (Pretty): 831-1.0064798-rdf.xml
RDF/JSON: 831-1.0064798-rdf.json
Turtle: 831-1.0064798-turtle.txt
N-Triples: 831-1.0064798-rdf-ntriples.txt
Original Record: 831-1.0064798-source.json
Full Text
831-1.0064798-fulltext.txt
Citation
831-1.0064798.ris

Full Text

WARNSIS II A WARNING SIGNAL IDENTIFICATION S Y S T E M FOR T H E HARD OF HEARING Kim Dotto, P.Eng. B.Sc. University of British Columbia, 1979 B A . S c . University of British Columbia, 1982 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF T H E REQUIREMENTS FOR T H E D E G R E E OF M A S T E R OF APPLIED SCIENCE in T H E F A C U L T Y OF G R A D U A T E STUDIES D E P A R T M E N T OF ELECTRICAL ENGINEERING We accept this thesis as conforming to the requirecr-SFandard  T H E UNIVERSITY OF BRITISH C O L U M B I A March 22 1995 © Kim Dotto, P.Eng.,  1995  In presenting this thesis in partial fulfilment  of the requirements for an advanced  degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department  or  by  his or  her  representatives.  It  is understood that  copying or  publication of this thesis for financial gain shall not be allowed without my written permission.  Department of The University of British Columbia Vancouver, Canada Date  DE-6 (2/88)  Abstract  Having examined a number of common warning signals such a telephone rings, microwave oven alarms and continuous tone alarms, a software method, eliminating the need for specialized hardware, was developed for both recognizing known warning signals and learning new signals. The method, called WARNSIS II was first implemented on a PC-compatible computer using a Creative Labs signal acquisition board which provided a base for graphical signal analysis and for the development of algorithms. The algorithms were also implemented on the Texas Instruments TMS320C30 Evaluation Module (EVM) digital signal processing board to demonstrate that the algorithms can be easily ported to smaller, more cost effective platforms.  The WARNSIS II system operates in two modes: learning and recognition. In the learning mode a template for a signal is constructed by analysing the signal for spectral and temporal information. The frequency at which the maximum peak in the signal's spectral energy occurs is determined and this value is saved in a template. The duration of the signal burst, as well as the interval time between signal bursts for repetitive signals, are determined and are also saved in the template. In the recognition mode, the spectrum of the incoming real-time signal is analysed to determine if any of its spectral components match those found in the template. If a match is found, timing information is then applied to rule out transients which would generate false alarms  The system has demonstrated the ability to recognize warning signals in high background noise environments and to correctly identify multiple overlapping warning signals.  ii  Table of Contents  Abstract  "  List of Tables  • • vi  List of Figures  vii  List of Abbreviations  viii  Acknowledgement  i  1.0 Introduction  1  1.1 Background  x  1  1.1.1 Threshold Detectors  2  1.1.2 Hard-wired / Dedicated Devices  3  1.1.3 Hearing Ear Dogs  5  2.0 The WARNSIS Project 2.1 WARNSIS I 2.1.1 WARNSIS I Recognition Scheme 2.1.2 Evaluation of WARNSIS I  6 7 8 10  2.1.2.1 Recognition Scheme  10  2.1.2.2 Hardware Implementation  12  2.2 WARNSIS II Objectives  12  iii  3.0 Sound and Signal Recognition Schemes 3.1 Speech Recognition Schemes  13 13  3.1.1 Dynamic Time Warping  13  3.1.2 Hidden Markov Modelling  14  3.2 Warning Signal Characteristics vs Voice/Word Characteristics  4.0 Spectral Analysis Methods 4.1 WARNSIS II Spectral Analysis 4.1.1 Fast Fourier Transform  15  22 23 ....24  4.1.1.1 FFT and Spectral Power Estimation  26  4:1.1.2 Data Windowing  28  4.1.1.3 Maximum Entropy Method  31  4.1.2 Discrete Hartley Transform  33  4.1.3 Discrete Cosine Transform  34  4.1.4 Finite and Infinite Impulse Response Filters  34  4.1.5 Wavelet Transform  35  4.2 Evaluation of Computational Methods for Spectral Analysis  5.0 WARNSIS II Design  37  38  5.1 Overview  38  5.2 Learning Mode  38  5.3 Recognition Mode  43  6.0 WARNSIS II Implementation and Evaluation 6.1 PC Based System 6.1.1 Results of PC Based Implementation  55 55 57  iv  6.1.2 Other Results 6.1.2.1 8 Bit vs 16 Bit Digitization  67 68  6.1.2.2 FFT Size, Frequency Resolution and Sampling Rate . . . 69 6.1.2.3 Sampling Window Effects  70  6.1.2.4 Speed Considerations  71  6.2 TMS320C30 Based System  76  6.2.1 Program Size  78  6.2.2 Results of DSP Based Implementation  78  6.2.2.1 Performance Measurements  7.0 Conclusions and Recommendations 7.1 Future Work  79  88 . 89  7.1.1 Improved Learning Mode  90  7.1.2 Improved Recognition Mode  91  7.1.3 Additional Features  91  7.2 Other Applications  92  References  94  Appendices  97  Appendix-A WARNSIS IITMS320C30 Assembly Language Code  97  v  List of Tables  6.1  Single Warning Signal vs Noise Sound Level Measurements  84  6.2  Dual Warning Signal vs Noise Sound Level Measurements  85  vi  List of Figures  3.1  "Hello" Spectral Analysis  17  3.2  Electronic Ringing Signal Spectral Analysis  18  3.3  Mechanical Ringing Signal Spectral Analysis  19  3.4  Microwave Alarm Signal Spectral Analysis  20  4.1  FFT Bit Reversal Recombination  27  4.2  Parzen, Welch & Hanning Window Functions  30  4.3  Leakage for Parzen, Welch & Hanning Window Functions  32  5.1  Short Time Average Absolute Amplitude (STAAA) for Burst Determination  40  5.2  Flowchart for WARNSIS II Learning Mode Algorithm  44  5.3  Typical Warning and Noise Signal Power Spectra  48  5.4  Flowchart for WARNSIS II Recognition Mode Algorithm  54  6.1  Results of Learning Mode for Electronic Telephone Ringing Signal....  58  6.2  Composite and Individual Warning Signal Analyses  61  6.3  Effect of Sampling Window Function on Power Leakage  72  6.4  Effect of Sampling Window Function, Background Noise Power Spectrum  74  6.5  Performance Test Measurement Setup  80  6.6  Panasonic PD-2300 Electronic Ringing Signal Spectral Analysis  81  6.7  2200Hz Continuous Tone Spectral Analysis  82  6.8  Test Background Noise Spectral Analysis  86  6.9  Combined Warning Signal A and B Spectral Analysis  87  vii  List of Abbreviations  AIC  Analog Interface Circuit  DAT  Dynamic Amplitude Threshold  DCT  Discrete Cosine Transform  DFT  Discrete Fourier Transform  DHT  Discrete Hartley Transform  DSP  Digital Signal Processor  DST  Discrete Sine Transform  DTW  Dynamic Time Warping  EVM  Evaluation Module  FFT  Fast Fourier Transform  FHT  Fast Hartley Transform  HMM  Hidden Markov Modelling  MBD  Minimum Burst Duration  MEM  Maximum Entropy Method  MIAT  Maximum Inter-Arrival Time  PC  Personal Computer  STAAA  Short Time Average Absolute Amplitude  STFT  Short Time Fourier Transform  VOC  Creative Voice File  WARNSIS WT  -  Warning Signal Identification System Wavelet Transform  Acknowledgement  I would like to thank my supervisor, Dr. C A . Laszlo for his encouragement and advice during this project, and for his belief in my abilities from the start which allowed my to undertake this project. I would also like to thank my wife Patricia for her support and understanding and my children, Alexander and Laura for their unending diversion.  This project was funded by NSERC Operating Grant OGP0006701  ix  Chapter 1  1.0 Introduction 1.1 Background  In everyday life we are constantly bombarded with information about our environment. Although humans are visually oriented, much of the important information, that which requires immediate attention, is transmitted by sound. Warning sounds such bells and buzzers are part of our everyday life both waking and asleep. Unlike visual information, which is not processed while asleep, auditory information is processed by the ear and brain continuously.  Approximately eight percent of the general population suffers from some level of hearing impairment. Approximately 70 out of every 1000 people are "hard of hearing", another 6 out of every 1000 are classified as late deafened adults, and 1 out of every 1000 are deaf [1,2].  Hard of hearing people are those who use speech as their main method of  communication but have some impairment in their ability to hear. Such impairment may range from mild to profound. Late-deafened adults are those who have suddenly become deaf later in life usually due to accident, illness or medication related causes. This group still uses speech, but also must rely on speech reading or written aids such as transcription to understand what others say. Some late deafened adults also sign as a means of communication. People who are deaf from birth usually use signing as their main method of communication. Signing is a distinct language apart from any written or spoken language and promotes an independent culture just as the use of English or French does for speakers of those languages. Those who consider themselves to belong to this cultural group define themselves as Deaf. There are also Oral Deaf people, people who have been deaf from birth or an early age but have been taught to speak, rather than sign as their main method of communication. They may also rely on sign  1  Chapter 1 - Introduction occasionally but they rely on speech and speech reading as their main methods of communication.  Members of all groups are placed at various levels of disadvantage by their hearing loss, depending on the environment or situation. Such disadvantage can even be life-threatening, such as failing to hear a smoke detector, fire or burglar alarm. Even missing a phone call can have serious consequences. To help overcome this disadvantage many devices and approaches have been designed in the past to alert a Deaf or hard of hearing person to the presence of specific warning sounds. These fall into 3 main categories, threshold detectors, hard-wired or dedicated devices and hearing ear dogs[3].  1.1.1 Threshold Detectors  Most warning signals are designed to be heard above a general ambient noise level and, as such, are louder than most other sounds that one might encounter in a given environment. Threshold detectors function by exploiting this fact. They are designed to detect any increase in sound amplitude over a preset limit or set point. This can work reasonably well in an isolated environment where the device is required to identify a single warning sound. It can also be useful when multiple warning signals need to be monitored and all that is required is to alert the user that one of them has occurred without being specific as to which one.  One of the main drawbacks of threshold detectors, however, is that sounds which are louder than the preset limit but originatefromsources other than the alarm or alert will also trigger the detector, giving a false positive indication. For example, a threshold detector set to detect a telephone ring may be erroneously triggered by a doorbell or afirealarm or even the passage of a noisy truck.  2  Chapter 1 - Introduction Another disadvantage of a threshold detector is the need for adjustment when moving it from one location to another. If the detector were set to function correctly when in the same room as the telephone, the amplitude of the sound that reaches the detector if the user moves it to a different room may not be loud enough to trigger the detector. Adjusting the set point to a lower value may not be possible due to a greater ambient noise levels in the new location. The detector would then give a number of false positives that would render the device virtually useless.  Threshold detectors have been designed to operate on signal sources other than sound. For example, detectors for magnetic fields emitted by telephones exist, but the detectors must be located very near the telephone in order to pick up the relatively weak fields generated. This greatly reduces the range and effectiveness of such devices.  Additionally, many newer  telephones do not use electro-mechanical ringers and therefore generate no detectable magnetic fields.  1.1.2 Hard-wired / Dedicated Devices  Hard-wired or dedicated devices can overcome many of the problems found with the threshold detection devices described above. Hard-wired devices are electrically, and often mechanically, connected to the device they are designed to detect. The signalling device may also be hard-wired, although radio-operated remote pagers which use lights or vibration to signal the wearer are becoming popular [4].  For the telephone, rather than listening for an  increase in ambient noise level, the detector is electrically connected to the telephone and monitors the incoming ringing signal from the telephone exchange. When the ringing signal is detected, the device signals the user by triggering the pager or flashing a lamp on and off.  3  Chapter 1 - Introduction  There are three main disadvantages to this method:  i)  a separate detector is required for each device that is being monitored;  ii)  installation requirements can be prohibitive; and  iii)  the devices lack portability.  The detectors for these types of devices are usually designed for a specific piece or type of equipment. For example, it is unlikely that a telephone detector would be suitable for connection to a door bell. In addition, many devices that a hard of hearing person would like to monitor, such as a microwave oven or smoke detector do not have commercially available detectors.  In those cases where a suitable specific detector is available, its installation may require expert assistance, or modification of the monitored equipment. This is both inconvenient and expensive for the user and can be hazardous should the installation be done incorrectly.  Lack of portability is a major drawback for the user with hard-wired devices. People are more mobile now than any time in the past and travel away from the home or office is much more common than ever before. For some jobs, especially at higher levels of responsibility, it is a major requirement of the job. Lack of mobility for the hard of hearing person can be a major impediment to career advancement. Business is more often conducted by phone and facsimile these days than by personal meeting. When travelling, the hard of hearing person will not be able to modify all, if any, of the devices that they would normally rely on at home with hard-wired detectors. Even a simple change of office or building could require significant time and expense to set up.  4  Chapter 1 - Introduction  1.1.3  Hearing Ear Dogs  Like Seeing-Eye-Dogs, Hearing-Ear-Dogs are available for all hearing impaired people. These dogs are very useful, but they are also quite valuable and in short supply. It takes many months of training to prepare a dog and a reasonable "training" period for the recipient as well. In addition, dogs require regular "refresher" training. As training is a lengthy and difficult process, it is often not possible or practical to update the animals skills once the have been placed with the hearing impaired owner.  In addition, just as for Seeing-Eye-Dogs, not all hearing impaired people would be able to utilize such a dog. The hard of hearing person may not physically be able to care for a dog due to age or other disabilities or they may not wish to own a dog. A dog may not be suitable for other reasons such as living arrangements and there is increased cost and difficulties involved in the transportation of the dog when travelling.  5  Chapter 2  2.0  The WARNSIS Project  The objective of the WARNSIS (WARNmg Signal identification System) project is to develop a device that would overcome the problems and deficiencies noted with the devices and solutions described previously. As such, the device:  i)  would be required to reliably recognize warning sounds for hard of hearing and deaf people in the presence of background noise, such as radio music, conversation and machinery;  ii)  must be portable and not require any special connections to the warning signal generating sources;  iii)  must have the ability to not only discriminate between different signals sources but must also have the ability to easily learn and recognize previously unknown signals.  In addition, it is an explicit long-term objective of the project to minimize the cost of manufacture in order to make the device accessible to as many users as possible.  There have been attempts previously to design devices with these capabilities in the past [5,6], but these devices have suffered from limitations in their abilities to learn a wide variety of signals or to discriminate between signals with similar timing and spectral characteristics.  6  Chapter 2 - The WARNSIS Project 2.1 WARNSIS I  To date there have been two phases of the WARNSIS project. In the initial phase of the WARNSIS project (WARNSIS I) much of the study was devoted to the characterization of the various types of warning signals in everyday life. WARNSIS I also produced an initial prototype device.  In WARNSIS I it was determined that the majority of signals that the device would encounter fell into two categories:  i)  either single or repetitive burst signals ( such as telephone rings );  ii)  continuous signals (such as produced by fire alarms and smoke detectors).  It was also found that the warning signals examined in the study had at least one characteristic frequency or main harmonic above 900 Hz and below 5000 Hz [7].  Ambient noise was also characterized to be broad band with most of its spectra energy below a frequency of 300 Hz. This is common, as ambient noise in the usual office and home environments is generated by machinery such as fans and passing automobiles.  The frequency range between 300 Hz and 900 Hz was found to possess both noise and signal components. Most notably, warning signals from automobile horns (electric) and truck horns (air) fell into this category with their dominant frequencies in the 300 Hz to 500 Hz range. The human voice possesses energy atfrequenciesboth inside and outside this range but most of the energy in the human voice is contained within this frequency range. The human voice rises about 5 dB from its base value in the range from 100 Hz to 600 Hz and then falls by approximately 6 dB, 9 dB, 12 dB and 15 dB in succeeding higher octaves [8].  7  Chapter 2 - The WARNSIS Project The general recommendation for the design of warning devices is that such a device should be capable of producing an output sound level pressure (SPL) of at least 85 dB (with reference to 20 u Pa) at a distance of 10 ft from the device [9]. Additionally the warning signal should be at least 10 dBA SPL above the ambient noise level for warning devices in the home environment or 15 dBA SPL for those in public places [10]. This is a difficult condition to satisfy in real environments as most warning devices are preset at the time of manufacture or installation but the ambient noise levels where the device are used tend to vary with time.  2.1.1  WARNSIS I Recognition Scheme  The WARNSIS I recognition scheme relied on a two-part analysis [7].  Thefirstpart  of the analysis was a timing analysis, the second was a spectral analysis. A signal was "recognized" only if both parts of the analysis were successful. In WARNSIS I, the timing analysis was performed first in order to speed processing. This was significant, because processing power was limited by the microprocessors available in the market at that time (1986-88).  The timing analyser included the following three processes:  i)  the Dynamic Amplitude Threshold (DAT),  ii)  the Minimum Burst Duration (MBD),  iii)  the Maximum Inter-Arrival Time (MIAT).  The purpose of the DAT process was to identify a signal that may be of "interest" in order to start the recognition process. The DAT process continuously monitored the input signal level and updated a threshold level. If the input signal amplitude increased to twice the threshold level, a "signal of interest" was assumed to be present. The threshold was 8  Chapter 2 - The WARNSIS Project continuously updated by averaging the previous threshold with the incoming signal amplitude. The threshold thus tracked an increase or decrease in the ambient noise level.  The MBD process was used tofilterspurious burst noises before they reached the later recognition steps. The timing analyser monitored the incoming signal and measured the amount of time the input signal strength was above the threshold. If the MBD was less than a preset value the signal was ignored. If the MBD was longer than the preset limit a "valid" signal was assumed. If the MBD was longer than 4 seconds a continuous warning sound was assumed, if the signal was less than 4 seconds but longer than the preset minimum, a repetitive signal was assumed.  For repetitive signals the MIAT process was used to determine if the signal was in fact repetitive or a collection of random noise bursts of duration longer than the MBD. If two burst occurred in a time period less that the MIAT they were considered to belong to the same warning signal occurrence. If they occurred outside the MIAT they were considered to have been produced by separate warning events.  The timing analysis was followed by spectral analysis to determine if the identified burst was a valid signal. The spectral analyser was based on a NEC chip set designed to perform Dynamic Time Warping speech analysis and was implemented via an NEC //PD7761 and //PD7762 Pattern Matching Processor and Controller combination. The input signal was analysed by passing it through an eight frequency range filter bank and extracting the average energy contained in each of the eight frequency ranges between 100 Hz and 5000 Hz. The spectral analysis was then performed by comparing the output from these eight filters with prestored templates. If the output patternfromthefiltersmatched one of the pre-stored templates, the signal was then considered to be validated and a warning to the user was issued. Similar filter bank approaches have been tried by other researchers as well [11]. 9  Chapter 2 - The WARNSIS Project  2.1.2 Evaluation of WARNSIS I 2.1.2.1 Recognition Scheme  Although the two part system combining a timing analyser and spectral analyser seemed to give satisfactory results in low background noise cases, it produced a relatively higher number of false alarms in noisy environments and failed to detect a number of key signals. In fact, experience has shown that the failure of the device to recognize key signals in noisy environments was due to the sequence of the two-part timing and spectral analysis scheme .  In particular, as already noted, in WARNSIS I, the M B D detection process, used to determine if a burst was a warning signal or a transient, was applied before the spectral analysis to determine if the signal was worth examining. This meant that timing, not spectral energy content, was the main feature that the device detected. This, in combination with the MIAT measurement, caused the device to fail to detect repetitive signals in noisy environments. The original WARNSIS I device would identify a signal burst and then wait for the second in a series of supposed repetitive bursts. If a noise burst (or other warning signal) occurred during the waiting period, the original signal would be rejected because the M B D or MIAT did not match the template value. The spectral content of the intermediate burst was not examined, so there was no way for the device to differentiate if the intermediate burst was a true signal burst or if it was simply due to noise.  In an attempt to streamline processing, the original recognition scheme included three other compromises that made its real world use unsatisfactory. Firstly, the WARNSIS I device required at least one repetition to identify a repetitive signal. Since there is no guarantee in the real world that a repetitive signal will repeat, such signals should be identified on the basis of  10  Chapter 2 - The WARNSIS Project a single appearance. For example, in an emergency situation the warning device could be damaged before giving the second warning burst or the phone, or the postman, "may only ring once".  Thus, this recognition scheme would ignore the original burst since it detected no  repetitions.  Secondly, the WARNSIS I recognition scheme based its initial signal determination on the increase in the average total signal amplitude (energy). This meant that from the time the beginning of a signal burst was identified, until the time that signal burst ended, the device could not recognize other warning signals. Thus, if a noise burst occurred and triggered the timing functions before a true signal burst occurred, the signal burst would be completely ignored, or added into the noise bursts timing. Also, if the device was monitoring a valid signal and another valid signal occurred, overlapping with the first, the second signal's timing characteristics would again be added to the first and neither signal would be successfully detected. This could quite easily occur in an office environment where a number of phones could ring simultaneously. Rather than giving a false positive, as would be the case for the threshold detector, the device would give no indication of any activity at all.  Lastly, although the D A T function successfully tracked the increase in ambient noise level to prevent false positives, this actually had the effect of "deafening" the device in high noise environments. For the start of a burst to be detected, an increase of twice the threshold limit was required. As the ambient noise level would rise, the threshold would rise. However, the absolute amplitude of the warning signal, such as the telephone ringer volume, would remain the same. Thus, the detection requirement of twice the threshold limit could not be met by the warning signal at high ambient noise levels.  11  Chapter 2 - The WARNSIS Project  2.1.2.2 Hardware Implementation  The WARNSIS I system consisted of approximately 80 components including 4 microprocessors and a number of specialty N E C spectral analysis chips. Given the level of complexity of the hardware, multiple processors, specialty chip sets, and the requirement of an additional PC to coordinate the overall function of the device, it would have been impossible to turn the prototype into a practical device due to reliability and price considerations.  However, the WARNSIS I project determined that it was possible to detect and recognize warning sounds in real time, and although the design of the device had several shortcomings, the WARNSIS I project provided the basis for the evaluation of the usefulness of the timing and spectral information in the detection of this class of signals.  2.2 WARNSIS H Objectives  Given the above analysis of WARNSIS I, the objectives of WARNSIS II are:  1.  Redefine the detection and recognition algorithms to improve the performance in noisy environments and overcome the deficiencies in the original scheme;  2.  Reduce the hardware requirements so that a viable, cost effective production device can be made.  3.  Produce a system that is both easily learned and used by the end user  4.  Produce a system that can be easily maintained and upgraded in the manufacturing environment.  5.  Provide an overall system design, from both a hardware and software perspective,  including  support  tools  for  further  development  and  commercialization of the project. 12  Chapter 3  3.0 Sound and Signal Recognition Schemes  Currently most speech recognition systems are based on one of two basic mathematical models: Dynamic Time Warping (DTW) [12,13,14] or Hidden Markov Modelling (HMM)[12,13,15]. Both of these approaches are statistically based and are used because of the need to allow for the variations in speech that occur for the same word or words when spoken by various speakers or the same speaker at various times.  3.1 Speech Recognition Schemes 3.1.1 Dynamic Time Warping  Dynamic Time Warping is a useful technique when matching spectral patterns between a known signal (template) and a unknown incoming signal, which may contain timing differences. When a signal is" learned" and a template is created, the incoming signal is divided into smaller time segments. For each of these time segments a spectral analysis of the incoming signal is performed by afilterbank. The number of outputs from the filter bank depends on the spectral resolution required (For example: for WARNSIS I, this was eight outputs covering a frequency range between 100 Hz and 5000 Hz). The outputs from the filter bank give an estimation of the energy content in the spectral region covered by each of thefiltersin the bank. The outputsfromthesefiltersare stored in the templates for each time segment created during the learning process.  During the recognition process, the incoming signal is again divided into smaller time segments and the same spectral analysis is performed by the filter banks. For each time segment the outputfromthefilterbank for the incoming signal is compared to the values stored 13  Chapter 3 - Sound and Signal Recognition Schemes in the templates. If the output and template values match within a set of statistical parameters a match is indicated for that particular time segment.  The "Dynamic Time Warping" comes into effect by allowing for the misalignment of time segments. For example, if we wish to be able to recognize the word "hat", we would first analyse the voice of a speaker saying the word "hat". The length of time to say the word "hat" during the learning process may be 10 milliseconds and the learning process would divide this into 50 time segments. During the recognition phase, the speaker would again repeat the word "hat". However, because of changes in intonation and emphasis, which are normal during the speaking process, the new occurrence of the word hat may take 15 milliseconds to say. The analysis process would divide this occurrence into 75 time segments. Since there can not be an exact one to one correspondence between the original 50 segments stored in the template and the newly acquired 75 segments, allowances for time "slippage" must be made. The allowance for slippage is achieved by "Dynamic Time Warping". A more complete mathematical model for DTW can be found in the literature and will not be repeated here [13].  3.1.2 Hidden Markov Modelling  Hidden Markov Modelling is a statistical method which also models the variations in the way a speaker pronounces a word. Each word is divided into states and a probabilistic determination is made on the likelihood of transitions from one state to another. The states in a typical application are generated by filtering and digitizing the input signal, then segmenting it into smaller overlapping blocks which are fit to a linear predictive coding model [13]. Once this has been done a template is created for each word or sound that must be recognized and the incoming signal is analysed and compared to the pre-existing templates. However because the H M M is a statistically based process, the templates must be built from a number of repetitions by the speaker during the learning process [13]. For a given word to be learned 14  Chapter 3 - Sound and Signal Recognition Schemes it may require 40 or more repetitions of the word to be spoken in order to produce a template which accurately maps the possible state transitions [16].  Although there are differences between the D T W and H M M methods, good implementations of either of the two processes can result in good speech recognition systems. The trade offs between the two methods comefromthe decreased learning time require for the D T W method versus the shorter processing time required for the H M M method. D T W algorithms are computationally expensive, since each incoming signal pattern must be compared to those stored in all of the templates [12].  3.2 Warning Signal Characteristics vs Voice/Word Characteristics  The two methods described above have been designed to learn and recognize human speech. This is a much more complicated process than what is required for the recognition of warning sounds. Human speech is not uniform between speakers or even for the same speaker. It is formed by the interaction of the vocal cords, the pharynx, mouth, nose and sinus cavities. The tongue, teeth and lips also interact to produce the sounds we recognize as speech.  The  same word will sound different depending on its use, the mood of the speaker and even the time of day.  Warning sounds, on the other hand, are mechanically generated and must remain relatively constant infrequencycomposition and duration over their lifetime in order to perform their intended function. For example, phone rings are recognized throughout Canada and the United States regardless of geographical location because their frequency and timing characteristics are held within narrow limits.  The warning sounds generated by other  equipment also have characteristics which, in general, do not change significantly, if at all, after installation. Figure 3.1 shows the spectrum for three occurrences of the word "hello", spoken 15  Chapter 3 - Sound and Signal Recognition Schemes by the same speaker. Figures 3.2 through 3.4 shows the spectrum for a number of electronically and mechanically generated warning signals.  These graphs show why the learning and recognition processes for warning sounds should be much less complex than those for speech, and why the methods such as DTW and H M M , although well suited to speech recognition, are not the ideal processes for warning sound recognition.  The warning signals shown in Figures 3.2 through 3.4 have characteristic peaks that remain well defined and constant infrequency.They also have burst and interval durations that remain constant in time. From examining these graphs it is possible design a warning signal recognition algorithm. In order to detect a warning signal we must correctly identify the three characteristic features of the signal. For all warning signals, the first feature, the signals characteristic peak frequency, must be detected.  Next we must identify the timing characteristics of the signal. For burst type signals, the burst duration must be determined and if the signal is of repetitive burst type, the interval time between bursts. Should a warning signal be of the continuous type, then we must determine if the signal we are detecting is actually continuous or simply due to noise by ensuring that the signal is detected for a long enough time period.  The third characteristic of a signal is its energy content. Additional information about a warning signal is conveyed by the amount of energy contained in the signal. A louder signal is, in general, considered to be more urgent or important than a softer one. This is a matter of perception, and is highly dependent upon the surrounding environment since "loudness" is usually compared to some arbitrary background noise level. Often just the presence of an increase in sound level can be enough to alert us that something has occurred. 16  Chapter 3 - Sound and Signal Recognition Schemes  1.00  -i  ©  0.80  H  ®  0.20 0.00  iiii|itii!iiii1iiii]iiji|iirit«iii|rii<iiiti|jiiJiiiiir<)t*[i)>itii*tl'i''l<iii|tiiiiiiiiiii)iiiiii|ifii|  ' | ' i '' | ' ' " | " ' ' | '' ' ' | ' '" | ' ' ' ' | " ' ' |' ' ' ' | ' " I " I " " I" " I ! " I " i |Tii 11 i i i i | 11 i i 11 1  1000  11  2000 3000 4000 Relative F F T P e a k Intensity (0 - 5000 Hz)  1  1  5000 frequency (Hz)  Figure 3.1 - "Hello" Spectral Analysis 17  Chapter 3 - Sound and Signal Recognition Schemes  6178 msec  <D 1.00  •o 0.75 B 0.50 c 0.25 g> 0.00 3 -0.25 _ -0.50 r? "0-75 -1.00 -> 0 1  time  Relative Magnitude vs Time  1.00 - i itiiiiiit]iirijiiii|tiii|iiif|ipit|ttii|tiii|fiitjfiif[iitt|tttt|(tii|itii|iiii|fiiijittt|iiii|iiii|iiii|ii'i © 0.80 0.60 - | cn 5 0.40 ® 0.20 H ......... j  0.00  1.00 -j.  1000  |  ,T>l|ll l|ll^ ,.,|.rn l^h|.,.r .. . i.. ..i „.. l  |l  |  |  l  |  T  |  r  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  |IIII|IIII|IIII|UII|MII|4--U  I I I l| I I I I |l I I I | I II I |  TT,,|  5000 frequency (Hz)  11 II | 11 I I |l 11 I | II I I | I III | I I I l| I I I I | II I I | I II I 11  ® 0.80 ••§ 0.60 cn  I  1593 Hz Average Peak Intensity  0.40 -  ® 0.20 0.00  i  h • i::. 1 7 ,7, j,|.',>i|n n|i|^,|,,,, A^n i.*iArsiA v  1000  [  n.r,,,,.,... . . . . .... ..,,,,,, ^ss n  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  (  r  5000 frequency (Hz)  Figure 3.2 - Electronic Ringing Signal Spectral Analysis 18  Chapter 3 - Sound and Signal Recognition Schemes  <D 1.00 •o 0.75 B 0.50 k 25 g» 0.00 § -0.25 - -0.50 -I £ -0.75 -A -1.00 0  1  1.00  - i  Relative Magnitude vs Time  ii|iiii|iiii,iiii,iiii|iiii,,,j,,,,,, , , (  1000  1.00  I M  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  llll|llll|MII|llll||l|,,,,,  I  H  ^  I  M  ,  I  M  I  j  l  l  l  |  j  M  M  I  ^  l l M | l l l l | I M l | l l l l | P I I I M l l l | M l l I l l l l | l M l | | | I l | l l  l  l  l  |  |  )  |  |  ,  j  |  |  |  |  (  l  |  I  |  |  t  (  |  I  |  |  ,  |  |  |  |  5000 frequency (Hz)  t  l  |  |  |  |  |  |  ^  © 0.80 H "§ 0.60 H  1658 Hz  O)  ^  Average Peak Intensity  0.40 H  ® 0.20 0.00  PJ. .TTTI, , , ,rr77t,,7r , , .,,,,,, "'I '"!""!""!" ' i"" r~TT-irrT 1000 2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz) 1  1  7  T  7777 7rrT^ T  5000 frequency (Hz)  Figure 3.3 - Mechanical Ringing Signal Spectral Analysis 19  Chapter 3 - Sound and Signal Recognition Schemes  o> 1.00 •o 0.75 H 3 0.50 0-25 g> 0.00 5 "025 - J - -0.50 H f? - ° ^ -1.00  616 msec  1281 msec  •'lIKJIiMIHInJ ' l'  7 5  1.00  Relative Magnitude vs Time  time  - i [tit|itii|itri|tiii|ir[f|iiti|iiti|iiiigtiii]iiitjifii|Tiii|ftit|riii|iiii|titi|iiii|tii«jiiit|iiii|ii«ijiiitj  © 0.80 • | 0.60 H 5  0.40  ® 0.20 H 0.00  |iin,.ii.,...,Tnii|ii i|..ii| l  1000  1.00  i,|,iM,,i,r  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  [»• > f F t r 1111 r i j 11111111 r j J 11 j 11111 j i  5000 frequency (Hz)  — i »1111 F 1111111 j 111111111 [ 1111 j 1111 j 1111 j i i 1111111 j 11 j 111 j 11  © 0.80 f: 0.60  1981 Hz  O)  ^  Average Peak Intensity  0.40  ® 0.20 0.00  .[....!••..,. .|.  i.,... 11 i I.  1000  ,  . . . . . . . . . . . . . | n - , . . ,., ..............,  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  ,[,,,, |  5000 frequency (Hz)  Figure 3.4 - Microwave Alarm Signal Spectral Analysis 20  Chapter 3 - Sound and Signal Recognition Schemes This leads us to a 3-part analysis scheme for our recognition algorithm, one part for spectral analysis, a second for timing analysis and a third for energy content analysis. The important question here is: in what order do we perform these analyses? Although frequency , timing and energy characteristics are important, which is most important for recognizing a warning signal?  When a telephone initially begins to ring, one is alerted to that fact by the presence of the ringing sound. Before the ringing burst finishes, it can be determined that a telephone call is incoming. If one is unsure that the telephone actually rang, one can wait for the burst to end or a second burst to repeat for confirmation. It is, however, the presence of the characteristic ringing frequency, where there was none before, that gives the first alert. Similarly, in an office or home, if two closely placed different phones ring simultaneously, the only way to tell them apart is by the different sound of the two ringers.  Even for an unknown warning signal, it is often the presence of a new spectral component in the background noise that gives the warning. When a component of a vehicle breaks down, there is often a new "sound" to the vehicle that is a direct result of the fault. For example, should a bearing wear out, it is often accompanied by a screeching sound. One may not have heard the sound before, but it is immediately obvious that something has happened. It would appear that a significant amount of information required to recognize a warning signal is contained in the spectral and energy characteristics of the signal. Also, although additional information is contained in the timing characteristics of a warning signal, those characteristics would appear to be secondary. For these reasons, for WARNSIS II, we shall approach our algorithmic design with the intention of performing the spectral and energy analyses first.  21  Chapter 4  4.0 Spectral Analysis Methods  For WARNSIS II, it was decided to implement as much of the analysis as possible, including the spectral analysis, in software. The reasons for this are three-fold. First, by relying on software for as much of the recognition scheme as possible, the overall chip count for the device can be minimized. This allows for lower overall cost for both design and manufacture. By reducing the number of chips or specialty chip sets, both the number of parts and the overall size of the board can be reduced. This in turn will also lower assembly and testing costs. By reducing the parts count the time required to design and layout the circuit is also greatly reduced. Eliminating the use of specialty chips is important. The use of specialty chips would limit the functionality and flexibility of the device because, should improvements to the recognition algorithm be developed in the future, they would not be easy to incorporate into the existing hardware. With software, this is not problem.  Secondly, implementing WARNSIS U in software means that large economies of scale can be applied to the production of the final device. With no specific hardware requirements, any commercially available platform with enough processing power could be used. For example, a PC sound card with production volumes of millions of units per year could be used as the basis for implementing some versions of the WARNSIS II system.  Lastly, although the WARNSIS II project is intended to produce a design which can be implemented as a stand-alone device, the functionality of the WARNSIS II recognition scheme could provide useful features to be incorporated into other devices such as medical monitoring equipment. A software approach makes this "generalization" much easier.  22  Chapter 4 - Spectral Analysis Methods 4.1 WARNSIS II Spectral Analysis  For WARNSIS II we propose to perform the spectral analysis via a computational method. There are a number of reasons for this approach. First, by using a computational method, such as the Fast Fourier Transform (FFT), the number of frequency ranges and the total frequency range covered can be adjusted by software on an individual signal or implementation basis. This allows for a multilevel spectral analysis, if required. For example, an incoming signal could first be examined for energy content above or below a given value in order to reduce the search path and execution time. Alternatively, the FFT approach would allow for finer or coarser frequency determinations in changing noise environments.  The use of a computational spectral analysis method also allows for some type of noise cancellation. The spectra for the templates obtained during training of the device are likely to be obtained in the "best" conditions available. This could mean no, low or modest noise environments, depending on where the signal was "learned". The spectra of signals detected in the real world are likely to have a large noise content. Noise cancellation on both training and analysis would give the cleanest signal both for the templates and for comparison, and should improve the ability of our scheme to recognize a signal in noisy environments.  There are a number of computational frequency analysis methods in addition to the FFT, mentioned above, which can be used for spectral analysis. Other computational methods such as the Wavelet, Hartley and Cosine transforms, and Finite and Infinite Impulse Response filters (FIR and IIR) are available.  These will be compared in the following sections to  determine which method best fits the WARNSIS II requirements.  23  Chapter 4 - Spectral Analysis Methods 4.1.1 Fast Fourier Transform [17,18,19,20,21]  The FFT,firstpopularized by J.W. Cooley and J.W. Tukey in 1965 [18,21], is currently one of the most common and successful methods for performing spectral analysis on digitized data.  Suppose we a sample a continuous function of time h(t) so that we have N consecutive values, where N is even, with a sampling interval of A.  K  > h  s  >  = °> > > - > ~  k  l  2  N  l  If we are attempting tofindthe Fourier transform for this function, then having N input values we can produce no more than N independent output values. This means that we can  I  =  ,  /VA  J n  n =  -  —  ,  .  .  .  ,  2  —  -  2  =  —  2  —  2  (4.2)  obtain estimates only for those frequencies at discrete values or bins. We approximate the Fourier integral by the sum +0  °  7V-1  „) = fhWe **''* 2  -  N-\  Y,h e '''A 2lttf  k  =  A Y.K^  iknm  (  The final summation in equation (4.3) above is known as the Discrete Fourier Transform (DFT). The DFT requires N complex multiplications and is an 0(N ) process. Using the 2  2  24  Chapter 4 - Spectral Analysis Methods FFT algorithm, the Discrete Fourier Transform can be calculated on the order of 0(Nlog N), 2  which is an enormous difference. The FFT is derived as:  (N/2)-  1  £  (N/2)- 1 2*tkQj)iN  e  jQj)  +  7=0 (N/2)-  where  n  i  k  {  2  j  +  X  )  I  N  f(2j  + \)  7=0 1  (N/2)- 1  7=0  f  2 e  7=0  +  w F° k  W = e''™ , sometimes referred to as the "twiddle factor" " F k  1  k  denotes ftte k  component of the Fourier transform of length N/2 formed from the even components of the original fl]) and F ° is the corresponding transform of length N/2 formed from the odd k  components. The fact that this formula can be used recursively means that, for transforms for which N is an integral power of 2, it can be repeatedly broken down until we have only to calculate transforms of length 1. A Fourier transform of length 1 is simply the identity operation that copies it input value to its output slot or bin. This means that every length 1 transform in the series corresponds to one of the input values. The correct input value can be determined by bit reversing the index j for the original function. If you take the original data sequence and rearrange it so that the values are in order not of j, but in order of the numbers obtained by reversing the bits of j written as a binary number, you have the correct relation between the inputs and the length one transforms. For example, if j=3 for a length 8 transform then the correct output bin for the length one transform would be given by:  j = 4 = 100 yielding 10  2  bin # = 001 = 1 2  10  (4.5) 25  Chapter 4 - Spectral Analysis Methods From this it is a simple matter of calculating the combined transforms of size 2, 4,  N in  recursive stages. Figure 4.1 shows a length 8 transform being bit reversed and then recombined.  4.1.1.1 FFT and Spectral Power Estimation [19]  Since we are trying to determine if a signal being analysed by WARNSIS II has a spectral component at a given frequency, we are interested in the energy content of a signal at that frequency. This means that rather than using the Fourier Transform itself, as we would if we were required to perform a cross-correlation with a second signal, we require only the signal's power spectrum. This can be done using the FFT. Rather than matching the power at a particular frequency f that would be obtained from calculating the continuous Fourier k  transform, the power given by the FFT is an "average" or expected value for thefrequencybin centred at f extending over a narrow window . Historically this has been called a k  periodogram. For an N-point sample of a function c(t) using the FFT 7Y-1  ce  iTZijkIN  k =  (4.6)  0,...,N-l  the periodogram estimate of the power spectrum is defined as  P(0)  1  =/Vo) = —AC  {  J_  N  2  C,  +  L  c  N N-k  * = l,2,...,(il-l)  (4.7)  1 N/2  26  Chapter 4 - Spectral Analysis Methods  Figure 4.1 - FFT Bit Reversal Recombination  27  Chapter 4 - Spectral Analysis Methods where f is defined only for the zero and positive frequencies k  (4.  k  For the periodogram defined above, the narrow window over which the average is taken, as a function of 5 the frequency offset in bins, is described by  W{s) =  1  sin (re s)  2  /V I sin(TLs/7V) 2  (4.9)  This window has side lobes that contribute significant amount of "leakage" a number of bins away.  4.1.1.2 Data Windowing  Performing a Fourier transform on a given function of time assumes an infinite sequence of input values for the integral. The FFT, which is used for discrete data, is always performed on a sample size somewhat less than this. By performing an FFT on a finite sample size we are in effect convoluting an "infinite" sequence with a square window function which is 0 except during the finite sampling time. The overall effect of the finite sample is to cause "leakage" in the power spectrum from the true frequency to other frequencies a number of bins away as described above. The "leakage" can be substantial even at frequencies a large number of bins awayfromthefrequencyof interest because the square window function, in effect, turns on and off instantaneously. 2 8  Chapter 4 - Spectral Analysis Methods To overcome this leakage problem it is possible to modify the sampling window function by multiplying the input signal data Cj, j - 0, ... N - l by a windowing function w. There have been a number of alternative window functions proposed [19]:  the Parzen window,  w. j  1  (4.10)  -  the Welch window,  w. j  =  1  (4.11)  -  and the Hanning window,  w. = — J  2  COS (  N-l  -)  (4.12)  Each of these window functions is shown in Figure 4.2 [19]. The effect that each of the windowing functions have on the "leakage" between bins is different. These effects are usually given "figures of merit" that can be used to describe the narrowness of the peaks. The tradeoff between different window functions is between the narrowness of the peak and the fall off of the tails. In general it is recommended, that if a windowing function is required, the  29  Chapter 4 - Spectral Analysis Methods  Bin Number (0 to 255)  Figure 4.2 - Parzen, Welch & Parzen Window Functions 30  Chapter 4 - Spectral Analysis Methods Parzen or Welch windows be used. The larger computational effort required for the cosine function in the Hanning window gives minimal additional value [19]. Figure 4.3 shows the effects of the three windowing functions in comparison to the square sampling window [19].  4.1.1.3 Maximum Entropy Method [19,32]  As stated earlier, when performing a spectral analysis using the FFT there is a relationship between the number of samples that must be used to produce a given frequency resolution for a given sampling rate. Thefinerthe frequency resolution, the larger the number of samples that must be considered. This can lead to prohibitively large sample sizes which can consume large amounts of memory while processing.  The Maximum Entropy Method (MEM) [19,32] for power spectrum estimation allows one to perform a parametric (model based) spectral analysis which will provide a better frequency resolution for a smaller sample size. The M E M is an auto-regressive method which characterizes a known signal in terms of a finite number of poles that best represents its spectrum in the complex plane.  The M E M can produce a better spectral resolution for a smaller number of samples than the standard FFT methods. The M E M does, however, have a few disadvantages. Firstly, it exhibits line splitting at high signal to noise ratios. Secondly, at higher orders the M E M can introduce spurious peaks. Thirdly, for sinusoidal signals in noise, which would encompass a large number of the warning signals of interest to a WARNSIS device, there is a frequency shift in the signals spectrum that is dependant on the initial phase of the signal which we are trying to recognize. For these reasons and because the M E M requires extra computational effort to calculate the parametric coefficients, this method was not used for WARNSIS II. 31  Chapter 4 - Spectral Analysis Methods  Offset (in Frequency Bins)  Figure 4.3 - Leakage for Parzen, Welch & Hanning Window Functions  Chapter 4 - Spectral Analysis Methods 4.1.2 Discrete Hartley Transform [17,22,23]  The Discrete Hartley Transform (DHT) is applicable to real valued signals and is closely related to the FFT, in fact the DHT and the FFT can be derived from each other . The DHT is defined as:  N-l H(K) =  5Zx(n)cos(27Tkn/N) + x(n)sin(2Ttkn/N) k = 0,...,N-l  (4.13)  n=0  N-l x(n) = 1/N SH(k)cos(27ikn/N)+H(k)sin(2Tckn/N) k = 0,...,N-l  (4.14)  k=0  where x(n) is the real valued sequence. There have been a number of claims that the Fast Hartley Transform (FHT) implementation of the DHT is more efficient than the real-valued FFT for computing the power spectrum for real-valued sequences with N =2 . The two most P  recent comparisons of the two methods have concluded that the FFT is in fact a more computationally efficient algorithm [22,23]. The time required for computing the FFT vs the time required for computing the DHT give a ratio of processing times of 1:1.04 for a size 512 transform [24]. For the TMS320C30 processor used in WARNSIS II, the ratio of processing time between implementations of the FFT and DHT on the same signal processor is approximately 1:1.98 in favour of the FFT which is a significant difference [17].  33  Chapter 4 - Spectral Analysis Methods 4.1.3 Discrete Cosine Transform [17,19,24]  The Discreet Cosine Transforms (DCT) also arises from the FFT. The DCT is given by: N-l . F(K) =  x(n) cos(xck n / N)  k = 0,..., N - l  (4.15)  n=0 where x(n) is the real valued sequence. Although the DCT appears to be simply the real part of the Fourier Transform, it differs by a factor of 2. The DCT and Discrete Sine Transforms (DST) are more useful when applied to boundary value problems than for generating the power spectrum information that we require. Although new, more efficient, direct computation algorithms have been proposed for the DCT and DST [24], the FFT is still superior for our purposes. The ratio of processing time for implementations of both the FFT and DCT on the TMS320C30 signal processor is approximately 1:1.91 in favour of the FFT for a size 512 transform [17].  4.1.4 Finite and Infinite Impulse Response Filters [17,19,20]  Rather than using the FFT or other similar transform, it is possible to duplicate the process used in WARNSIS I where the frequency spectrum was divided into 8 ranges by the filter bank by the use of linear digital filters. If we assume that the signal x(n) is applied to a bank of complexfilterswith impulse response h^expfjco^) where (j\ is the centre frequency of anyfilter,and h(n) is the response of an ideal lowpassfilterwith bandwidth u> . If the real h  part of thefilteroutput is squared, doubled and bandlimited to 2<o, then the resulting analysis h  is the same as the square of the magnitude of the Short-Time Fourier Transform of x(n) for 20^ <|co |< Tt-2w [20]. k  h  34  Chapter 4 - Spectral Analysis Methods The generic linearfilteris formed by taking the sequence of inputs x„ and producing a series of outputs y such that n  M  N  k=0  7=1  where q and dj arefixedcoefficients which define thefilterresponse. If N=0 so that the second sum does not contribute to the filter response, then the filter is said to be non-recursive or a finite impulse responsefilter(FUR). If N<>0 then the filter produces a response from not only the current input values butfromits own previous output as well. In this case the filter is said to be recursive or an infinite impulse responsefilter(IIR).  The main drawback of using these methods is in the calculation of the coefficients. There are a number of methods for calculating the coefficients q and dj depending on whether one is implementing an FIR or IIR. The Remez Exchange Algorithm produces the best Chebyshev approximation for a fixed number offiltercoefficients for an FIR and one useful technique for ITR's is the bilinear transformation method [19]. The drawback is that all of the methods for calculating the coefficients require large amounts of processing time. This would then require WARNSIS II to use higher speed and higher cost processors to implement the spectral analysis component of the WARNSIS II algorithm. A second drawback of the filter approach is that even though new IIR algorithms are available for tracking sinusoidal signals in noisy environments, the algorithms all exhibit "rather erratic" convergence behaviour [25].  4.1.5 Wavelet Transform [26,27,28]  The Wavelet Transform (WT) is an alternative time-frequency representation that can 35  Chapter 4 - Spectral Analysis Methods be used for spectral analysis.  The time-frequency version of the WT is defined as  (4.17)  where y(t) is the "analysing wavelet" and is a real or complex bandpass function centred around time t=0 and f  0  is the centre frequency of y(t) [26,28]. In principle the wavelet  transform and the Fourier transform are very similar in their approach to time-frequency representation, as both can be represented as inner products. In fact the WT is just a special case of the generalized STFT [27]. There are two essential differences between the wavelet and Fourier transforms. Thefirstis the choice of a linear time-shift/frequency-shift operator for the Fourier transform versus a time-scaling/time-shift operator for the wavelet transform. The second is that the equivalent y(0 function for the Fourier transform is a lowpass function instead of a bandpass function for the wavelet transform.  Both transforms suffer from similar time-frequency resolution limits. Thus, neither transform can provide arbitrarily good time resolution andfrequencyresolution simultaneously. For example using the Fourier transform with a given sampling rate, if one wishes to increase the frequency resolution of the power spectrum, one must increase the number of samples taken, thus producing a power spectrum covering a longer time period. However, the Fourier and Wavelet Transforms are different regarding their time-frequency resolution in ways which are important for the WARNSIS II algorithm. In particular, for the Fourier Transform the time-frequency resolution is the same for allfrequencies.For the Wavelet Transform, however, the time-frequency resolution is not constant, higher frequencies are analysed with better time resolution, but with poorer frequency resolution [28].  This is unacceptable for the  WARNSIS II algorithm since it is essentially the higherfrequenciesthat are of interest. The  36  Chapter 4 - Spectral Analysis Methods time-frequency resolution should be constant over the entire frequency range of interest since we have no way of predicting a priori which frequencies will be relevant when the device is actually in use.  4.2 Evaluation of Computational Methods for Spectral Analysis  The FFT approach to frequency analysis was chosen over the WT for the reasons explained above. The FFT is also preferred to the Hartley, and Cosine Transforms and the FIR and IIRfiltermethods because of the time comparison factors as discussed in sections 5.1.2, 5.1.3 and 5.1.4, as well as other reasons. Firstly, the FFT is one of the best understood computational methods and optimized code for performing the FFT is available for most computer languages and systems available on the market today. Also, because of its popularity, many of the "off-the-shelf signal processing chips are architecturally designed to exploit fast addressing schemes which provide for a further increase in FFT processing speed.  Additionally, further speed increases can be gained by exploiting specialized implementations of the FFT algorithm which are known as RADIX-2 or RADIX-4 versions. When the number of input values for the FFT is n or n then the FFT processing speed can be 2  4  increased by reducing the number of stages used. Also for the WARNSIS II algorithm we are digitizing real signals, hence the input to the FFT routines will be real values with no complex parts. This allows us to take advantage of the ability to double the FFT processing speed by substituting real values for complex values in the input array.  The FIR and IIR methods were not considered as the number offilterbanks required to implement afineenough frequency resolution would be computationally prohibitive. 37  Chapter 5  5.0 WARNSIS n Design 5.1 Overview  The WARNSIS II warning sound recognition system is a set of software algorithms which can be implemented on any hardware platform with sufficient processing power to perform the required real-time FFT analysis and template matching algorithms. The system consists of a number of functional modules which allow the WARNSIS II system to operate in two modes: learning mode and signal recognition mode. In the learning mode, a template for a warning signal is "learned" by analyzing the signal for spectral and temporal information. The frequency(s) at which the maximum peak(s) in the signal's spectral energy occur are determined and these values are saved in a template. Timing information, specifically, the duration of a warning signal burst and the interval time between warning signal bursts (for repetitive signals such as telephone rings) are determined and also saved in the template.  In the recognition mode, the spectrum of the incoming real time signal is continuously analysed. The analysis determines if any of the incoming signal's spectral components match those stored in one of the "learned" templates. If a spectral match is found, timing information is then applied to rule out transients which could generate false alarms.  5.2 Learning Mode As stated earlier, the drawbacks of the devices commercially available today are their lack of flexibility causing difficulties when moving from one location to another and their lack of the ability to accommodate new types of warning signals. To overcome these deficiencies a WARNSIS II device must include the capability for the automatic "learning" of a new signal. 38  Chapter 5 - WARNSIS II Design  When the learning mode is entered, a signal learning algorithm begins. The input signal is continuously monitored until an increase in the Short Time Average Absolute Amplitude (STAAA) is found. The STAAA is calculated by averaging the absolute value of the input amplitude over a period of 512 samples (63.9 ms at 8,012 Hz sampling rate). This is sufficient to eliminate short noise bursts which would interfere with the second stage of the signal detection algorithm. When the learning mode isfirstentered a sample of the background sound level is taken and its STAAA is calculated. This level then becomes the value against which all later STAAA's are compared in order to determine if an increase in signal amplitude due to a warning signal has occurred. If a future STAAA is greater than 1.5 times the background level value then a valid amplitude increase has been detected. To actually detect the beginning of a valid signal, the signal acquisition algorithm requires that two consecutive STAAA's 1.5 times greater than the background level be detected. If a valid STAAA is detected, but the next STAAA fails to exceed 1.5 times the background value, then the first STAAA is ignored. This differs from the original WARNSIS I algorithm in that there is no Dynamic Amplitude Threshold (DAT) and that two consecutive valid STAAA's are required to initiate the learning process. Although this algorithm would be affected by an overall increase in ambient noise levels, causing it to falsely detect the start of a warning signal, it should be possible in most cases to "learn" a signal in a low noise environment. For example, it is possible to lower the ambient noise level in a home or office for a short period of time by temporarily eliminating the noise sources. Figure 5.1 shows the learning mode process described above.  39  Chapter 5 - WARNSIS II Design  1.00 0.75 0.50 0.25 CO 0.00 0.25 — -0.50 r? "° ^ -1.00 7  2286 msec  6088 msec  5  Relative Magnitude vs Time  time  Single STAAA Below Minimum Level Not Detected As Burst End Point  Minimum STAAA Level  time Short Time Average Absolute Amplitude (STAAA) vs Time  Figure 5.1 - Short Time Average Absolute Amplitude (STAAA) for Burst Determination  40  Chapter 5 - WARNSIS II Design Once two consecutive STAAA's have been detected, the signal acquisition algorithm sets the start of valid signal flag and begins the spectral analysis. The spectral analysis at this stage of the learning process is performed by continuously calculating the FFT on the incoming signal in 512 sample intervals. As each set of 512 samples are collected the FFT is processed and the magnitude of the FFT for each bin in the power spectrum is calculated and added to the total sum of all magnitudes calculated for each bin from all of the previous 512 sample interval since the start of the warning signals acquisition.  This process continues until the warning signal is "lost". The signal is lost if two consecutive STAAA's fail to exceed 1.5 times the background STAAA value. If a single STAAA fails to exceed the background STAAA limit but the STAAA from the next 512 sample interval does exceed it, then the signal is not lost. Once the warning signal has been lost, the spectral analysis is ended, the FFT magnitude sum is preserved and the warning signal burst duration is calculated as the time from the detection of the first of the two initial STAAA's to the time of thefirstof the two consecutive STAAA failures. Monitoring of the input signal continues until one of two events happens. If two new consecutive STAAA's above the background value are detected before the learning mode "times out", then a valid signal repetition is deemed to have been detected and the signal interval time is calculated as the time from the detection of the first of the two initial STAAA's at the beginning of the initial burst to the time of thefirstof the two consecutive STAAA at the beginning of the repetition. If a repetition is detected then the learning mode signal acquisition phase ends. Alternately, if no repetitive burst is noted before the learning mode times out (after approximately 30 seconds) the signal acquisition phase is ended anyway. If the learning mode times out while the signal is still being acquired then a continuous signal, such as that from a smoke detector, is deemed to have been detected.  41  Chapter 5 - WARNSIS II Design Once the signal acquisition phase ends and the burst duration and interval have been determined, the FFT magnitude sum is examined to determine the main spectral peak(s). The centre frequency for the bin which has the greatest magnitude sum among those bins for frequencies above 900 Hz is deemed to be the dominant spectral peak for the acquired signal. The peak is detected by an algorithm similar to the algorithm used for detecting the beginning and end of the signal during the signal acquisition phase. The FFT magnitudes are examined and the start of a peak is determined by two consecutive increases in FFT magnitude when compared with the previous adjacent FFT bin magnitude. There is no preset value for the peak increases to exceed as it is only the increase that is relevant, not the absolute value of the increase.  As peak detection proceeds, the FFT magnitude values are compared for each bin  within a peak. The maximum magnitude found for each peak during this examination process is saved as the peak maximum. The bin number corresponding to the maximum magnitude found is taken as the centre frequency of the peak. Peak detection continues until the peak maximum is detected, again this is determined by two consecutive decreases in FFT magnitude for adjacent bins. The "down slope" of the peak is monitored until the FFT magnitude exhibits either two more consecutive increases, indicating the start of another peak, or two consecutive equal magnitudes, indicating the "bottom" of the peak. The width, centre frequency and maximum magnitude are thus determined for each peak in the FFT magnitude spectral sum.  Once the entire spectrum has been scanned and all peaks have been identified, the characteristic peak for the warning signal is determined to be the peak with the greatest peak magnitude. The maximum peak magnitude is used, rather than the peak "area", as warning signals tend to have narrow peaks and noise tends to be broad band covering a larger number of bins. A noise peak may contain more total energy than a warning signal peak, but that energy is spread over a greater frequency range for the noise peak than for the signal peak.  42  Chapter 5 - WARNSIS II Design The warning signal is thus characterised by three attributes:  i)  a characteristic peak frequency (bin number),  ii)  burst duration time  iii)  burst interval time (if required).  The peak magnitude and width are not currently used for signal recognition and are not stored in the learned warning signal's template.  Figure 5.2 shows the flowchart for the generalized WARNSIS II learning algorithm.  5.3 Recognition Mode  The recognition mode in WARNSIS II operates much in the same manner as learning mode, except that, rather than simply using amplitude increases and decreases for identifying the beginning and ending of signal bursts, it is the presence or absence of  a  signal's  characteristic peak frequency that determines the beginning and ending of a burst.  While operating in recognition mode, the input is continuously monitored and the FFT of the incoming signal is continuously calculated in the same 512 sample size intervals as for the learning mode. It is important that the same sample size and sampling rate be used for both the learning mode and the recognition mode as changing the sample size or sampling rate changes both the size and centre frequency of the bins. Once the FFT has been calculated for a 512 sample interval, rather than summing the FFT's output for an extended period as in the  43  Chapter 5 - WARNSIS II Design  E n t e r Learning Mode  Sample Background Calculate Background  Level "pTAAA  Collect N e x t 512 Sample's Calculate Current  "iTAAA  Yes  Find Characteristic  Peak  ' s e t D u r s t Duration t o Indicate Continous Signal  Yes  Yes Yes  Is This •pecond Consecutive J b T A A A Failure?,,  Learning Mode H a s Timed Out Without Identifying A n y Warning Signal  Yes  Calculate B u r s t  'bave Template  Duration  Hna Characteristic Peak 1  A n d 'bave In Template  "itart Burst  Timer  Calculate Interval Time Calculate F F T and "jum  h"fo:  Characteristic Peak D u r s t Duration N o Interval Time  And 'iave in Template  Exit Learning Mode  t Figure 5.2 - Flowchart for WARNSIS II Learning Mode Algorithm  44  Chapter 5 - WARNSIS II Design learning mode, the spectral analysis is performed on the individual 512 sample intervals. As each 512 sample segment is processed, all peaks present in that time interval's spectrum are identified using exactly the same peak detection algorithm as was used in the learning mode.  Each peak above 900 Hz present in the current segment's spectrum that is greater in magnitude than a minimum limit and that is also greater in magnitude than 25% of the magnitude of the largest peak is compared to the characteristic peak frequencies stored in the templates for the various signals that have been learned. The input signal's peak magnitudes are compared to both a preset minimum peak energy value and the 25% limit in order to eliminate false peak detection. Since the energy content in the background signal at frequencies above 900 Hz is generally due to transients and higher harmonics, the magnitude of these peaks are generally lower than those for true warning signals. By only looking at the significant peaks in the spectrum we can eliminate the peaks due to transients. Transient signals are eliminated by this method because signals that are of short time duration with respect to the sampling period, and are of limited power do not contribute as much to the power spectrum as do longer duration, higher intensity signals.  The WARNSIS II algorithm is only interested in the spectrum above 900 Hz and takes no account of any spectral components below 900 Hz. This means that if no warning signal is present, the spectrum of the incoming signal above 900 Hz will be filled with peaks generated by the background noise. Since there will be no large magnitude peak due to a warning signal, the largest peak above 900 Hz will belong to the background noise spectrum and the 25% limit will be set relative to the background noise. This means that noise peaks would then be considered as possible candidates for recognition.  45  Chapter 5 - WARNSIS II Design The 900Hz lowerfrequencylimit and 25% magnitude limit were chosen by examining thefrequencyspectrum from a number of digitized background samples. It was found that in almost all cases the magnitude of peaks in the frequency spectrum decreased significantly at frequencies greater than 900 Hz and that, in general, noise peaks above 900 Hz had magnitudes less than 25% of the magnitude of the signals that we were examining. These are notfixedlimits. Since these values as well as all other limits for the WARNSIS II algorithms are set in the software, different implementations of WARNSIS II could use different limits.  To overcome this problem WARNSIS II uses a 2-part level analysis. In addition to ignoring peaks which are less than 25% of the maximum peak detected, WARNSIS II, as stated earlier, also ignores any peak which is lower in magnitude than a preset minimum value. By only "acknowledging" peaks with at least a minimum energy content we can eliminate those which do not contain energy substantially above the background level. This is more effective than using a total signal amplitude threshold approach since in a typical noisy environment that the device may be used, most of the background noise signal's total energy is generated by voices, radio or television broadcasts and will be found below 900 Hz. This 2-part analysis allows a warning signal to be successfully detected by its characteristic frequency peak even in a very noisy environment.  There is one drawback to this 2-part analysis method. If two warning signals occur at the same time, the peak magnitudes will be normalized with respect to the stronger signal. If one of those signals is significantly weaker than the other, so that the weaker signal's peak does not exceed the 25% threshold, the detection of the weaker signal would be suppressed. This means that a signal with a fixed magnitude may not be detected in the presence of a significantly stronger warning signal, even though it would be successfully detected if it  46  Chapter 5 - WARNSIS II Design occurred by itself. However, this is the case for the human ear as well, a ringing telephone at a given volume will be detected above the general office or home background noise level, but not above the ring of a fire alarm bell.  Figure 5.3 (a) and (b) show the power spectrum for typical warning signals (in this case a microwave oven alarm (a) and a mechanical telephone ringer (b)). Figure 5.3 (c) shows the power spectrum for typical background speech and music. For each figure, the top graph shows the digitized input signal's magnitude vs time. The second graph in each figure shows the relative magnitude between peaks for the complete power spectrum for the input signal from 0 to 5000 Hz. The third graph in each figure shows the relative magnitude for those peaks in the power spectrum above 900 Hz.  As can be seen from figure 5.3 (a) the majority of the spectral energy content in the warning signal is in the range above 900 Hz. Notice the narrowness of the characteristic peak and the lack of secondary peaks. This is common for warning signals that are generated electronically. Warning signals generated mechanically, such as the ring of a telephone bell, generally show a slightly broader characteristic peak as well as multiple harmonic peaks as shown infigure5.3 (b). For the general background noise case shown in figure 5.3 (c), in this example F M rock music and voices, although there are secondary peaks at frequencies above 900 Hz, most of the energy content and the main peaks in the power spectrum are at frequencies well below the 900 Hz range.  The third graph offigure5.3 (c) shows why, if we selectively look only at those peaks in the power spectrum above 900 Hz, we require the preset minimum limit for peak detection. When the low frequency energy content is eliminated from the peak detection process, the  47  Chapter 5 - WARNSIS II Design  1.00 —I 0.75 - \ 3 0.50 £ 0-25 g» 0.00 5 -0.25 -i _ -0.50 ® -0.75 -1.00 <D •D  616 msec  1281 msec  time  0 1  -00  Relative Magnitude vs Time  t••••|iiii|iiii|iiit|fiif|iiii|tiii'|jiii|iiif|itii|itif|iiiijiiii|iiii|iiiijiiii|iiii|ii  l l  .|itit|tt(f|iiii|ii(i|  © 0.80 =| 0.60 - | O)  g  0.40 - \  ® 0.20 H 0.00  1.00  1000  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  - iMll|llll|llll|llll|llll|llll|llll|l  5000 frequency (Hz)  •ll|llll|llll|llll|llll|llll|llll|llll|llll|lll||H|l|llll|IIU|llll|  © 0.80 - \ • | 0.60 H |  1981 Hz  0.40-  Average Peak Intensity  ® 0.20 0.00  ' ' ' I  "'•'I'"" I"" I  1000  |,,,| ,,,,,,,,,  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  ,|.  5000 frequency (Hz)  (a) Microwave Oven Alarm Spectral Analysis  Figure 5.3 - Typical Warning and Noise Signal Power Spectra  48  Chapter 5 - WARNSIS II Design  © 1.00 - i 0.75 H 3 0.50 - \ c 0.25 g» 0.00 5 -0.25 H _ -0.50 H S -0.75 -1.00  •D  1.00 - | © 0.80  Relative Magnitude vs Time  iii|uii|Mii|ini|iiii|ini|iiii|iiii|iiii|iiu|nii|iiii|iiii|iiii|iiii|iiii|iiii|nH|Mii|iin|ini|iiii|  -j  =| 0.60 cn 2 0.40 © 0.20  or  A  0.00  1000  1.00  II  11111  ti  11 II  i|  . A 5000 frequency (Hz)  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  11111 II 11 ("" 'HH"' > " | " 1 1 1 ' 1  |* • i M  M11  1  11  • •  |'  1 1 1  1""  I"" 1 " I " 1 11  1 1  , M  1  1 " 1 " "1 1  1  1111  © 0.80 - \ % 0.60 cn 2 0.40  1658 Hz Average Peak Intensity  H  © 0 20 or  o.oo  1000  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  5000 frequency (Hz)  (b) Mechanical Telephone Ringer Spectral Analysis  Figure 5.3 - Typical Warning and Noise Signal Power Spectra  49  1  Chapter 5 - WARNSIS II Design  1.00 •o 0.75 2 0.50 c 0.25 §» 0.00 5 -0.25 _ -0.50 S -0.75 -1.00 <D  - i  -  H  -  1  time  Relative Magnitude vs Time  1.00  ini|lll!|llll|l!ll|llll|llll|llll|llll|MII|IMI|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll  © 0.20 0.00  1.00  ! i i . . ! . . . . ! . • . . • i • 11 •• i • ! . •• • I. i •.[. • • • | . • • H • •• • ! . • (  1000  - i 11111 II  I • • • . [• • • • I •• • • • i •• l • • i •) • i • • I •• • • I • t  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  11111 II 1111 II 11111 II 1111 II 11111 ij 1111 | i 11111  II  • p i • H • • I'I I  5000 frequency (Hz)  I I II I III I II I I I I II II I I l l l l I I I II I I I I I II I I I I III I I I I II I I I I |  © 0.80 ••§ 0.60 CJ)  £  Average Peak Intensity  0.40  © 0.20 0.00  i  •' i ' •  i " ' " i " ' • i •• • • i • •• • i • • " i • • • ' i " • • i • " i ' " i 1  1000  1  1  1  1  •i "  1 1  1"" i " "i  1 1  " i "" i " "i"' 1  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  1  1 1 1  'i " 1 1  1  5000 frequency (Hz)  (c) Typical Background Noise (FM Rock Music & Voices) Spectral Analysis  Figure 5.3 - Typical Warning and Noise Signal Power Spectra 50  Chapter 5 - WARNSIS II Design relatively minor noise peaks become dominant in the high frequency power spectrum. This could lead to erroneous spectral matches. These matches are not likely cause warnings to be issued to the user since a particular noise spectrum is unlikely to persist long enough to match the timing criteria of the timing analyser. However, by eliminating the noise peaks at this stage, we can increase the overall processing speed of the WARNSIS II algorithm.  In the recognition mode, if one of the detected peaks in the input signal's spectrum matches the characteristic peak of one of the learned signals in one of the templates, then a signal match is deemed to have been made for that template.  For the recognition mode  acquisition algorithm, as for the learning mode signal acquisition algorithm, two consecutive signal matches are required in order to determine if a "candidate" warning signal has been identified. A "candidate" signal is one for which further spectral and timing analyses shall be performed to determine if indeed an actual warning signal has been successfully detected. Unlike in the learning mode, however, in the recognition mode, a warning signal's candidacy is based on energy content at its characteristic frequencies  and not on  total energy  (amplitude) increases. Once the "candidate" signal is associated with a given template, the start-of-burst indicator flag is set and the burst start time is recorded.  The WARNSIS II algorithm uses multiple templates, one for each learned signal, and each template has its own set of timing records and flags. Thus, it is possible for WARNSIS II to identify multiple warning signals overlapping in time. Provided that the characteristic peak of each of the different warning signals  in the input to WARNSIS II are at a different  frequencies, and that each of the warning signals in the input possesses enough energy to meet the minimum energy (magnitude) criteria stated earlier, the peak for each individual warning signal in the combined signal will be detected by the algorithm.  51  Chapter 5 - WARNSIS II Design Once a warning signal's candidacy has been determined, that is a spectral template match has been found, the burst duration timer is kept running until the warning signal's peak is no longer detected (lost). In the recognition mode, losing the signal requires two consecutive absences of the given warning signal's characteristic peak in the input signal. Once the signal is lost, the burst duration is calculated as it was in the learning mode, from the time of detection of thefirstof the two initial matches between the input signal's spectral peaks and the warning signals characteristic peak stored in the template to the time of thefirstof the two consecutive peak losses. At this point a determination can be made as to whether a spectral and burst timing match can be made between the input signal and a previously learned signal whose characteristics are saved in the template. A "match" between an incoming signal and a template requires both the spectral characteristics and the burst duration timing of the input signal match the corresponding template values within pre-defined limits.  In particular, the burst  duration comparison algorithm allows a burst duration match to fall within a time window of variable length.  From examining the variation in a number of real input signals, it was  determined that the input signal's burst duration need only match the template values within +/10%. This means that the detected burst can be up to ten percent longer or ten percent shorter than the value stored in the template. Similarly, the spectral peak comparison algorithm was determined to require a tolerance of +/-1 frequency bin (+/-15.6 Hz for 512 sample intervals @ 8012 HZ) in order to successfully match a peak from the input signal to a characteristic peak in a template. Both tolerances can be defined on either a template to template basis or as an overall tolerance limit for WARNSIS II and, as for all other WARNSIS II limits, can be changed on an implementation to implementation basis.  If both the timing and spectral  characteristics have been matched between the input signal and one of the learned warning signal templates, a burst recognition flag is set indicating a valid burst match for that warning signal.  52  Chapter 5 - WARNSIS II Design For continuous signals, the burst duration must only be longer than the minimum burst duration that is stored in the template, rather than actual burst duration. If WARNSIS II is trying to recognize a continuous signal, once the minimum burst duration is exceeded a continuous recognition flag is set. For a continuous signal, the recognition flag can be maintained for the duration of the signal, or it can be cancelled automatically after some period of time and re-issued if the warning signal remains on long enough to exceed the minimum burst duration a second or third time.  WARNSIS II also has the ability to further validate repetitive signals such as telephone rings by waiting for a second occurrence of the warning signal to appear. When in the learning mode, we assume that the second increase in amplitude indicates a second signal burst. In the recognition mode, WARNSIS II requires a second complete burst to occur before it can attempt to match the interval times of the incoming signal with that of the template's. Rather than just waiting for a second burst to start, the entire second burst must occur and match the same timing and spectral characteristics as the first. This means that noise bursts, as well as intervening signals from other valid warning devices will not affect the interval timer. The interval timer also allows a +/-10% variation in interval time between the input signal and the warning signals template value for a valid match to occur. If an interval timing match is found an interval recognition flag is set. The use of the various recognition flags will depend on the implementation of WARNSIS II in an actual device. In some cases a notification to the user that a warning signal has been detected could be issued, in others the recognition flag may be used to trigger further processes in an existing medical device.  Figure 5.4 shows theflowchartfor the generalized WARNSIS II recognition algorithm. The DSP code for both the learning and recognition modes can be found in Appendix A. 53  Chapter 5 - WARNSIS II Design  Enter Recognition Mode  Collect Next 512 Samples :  - ^ C a l c u l a t e F F T Power 'jpectruttj Find Peaks in Spectrum Over q O O H z ' "  Figure 5.4 - Flowchart for WARNSIS II Recognition Mode algorithm  54  Chapter 6  6.0 WARNSIS H Implementation and Evaluation  The WARNSIS II project has resulted in two separate implementations of the WARNSIS II algorithms. Much of the initial design and testing was performed on a PC as a MS-Windows compatible program. This allowed for rapid modification and testing of the algorithms as well as providing a rich graphical environment for displaying and analyzing results. Once the basic algorithms had been designed, the system was then implemented on a Texas Instruments TMS320C30 Digital Signal Processing Evaluation Board.  This provided  the platform for testing the algorithms in real-time on a lower cost system. Finally the two implementations were integrated to allow PC control of the algorithms operating on the DSP board.  6.1 P C Based System  The PC version of the WARNSIS II algorithms were written in Turbo Pascal for Windows Version 1.5 to run under Microsoft Windows on any IBM compatible PC system. In addition to performing the WARNSIS II algorithms, the PC based program also provided a number of additional routines that were used to display and analyse digitized input signals. This was very useful in the early stage of development and lead directly to the development of a number of the WARNSIS II algorithms. By visually examining the digitized signals and their Fourier transforms, it was possible to determine what features made the warning signals distinct from other types of input signals.  Indeed, many of the WARNSIS II algorithms are  implementations of the pattern recognition "routines", such as picking out distinct peaks from the background, that were originally performed visually. 55  Chapter 6 - WARNSIS II Implementation and Evaluation  The PC based system also provides a "toolbox" environment for testing and refinement of new algorithms in the future. As new types of recognition algorithms are designed they can easily be added in a modular fashion to the existing PC program and then tested. This helps to meet one of the objectives of the WARNSIS II project, namely to provide a method for easily maintaining and upgrading the WARNSIS II system.  To allow the maximumflexibilityof the PC-based system, again rather than relying on an implementation specific format, digitized signals are input to the WARNSIS II program in V O C format. This is a standard PC format originally created by Creative Labs for their "Sound Blaster" series of signal processing boards. This allows any PC based sound acquisition board to function as the input system for a PC-based WARNSIS II system. For this portion of the project a Creative Labs Sound Blaster was used to provide the digitized input signals. 16  Using the standard V O C file format and a non-specific input device also provides two other useful features for WARNSIS II development. Since the V O C format provides for the storage of input signals in digital format as a file, new algorithms can be tested against existing digitized signals. This means that comparison of the new algorithms can be made against existing algorithms on the same signal. Even the best quality tape recordings will deteriorate over time whereas the digitizedfilescan be used over and over. The second advantage comes from the ability to use V O C files from any source. If a test of a specific warning signal is required, a V O C file for the warning signal can be easily sent via modem or network from a remote location.  56  Chapter 6 - WARNSIS II Implementation and Evaluation 6.1.1 Results of P C Based Implementation  Figure 6.1 (a) and (b) show an example of the results of the WARNSIS II learning mode algorithms.  The top graph shows the input signal amplitude versus time for  approximately 6.33 seconds of telephone ringing signal generated by an electronic, rather than mechanical bell, ringer. The entirefirstburst of the telephone ringing signal is shown, but only the beginning of the second ringing burst is shown as learning mode does not require the entire second burst for interval determination. Additionally, the top graph shows vertical lines indicating the beginning and end of the first burst and the beginning of the second burst calculated by the S T A A A method. The burst duration and interval times calculated using the STAAA method for this signal were found to be 2.189 seconds and 6.178 seconds respectively which is in agreement with the telephone standards [29].  The middle graph shows the overall FFT power spectrum for the input signal for the time period between the vertical lines indicating the start and end of the first ringing burst. As stated earlier, this is the combined power spectrum totalling each of the FFT magnitudes calculated for the 46 individual 512 sample FFTs performed during the burst.  The bottom  graph shows the combined power spectrum for frequencies above 900 Hz and also shows the peaks in the power spectrum identified by learning mode. The small vertical lines at the bottom of each peak show the width of the peak as detected by the peak detection algorithm as well as the centre frequency for each peak, shown by the small vertical line at the top of the peak. The characteristic peak is highlighted at the top of the third graph by a horizontal line showing the width of the characteristic peak. Although, at present, the width of the characteristic peak is not used in recognition mode (nor calculated in the DSP version), it is included as a feature in the PC version of the learning mode in order to supply more spectral information when  57  Chapter 6 - WARNSIS II Implementation and Evaluation  6178 msec  © 1.00 - i •o 0.75 3 0.50 "c 0.25 g> 0.00 5 -0.25 _ -0.50 r? -0.75 -1.00 -  0 1  time  1  1.00  -  Relative Magnitude vs Time  ii f i i ] f i f i | i i i i | i i i i | i i i i j t f i i | i B i i | i i i i | f i f i | i i i i | i i i i | r t i i | t i i i ] i f t t | i i i i | r i i i | i i ( i | i r i i | i i i i j f i j i | i i f i | i t i t |  CD  5  0.40 H  ® 0.20 H n '' i i  i  i i i  'i 'M 'M'''M'''M'' M'' M i i  ?  i i  1000  i  i i  ^i 'M' i i  r t  V^i  'n'' M ''n'' M' ''f ' M '' i^  , i  ,  i  i  i  i  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  1.00 - • • i i f i > i i j t i i i | t i i i | i t t i | r i i i  i  ,  i  , ,  'i  5000 frequency (Hz)  j-t-i-t-i- | i i J i | i t i i f i t t i | i i i i | t i i i | i i i i j i i i i j i i i f | i i i i | i i i i | i i i i | i i i i | i i i f | i t i i | i i i i j  © 0.80 fz  0.60  1593 Hz  Jj 0.40 -  Average Peak Intensity  ® 0.20 0.00  'i""i""i"*'i ' r" r "i"'w , ,  l  ,  ,  , r i  l""l  ^T  | ,  " r'^ T '^ l"" l""r"T"'i""f l  >  f  ,  ,  4000 1000 2000 3000 Relative FFT Peak Intensity (above 900 Hz)  ...ifs^j  5000 frequency (Hz)  Figure 6.1 (a)- Results of Learning Mode for Electronic Telephone Ringing Signal  58  Chapter 6 - WARNSIS II Implementation and Evaluation  1.00 - i l 'l 11111111111111111 j 111111111 |_L1JLL j > 1 < < | • • ' • (< < > • | • • 1111 (1111111111111 M 111111111111 {1111 f 111 f 1111111111 p <D  •o  C  cn (0 <D  0.80 H  0.60  0.40 H 1593 Hz  0.20  Average Peak Intensity  o.oo  1000  • I •' '• I" •" I  I  rQ-rn 11 ITTT,  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  5000 frequency (Hz)  Figure 6.1 (b) - Results of Learning Mode Electronic Telephone Ringing 59  111  1  Chapter 6 - WARNSIS II Implementation and Evaluation developing new algorithms. For the telephone ringing signal shown in this set of graphs, the characteristic peak frequency was determined to be 1,593 Hz with a width of 275 Hz from 1,458 Hz to 1733 Hz. The centre frequency is in close agreement with the frequency of 1575 Hz measured by oscilloscope and is within the accuracy limits for the FFT at the sample rate of 11,025 Hz and 512 samples. The horizontal line near the bottom of this graph shows the average peak power above 900 Hz and again is shown as a development "tool" rather than as one of the parameters for signal recognition.  Figure 6.2 (a) shows graphically the overall results obtained by the WARNSIS II recognition mode algorithms from a complex signal. The graph in Figure 6.2 (a) shows 7.64 seconds of digitized signal. The signal is a composite of four separate signals:  i)  Background Noise (FM rock radio and voices)  ii)  Warning Signal A, microwave oven alarm  iii)  Warning Signal B, electronic tone telephone ringer  iv)  Warning Signal C, mechanical bell telephone ringer  Figure 6.2 (b), (c) and (d) shows the individual digitized warning signals without the background noise signal. For each of the warning signals in Figure 6.2 (b), (c) and (d) the values showing the characteristic peak frequency, burst duration time and interval time were obtained from the WARNSIS II learning mode algorithm. Figures 6.2 (b) and (c) show multiple bursts so that interval times can be shown, whereas the composite signal shown in. Figure 6.2 (a) contains only a single repetition of signals B and C.  60  Chapter 6 - WARNSIS II Implementation and Evaluation  1.00  Electronic Ringer  Microwave Alarm  M e c h a n i c a l Ringer  6 c  0.75  0)  TJ  2 o> c  3a a at  Ii L.  0.50  .1  'V l^| , ll  Background Only  l  0.25  -0.25  r 'VI'I  W  i'  """"  i , "i 1  ' I . Jii  Jji^  a,I i  IS  i  l l f l  -0.50  I  j I'V^L^V^I'I^V^KV  '"  0.00  |  [IF  -0.75 -1.00  c b a  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIM I I II II I lllllllllllllllllllll llllllllllll llllllllll  Illlllllllllll  III11II11II11  Illlllllllllll  Each Line indicates a Successful Spectral Match  Relative Magnitude vs Time Burst Duration: 1: 2: 3: 4: 5: 6: 7: 8:  650 ms 2043 ms 604 ms 139 ms 13? ms 13? ms 650 ms 2090 ms  Interval:  (microwav.wtp) (mech_phn.wtp) (microwav.wtp) (mech_phn.wtp) (mech_phn.wtp) (mech_phn.wtp) (microwav.wtp) (elec_phn.wtp)  Dur. M a t c h : microwav.wtp bur. M a t c h : mech_phn.wtp Dur. M a t c h : microwav.wtp Int. M a t c h : microwav.wtp  1254 ms  Dur. M a t c h : microwav.wtp Dur. M a t c h : elec_phn.wtp  1207 ms  Int. Match : microwav.wtp  (a) - Results of WARNSIS II Analysis of Composite Signal Figure 6.2 - Composite and Individual Warning Signals Analyses. Thefigureabove shows the results of the PC-based recognition mode analysis. The central graph of the figure shows a combined signal consisting of background noise and three different warning signals: a - Microwave Oven Alarm, b- Electronic Telephone Ringer, c - Mechanical Telephone Ringer. The set of horizontal lines at the top of the graph, indicated as a, b and c, show the position of each of the individual warning signals in the composite signal, as determined by the recognition mode analysis. The small vertical lines at the bottom of the graph, indicated as c, b and a, show each successful spectral match for each warning signal in the composite. Each vertical line corresponds to one 512 sample period. Each of the  horizontal lines above the graph corresponds to one set of vertical lines below the graph are arranged  symmetrically around the central time axis.  (  61  Chapter 6 - WARNSIS II Implementation and Evaluation  6088 msec  1.00 •o 0.75 H 3 0.50 c 0.25 -I ro 0.00 2 "025 - \ - -0.50 <D  E  -1.00  1.00  Relative Magnitude vs Time  -  i  itii|ttfi|ittitfiiijrirt|irii|ifBt|iiti|ttii|iiif|iitijiiii|iifi|fiii|«tii|iiii|iiji|iiifjiiif|iiii|iiif|tfff|  © 0.80 H ~ 0.60 - | cn 5 0.40 —I © 0.20 H 0.00  | M , ,  1000  1.00  -  i  |  I , , ,  R  I , , , , I , ,  |  , r r r p - r w q > n ,  , , , , , , , , , , , , , ,  f  rjT7rriTrrrrrrT,p-pr^  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  * i (> | • • < 11 < * f 111 r f 11 r i e 11111 f J ^ '*~T~ '' ( ' • [ ' ' ] -4-  -  1 1  1  1  11  1 1  5000 frequency (Hz)  > * | '' | • > * ] > <' | < < • • | < • < • | < < < ^ j • • • < j < > •' j * < i • | • • 11  (  1  © 0.80 •"§ 0.60 cn §  1658 Hz Average Peak Intensity  0.40  ® 0.20 0.00  .|.... .... ..'.rivrr;|,J.. ,M.|,.lTrrX,|.Vrrrrrw^^ 1000 2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz) l  |  |  5000 frequency (Hz)  (b) - Mechanical Telephone Ringer Signal and Spectral Analysis Signal C  Figure 6.2 - Composite and Individual Warning Signals Analyses 62  Chapter 6 - WARNSIS II Implementation and Evaluation  6178 msec  1.00 —i •o 0.75 3 0.50 <D  g* o.oo  -H  ii^TWUHanraninriii  2 -0.25 - -0.50 ® -0.75 -1.00  time  K  Relative Magnitude vs Time  1.00 - i M M | i i i i  |  i,,,,,,, |,, l  lI|IIII|l  .  II|lIllMniMlll|llll|ll  ,  lJllIljfI|l|ll|l|i:tllJ|||ij||ii||Mi|iiM  ® 0.20 H i " " i " " i " " i " " i " i " 1 " ' * i l "I "n ifO> 11 II 11111 n T '' l""l""l""T'"|""f""i""i "l 1000 2000 3000 4000 5000 Relative FFT Peak Intensity (0 - 5000 Hz) frequency (Hz) 11  1  r  LOO n ' " ' r " | . i i i | n H | , . . . | , . i | j | u | , M | . . M l  l  r  ,  |  f  r  i  r  © 0.80 H  f  0.60  1593 Hz  CD  |  Average Peak Intensity  0.40-  ® 0.20 0.00  ' - • i • *' • •• i • -J'-r^" i • n 1000 2000 3000 4000 3000 4000 Relative FFT Peak Intensity (above 900 Hz) 1  T...|....f.., ,...f5s 5000 frequency (Hz) l  (c) -Electronic Telephone Ringer Signal and Spectral Analysis Signal B  Figure 6.2 - Composite and Individual Warning Signals Analyses  63  Chapter 6 - WARNSIS II Implementation and Evaluation  1.00 - i •o 0.75 3 0.50 c 0.25 g> 0.00 — § -0.25 _ -0.50 <D  r? - ° 0 0  7 5  816 msec —\  -  time  Relative Magnitude vs Time  -1.00  1.00  1281 msec  —11111111111111111 M 1111111111 1111111111 I 1111111111 i n 1111 n i II 11 |i m i n 111 n n 11111111111 II 1111 n 11 II 1111111  © 0.80 TO  =§ 0.60 - i CD  2  0.40  — I  © 0.20 0.00  | ' i " | " " | ' " ' i | l l l l | l l , , | , , , , | , > . , | , l l l | l , l l | . , , , | , . , i | . . . i | , i i , | , i , r , , . , . , . . . i , , r i i , i . i . |  1000  2000  3000  4000  Relative FFT Peak Intensity (0 - 5000 Hz)  1.00  | i i. i |  5000  frequency (Hz)  H|IIII|IIII|IIII|IIII|IHI|IIII|IIII|IIII|IIII|IIII|IIII|IIII|IIII|  © 0.80 ••§ 0.60 - |  1981 Hz  CD  5  0.40  ® 0.20 0.00  Average Peak Intensity  — I  H M' 'M'TM'''M'''-r--M~' M' ~M''''H"'M'' M ''M' Mr' M' ' l' 'M' 'M'''M ''M'''Mr L  ,  1000  2000  l  ,  ,  3000  l  ,  ,  T  l  4000  Relative FFT Peak Intensity (above 900 Hz)  ,  l  i i  ~  5000  frequency (Hz)  (d) - Microwave Oven Alarm Signal and Spectral Analysis. Signal A  Figure 6.2 - Composite and Individual Warning Signals Analyses 64  Chapter 6 - WARNSIS II Implementation and Evaluation Figure 6.2 (a), produced directly by the PC based implementation, shows the combined results of the timing and spectral analysis algorithms. For each warning signal in the composite signal, the spectral matches between the peaks in the FFT power spectrum for the composite signal and the characteristic peaks stored in the templates for each of the warning signals is shown by a small vertical line below the digitized signal. Each vertical line corresponds to a spectral match for one 512 sample time interval. The spacing between each vertical line is not constant due to the resolution limits of the display screen, but the timing is identical for each of the 512 sample intervals. The timing analysis for each warning signal burst is shown by the horizontal lines above the digitized signal. The corresponding spectral and timing indication lines are symmetric about the horizontal axis at the centre of the digitized signal, shown by labels a-a, b-b etc..  Thus the first set of spectral match lines below the digitized signal  correspond to the first horizontal timing line above the digitized signal.  Below the graph, the calculated burst duration and interval times as well as burst duration and interval match messages are shown for the warning signals in order of their recognition. Thus, although warning signal C started before warning signal A, the burst for signal A ended before that for signal C, allowing A's burst duration to be calculated and the user message for signal A to be generated before signal C ended.  The spectral matching acquisition algorithm's requirement for two consecutive matches or losses can be clearly seen in the spectral match lines for warning signal B. Approximately half way into signal C's spectral match series a single spectral match for signal B is shown on the graph. Since this was a single occurrence, the two consecutive spectral match criteria was not met and the signal's candidacy was not successful at this stage. Approximately 6 time segments later signal B was successfully determined to be a candidate. The signal remains a  65  Chapter 6 - WARNSIS II Implementation and Evaluation candidate until the end of the warning signal burst, even though there are two occasions indicated by missing vertical lines when a spectral match for a single 512 sample interval is not found for signal B. This is one of the key features of the spectral analysis algorithm. It allows the temporary loss of the signal without interrupting the timing analysis.  The two consecutive loss algorithm can be extended to three or more consecutive losses for determining candidacy or loss of a signal. This could allow the WARNSIS II signal recognition algorithm to operate in a higher noise environment than for the standard two match/loss algorithm. For example, for the two consecutive loss algorithm, a signal would be lost after being masked by background noise for only two time periods.  If a signal requires  three or four consecutive losses to end the signal's candidacy, then in a very noisy environment the signal could be masked by background noise for up to four time periods without being lost. This would allow noise bursts to be longer in duration without interrupting the timing analyser.  This would also, however, have the effect of lengthening the time after the warning signal ends before the burst recognition flag is set, since three or more time intervals, instead of two, would be required to elapse after the end of the signal burst.  This would not  necessarily cause a problem as the time intervals are on the order of 64 msec (sample rate for the PC version of WARNSIS II was 11,025 Hz) and 4 time intervals would only amount to 1/4 of a second delay. A greater problem would occur from linking spurious noise bursts into a single long duration burst. The higher the number of dropouts allowed in the signal matching algorithm, the greater the likelihood that a series of noise burst would be grouped into a single burst. This could cause a false positive message to be issued, especially for continuous signals where a timing match only requires exceeding a minimum burst duration time.  66  Chapter 6 - WARNSIS II Implementation and Evaluation Figure 6.2 (a) also shows why a two part spectral and timing analysis is required. Although the WARNSIS II spectral analysis correctly identifies the spectral matches for the initial occurrence of warning signal C, after warning signal C ends, the spectral matching algorithm continues to find a number consecutive spectral matches between the input signal and the characteristic peak for warning signal C. These are listed in the burst duration calculation tables shown below the graph as 139 ms duration bursts. However, because these bursts do not match the timing requirements of the timing analysis algorithm, no burst duration or interval time match message is issued to the user. If only spectral information had been used, the recognition of the signal by the spectral analyser alone would have issued an erroneous message.  As can be seen in Figure 6.2 (a), the use of both spectral and timing analysis in combination with the use of multiple templates (one for each warning signal learned) allows the WARNSIS II system to detect multiple overlapping warning signals in a noisy environment. Figure 6.2 (a) shows at one point the simultaneous occurrence of the three warning signals in addition to the background noise. It should also be noted that the characteristic peaks of warning signals B and C are at frequencies of 1658 Hz and 1593 Hz respectively. This is a separation of only 65 Hz or 3 bins for a sample rate of 11,025 Hz. Since the spectral matching algorithm allows for a variation of plus or minus one bin for a valid spectral match, this is very close to the operational frequency resolution limits of WARNSIS II.  6.1.2 Other Results  As the spectral analysis for WARNSIS II is performed in software by the using the FFT, it is important to determine the effects of digitization, sampling rate, and the data sampling  67  Chapter 6 - WARNSIS II Implementation and Evaluation window on our algorithm. The PC-based implementation provides not only a basis for implementing the WARNSIS II algorithms but also for testing the effects of various parameters and features of the WARNSIS n algorithms. The following sections detail the results of those investigations and their effects on the WARNSIS II algorithm.  6.1.2.1 8 Bit vs 16 Bit Digitization  The V O C format provides for the storage of digitized signals in both 8 and 16 bit data sizes. Initially both 8 and 16 bit data formats were used for digitizing the input signal when testing the WARNSIS II algorithms. An 8 bit digitization allows for 256 levels of input signal (+/- ~ 0.4%), a 16 bit digitization allows for 65536 levels (+/- -0.002%). Calculating the STAAA's averages the input signal's magnitudes over a time period of 512 samples.  If we  assume a maximum error of Vi of a bit between the real and digitized input signals for each of the 512 samples then the maximum error for 8-bit digitization is 512* 1/2 bit = 256 bits. For 512 samples this would give a maximum error of 256/512 = Vi bit maximum error after the average is taken. The result is the same for 16-bit digitization. Since the S T A A A process requires a increase of 50% in the input signal amplitude above the background level to start the learning process, the difference between 0.4% and 0.002% is irrelevant.  As the spectral analysis relies only on relative magnitude differences in the FFT power spectrum, the extra resolution provided by the greater number of input bits is of no extra value. Since peaks lower in magnitude than 25% of the largest peak found and lower than a preset minimum are ignored, the extra resolution is lost in the background. Given these results, it was found that when performing either the S T A A A analysis or the FFT analysis that the data digitization at either 8 or 16 bits had no effect on the function of the WARNSIS II algorithms.  68  Chapter 6 - WARNSIS II Implementation and Evaluation  6.1.2.2 FFT Size, Frequency Resolution and Sampling Rate  For the FFT the relationship between frequency resolution, sampling rate and sample size is given by, Af=R/N  (6.1)  where A/is the frequency resolution between adjacent bins, R is the sampling rate and N is the size of the FFT. The larger N, the FFT size, becomes, the smaller A/becomes. However, the larger N becomes, the longer the period of time a single FFT power spectrum covers. These are the time-frequency resolution limits described earlier in section 4.1.5.  There is no theoretical limit on sampling rate and size, and time-frequency resolution for WARNSIS n. The WARNSIS n algorithms can be implemented at any sampling rate. The trade-off, again is between the time and frequency resolution. For a WARNSIS II device to operate successfully it must be able to meet the two following criteria. Firstly, to discriminate between multiple overlapping signals, the characteristic peak frequencies of the two signals must be resolved separately from each other. In order to do this the frequency resolution of the FFT must be fine enough to place the characteristic peaksfromtwo separate signals into different bins. Secondly, if two warning signals have identical characteristicfrequencies,then they can only be successfully recognized if they do not overlap in time, and they have different burst and/or interval times.  This means that the time-frequency resolution issue must be solved on a practical basis such as the processor memory requirements or expected signal characteristics. If the sample 69  Chapter 6 - WARNSIS II Implementation and Evaluation size was set so that only a few bins covered the entire spectrum, then the frequency performance of the WARNSIS II algorithm would suffer accordingly. Conversely, if the sample size is too great then the memory requirements and the time resolution would be similarly effected.  For the WARNSIS II algorithms, the size of 512 samples was chosen for two main reasons. First, choosing a sample size of 512 we can achieve a frequency resolution of approximately 21.5 Hz covering a period of 46.4 msec for a sampling rate of 11,025 Hz for the PC based implementation. This provides a reasonably good resolution for both frequency and time. Secondly, a sample size of 512 allows the DSP implementation to maintain two separate FFT sample arrays and processing code in the processor's internal memory. This greatly increases the speed of the DSP FFT algorithm [17]. By maintaining the same sample size for both implementations it is easier to compare algorithms between the two platforms.  More important than using a specific sample rate or sample size, is the requirement that the same sample rate and size be maintained both in the learning mode and in the recognition mode. Since not only the frequency resolution, but also the centre frequencies of the bins (hence the bin #) changes with sampling rate and size, a signal learned at one sample rate and size will not have the same centrefrequencyor bin number if the recognition algorithm operates at a different sample rate and size.  6.1.2.3 Sampling Window Effects  Section 4.1.1.2 discussed the effect that various sampling window functions would have on the leakage of energy between bins in the FFT power spectrum. Figures 6.3 (a), (b), (c)  70  Chapter 6 - WARNSIS II Implementation and Evaluation and (d) show the effect of the standard square window, the Parzen window, the Welch Window and the Hanning window on the FFT spectrum of a 2040 Hz signal. Although the Parzen, Welch and Hanning window functions all improve the leakage between bins, as shown by the narrowing of the base of the peak, they provide little advantage for the WARNSIS II spectral analysis algorithm. The reduction in leakage is so small that it is lost in the background noise. This can be seen in Figures 6.4(a) and (b). Figure 6.4 (a) shows the power spectrum of the background noise signal using the standard square window. Figure 6.4 (b) shows the power spectrum for the same signal using the Hanning window function. There is virtually no difference in the spectrum asidefroma slight "smoothing" effect that the Hanning window has on the peaks and valleys as was shown in Section 4.1.1.2.  Since only the relative magnitudes  of the peaks above the preset limit and above 25% of the maximum peak are important, the use of any one of the additional windowing functions simply adds to the processing time of the algorithm with no appreciable benefit.  6.1.2.4 Speed Considerations  Although the PC implementation of the WARNSIS II algorithms operates on stored data files, an attempt was made to have the algorithms perform at a "real-time" rate. Due to the overhead of the Windows environment and the extra effort required by the PC's processor to display the graphical information generated by the program, there was not enough processing power to have the algorithms process all of the incoming data in real time. To speed up the processing time, rather than performing the FFT analysis on all of the data, the program was modified so that the FFT was only calculated for one of two, one of three, one of four, etc. sample periods. The time for the intervals for which the FFT was not calculated was included in the burst duration calculations, but no spectral analysis was performed on these missed  71  Chapter 6 - WARNSIS II Implementation and Evaluation  o  1.00 -  TJ 0.75 3 0.50 c 0.25 0.00 5 -0.25 _ -0.50 • -0.75 -1.00  time  Relative Magnitude vs Time  1.00 ® 0.80  H  =| 0.60  H  CD  |  0.40 -  © 0.20 0.00  M  i  i  i  M'  i  i  'i  i  i  i  M ''M ''M'' 'P'M i  1000  i  L  I  I  I  I  T'  l  l  'r'''i '' r' i  i  i  i  r ''i ' 'r i  i  i  i  i  'i''''r  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  1.00 -i i i i i | i i i i | i i i i | i i i i | i i i t | i i i i | i i i i | i i n  i  i  i  r'''r ' i' ' i i  i  i  i  1  1  1  1  5000 frequency (Hz)  fiiiiiiii|Mii|iiii|iiii|iiii|iiii|iiii|iiii|iiii|ini|iiii|iiii|iii  a> 0.80 fz  0.60  2  0.40  2040 Hz Average Peak Intensity  ® 0.20 0.00  1000  •i"  " i "  " i " '  • i""  i • • " i'"  • i""  i""  i —  j . . . - 1 1 1 " 1111 n | i  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  5000 frequency (Hz)  (a) Standard Square Sampling Window for 2000 Hz Signal  Figure 6.3 - Effect of Sampling Window Function on Power Leakage  72  Chapter 6 - WARNSIS II Implementation and Evaluation  1.00  - iM I I | I I I I | I I I I | I I I I | I I I I | I I M | I I I I | | I I |  MII|IIII|IIII|IIII|IIII|IMI|III||I|||||||||IIII|IIII|IIII||I||||||I  © 0.80 ••§ 0.60 cn to  0.40  ® 0.20 0.00  'i""i""i""r "i""i""i""i" i""i""i""i""i""i""i""{""i""i""i""i""r i  T l  1000  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  5000 frequency (Hz)  (b) Parzen Window for 2000 Hz Signal 1.00  1 III 11  • • 11  j 111111111 j f • i J j 111111 (111111 1 f > > I >' i r 111111 r 11 r 111 J i j 1111 j j 111111 r 11111111111 j 11111 1  1  © 0.80 "§ 0.60 cn  2  0.40  ® 0.20 0.00  1  1" 1" " i " r • • 1 " 1 11  1  1  1  1000  1  1  1111  1" 1 11  1 • " i" "i  1 rt 1  2000  1  1111  1  1111  1 •" i " " i  3000  1  1111  1" 1" " i 11  4000  Relative FFT Peak Intensity (0 - 5000 Hz) (c) Welch Window for 2000 Hz Signal 1.00  1111  1" " i " 1 1  1  1  5000 frequency (Hz)  |IIII|MII|IIII|IIII|UII|IIII|IIII|IIII|IIII|IIII|IIII|IIII|IIII|IIII  o 0.80 f= 0.60 cn  J£ 0.40 ® 0.20 0.00  1000  2000  3000  4000  Relative FFT Peak Intensity (0 - 5000 Hz)  5000 frequency (Hz)  (d) Hanning Window for 2000 Hz Signal  Figure 6.3 - Effect of Sampling Window Function on Power Leakage 73  • 1111»111 j»111  Chapter 6 - WARNSIS II Implementation and Evaluation  a> 1.00—]  •o 0.75-1  3 0.50  E 0-25 §> 0.00 2 -0-25 _ -0.50 5 -0.75 -1.00 0 1  1.00  H H  time  Relative Magnitude vs Time  -II  ] M M T M T T T H ll,  l,l  lll  ll  lll  ll  ll  ll  llll  l  llll  l  ,lll  l' l lll  llll  l  llll  l 'l l,,  ll,l  l' l ,ll  llll  l l nil  llll  l l nil  ® 0.80 •j= 0.60 - \  5  0.40  H  Relative FFT Peak Intensity (0 - 5000 Hz)  1.00  frequency (Hz)  llll|MII|llll|MII|llll|llll|llll|||||||||||M||||||  Average Peak Intensity ® 0.20 H  Relative FFT Peak Intensity (above 900 Hz)  frequency (Hz)  (a) - Background Spectrum for Standard Square Sampling Window  Figure 6.4 - Effects of Sampling Window, Background Noise Power Spectrum  74  Chapter 6 - WARNSIS II Implementation and Evaluation  0 1.00 •o 0.75 B 0.50 £ . 0.25 g> 0.00 3 -0.25 _ -0.50 ® -0.75 -1.00  -  0 1  1.00 © 0.80  time  Relative Magnitude vs Time  iiij|i|ittf|ii'*i|iiir|ifii|(iitjifii|irti|titj|rtii|iiirjtitt|iif«jiiiijiiii|iitijtttfjttti|iiii|tiii|fiii|ff(i|  H  =| 0.60 cn |  0.40 - \  ® 0.20 H 0.00  1000  2000  3000  4000  Relative FFT Peak Intensity (0 - 5000 Hz)  5000  frequency (Hz)  1.00  1000  2000  3000  4000  Relative FFT Peak Intensity (above 900 Hz)  5000  frequency (Hz)  (b) - Background Spectrum for Hanning Sampling Window  Figure 6.4 - Effects of Sampling Window, Background Noise Power Spectrum  75  Chapter 6 - WARNSIS II Implementation and Evaluation intervals to determine if a signal was still a candidate or had been lost.  The same two  consecutive spectral matches or loss for signal acquisition or loss were still required, but these consecutive matches were now spaced further apart in time by the number of "missed" intervals. In comparison to those test signals that were successfully detected by the standard algorithm when no intervals were missed, the modified algorithms were able to miss up to 6 consecutive intervals and still successfully identify the warning signals.  This brought the  processing speed on a 50MHz 486 PC to the point where the signals could be processed in an amount of time less than or equal to the actual duration of the input signal.  An additional increase in processing speed was obtained by comparing the square of the peak magnitudes instead of the peak magnitudes. Since we are only interested in relative magnitudes and not absolute magnitudes there is no need to perform the square root function required to obtain the absolute magnitude from the real and imaginary parts of the FFT. This provides a great increase in speed for the spectral analysis algorithm since processing the square roots requires as much processing time as performing the FFT itself.  6.2 TMS320C30 Based System  The DSP version of the WARNSIS II algorithms were written in TMS320C3x assembly language code and implemented on a Texas Instruments TMS320C3x Evaluation Module (EVM). The E V M is a half length board that installs in an IBM compatible PC. T h e E V M c a n run in stand alone mode operating completely independently from the PC or can be interfaced to the PC through the PC's I/O port structure. The E V M itself consists of a 33 MFLOP 32 bit TMS320C30 Digital Signal Processor with 2K words of internal R A M . 16K words of additional zero wait-state R A M are also provided on the circuit board as well as a TLC32044  76  Chapter 6 - WARNSIS II Implementation and Evaluation Analog Interface Circuit (AIC). The AIC provides 14 bit digitization for audio signals which can be input directly from a microphone or via a preamplified line [30].  In the WARNSIS II setup the AIC of the E V M was connected via the Creative Labs Sound Blaster  16  to a standard 500 Ohm unidirectional microphone.  implementation of WARNSIS II, the Sound Blaster  16  For the DSP  was used only as a preamplifier for the  microphone and no digitization orfilteringwas performed by this board.  The TLC32044  AIC however has an internal bandpassfilterwith the ripple bandwidth and 3-dB low frequency roll-off points of the highpass section at 150 Hz and 100 Hz respectively, and a high frequency 3-dB roll-off at approximately 3,700 Hz for a sample rate of 8,012 Hz [31].  The sample rate  of 8,012 Hz is used for the DSP implementation as the AIC filtering circuits are optimized for this frequency. The lower sample rate for the DSP implementation vs the PC implementation presents no problems in that it still provides a maximum frequency resolution of 15.64 Hz and an interval time of 63.9 msec. The maximum frequency limit from the lowpass section of the AICfilteralso presents no problems as all of the warning signals that we have identified so far have their characteristic peakfrequencieswell below this limit. As for the PC implementation, the actual choice of sampling rate and sample size is a practical one guided by memory requirements and desiredfrequencyresolution, not a theoretical one.  The TMS320C3x Digital Signal Processor family was chosen due to the support available from the manufacturer as well as the availability of a number of versions of the processor at various speed and price ranges. Although the E V M cost was on the order of $1200 US, some versions of the processor itself can be purchased in quantity for under $20 US. This means that a relatively low cost implementation of a stand alone device based on the TMS320C3x DSP could be designed.  77  Chapter 6 - WARNSIS II Implementation and Evaluation  6.2.1 Program Size  The size of the compiled assembly language program for the DSP implementation was 1,492 words and required 1,801 words of data storage.  Of the 1,492 words of program code,  952 words were required for implementing the WARNSIS II algorithms and communications routines with the PC, 420 words were required for the FFT routine, 78 words were required to implement a floating point divide routine and the remaining 42 words were for miscellaneous interrupt vectors and processor control. Of the 1,801 words of data storage, 1,024 were required for maintaining two 512 word tables, one for collecting the current 512 input samples, the second for simultaneously calculating the FFT of the previous 512 samples. The rest of the data storage was comprised of 256 words of storage for the FFT sums for learning mode, 256 words for the FFT "twiddle factors", 120 words for peak identification, 40 words for templates, 10 words for I/O buffers for PC communications and 55 words for miscellaneous variables. The majority of both code and data were accommodated in the 2K of internal R A M provided on the TMS320C30 DSP chip, meaning less than 2K of external R A M was required.  6.2.2 Results of DSP Based Implementation  The WARNSIS II spectral and timing analysis algorithms functioned similarly in the DSP based implementation as they had for the PC based implementation. The TMS320C30, however, provided enough processing speed to perform the analysis in real time. In fact, of the 63.9 msec interval time for 512 samples, approximately 0.57 msec was required to process the FFT from the previous 512 samples. As the current samples are input via an interrupt routine the time not used for processing the FFT's is available for the peak detection, spectral and timing analysis and template comparison algorithms. Also, because the data is input via an  78  Chapter 6 - WARNSIS II Implementation and Evaluation interrupt routine and the burst timing and spectral analysis are performed in real time as the input signal is digitized, the delay from the end of a burst, or interval between bursts, to the time a message is issued to the user is less than one 512 sample interval. This means that there is no appreciable time delay between the end of a warning signal's occurrence and the setting of the recognition flag.  6.2.2.1 Performance Measurements  Tests of the DSP implementation of the WARNSIS n algorithms were performed under quiet office conditions with an ambient noise level below 50 dB. The background noise added for testing was generated by a standard stereo receiver playing a combination of F M rock music and voices. Figure 6.5 (a) shows the physical location of signal and noise sources in relation to the microphone input. N shows the location of the noise generating source, W the A  location of the warning signal source A, W the location of the warning signal source B, M the B  microphone location and S the location of the sound level meter. Warning signal source A was a typical telephone ring generated by a Panasonic PD-2300 telephone whose FFT spectrum and characteristic peak frequency are shown in Figure 6.6.  Warning signal source B was a  continuous 2200 Hz tone generated by a function generator whose FFT spectrum and characteristic peak frequency are shown in Figure 6.7. Sound level measurements were made with a Realistic (TM) Sound Level Meter with both standard A and C weighting. As shown in Figure 6.5 (b) the C weighting curve has a flat frequency response from 32 Hz to approximately 2,500 Hz, the A weighting curve has a 3 dB highpass roll-off at approximately 500 Hz.  This means that more low frequency energy is measured with the C weighting than  for the A weighting.  79  Chapter 6 - WARNSIS II Implementation and Evaluation  *  a  f — — 3 ft  >  (a) Noise, Warning Signal and Microphone Test Setup  20  BO  100  200  500  IK  2  5  FREQUENCY (Hi)  (b) A and C Sound Level Meter Weightings  Figure 6.5 - Performance Measurement Setup  10  20  Chapter 6 - WARNSIS II Implementation and Evaluation  6178 msec  time  Relative Magnitude vs Time  1.00  llll|llll|llll|llll|IIM|llll|l  © 0.80  TO  ~  0.60  - i  2  0.40 ® 0.20 H 0.00  1.00  I " •• I — I  —  1000  I " ' ' I • " ' I  —I  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  iiii|ini|iiii|iiii|imiiiii|  5000 frequency (Hz)  i i i n IIII i n n i II 11 II II III n i l i n i i n i n i l 11 n i l i n i l i II n i i i i i t i i i i i i II i n  © 0.80 ••§ 0.60 5  1593 Hz  0.40 H  Average Peak Intensity  ® 0.20 0.00  • i" •' i • • " i •  l *|VV|A , i. ,  1000  "W^-I  I  l,. ,,,,,,.,. .„, ,..^w? 1  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  r  l  5000 frequency (Hz)  Figure 6.6 - Panasonic PD-2300 Electronic Ringing Signal Spectral Analysis  81  Chapter 6 - WARNSIS II Implementation and Evaluation  a> 1.00 - i •u 0.75 B 0.50 c 0.25 g> 0.00 §. -0.25 - f _ -0.50 S -0.75 or -1 .oo - 1  1.00  Relative Magnitude vs Time  111 j f 1111 j 111) 11111 [ 111111 • 11111111 r 111111 j f j 1111 ] 1111 j 111111111 ]. 111111 j 111 j 11111111111111»111 j 1111 j 11111111 • j  a> 0.80 H ••§ 0.60 - \ o> 5 0.40 ® 0.20 H 0.00  1.00  1000  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  i j i • j 1111111111111 r 1111111111 ] a 11 r 11111 j  5000 frequency (Hz)  j-t- r 11 [ 11 > i j 111 > 11111 j 1111111111 < 11 r j 11111 p • 11111111 [ 111 j t f 11 j r (111  ® 0.80 - \ 2200 Hz  fz 0.60 - \ CD  2  Average Peak Intensity  0.40  ® 0.20 H 0.00  1000  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  5000 frequency (Hz)  Figure 6 7 - 2200 Hz Continuous Tone Spectral analysis  82  Chapter 6 - WARNSIS II Implementation and Evaluation Table 6.1 shows the upper limits on signal and noise for the DSP implementation of WARNSIS II for sound level measurements with both A and C weightings. As can be seen, the DSP implementation of the WARNSIS II algorithms can successfully signals in  detect warning  very noisy environments. The DSP implementation was able to detect a 57 dB  warning signal at a distance of 4 ft from the device generating the warning signal in the presence of76dB average background noise. This is a signal-to-noise ratio of -19 dB. Since most warning signals are designed to be at least 10 dB above ambient noise levels, the DSP implementation far exceeds the requirements. In fact, in testing, the DSP implementation of WARNSIS II outperformed the author's own ability to detect warning signals by ear and to discriminate between warning signals in very noisy environments. The DSP implementation of the WARNSIS II algorithms performed with 100% recognition accuracy during testing. All occurrences of perviously learned warning signals were recognized until the background noise level exceeded the values shown in Table 6.2.2.1 below and no false positives were generated.  Table 6.1 - Single Warning Signal vs. Noise Sound Level Measurements  Distance  Distance  Meter  Warning Signal  Maximum Average  Maximum Peak  a (ft)  b(ft)  Weighting  StrengthJdBA)  Noise Level (dBA)  Noise Level (dBA)  11  2  A  56  72  74  11  2  C  58  80  84  11  4  A  56  62  66  11  4  C  57  76  78  83  Chapter 6 - WARNSIS II Implementation and Evaluation To determine if the presence of one warning signal would suppress the detection of another signal in a noisy environment, a second signal was introduced during testing. In order to determine the level at which the second warning signal (B) would suppress the detection of the original warning signal (A) the following procedure was used.  First the noise  background level was increased to the point where detection of warning signal A was suppressed by the noise alone. Next the noise level was decreased by 2 dBA to allow detection of warning signal A. The level of warning signal B was then increased to the point where detection of warning signal A was again suppressed. Table 6.2 shows the upper limits for the sound level for the two signals and the background noise.  Table 6.2 - Dual Warning Signal Vs Noise Sound Level Measurements  Warning  Warning  Maximum  Maximum  Distance  Distance  Meter  Signal A  Signal B  Average  Peak  a (ft)  b(ft)  Weighting  Strength  Strength  Noise Level  Noise Level  (dBA)  (dBA)  (dBA)  (dBA)  11  2  A  58  58  70  72  11  2  C  62  58  78  82  11  4  A  58  55  60  62  11  4  C  60  55  70  74  11  4  A  58  55  -  -  11  4  C  60  55  -  -  84  Chapter 6 - WARNSIS II Implementation and Evaluation  The first four rows of table 6.2 show the level at which the detection of warning signal A was suppressed by warning signal B in the presence of background noise. The last two rows of table 6.2 show the level at which detection of warning signal A was suppressed by warning signal B alone, without the addition of background noise. It is significant to note that the presence or absence of the background noise has no effect on level at which suppression of signal A by signal B occurs.  Figure 6.8 shows the FFT spectrum of the background noise. Note that most of the energy is in the range below 900 Hz. Figure 6.9 shows the combined spectrum of signal A and signal B at the point just before suppression of signal A occurs.  This shows that suppression  of signal A occurs when the magnitude of the characteristic peak for signal B is approximately four times that of signal A. The noise signal can only contribute to the suppression of signal A by signal B if there is significant energy in the noise spectrum at the characteristic frequency peak of signal B. This is in agreement with the original algorithm design as discussed in section 5.3.  It would appear from the sound level readings that the strength of both signal A and signal B are at approximately the same level, 55 dBA to 60 dBA, and the magnitude of their characteristic peaks should also be approximately the same. However, since signal B is a pure tone, all of the energy in signal B is found at its characteristic frequency. Signal A, on the other hand, has its energy distributed across the spectrum, including a portion below 900 Hz, which means less energy is contained at the characteristic frequency .  85  Chapter 6 - WARNSIS II Implementation and Evaluation  1.00 •o 0.75 H B 0.50 c 0.25 §» 0.00 5 -0.25 _ -0.50 —I £ -0.75 H -1.00 <D  0 1  1.00  time  Relative Magnitude vs Time  If  ll|llll|llll|IMI|llll|llll|llll|llll|llll|llll|llll|UII|llll|llll|llll|IIH|llll|llll|llll|llll|llll|llll|  ® 0.80 H 0.60 ~ i CD  J  0.40  ® 0.20 0.00  H • I  1 1  ' ' I "  *' I ' ' 1 1  11  1000  1.00  ' ' ' ' I ' ' ' I ' '' 1 ' ' ' '1 ' ' I'' ' • 1 1  1  1  1  1 11  ' I ' ' '' I '" ' ' I'  1 1  ' I " *' I ' ' ' I ' ' ' I ' • ' • I •' • • I ' • • I' ' 'I ' ' ' ' I 1  2000 3000 4000 Relative FFT Peak Intensity (0 - 5000 Hz)  1  1  5000 frequency (Hz)  l|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll|llll|IMI|llll|llll|  ' | " " | ' • " | " " | " " | " " | • " ' | " 'I' 1  1000  1  1  • I" ' '  I "" I " 1  1  I " ' I" ' t'''' 1 ' '' I'' ' • I • ' " I " " 1  1  1  2000 3000 4000 Relative FFT Peak Intensity (above 900 Hz)  I'"'  I  5000 frequency (Hz)  Figure 6.8 - Test Background Noise Spectral Analysis  86  Chapter 6 - WARNSIS II Implementation and Evaluation  <D 100 - j •o 0.75 B 0.50 c 0.25 g* 0.00 f| -0.25 - -0.50 ~i  r? -1.00 -°-  7 5  time  K  1.00  © 0.80  Relative Magnitude vs Time  nMII|llll|llll|IIU|MII|nil|MII|IIM|Mlj|MII|llll|IIM|IMI|MII|lin|llll|Mn|ltll|llll|lll'l|llll|IMI|  .-I  Z3 •  ~ 0.60 o> |  0.40  © 0.20  H  0.00 ft  1  "I""!  "A  •"•••in—  1000  1.00  J  •i,, ,.., Tr7Tpii |i.. |iTii  llll|llll|llll|IIM|llll|llll|llll||||||||  © 0.80  H  •§ 0.60  H  |  |  l  l  ,,,,,  |  i,  ,,,,,,  3000 (0 - 5000 4000 Relative2000 FFT Peak Intensity Hz)  5000 frequency (Hz)  INI|IIII|IIII|IIM|IIII|IIII|IIII|IIII|IIII|IMI|IIII|IIII|I|I||  O)  5 0.40  Average Peak Intensity  ® 0.20 - \ 0.00  t  . . . . . . .|i  H  .-nrT-rr.—,  1000  , , , H | „ ,  2000  3000  F  p "  1  " " I " "I " 'I " '  4000  1  '1*^''  I  5000  Relative FFT Peak Intensity (above 900 Hz)  frequency (Hz)  Figure 6.9 - Combined Warning Signal A and B Spectral Analysis 87  Chapter 7  7.0 Conclusions and Recommendations  It has been shown that the WARNSIS II algorithms, can, by the application of separate spectral, energy and timing analysis routines, in that order, learn and then later recognize warning sounds with 100% accuracy in very noisy background environments. The signal-to-noise ratio in these environments can be on the order of -20 dB. It has also been shown that warning signals can be successfully recognized on the basis of four characteristics:  i)  peak frequency  ii)  energy content at the peak frequency  iii)  burst duration  iv)  interval time.  Both continuous and burst warning signals can be recognized by this method. In particular, a burst signal can be recognized after a single burst and a repetitive warning signal can be successfully recognized on the basis of a single repetition. A warning signal can also be identified with no appreciable delay due to processing after the signal burst has ended. Additionally, it has been shown that it is possible to successfully recognize multiple overlapping warning signals in the presence of background noise. These results mean that it would be possible to implement a device that could operate successfully in real-life situations.  The implementations of the WARNSIS II algorithms on both a PC and a DSP module have also shown that it is possible to implement a system that does not rely on any specialized hardware and can be easily ported to distinctly different platforms. 88  Chapter 7 - Conclusions and Recommendations  In addition to aiding the design and development of the WARNSIS II algorithms, the PC implementation has provided, not only a tool for further development of WARNSIS II based systems, but a tool for general spectral analysis as well.  The base routines and  functionality of the PC program as well as the graphical displays for instantaneous signal amplitude, absolute signal amplitude and FFT power spectrum can easily be used as the starting point for other projects in this field.  The DSP implementation further shows that it is possible to implement a low cost, low part-count system, with sufficient power to perform the required analysis. The E V M board used in the DSP implementation contains only 24 IC's and provides extra functionality such as analog output and secondary serial communications not required for the WARNSIS II implementation.  Although the E V M provided 16K of additional zero wait state R A M , less  than 2K of this R A M was required for the WARNSIS II algorithms. This means that a standalone implementation of WARNSIS II could be produced on a system consisting of fewer than the 24 IC's on the E V M .  Since the code and data space and processing time requirements for  the WARNSIS II algorithms are small, it may be possible to add the WARNSIS II functionality to existing equipment without additional memory or processing power.  7.1 Future Work  Although the WARNSIS II system performed extremely well and met all of the objectives of phase II of the project, there are some areas where further improvement is possible.  89  Chapter 7 - Conclusions and Recommendations  7.1.1 Improved Learning Mode  Although the WARNSIS II recognition mode is able to operate in extremely high noise background areas, the learning mode algorithms require that the warning signal that is being learned be significantly louder than the background noise. In most cases this would not be a problem as it should be possible to arrange, temporarily at least, for a sufficiently quiet background in which to learn a warning signal. There may be cases, however, where this would not be possible and the warning signal would have to be learned in a high noise background environment.  It may be possible to improve the learning mode's ability to learn new signals in high noise environments by using an approach similar to the recognition mode's warning signal "candidacy" algorithm. Rather than relying on a single burst and using the S T A A A to identify the beginning and end of a burst, multiple signal bursts and frequency characteristics could be used. For example, the first burst could be used to identify the characteristic frequency for the warning signal by monitoring for the occurrence of a strong peak in the power spectrum. The second burst could then be used for confirmation of the spectral peak and burst timing and a third complete burst could be used for interval timing and confirmation of the characteristic frequency and burst times.  If the WARNSIS II device were provided with enough memory to store the digitized input signal for two complete bursts, the learning mode could be designed to learn from a single repetition of a warning signal by performing the spectral analysis twice on the initial burst. The  90  Chapter 7 - Conclusions and Recommendations first pass would identify the characteristic peak, the second pass would be used to identify the burst duration time. At least one partial repetition would still be required, however, to identify the interval time.  7.1.2 Improved Recognition Mode  It was stated earlier in section 5.3, and shown in section 6.2.2.1, that the presence of a warning signal that was significantly greater in power than other warning signals could, in effect, suppress the recognition of those other warning signals should they occur at the same time. It may be possible to overcome the suppression by performing a multi-pass frequency analysis. In the first pass, the peak with the largest magnitude in the spectrum would be used for normalizing the spectral magnitudes. Once the spectrum had been analysed using this peak for normalization, the process would be repeated using the next largest peak to normalize the spectrum. This would continue until all peaks that exceed the preset minimum "background" value had been used for normalization. This way a single powerful signal would not be able to suppress a valid peak. This would, however, require an increase in both processing power and memory. The processing would only require extra time to recalculate the normalized magnitudes for each pass, not to recalculate the FFT.  The data storage requirements would  increase by 8 words (256 bits, one for each frequency bin) forflagsto indicate if a peak had been previously used for normalization.  7.1.3 Additional Features  We have shown that a WARNSIS II device is capable of correctly identifying warning sounds in noisy environments. There is often other information conveyed with a warning signal  91  Chapter 7 - Conclusions and Recommendations in addition to that simple presence or absence of the sound. Humans rely on binaural hearing for sound localization. An improved WARNSIS 13 device could supply even more information to the user if some type of sound localization could be performed. Additionally, an estimate of the "loudness" of the warning signal could provide added benefit to the user.  The  implementation of these features should be explored.  7.2 Other Applications  As stated earlier the functionality of the WARNSIS II algorithms can be incorporated into other devices. This could provide assistance not only to the hard of hearing or the deaf but also to people in other situations. The problem of recognition of warning sounds is not limited to those with hearing impairments.  There are situations which arise on a day to day  basis which can have serious affect on people with normal hearing.  In many industrial  environments auditory warning signals are commonly used. On construction or mining sites it is common practice to use auditory warning signals to signal blasting or movement of heavy machinery. In mills and chemical processing plants the starting of a piece of equipment is often preceded by an auditory warning burst. Often the noise present in these environments and the need for personnel to wear hearing protection makes it difficult to hear these signals. Personnel who are working in an area where the risk of injury is high would benefit from a device that was able to alert them to these signals.  Another possible use for the WARNSIS II system is in hospitals. In critical care areas, patients may be connected to a number of different medical devices, each with its own alarm sound. Rather than relying on separate recording instruments or hard-wiring the alarms to the central station, a WARNSIS II device which monitors all alarms and reports to the central  92  Chapter 7 - Conclusions and Recommendations station could save both wiring and training costs. Time and effort would also be saved when new equipment was introduced to a critical care area. Since each medical device would have its own warning signal characteristics which could be "pre-learned" by the WARNSIS II device, no extra connections or training would be required each time the equipment was introduced into a new area. By elimination of the hard-wire requirements for some devices, the space near the patient would be less cluttered, allowing for better patient access.  93  References [I]  "The Prevalence of Hearing Impairment and Reported Hearing Disability Among Adults in Great Britain", A.C.Davis, pp. 911-917, International Journal of Epidemiology, 18 (4)  [2]  "Canadians with Impaired Hearing", J. Shein, ed., Publication Division, Statistics Canada, 1992  [3]  "Visual Devices For Deaf and Hard of Hearing People: State-of-the-Art", Judith Harkins, GRI Monograph Series A, No. 3, Gallaudet Research Institute, 1991  [4]  "Technological Devices for Deaf-Blind Children: Needs and Potential Impact", A.Y.J. Szeto, K.M.Christensen, IEEE Engineering In Medicine and Biology, Volume 7, pp. 25-28, September 1988  [5]  "A Computer Sound Cue Indicator for Hearing Impaired People", C.Jensema, D.Hinton, N.Drew, pp. 49-52, Computing Applications to Assist Persons with Disabilities, 1992 Proceedings  [6]  "Sound Alerting Aids for the Profoundly Deaf, B.Uvacek, G.S.Moschytz, pp. 26152618, IEEE International Symposium on Circuits and Systems, 1988  [7]  "A Warning Signal Identification System (WARNSIS) for the Hard of Hearing and the Deaf, Simon Chau, Masters Thesis, University of British Columbia, 1989  [8]  Speech Level and Spectrum, Electronics Engineer's Handbook, Second Edition, Section 19.10, pp. 19-7, McGraw-Hill, 1984  [9]  "Standard for the Installation, Maintenance and Use of Local Protective Signalling Systems for Guard's Tour, Fire Alarms and Supervisory Service", National Fire Protection Association, NFPA 72A, 1985  [10]  "Guide for the Installation, Maintenance and Use of Notification Appliances for Protective Signalling Systems", National Fire Protection Association, NFPA 72G, 1985  [II]  "Long-Duration Signal Detection in a Noisy Environment", S.C.Clontz, R.R. Adhami, pp. 527 - 532, IEEE 1989 South Eastern Symposium on System Theory, 1989  [12]  "Speech Recognition Techniques", P.M.Grant, pp. 37 - 48, Communications Engineering Journal, February 1991  Electronics &  94  [13]  "Algorithms and Architectures for Dynamic Programming on Markov Chains", W.G.Bliss, L.L.Scharf, pp. 900-912, IEEE Transactions on Acoustics, Speech and Signal Processing, Vol. 37, No. 6, June 1989  [14]  "A Real Time Connected Word Recognition System", Y.Ishikawa, K.Nakajima, pp. 215-217, 10th International Conference on Pattern Recognition, 1990  [15]  "Speech Technology At Work", J. Hollingum & G. Cassford, IFS Publications, 1988  [16]  "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition", L.R.Rabiner, Proceedings of the IEEE, pp. 257-285, Vol 77, No. 2, February 1989  [17]  "An Implementation of FFT, D C T , and Other Transforms on the TMS320C30", P. Papamichalis, pp. 53-136, Digital Signal Processing Applications with the TMS320 Family, Theory, Algorithms and Implementations, Texas Instruments, Volume 3, 1990  [ 18]  "How the FFT Gained Acceptance", J. W. Cooley, IEEE Signal Processing Magazine, Volume 9, Number 1, 1992  [19]  "Numerical Recipes in Pascal", W.H. Press, B.P. Flannery, S.A. Teukolsky, W.T. Vetterling, Cambridge University Press, 1992  [20]  "A Spectral Magnitude Analysis Theorem and Applications", J.C.Anderson, pp 277280, Time-Frequency and Time-Scale Analysis, IEEE International Symposium on Signal Processing, 1992  [21]  "An Algorithm for the Machine Calculation of Complex Fourier Series", J.W. Cooley & J.W. Tukey, Math. Comp. 19, 1965  [22]  "A New Look at the Comparison of the Fast Hartley and Fourier Transforms", M.Popovic, D.Sevic , pp. 2178 - 2182, IEEE Transactions on Signal Processing, Vol. 42, No. 8, August 1994  [23]  "Transforming Real-Valued Sequences: Fast Fourier versus Fast Hartley Transform Algorithms", P.R.Uniyal, pp. 3249 - 3255, IEEE Transactions on Signal Processing, Vol. 42, No. 11, November 1994  [24]  "Restructured Recursive DCT and DST Algorithms", P.Lee, F.Huang, pp. 1600 - 1609, IEEE Transactions on Signal Processing, Vol. 42. No. 7, July 1994  95  [25]  "An Adaptive UR Structure for the Separation, Enhancement, and Tracking of Multiple Sinusoids", C.C.Ko, C.P.Li, pp. 2832 - 2834, IEEE Transactions on Signal Processing, Vol. 42, No. 10, October 1994.  [26]  "Linear and Quadratic Time-Frequency Signal Representations", F. Hlawatsch, G.F. Boudreaux-Bartels, IEEE Signal Processing Magazine, Volume 9, Number 2, 1992  [27]  "A Wavelet Magnitude Analysis Theorem", J.C.Anderson, pp. 3541 - 3543, IEEE Transactions on Signal Processing, Vol. 41, No. 12, December 1993  [28]  "Wavelets and Signal Processing", O.Rioul, M.Vetterli, pp. 14 -35, IEEE Signal Processing Magazine, October 1991  [29]  "TMS320C3x Evaluation Module", Technical Reference, Texas Instruments, 1990  [30]  "Performance and Compatibility Requirements for Telephone Sets", Canadian Standards Association, National Standard of Canada, CAN/CSA-T510-M87, March 1987.  [31 ]  TLC32044C, TLC32044I Voice-Band Analog Interface Circuits, Linear Circuits Data Conversion, DSP Analog Interface, and Video Interface Data Book, Volume 2, Texas Instruments, 1992  [32]  "Advanced Digital Signal Processing", J.G. Proakis, C M . Rader, F. Ling, C.L. Nikias, pp. 498 - 520, MacMillan Pubilishing Company, 1992  96  Appendices Appendix - A  WARNSIS n TMS320C30 Assembly Language Code  ********************************************* * FILENAME * WRITTEN  *  : warnsis.asm BY  : Kim D o t t o  * DATE  : 23rd June  * VERSION  : 1.0  *  1994  * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * VER * * 1.0  *  DATE 23rd June  COMMENTS 94  TMS320C30 I m p l e m e n t a t i o n o f WARNSIS  . II project  * * * * *************************************************************************** * * SYNOPSIS:  *  *  * * * * *  The WARNSIS P r o g r a m i s d e s i g n e d t o d e t e c t t h e p r e s e n c e o f a u d i b l e w a r n i n g signals. T h e s e s i g n a l s c a n be s i n g l e o r r e p e t a t i v e b u r s t t y p e i n n a t u r e , o r t h e y c a n be c o n t i n u o u s . T y p i c a l d e v i c e s g e n e r a t i n g t h e s e w a r n i n g s i g n a l s w o u l d b e t e l e p h o n e s , m i c r o w a v e s , smoke d e t e c t o r s o r o t h e r home or office devices.  * * * * * * *  The WARNSIS I I a l g o r i t h m s e l i m i n a t e t h e n e e d f o r s p e c i a l i z e d h a r d w a r e a n d p r o v i d e s v e r y good p e r f o r m a n c e i n n o i s y e n v i r o n m e n t s . S p e c t r a l a n a l y s i s i s p e r f o r m e d c o n t i n u o u s l y b y s o f t w a r e u s i n g t h e FFT i n s t e a d o f s p e c i a l i z e d chipsets. The s t a r t o r e n d o f a w a r n i n g s i g n a l b u r s t o r r e p e t i t i o n i s d e t e r m i n e d by t h e p r e s e n c e o r absence o f key s p e c t r a l i n f o r m a t i o n f o r a given warning s i g n a l . The FFT power s p e c t r u m f o r t h e r e a l t i m e i n p u t i s compared t o i n f o r m a t i o n s t o r e d i n p r e d e f i n e d t e m p l a t e s . I f the  * * * * * *  s p e c t r a l i n f o r m a t i o n matches t h e t e m p l a t e a s p e c t r a l m a t c h i s r e g i s t e r e d . The s i g n a l i s t h e n c o n t i n u o u s l y m o n i t o r e d u n t i l t h e s p e c t r a l s i g n a t u r e disappears. The b u r s t d u r a t i o n and i n t e r v a l t i m e s a r e t h e n compared t o those i n the template. I f a match o c c u r s f o r b o t h s p e c t r a l and b u r s t d u r a t i o n t h e n a b u r s t match i s i n d i c a t e d . I f a match a l s o o c c u r s f o r t h e i n t e r v a l t i m e t h e n an i n t e r v a l m a t c h i s i n d i c a t e d .  * * * * * * * *  B e c a u s e t h e s p e c t r a l a n a l y s i s i s c a r r i e d o u t i n s o f t w a r e , t h e WARNSIS I I p r o j e c t c a n be p o r t e d t o any hardware w i t h s u f f i c i e n t power t o p e r f o r m t h e FFT a n a l y s i s i n r e a l t i m e . T h i s i n c l u d e s a 50MHz 486 PC r u n n i n g u n d e r MS Windows, w h e r e t h e s o f t w a r e was o r i g i n a l l y d e s i g n e d . T h e Windows p r o g r a m t h a t p e r f o r m s t h e a n a l y s i s i s c a l l e d WARNSIS.EXE a n d was w r i t t e n f o r B o r l a n d ' s T u r b o PASCAL f o r Windows V e r . 1.5. T h i s program and t h e a c c o m p a n y i n g s o u r c e f i l e s s h o u l d b e a v a i l a b l e f r o m t h e same s o u r c e a s this file.  *  *  97  T h i s v e r s i o n o f t h e WARNSIS I I p r o j e c t i s d e s g i n e d t o r u n o n t h e T e x a s I n s t r u m e n t s TMS320C30 DSP a n d t h e C30 E v a l u a t i o n M o d u l e a n d i s i n t e n d e d t o show t h a t t h e p r o j e c t c a n be i m p l e m e n t e d o n a l o w c o s t DSP c h i p , n o t j u s t a n I n t e l 80C486 50MHz s y s t e m .  ********************************************************** FILES: WARNSIS.ASM WARNMATH.ASM WARNFFT.ASM WARNTWID.ASM  Main program f i l e Math r o u t i n e s f o r F l o a t i n g P o i n t D i v i d e FFT s u b r o u t i n e c o d e f i l e FFT t w i d d l e f a c t o r s f i l e ( s i n e t a b l e )  WARNFFT.CMD  Linker  command  file  ************************************************************************ PASCAL PSEUDOCODE: program  warnsis;  const s i n e _ t a b l e = a r r a y [0. .255] min_hz = 1000; max_hz = 4000; min_power = 1000;  of real;  {twiddle factors} {minimum c u t o f f f r e q u e n c y } {maximum c u t o f f f r e q u e n c y } {minimum s p e c t r a l p e a k p o w e r b e l o w } {which peak w i l l n o t be c o n s i d e r e d }  var i,j : integer; {general purpose counters} f i l l _ c n t : i n t e g e r ; {current p o s i t i o n o f t a b l e being filled} f f t d a t O , f f t d a t l : a r r a y [0. . 511] o f r e a l ; {2 t a b l e s f o r c o l l e c t i n g i n p u t {and c a l c u l a t i n g f f t p o w e r {spectrum i n f o f f t t o t a l : a r r a y [0..511] o f r e a l ; { s t o r a g e f o r t o t a l f f t s p e c t r u m p o w e r { u s e d i n l e a r n i n g mode max_fft : r e a l ; {maximum f f t m a g n i t u d e i n p o w e r s p e c t r u m , u s e d f o r { n o r m a l i z a t i o n o f power s p e c t r u m b e t w e e n s a m p l e s ave_fft : r e a l { a v e r a g e f f t m a g n i t u d e i n power s p e c t r u m , g i v e s I { b a s e l i n e f o r comparison o f peak t o b a c k g r o u n d n o i s e | { E a c h new t y p e o f s i g n a l must b e l e a r n e d b e f o r e i t c a n b e d e t e c t e d } { e a c h " l e a r n e d " s i g n a l h a s i t s own t e m p l a t e w i t h t h e f o l l o w i n g i n f o } template = record info : string[30]; burst_duration : real; i n t e r v a l time : real; waiting end;  procedure  boolean;  ffft_rl(fft_size,  { t e m p l a t e name} {burst duration} {interval duration} {currently matching  log_size: integer;  spectrum  source_addr,  flag]  dest_addr,  98  s i n e _ t a b l e : p t r ; b i t _ r e v e r s e : boolean begin i f source_addr=dest_addr then calculate_fft_inplace else calculate_fft; i f b i t _ r e v e r s e then d o _ b i t _ r e v e r s a l s ; end; {get_realtime_data  i d called  upon e n d o f c o n v e r s i o n  );  interrupt}  procedure get_realtime_data : interrupt begin tmp_real:=get_analog_value; i f s t o r i n g _ t a b l e O then begin fftdatO[fill_cnt]:=tmp_real end else begin fftdatl[fill_cnt]:=tmp_real end; inc(fill_cnt); start_next^conversion; end; b e g i n {main p r o g r a m ) initialize_data_structures; start_first_A/D_conversion; repeat i f learning_mode then begin cancel_template_tests; i f check_for_available_template=true then begin initialize_total_fft_j?ower_array; wait_for_input_signal_above_predefined_amplitude; start_duration_timer; start_interval_timer; w h i l e i n p u t _ a b o v e _ l i m i t do begin calculate_fft_every_512_samples; add_current_fft_magnitudes_to_total_fft_magnitudes end; end_duration_timer; save_duration_time; find_main_peak_in_fft_power_spectrum; save_peak_frequency_and_peak_width; wait_for_input_signal_above_predefined_amplitude_again; i f second_amplitude_increase_found then begin end_interval_timer; save_i n t e rval_time; end else cancel_interval_timer; exit_learning_mode; end  else issue_warning; end else begin i f f i l l _ c n t = 5 1 2 then begin fill_cnt:=0; set_other_table_to_be_filled; i f f f t d a t O _ f u l l then ffft_rl(512,9,fftdatO,fftdatO,sine_table,false) else ffft_rl(512,9,fftdatl,fftdatl,sine_table, false) { | f f t | a n d f i n d t h e maximum a n d a v e r a g e v a l u e o f t a b l e f o r t h o s e } { f f t v a l u e s f o r f r e q u e n c i e s b e t w e e n max_hz a n d m i n _ h z } ave_fft:=0 max_fft:=0; j:=0; f o r i : = 0 t o 255 do i f f f t _ h z [ i ] > m i n _ h z and f f t _ h z [ i ] < m a x _ h z then begin i n c (j ) ; Fft_real[i]:= sqrt(fft_real[i]* fft_real[i]+fft_imag[i]* fft_imag[i]); i f f f t _ r e a l [ i ] > m a x _ f f t then m a x _ f f t : = f f t _ r e a l [ i ] ; ave_fft:=ave_fft+fft_real[i]; end; ave_fft:=ave_fft/j; i d e n t i f y _ j ? e a k s ; { i d e n t i f y peaks i n spectrum > 0.25*max_fft} f o r a l l _ t e m p l a t e s do begin f o r e a c h _ p e a k _ f o u n d do i f ( a b s ( p e a k _ f r e q - t e m p l a t e _ f r e q ) < t e m p l a t e _ t o l e r a n c e ) and (peak_magnitute>2.5*ave_fft) and (peak_magnitude>min_jpower) t h e n { f o u n d a s p e c t r a l match} begin i f c u r r e n t l y _ t i m i n g _ a _ s p e c t r a l _ m a t c h _ f o r _ t h i s _ t e m p l a t e then begin i f have_been_timing_for_at_least_2_sample_periods then set_flag_to_indicate_valid_start_of_signal; continue_timing_spectral_match; end; else begin start_timing_spectral_match; end end else begin i f c u r r e n t l y _ t i m i n g _ a _ s p e c t r a l _ m a t c h _ f o r _ t h i s _ t e m p l a t e then i f have_lost_the_match_for_at_least_2_sample^periods then begin stop_timing_spectral_match; i f timing_duration=template_value+-tolerance then issue_duration_match_message; i f currently_timing_interval then  100  * * * * * * * * * * * *  *  i finterval_duration=template_value+-tolerance issue_interval_match_message; reset_interval_timer_for_this_template; end; end; end; end else wait_for_full_table end; u n t i l done; end;  then  * ********************************************* .global .global .global .global .global .global .global .global .global .global .global .global .global .global .global .global .global ..global .global .global .global .global .global .global .global .global .global •global .global .global .global .global .global .global  sinetab process_mode,fill_cnt,rla_addr, rlb_addr _ffft_rl SQRT FINV FDIV find_peaks,fft_magnitude, find_match, f i l l _ a r r a y , get_data start_learning,start_analysis,idle_loop,setup_fft fcnt,wfill,process_mode max_fft,ave_fft,cycle_cnt rla_addr,rlb_addr,fft_addr t_info,t_config,t_burst_dur,t_interval_time t_range_min,t_range_max,t_range_tol,t_range_peak t_waiting p e a k _ h z , p e a k _ c n t , p e a k s _ h c n t , p e a k s _ t c n t , g_up,peak_max peak_cs t2000 t_sig shortmix microsht no_message test_burst,test_interval,template_loop casel_0,casel_l,casel_2,casel_3,casel_4,casel_end case2_0,case2_l,case2_2,case2_3,case2_4,case2_end case3_0,case3_l,case3_2, case3_3, case3_4, case3_5, case3_end case4_0,case4_l,case4_2, case4_3, case4_4, case4_5, case4_end found_burst,found_int,data_index,max_peak ave_ampl,learn_cnt,keep_waiting, tmp_table no_fft_req,find_template, less_than_min,find_main_peak find_amplitude,sum_ffts,copy_fft_sum,pick_main_peak save_template_info,clear_table,average_fft_sum sysinit,aicreset,com_j?arm,hcontrol,receiveO hreadl6,hwritel6,hread32,hwrite32 w a i t _ t r a n s m i t _ 0 , dmadone, w o r d f l a g  /•Template I n f o r m a t i o n t_info t_burst_dur t i n t e r v a l time  .usect .usect .usect  f o r 5 templates ".fftdata",5 ".fftdata",5 ".fftdata",5  ; t e m p l a t e name ;burst duration ;interval duration  101  t_range_peak t_waiting t bstart t bend t i n t count  .usect .usect .usect .usect .usect  II  p r o c e s s mode fill_cnt f cnt wfill cycle cnt none_waiting  .usect .usect .usect .usect .usect .usect  II  learn_cnt a v e ampl t e s t ampl  .usect .usect .usect  II  peak c n t g_up peak hz peak_max  .usect .usect .usect .usect  r l a addr r i b addr fft_addr data index  .usect .usect .usect .usect  ti  max f f t ave_fft  .usect .usect  II  tmp table max_peak peak c s peaks hcnt peaks_tcnt cont f l a g  stack_size stack  .usect .usect .usect .usect .usect .usect  .set  .usect .sect  PARMS: reset into intl int2 int3 xintO ;rintO  .word .word .word .word . word .word  II II II II  II II II II II  H II  II II II II  tt ti II  II  .fftdata", 5 .fftdata",5 .fftdata", 5 .fftdata",5 .fftdata", 5  ;peak f r e q u e n c y / c u r r e n t l y matching spectrum ;burst timer s t a r t time ; b u r s t timer end time ; i n t e r v a l timer  .fftdata", .fftdata", .fftdata", .fftdata", .fftdata", .fftdata",  ;analyze=0 l e a r n = l ;realtime data count f l a g ;realtime data count ;realtime data array f l a g ;timing cycle counter ;no t e m p l a t e s w a i t i n g f l a g  1 1 1 1 1 1  flag  .fftdata", 1 .fftdata", 1 .fftdata", 1  ; l e a r n i n g mode c y c l e c o u n t e r /average i n p u t s i g n a l s t r e n g t h /average i n p u t s i g n a l s t r e n g t h  .fftdata", .fftdata", .fftdata", .fftdata",  1 1 60 60  /number o f p e a k s i n s p e c t r u m / g o i n g up a p e a k o r down? /frequency bin# o f i d e n t i f i e d /power o f i d e n t i f i e d p e a k s  .fftdata", .fftdata", .fftdata", .fftdata",  1 1 1 1  /table 0 address /table 1 address / f f t t a b l e address /address index o f r e a l  .fftdata", 1 .fftdata", 1  peak  data  /maximum v a l u e f o r n o r m a l i z a t i o n /average f f t magnitude  it  . t m p d a t a " , 256 ; t e m p o r a r y t a b l e f o r summing f t t s fftdata",! /peak w i t h g r e a t e s t m a g n i t u d e i n F F T II fftdata",10 /frequency bin# o f i d e n t i f i e d peaks II fftdata",1 /peak w i t h g r e a t e s t m a g n i t u d e i n F F T II fftdata",1 /peak w i t h g r e a t e s t m a g n i t u d e i n F F T tt . f f t d a t a " ,1 /continous s i g n a l f l a g II  500 ".stack",stack  size  ".vecs" warnsis cmd_write null int null_int /hreadl6 null int transmitO .word receiveO  102  rintO  .word  fill  array  xintl rintl tintO tintl dintO  . word . word .word .word . word  transmitl recievel null i n t timerl null i n t  .data m i n ampl min_power  .float .float  500.0 3.0e6  hostport  . word  000804000h  ramO a d d r rami addr ramla addr ramlb addr tmp a d d r peak t a b l e peak mtable sine templates t_rp t_bdur t wait t_start t_end t_int t_intc temp_def peak c t a b l e peaks_hcount peaks_tcount fft  voc data  template  . word .word .word . word . word . word . word . word . word .word .word .word .word .word .word .word .word .word .word .word .word  defaults .word . word .word .word .word  ;6  /minimum a m p l i t u d e /minimum s p e c t r a l  (500) peak power  809800H 809C00H 809C00H 809E00H / a d d r e s s temp c a l c u l a t i o n t a b l e tmp t a b l e p e a k hz /address o f peak t a b l e / a d d r e s s o f p e a k maximum v a l u e s p e a k max /address of t w i d d l e f a c t o r s sinetab /address of template i n f o t info t_range_peak /address o f template peaks t burst dur /address o f template b u r s t d u r a t i o n s t_waiting /address of template w a i t i n g f l a g s t_bstart /address of template b u r s t s t a r t t bend /address o f template b u r s t end t i n t e r v a l time /address o f template i n t e r v a l time t i n t count /address o f template i n t e r v a l count template d e f a u l t s /address o f template d e f a u l t s peak_cs /address o f peak t a b l e /address o f peak t a b l e i n d e x peaks_hcnt /address o f peak t a b l e i n d e x peaks_tcnt microsht  /address  0 1 2 3 4  /template  .word . word . word . word .word  13 34 1000 1000 1000  /burst durations  .word . word .word .word . word  26 92 1000 1000 1000  /interval  of realtime  data  names  times  103  .word . word . word . word .word  ;range peak  .word .word . word . word . word  ;waiting state  .word .word . word . word . word  ;burst t i m e r s t a r t times  .word .word .word . word . word  ;burst t i m e r end times  .word .word .word .word .word  ; i n t e r v a l timer s t a r t times  . sect ;stack_addr ;intl_hwrl6 ;intl_hwr32 ;intl_cwr ;int2_hrdl6 ;int2_hrd32 ;cmd_temp parameters ;com_j?arm ;wordflag  92 101 255 255 255  flags  ".aicdata"  .word .word .word .word .word .word .word  stack hwritel6 hwrite32 cmd_write hreadl6 hread32 com_cmd  ;address o f s t a c k /Address o f 16 b i t host w r i t e f u n c t i o n /Address of 32 b i t host w r i t e f u n c t i o n /Address o f command w r i t e f u n c t i o n /Address of 16 b i t host read f u n c t i o n /Address o f 32 b i t host read f u n c t i o n /Temporary address o f command  .word .word  com_stat 0  /Address o f command parameters  * Addresses o f v a r i o u s p e r i p h e r a l s and memory c o n t r o l r e g i s t e r s *  *********************************************************** ;dma_ctl mcntlrO mcntlrl tO_ctladdr tl_ctladdr p0_addr  .word .word .word .word .word .word  000808000h 000808064h 000808060h 000808020h 000808030h . 000808040h  /dma g l o b a l c o n t r o l r e g i s t e r / i / o i n t e r f a c e c o n t r o l r e g . addr. / p a r a l l e l i n t e r f . c n t l . r e g . addr. /Timer 0 /Timer 1 /Serial port 0  **************************************************  * C o n t r o l parameters t o l a r g e t o f i t i n immediate v a l u e * *****************************************************************  104  enbl_eintl enbl_eint2 enbl_spO_r intoff  . word .word .word .word  000020400h 000040400h 000000020h OfffOfbflh  intclr tO c t l i n i t  .word .word  Offfffff9h 0C00002Clh  p0_global  .word  00e970300h  ;dma_wctl  .word  0C0000943h  ;dma_rctl  .word  0C0000A13h  ; i n t l e n t e r r u p t dma ( h o s t w r i t e s ) ; i n t 2 i n t e r r u p t dma ( h o s t w r i t e s ) ;serial port 0 receive interrupt ;turn o f f i n t l , i n t 2 , i n t 3 , e i n t O , e i n t l ; e i n t 2 , e i n t 3 , dma ; c l r out int0-2 ;set timer as e l k out, Hl/2 p e r i o d ; t i m e r w i l l r u n when c p u s t o p s i n ; e m u l a t i o n mode ;serial port 0 global control  register  ;dma w r i t e c o n t r o l ;com. r e g . -> C30 mem. ; i n t e r r u p t d r i v e n from host w r i t e s ;dma r e a d c o n t r o l ;c30 mem -> com r e g ; i n t e r r u p t d r i v e n from host reads  ********************************************* * Host communications command s t r u c t u r e * ***************************************************************** ; com s t a t ; com cmd ; com_ c o u n t l ; com c o u n t h ; com s a d d r l ; com s a d d r h ; com " d a d d r l ; com d a d d r h  .word .word . word . word . word .word .word . word  OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh OOOOOOOOOOh  /command s t a t u s ;command / t r a n s f e r count low / t r a n s f e r count h i g h ;source addr low ;source addr h i g h ;destination address /•destination address  ***************************************************************** * Various constants  * OOOOh OOOOh 1800h 2000h OOOlh 0002h 0004h 0008h OOlOh 0020h 0040h 0080h OlOOh 0200h 0400h  ;memory c o n t r o l r e g v a l , p a r a l l e l b u s ;memory c o n t r o l r e g v a l , i / o b u s ; c l e a r and enable cache ;global i n t e r r u p t enable ; i n t e r r u p t 0 enable ; i n t e r r u p t 1 enable ; i n t e r r u p t 2 enable ; i n t e r r u p t 3 enable ; s e r i a l port 0 transmit i n t . enable ; s e r i a l port 0 receive i n t . enable ; s e r i a l port 1 transmit i n t . enable / s e r i a l port 1 receive i n t . enable ;timer 0 i n t e r r u p t enable ;timer 1 i n t e r r u p t enable ;dma i n t e r r u p t e n a b l e ( c p u )  BEGIN CMD SEND . s e t . set END CMD SEND . set INIT_DONE  1 2 5  ; B e g i n s e n d i n g cmd p a r a m e t e r s ;End s e n d i n g cmd p a r a m e t e r s ;Reset i n t i a l i z a t i o n complete  . set . set  0 -1  WAITO WAITl CACHE ENBL_GIE ENBL INTO ENBL I N T 1 ENBL INT2 ENBL INT3 ENBL XINTO ENBL RINTO ENBL_XINT1 ENBL RINT1 ENBL_TINTO ENBL_TINT1 ENBL_DINT  CMD_OK CMD_ERROR  . set . set . set . set . set . set . set . set . set . set . set . set . set . set . set  :  /•Received cmd p a r a m e t e r s ok / E r r o r o n r e c e i v i n g command  parameter  105  CMD F I N I S H CMD" "LOAD CMD_ _ACTIVE  .set .set .set  0 1 2  CMD NOP CMD "HOST MR 16 CMD" ~H0ST_MW16 CMD HOST MR32 CMD HOST MW32 CMD" "HOST DMAR CMD" "HOST DMAW  .set .set .set . set .set .set .set  10 11 12 13 14 15 16  /Status, /Status, /Status, /Nop /C30 /C30 /C30 /C30 /C30 /C30  command i s f i n i s h e d command i s b e i n g l o a d e d command i s c u r r e n t l y a c t i v e  command memory r e a d , 16 b i t mode memory w r i t e , 16 b i t mode memory r e a d , 32 b i t mode memory w r i t e , 32 b i t mode memory r e a d v i a dma, 16 b i t mode memory w r i t e v i a dma, 16 b i t mode  . text warnsis:  start  end  xor xor  ie,ie if, if  xor ldp ldi sti ldi ldi ldi rptb  R0,R0 @raml_addr,DP @fft_voc_data,AR0 AR0,@data i n d e x @raml_addr,ARO @sine,AR2 1023,RC end i n i t  ldf subf ldi sti  *AR0,R1 128,Rl 0,R1 Rl,*AR0++  ; c l r R0 /set d a t a page /get address o f r e a l data /save i t i n d a t a _ i n d e x / l o a d a d d r e s s o f RAMla b l o c k /load address o f sine t a b l e / l o a d r e p e a t c o u n t e r f o r 1024 /repeats  init:  init:  ldi ldi ldp sti sti sti sti sti sti ldi sti not sti sti sti sti sti ldi ldi  @ r a m l a _ a d d r , ARO @ r a m l b _ a d d r , AR1 S p r o c e s s mode, DP ARO,@rla addr AR1,@rlb_addr R 0 , @ p r o c e s s mode R0,@fcnt R0,Speaks h c n t R0,@peaks_tcnt Shostport,AR4 R0,*AR4 R0,R1 Rl,@wfill R l , @ p r o c e s s mode R0,@fill_cnt R0,@cycle_cnt R0,@none w a i t i n g @templates,ARO @temp d e f , A R l  /get real /subtract  data 128 o f f s e t  /save a d j u s t e d r e a l d a t a / s t a r t f i r s t A/D c o n v e r s i o n / l o a d a d d r e s s o f RAMla b l o c k / l o a d a d d r e s s o f RAMlb b l o c k /set d a t a page /save t a b l e a d d r e s s c u r r e n t /data page /set f o r normal o p e r a t i o n / /set counter t o zero /set peak t a b l e head p o i n t e r = 0 /set peak t a b l e t a i l p o i n t e r = 0 /send  0 t o pc  /set i n i t i a l table /set f o r l e a r n i n g mode; /set fill_cnt to0 /set timer count t o 0 /set no t e m p l a t e s w a i t i n g t o 0 /load address o f template i n f o /load address o f template  defaults ldi rptb ldi  39,RC e n d temp *AR1++,R1  /repeats  106  end_temp:  /  sti  Rl,*AR0++  /set  up d e f a u l t  ldp or or or or or call ldp  PARMS ENBL G I E , S T ENBL X I N T 0 , I E ENBL I N T 2 , I E ENBL INTO,IE ENBL_RINTO, I E aicreset @process_mode, DP  /enable g l o b a l i n t e r r u p t /enable s e r i a l p o r t 0 t x i n t /enable s e r i a l p o r t 0 t x i n t /enable s e r i a l p o r t 0 t x i n t /enable s e r i a l port 0 rx i n t /routine to reset a i c / s e t d a t a page  /The p r o c e s s o r w a i t s here w h i l e i t f i l l s the a r r a y s f u l l then processing begins /when a n a r r a y i s idle  with  templates  data  loop: xor cmpi beq callu  R0,R0 @ p r o c e s s mode, RO do_analysis start learning  / a r e we i n l e a r n i n g mode? / i f we a r e do l e a r n i n g r o u t i n e  do_analysis: call ldi  fill array @fill_cnt,RO  cmpi calleq br  512,RO start analysis i d l e loop  /get data / e l s e h a v e we  512 p i e c e s  of  data?  end  / i f we do p r o c e s s t h e n / e l s e w a i t f o r more d a t a  idle:  /Analysis  Subroutines  setup_fft: ldi push ldi push ldi ldi not cmpi beq ldi  1,R0 RO @sine,RO RO @rla addr,R0 @wfill,Rl R1,R1 0,R1 fft 0 " @rlb_addr,RO  /set f l a g f o r doing b i t r e v e r s a l s /put i t on t h e s t a c k /get address o f s i n e t a b l e /put i t on t h e s t a c k /get address o f d a t a t a b l e 0 /get which t a b l e f l a g w f i l l /not(wfill) to recover f l a g / a r e we u s i n g t a b l e 0?  sti push push ldi push ldi push  R0,@fft RO RO 9,R0 RO 512,RO RO  / s a v e l o c a t i o n o f f f t when d o n e /push c o r r e c t t a b l e a d d r e s s on /stack f o r both source and d e s t . /log(fftsize):=9 /put i t on t h e s t a c k /fftsize:=512 /put i t on t h e s t a c k  /no  then get t a b l e  1 address  fftj): addr  xor call or  ENBL G I E , S T ffft r l ENBL_GIE, ST  /disable global interrupt /calculate f f t /enable g l o b a l i n t e r r u p t  pop pop pop  RO RO RO  /get r i d o f p a r a m e t e r s f o r ; _ffft_rl  107  pop pop pop retsu  RO RO RO  /Subroutine t o perform Main A n a l y s i s f o r s i g n a l d e t e c t i o n start analysis : xor R0,R0 RO,@fill_cnt sti ldi @hostport,AR4 r / send i t t o pc sti RO,*AR4 t ldp d p r o c e s s mode,DP / s e t d a t a page ldi S c y c l e cnt,RO /get c y c l e c n t /inc(cycle cnt) addi 1,R0 /save c y c l e c n t sti RO,@cycle_cnt xor call ldp ldi call ldp ldi call  • 1  1 r  call end_analysis:  /Learning start  ENBL_GIE, ST setup_fft @raml a d d r , D P @raml_addr,ARO f f t magnitude @raml a d d r , D P @raml_addr,ARO find_peaks find_match  /disable  global  interrupt  / s e t d a t a page / l o a d a d d r e s s o f RAMla b l o c k / c a l c m a g n i t u d e , maximum a n d a v e / s e t d a t a page / l o a d a d d r e s s o f RAMla b l o c k / f i n d peaks i n spectrum /find  any t e m p l a t e  matches  retsu  Subroutine  learning push push push push push push push push push push push push push push push push push push  DP ARO AR1 AR2 AR3 AR4 AR5 AR6 AR7 RO RI R2 R3 R4 R5 R7 IRO IR1  ldp ldi ldi ldi ldi  @peak_hz, DP Speak t a b l e , A R 7 Speak m t a b l e , A R 6 @t rp,AR5 @t_wait,AR4  template i n t e r v a l time /template b u r s t d u r a t i o n / b u r s t timer end times /burst timer s t a r t times waiting flags /template peak v a l u e s •peak t a b l e m a g n i t u d e s •peak t a b l e p e a k v a l u e s  found f l a g •waiting f l a g peak t a b l e s i n d e x •template t a b l e s index • s e t d a t a page •get a d d r e s s o f /get address o f /get address o f •get a d d r e s s o f  peak t a b l e p e a k max t a b l e template peaks template f l a g s  108  ldi ldi ldi  @t s t a r t , A R 3 @t end,AR2 @t_intc,AR0  /get ;get ;get  address address address  ldi ldf stf  0,IR1 -1.0,R0 RO,@test_ampl  ;template_index:=0  ldi call  0E000h,R7 w r i t e queue  ;set  test  ;send  flag  of burst timer start o f b u r s t t i m e r end of interval timer  amplitude  flag  for learning  mode  / i n s e r t code here t o / c a n c e l a l l w a i t i n g t e m p l a t e s f r o m p r o c e s s mode /when e n t e r i n g l e a r n i n g mode, c a n be d o n e w h i l e l o o k i n g / f o r b l a n k template because a l l unused templates a r e a f t e r /the templates that are being used ldi cmpi beq addi br  *+AR5(IR1) , RO 255,RO found template 1, IR1 f i n d template  / i f t e m p l a t e _ p e a k = 255 t h e n / found blank template / else / i n c ( i n d e x ) and t r y a g a i n  ldi addi call  0E020h,R7 IR1,R7 w r i t e queue  /send  found_template:  flag  for learning  / save c y c l e count here to set a b s o l u t e time l i m i t / l e a r n i n g c y c l e t o r e c o v e r f r o m unknown s i g n a l ldi sti  d c y c l e cnt,R0 RO,61earn_cnt  xor sti sti sti sti call  R0,R0 R0,@cont f l a g RO,*+AR2(IR1) RO,*+AR3(IR1) RO,*+AR0(IR1) clear table  call ldi cmpi bne  f i l l array S f i l l cnt,R0 512,RO keep_waiting  xor sti ldi ldi not cmpi beq ldi  R0,R0 R0,@fill cnt d r l a addr,R0 @wfill,Rl R1,R1 0,R1 f f t 00 @rlb_addr,R0  sti  R0,@fft_addr  •save  ldp  @process_mode,DP  / s e t data  mode on  /continuous s i g n a l f l a g • z e r o b u r s t end burst start and i n t e r v a l t i m e s c l e a r f f t sum t a b l e  keep_waiting:  fft  /get data •do we h a v e 512 p i e c e s o f d a t a ? •no  t h e n keep c o l l e c t i n g  data  •reset f i l l cnt f l a g to wait /get address o f data t a b l e 0 /get which t a b l e f l a g w f i l l /not(wfill) to recover flag /are we u s i n g t a b l e 0? •no  then get t a b l e  1 address  00: location  o f f f t when  done  page  109  ldi addi sti ldi ldi subi cmpi bit cmpi bit cmpi bge ldi sti br not  @cycle cnt,R0 1,R0 RO,@cycle c n t @cycle cnt,R0 @learn c n t , R l RI, RO 300,RO keep g o i n g 2,R5 end l e a r n i n g 4,R5 not continuous 2,R0 R0,@cont f l a g find_main_peak  ;get c y c l e c n t ; i n c ( c y c l e cnt) ;save c y c l e c n t ;get c u r r e n t c y c l e ;get count a t s t a r t  cnt of learn  cycle  ;have we s p e n t more t h a n 500 c y c l e s ; ~20 seconds ; i f n o t t i m i n g b u r s t t h e n e n d mode ;if  finished burst  then  not  contin.  continuous ldi sti br  1,R0 RO,@cont_flag f i n d main_peak  keep_going: call ldf cmpf bne ldf mpyf stf  f i n d amplitude ;get average amplitude @ t e s t ampl,R0 -1,R0 ,-have we s a m p l e d b a c k g r o u n d level b g ok @ave ampl,R0 1.5,R0 / m u l t i p l y by 1.5 RO,@test ampl ;save 1 . 5 * f i r s t s a m p l e a s b a c k g r o u n d  bg_ok: ldi cmpi bge  *+AR4(IR1) ,R5 4,R5 no f f t r e q  ;get w a i t i n g flag; ;have we f i n i s h e d w i t h b u r s t ;then j u s t wait t o i d e n t i n t e r v a l  cmpi bit  1,R5 no f f t r e q  xor call  ENBL_GIE, ST setup f f t  ;disable global interrupt /calculate current f f t  xor call call or  ENBL_GIE, ST f f t magnitude sum ffts ENBL_GIE,ST  /disable global interrupt / c a l c u l a t e current f f t magnitudes ;add t o t o t a l m a g n i t u d e s /enable g l o b a l i n t e r r u p t  no_fft_req: xor sti ldf fix call ldf ldf . fix call cmpf bit  R0,R0 RO,@fill_cnt @ave ampl,R0 R0,R7 w r i t e queue @min ampl,R2 @test ampl,r2 R2, R7 w r i t e queue R2,R0 l e s s t h a n min  ;reset f i l l ;get average  cnt signal  amplitude  ; g e t minimum a l l o w a b l e amplitude ;use t e s t b a c k g r o u n d instead  ; i f average  amplitude  < minlevel  then  110  c a s e 3 _0:  c a s e 3 _1:  case3  2:  c a s e 3 _3:  c a s e 3 _4  c a s e 3 _5  case3  end:  cmpi bne ldi sti ldi sti br cmpi bne ldi sti br cmpi bne br cmpi bne ldi sti br cmpi bne ldi sti ldi sti br cmpi bne ldi sti br br  0, R5 case3 1 S c y c l e cnt,R0 RO,*+AR3(IR1) 1,R0 RO, *+AR4(IR1) case3 end 1,R5 case3 2 2,R0 RO, *+AR4(IR1) case3 end 2, R5 case3_3 case3_end 3, R5 case3 4 2, RO RO,*+AR4(IR1) case3 end 4,R5 case3 5 @cycle cnt,R0 RO,*+AR0(IR1) 5,R0 RO,*+AR4(IR1) case3 end 5,R5 case3 end 6,R0 RO,*+AR4(IR1) case3 end case4_end  cmpi bne br cmpi bne ldi sti sti call br cmpi bne ldi sti ldi sti br cmpi bne ldi sti br  0,R5 case4 1 case4 end 1,R5 case4 2 0,R0 RO, *+AR3(IR1) RO,*+AR4(IR1) clear table case4_end 2,R5 case4 3 S c y c l e cnt,R0 RO,*+AR2(IR1) 3,R0 RO,*+AR4(IR1) case4 end 3,R5 case4 4 4,R0 RO,*+AR4(IR1) case4 end  0:begin  save b u r s t  start  time  waiting:=1 end 1:begin  waiting:=2 end 2:begin do n o t h i n g end; 3:begin  waiting:=2 end 4:begin  save  interval  time  waiting:=5 end 5:begin  waiting:=6 end end  l e s s _ than_min: c a s e 4 _0:  c a s e 4 _1:  c a s e 4 _2:  case4  3:  case waiting o f 0:begin do n o t h i n g end 1:begin  r e s e t b u r s t s t a r t time waiting:=0 c l e a r F F T m a g n i t u d e sums end 2:begin  save b u r s t  end time  waiting:=3 end 3:begin  waiting:=4 end  111  case4_4:  case4_5:  cmpi bne br cmpi bne ldi sti br  4:begin do n o t h i n g end 5:begin  4, R5 case4_4 case4_end 5, R5 case4_end 4,R0 RO, *+AR4(IR1) case4 end  waiting:=4 end end  case4_end: ldi cmpi bne  *+AR4(IR1),R5 6,R5 keep_waiting  ;get waiting flag ; a r e we f i n i s h e d ? ;no t h e n k e e p w a i t i n g ; else  xor call call call call or  ENBL_GIE,ST copy_fft_sum average_fft_sum find_peaks pick_main_peak ENBL_GIE,ST  /disable global interrupt ; c o p y sum f r o m t e m p o r a r y t a b l e / c a l c u l a t e max a n d a v e r a g e o f sum / f i n d t h e p e a k s i n sum t a b l e / p i c k t h e l a r g e s t peak /enable g l o b a l i n t e r r u p t  ldi sti ldi addi call  @max_peak,RO RO,*+AR5(IR1) OElOOh,R7 R0,R7 write_queue  / g e t f r e q u e n c y o f maximum /save i t i n t a b l e  ldi ldi subi ldi ldi subi  *+AR3(IR1),R0 *+AR2(IR1),R1 R0,R1 *+AR3(IR1) ,R0 *+AR0(IR1) ,R2 R0,R2  /get /get /get /get /get /get  find_main_peak:  save_template_info:  ldi ldi  @t_bdur,AR2 @t_int,AR3  ldi cmpi bit ldi  @cont_flag,RO 1,R0 no_set_int 0,R2  cmpi bit ldi  2,R0 no_set_burst 0,R1  sti sti ldi addi call ldi addi  Rl,*+AR2(IR1) R2,*+AR3(IR1) 0E200h,R7 R1,R7 write_queue 0E300h,R7 R2,R7  /send  flag  forlearning  peak  mode  burst s t a r t time b u r s t end time difference burst s t a r t time i n t e r v a l time difference  /get addr o f template b u r s t d u r r a t i o n /get addr o f template i n t e r v a l t i m e /get  continous  flag  no_set_int:  no_set_burst: /save b u r s t d u r r a t i o n i n t e m p l a t e /save i n t e r v a l time i n t e m p l a t e  /send  flag  f o rlearning  mode  112  call  write_queue  ;send  flag  f o rlearning  mode  end_learning: ldi call xor sti sti or pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop  0E010h,R7 write_queue ; s e n d f l a g f o r l e a r n i n g mode R0,R0 RO,@process_mode ; s e t f o r n o r m a l o p e r a t i o n RO, *+AR4 (IR1) ;waiting:=0 so i t w i l l d e t e c t l a t e r ENBL G I E , S T /enable g l o b a l i n t e r r u p t IR1 IRO R7 R5 R4 R3 R2 RI RO AR7 AR6 AR5 AR4 AR3 AR2 AR1 ARO DP  retsu ; Find_amplitude f i n d s the average absolute amplitude o f the i n p u t ; t o t e s t f o r b e g i n i n g and end o f s i g n a l b u r s t .  signal  f i n d amplitude: push push push push push push push push push ldf ldi ldi rptb  sum_average:  ldf absf addf float call stf  DP AR7 R4 R3 R2 RI RO RC RE 0,R0 @ f f t addr,AR7 511,RC sum a v e r a g e *AR7++,R1 R1,R1 R1,R0 512,RI FDIV RO,@ave_ampl  ;get a d d r e s s o f c u r r e n t ; s e t t o sum 255 w o r d s  f f t table  ;get c u r r e n t i n p u t d a t a ;get a b s o l u t e v a l u e ;add t o t a l ; d i v i d e sum b y 512 t o g e t a v e r a g e ;input absolute amplitude and ;save i t i n ave_ampl  113  pop pop pop pop pop pop pop pop pop retsu ;Sum f f t s  RE RC RO Rl R2 R3 R4 AR7 DP  sums the c u r r e n t FFT magnitudes with those saved i n t h e t o t a l t a b l e tmp t a b l e  sum f f t s : push push push push push push push  sum t a b l e :  DP AR7 AR6 Rl RO RC RE  ldf ldi ldi ldi rptb  0, RO dtmp addr,AR7 @fft addr,AR6 254,RC sum t a b l e  ;get address o f temporay t a b l e ;get address o f c u r r e n t f f t t a b l e ;set t o sum 255 words  ldp ldf ldp ldf addf stf  @raml addr,DP *AR6++,R0 @tmp table,DP *AR7,R1 R1,R0 RO,*AR7++  ;get data page o f current f f t t a b l e ;get c u r r e n t f f t magnitudes ;get data page o f temporary t a b l e ;get f f t sum from temporary t a b l e ;add c u r r e n t f f t t o t a b l e ;and save sum i n tmp_table  pop pop pop pop pop pop pop retsu  RE RC RO Rl AR6 AR7 DP  ; Copy_fft_sum copys Sum o f FFT magnitudes back t o t h e FFT a r r a y s so t h a t ;Find_jpeaks s u b r o u t i n e can operate copy_fft_sum: push push push push push push ldi ldi  DP AR7 AR6 RO RC RE @tmp addr,AR7 @fft_addr,AR6  ;get address o f temporay t a b l e ;get address o f c u r r e n t f f t t a b l e  114  ldi rptb  copy_sum:  ldp ldf ldp stf pop pop pop pop pop pop retsu  ; Find  ' s e t t o c o p y 255 w o r d s  254,RC copy_sum @ t m p _ t a b l e , DP *AR7++,R0 @raml_addr, DP RO,*AR6++  ;get d a t a page o f t e m p o r a r y t a b l e ;get f f t sum f r o m t e m p o r a r y t a b l e ;get d a t a page o f c u r r e n t f f t t a b l e ;fft_table[AR6]:=tmp_table[AR7]  RE RC RO AR6 AR7 DP  t h e average amplitude o f f f t peaks  f r o m t h e sum o f a l l t h e f f t s  average_fft_sum: push push push push push push push push push push push ldp xor stf stf ldi ldi ldi rptb cmpi  DP RE RC AR5 AR6 RO RI R2 R3 R4 IRO @rla_addr,DP RO, RO RO,@max_fft RO,@ave_fft @fft_addr,AR5 1, IRO 254,RC end_ave_lpop .58,IRO  bit ldf ldf cmpf bit stf  end_ave_loop *+AR5(IRO) ,R0 @max_fft,Rl R1,R0 no_new_amax RO,@max_fft  ; i f l e s s t h a n 900HZ t h e n ;@ s a m p l e r a t e 8000Hz ; d o n ' t c a l c u l a t e max o r a v e ;get fft_real[IRO] ;get current max_fft ; i f max_fft>new magnitude ;then don't pdate m a x _ f f t ; e l s e s t o r e new max  ldf addf stf addi  @ave_fft,Rl RO, RI RI,@ave_fft 1, IRO  ;ave_fft:=ave_fft+max_fft ;inc(IRO)  ldf ldf  @ a v e _ f f t , RO 197,RI  call stf  RO,Save  ;set  data  page  ;max_fft:=0 ;ave_fft:=0 ;get address o f f f t t a b l e ;set index t o 1 ;255 v a l u e s  no new amax:  end_ave_loop:  ;get average t o t a l ;get number o f a d d i t i o n s ; n o t e 197 f o r s a m p l e r a t e ; o f 8000 Hz  FDIV  fft  ;save i t  115  a v e sum e n d : pop pop pop pop pop pop pop pop pop pop pop retsu  IRO R4 R3 R2 Rl RO AR6 AR5 RC RE DP  ; Pick_main_peak scans t h e peak t a b l e g e n e r a t e d by f i n d _ p e a k s ; f o r t h e peak w i t h t h e g r e a t e s t magnitude  and l o o k s  p i c k _ m a i n _jpeak: push push push push push push push push ldf ldi ldp ldi ldi ldi subi rptb  DP AR5 AR6 AR7 RO Rl RC RE 0,R0 0,AR5 Speak hz,DP @peak_table,AR7 Speak mtable,AR6 Speak c n t , R C 1,RC next_peak  ldf cmpf bgt ldf ldi  *AR6++, R l R l , RO next_peak R l , RO AR7,AR5  addi  ldi sti pop pop POP pop pop pop pop pop retsu ;Clear_table  clears  1,AR7  *AR5,R0 RO, Smax_jpeak RE RC Rl RO AR7 AR6 AR5 DP  t h e F F T m a g n i t u d e sum  ; t e s t mag:=0 ;max_peak:=0 ; s e t d a t a page ;get a d d r e s s o f peak t a b l e ; g e t a d d r e s s o f p e a k max t a b l e ;get peak c n t ;set t o t e s t a l l peaks found  ;get peak magnitude ; i s i t bigger than c u r r e n t ; i f greater than ;then save magnitude and ;index t o peak f r e q u e n c y t a b l e ; inc(index)  :get f r e q u e n c y o f l a r g e s t ; s a v e i t i n max_peak  peak  table  116  clear_table: push push push push push ldf ldp ldi ldp ldi rptb clr_table:  DP AR7 RO RC RE 0,RO @tmp_addr,DP @tmp_addr,AR7 @ t m p _ t a b l e , DP 254,RC clr_table  stf  R0,*AR7++  pop pop pop pop pop retsu  RE RC RO AR7 DP  /Matching S u b r o u t i n e matches /stored i n templates find  peaks  / g e t d a t a page o f t e m p o r a r y t a b l e p t r /get address o f temporay t a b l e /get d a t a page o f t e m p o r a r y t a b l e / s e t t o c l e a r 255 w o r d s  ;tmp_table[AR7]:=0.0  found  i n find_peaks  to info  match: push push push push push push push push push push push push push push push push push push  DP ARO AR1 AR2 AR3 AR4 AR5 AR6 AR7 RO Rl R2 R3 R4 R5 R7 IRO IR1  ldp ldi ldi ldi ldi ldi ldi ldi  dpeak hz,DP @peak_table,AR7 Speak m t a b l e , A R 6 @t rp,AR5 @t w a i t , A R 4 @t s t a r t , A R 3 @t end,AR2 @t_intc,AR0  / s e t d a t a page /get address o f /get address o f /get address o f /get address o f /get address o f /get address o f /get address o f  ldf ldf mpyf  @min_power, R2 @ave f f t , R 3 2.5,R3  /Rl:=2.5*ave_fft  /template i n t e r v a l time /template b u r s t d u r a t i o n / b u r s t t i m e r end times /burst timer s t a r t times /waiting flags / t e m p l a t e peak v a l u e s /peak t a b l e m a g n i t u d e s /peak t a b l e p e a k v a l u e s  /min_power /2.5*ave_fft ;foung f l a g /waiting flag t  /peak t a b l e s i n d e x /template t a b l e s index  peak t a b l e p e a k max t a b l e template peaks template f l a g s burst timer s t a b u r s t t i m e r end interval timer  117  mpyf ldi  6.25,R3 0,IR1  ;Rl:=6.25*ave_fft  no  sqrts  ;template_index:=0  template_loop:  test_temps:  easel  easel  easel  0:  1:  2:  ldi ldi ldi subi rptb ldf cmpf bit cmpf bit  0,R4 0,IR0 @peak_cnt,RC 1,RC test_temps *+AR6(IR0),R0 R3,R0 test_temps R2,R0 test_temps  ;found:=false ;peak i n d e x : = 0 ; g e t number o f p e a k s  float float  *+AR5(IR1) ,R1 *+AR7(IRO) , RO  ;get t e m p l a t e v a l u e ;R0:=peak f r e q u e n c y  subf absf cmpf bgt addi addi ldi cmpi beq  R0,R1 R1,R1 3,R1 test_temps 1,R4 1,IR0 *+AR4(IR1) ,R5 0,R4 not_found  ;R1:=R1-R0  cmpi bne ldi sti ldi sti br cmpi bne ldi sti br cmpi bne  0,R5 casel_l @cycle_cnt,RO RO,*+AR3(IR1) 1,R0 RO,*+AR4(IR1) casel_end 1,R5 casel_2 2,R0 RO,*+AR4(IR1) casel_end 2,R5 easel 3  ldi  @t_bdur,ARl  found  ;get next peak i n peak t a b l e ; i f peak_mag<2.5*ave_fft ;then n o t a v a l i d peak ; i f peak_mag<min_power l i m i t ;then not a v a l i d peak  ; i f abs(peak-template)>tolerance ; t h e n no p e a k m a t c h ;else found:=true ;inc(peak_index) ;get w a i t i n g f l a g ; i f not(found) then ;no t e m p l a t e m a t c h case w a i t i n g o f 0:begin get c u r r e n t c y c l e count tempflRl].burst_start:=cycle_cnt waiting:=l end 1:begin  waiting:=2 end 2:begin do n o t h i n g j u s t  get  address template  wait  of template  burst  dur  test  ldi cmpi bne  *+ARl(IR1),R0 0,R0 no_test_cont  get  ldi ldi subi ldi  @cycle_cnt,RO *+AR3(IR1),R1 R1,R0 31,Rl  get b u r s t end t i m e get b u r s t s t a r t time burst durration:=end-start get c o n t i n u o u s b u r s t dur.  subi float  R1,R0 R0,R0  convert  else  dont  burst  issue  durration  message  cont:  (2  sec) to floating  point  118  absf float mpyf cmpf  R0,R0 31,RI 0.30,R1 RO, RI  g e t |R0-R1| RI s e t f o r +-15% t o l e r a n c e on b u r s t d u r a t i o n i f d i f f e r e n c e between b u r s t d u r a t i o n and s t o r e d v a l u e i n t e m p l a t e < 15% o f s t o r e d v a l u e then b u r s t matches  bit  no_test_cont  ldi sti  0, RO RO, *+AR4(IR1)  ldi addi  0C000H,R7 IR1,R7  push push ldi ldi sti addi cmpi bne xor  AR4 IRO @peak c t a b l e , A R 4 Speaks t e n t , I R O R7,*+AR4(IRO) 1, IRO 10,IRO nov4 IRO,IRO  sti pop pop  IRO,Speaks IRO AR4  br cmpi bne ldi sti br cmpi bne ldi sti  e a s e l end 3, R5 e a s e l 4' 2, RO RO,*+AR4(IR1) e a s e l end 4,R5 e a s e l end 2, RO RO,*+AR4(IR1)  br  temp_loop_end  waiting:=0  d i p l a y m e s s a g e BOO  s t o r e message i n  plus  index  peak_table  nov4: tent  no_test_cont: casel_3:  casel_4:  casel_end:  end; 3 rbegin  waiting:=2 end 4:begin  waiting:=2 end end  not_found:  case2_0:  case2_l:  case2  2:  cmpi bne br cmpi bne ldi sti br cmpi bne ldi sti  0,R5 case2_l case2_end 1,R5 case2_2 4,R0 RO,*+AR4(IR1) case2_end 2,R5 case2_3 Scycle_cnt,RO RO,*+AR2(IR1)  ;case w a i t i n g o f ; 0:begin ; do n o t h i n g ; end ; 1:begin ; ; waiting:=4 ; end ; 2:begin ; ; get current c y c l e count ; temptlRl].burst_end:=cycle_cnt  119  c a s e 2 3:  test  ldi sti br cmpi bne ldi sti  3,R0 RO, *+AR4(IR1) case2 end 3,R5 case2_4 0, RO RO, *+AR4(IR1)  ldi ldi subi ldi  *+AR2(IR1),R0 *+AR3(IR1),R1 R1,R0 @t_bdur,ARl  get b u r s t end time get b u r s t s t a r t time burst durration:=end-start get address o f template b u r s t  ldi subi float absf float mpyf cmpf  *+ARl(IR1),R1 R1,R0 R0,R0 RO, RO *+ARl(IR1),R1 0.30,R1 RO, RI  get  bit ldi addi  no m e s s a g e 0B000H,R7 IR1,R7  push push ldi ldi sti addi cmpi bne xor  AR4 IRO Speak c t a b l e , A R 4 Speaks t e n t , I R O R7,*+AR4(IRO) 1, IRO 10,IRO novl IRO,IRO  sti pop pop  IRO,Speaks IRO AR4  waiting:=3 end ,3: b e g i n  waiting:=0  burst:  dur  found  burst:  template burst  durration  convert to f l o a t i n g point g e t IR0-R1I RI s e t f o r +-15% t o l e r a n c e on b u r s t d u r a t i o n i f d i f f e r e n c e between b u r s t d u r a t i o n and s t o r e d v a l u e i n t e m p l a t e < 15% o f s t o r e d value then b u r s t matches e l s e dont i s s u e message d i p l a y m e s s a g e BOO p l u s i n d e x  s t o r e message i n p e a k _ t a b l e  novl:  test  tent  interval: get  address o f template  interval  ldi  St_int,ARl  float float cmpf beq  *+AR3(IR1),RO *+AR0(IR1),R1 0,R1 not_zero  get b u r s t s t a r t time get c u r r e n t i n t e r v a l timer c n t i f i n t e r v a l _ t i m e r = 0 then not c u r r e n t l y t i m i n g i n t e r v a l  subf float subf absf float mpyf cmpf bgt  RI,RO,RI * + A R l ( I R 1 ) ,R0 R0,R1 R1,R1 *+ARl ( I R l ) ,R0 0.10,RO R0,R1 no m e s s a g e  RI:=interval_timer-burst_start get template i n t e r v a l time  time  get magnitude o f d i f f e r e n c e get template i n t e r v a l time s e t 10% t o l e r a n c e i f magn o f d i f f < 10% o f s t o r e d i n t e r v a l time then i n t e r v a l  120  match bgt  not_zero  ;  interval  time  then  interval  match  found i n t :  ldi sti ldi addi  0,R0 RO,*+AR0(IR1) 0B100H,R7 IR1,R7  push push ldi ldi sti addi cmpi bne xor  AR4 IRO Speak c t a b l e , A R 4 Speaks t e n t , I R O R7,*+AR4(IRO) 1, IRO 10,IRO nov2 IRO,IRO  sti pop pop  IRO,Speaks IRO AR4  ldi sti br  *+AR3(IR1),RO RO,*+AR0(IR1) case2_end  ldi not  0,R7 R7,R7  br cmpi bne ldi sti  case2 end 4,R5 case2_end 0,R0 RO, *+AR4(IR1)  br  temp l o o p  addi cmpi bit  1,IR1 5,IR1 template_loop  pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop pop  IR1 IRO R7 R5 R4 R3 R2 RI RO AR7 AR6 AR5 AR4 AR3 AR2 AR1  interval_timer:=0; d i p l a y m e s s a g e BIO p l u s  index  s t o r e message i n peak t a b l e  nov2:  not  tent  zero: ;  interval  timer:=burst  start  no_message:  case2  case2  4:  end:  end  end 4:begin  waiting:=0 end end ;inc(template index) ;more t e m p l a t e s ? •compare n e x t t e m p l a t e • e l s e we a r e d o n e  121  pop pop end  match:  ARO DP  retsu find  peaks i n spectrum  f r o m FFT  find_peaks:  init_peak:  push push push push push push push push push push push ldp ldi ldi xor sti sti ldi ldi ldf ldi rptb stf sti ldi ldi ldi ldi ldi rptb cmpi  DP AR4 AR5 AR6 AR7 RO Rl R2 R3 IRO IR1 @peak hz,DP @peak_table,AR7 @peak mtable,AR6 R0,R0 RO,@peak_cnt RO,@g_up RO,IRO RO,IR1 0,R1 49,RC ; init_j?eak R1,*AR6++ R0,*AR7++ @peak_table,AR7 Speak m t a b l e , A R 6 @ f f t addr,AR5 @g_up,R2 254,RC testjpeaks 57,IR1  bit ldf ldf cmpf ble cmpi bge addi  test_peaks *+AR6(IR0),R0 *+AR5(IR1),R1 R0,R1 g o i n g downl 1,R2 going u p l 1,R2  stf sti br  Rl,*+AR6(IR0) IR1,*+AR7(IRO) test_peaks  ; s e t d a t a page ;get a d d r e s s o f peak t a b l e ; g e t a d d r e s s o f p e a k max t a b l e ;peak c n t : = 0 ;g_up:=0 ;peak_hz t a b l e index:=0 ; f f t peak t a b l e index:=0  ; s e t a l l p e a k maximums t o 0 ;set a l l peaks t o 0 ;get a d d r e s s o f peak t a b l e ; g e t a d d r e s s o f p e a k max t a b l e ;get c u r r e n t f f t peak t a b l e ; g e t g_up f l a g  ; i f l e s s t h a n 900HZ ;@ s a m p l e r a t e 8000Hz ;dont l o o k f o r peaks ;get c u r r e n t peakjnax[IRO] ;get c u r r e n t f f t _ v a l u e [ I R 1 ] ; i f R1>R0 ( i e f f t > p e a k max) ; t h e n we a r e g o i n g down a p e a k ; i f g_up<l t h e n  ;  ;inc(g_up)  going_upl: ;peak m a x [ I R 0 ] : = f f t v a l u e [ I R l ] ; ;peak_hz[IRO]:=[IR1]  going_downl: cmpi ble subi cmpi bne  0,R2 test_peaks 1,R2 0,R2 g o i n g down3  ; i f g_up>0 t h e n ;begin ; dec(g_up) ; i f g up=0 ; begin  122  going_down4:  going_down3: test_peaks:  ldf mpyf mpyf ldf cmpf ble addi sti br ldf stf xor sti  addi  @max_fft,R3 0.25,R3 0.0625,R3 *+AR6(IR0),R0 R3,R0 going_down4 1,IR0 IRO, @ p e a k _ c n t test_peaks 0,R0 RO,*+AR7(IRO) R0,R0 RO,*+AR6(IRO)  no s q r t get peak_max[IRO] i f peak_max[IRO]>0.25*max_fft inc(peak_cnt) save peak_cnt else peak_max[IRO]:=0; peak_hz[IRO]:=0; end end; inc(IR1)  1,IR1  ldi ldi  @peak_cnt,R0 @ p e a k _ c t a b l e , AR4  ;get c u r r e n t peak count ;get address o f peak count  ldi sti  @ c y c l e _ c n t , IRO RO,*+AR4(IRO)  ;get  table  pop pop pop pop pop pop pop pop pop pop pop  current  cycle  IR1 IRO R3 R2 Rl RO AR7 AR6 AR5 AR4 DP  end_find_peaks: retsu ; Realtime Data fill_array:  array f i l l i n g  routine  nop nop push push push push push push ldp ldi ldi cmpi beq ldi  ST DP AR7 RO IRO R7 @rla addr,DP @ r l a addr,AR7 @ w f i l l , RO 0,R0 fillO @rlb_addr,AR7  call call ldi stf  receiveO get d a t a @fcnt,IRO R7,*+AR7(IRO)  called  by  interrupt  ;set d a t a page ;get address o f t a b l e 0 ;get table f i l l i n g flag ; a r e we f i l l i n g t a b l e 0 ? ;yes t h e n j u s t c o n t i n u e ;else get address o f t a b l e  1  fillO: ;get the current realtime data ;get t a b l e index ;store data i n table  123  addi cmpi bne sti ldi not sti ldi  1,IR0 512,IRO no_reset_cnt IRO,@fill_cnt @wfill,R0 R0,R0 R0,@wfill 0,IR0  sti pop pop pop pop pop pop nop nop  IR0,@fcnt R7 IRO RO AR7 DP ST  ;inc index ;is table full? ;no t h e n k e e p f i l l i n g ;else set f i l l _ c n t flag ;get t a b l e f i l l i n g flag ; i n v e r t which t a b l e f l a g ;save which t a b l e f l a g ;reset index  no_reset_cnt: ;save  index  end_fill: reti rets ;Place holder subroutine ; r e t u r n s d a t a i n R7  for getting  realtime data  get_data: push push ldp ldi ldf subf  ;save d a t a page ; s a v e AR7 ;get c u r r e n t r e a l d a t a page ;get c u r r e n t r e a l d a t a a d d r e s s ;get d a t a , i n c ( d a t a _ i n d e x ) ; s u b t r a c t 12 8 f o r 8 b i t v o c  DP AR7 @data_index,DP @data_index,AR7 *AR7++,R7 128,R7  format sti pop pop retsu /Place holder null int:  ; s a v e new i n d e x ;restore registers  AR7,@data_index AR7 DP  f o r do n o t h i n g i n t e r r u p t retiu  routine  ; S u b r o t u i n e f o r c a l c u l a t i n g FFT m a g n i t u d e s , fft_magnitude: push DP push RE Re push AR5 push push AR6 push RO push RI push R2 push R3 push R4 push IRO @rla ldp R0,R0 xor  maximum a n d  ;set  data  average  page  124  stf stf ldi ldi addi ldi ldi rptb cmpi  R0,@max f f t R0,@ave f f t @ f f t addr,AR5 @ f f t addr,AR6 512,AR6 1, IRO 254,RC e n d magn l o o p 58,IRO  bit e n d magn l o o p ldf *+AR5(IRO),R0 ldf *-AR6(IRO),Rl mpyf R0,R0 mpyf R1,R1 addf R1,R0 SQRT ; call stf •RO,*+AR5(IRO) ldf @max f f t , R l cmpf R1,R0 bit no new max stf RO,@max_fft no  new  ;max_fft:=0 ;ave_fft:=0 ;get address  of  f f t table  ;get a d d r e s s o f end ;set index to 1 ;255 v a l u e s  of f f t t a b l e  ; i f l e s s t h a n 900HZ t h e n ;@ s a m p l e r a t e 8000Hz ; d o n ' t c a l c u l a t e max o r a v e ;get fft_real[IRO] ;get fft_imag[IRO] /square r e a l p a r t /square imag p a r t ;sum t h e s q u a r e s ;take the s q r t ;save i t i n t a b l e a t r e a l v a l u e ;get current max_fft ; i f max_fft>new magnitude ;then don't pdate m a x _ f f t ; e l s e s t o r e new max  max:  end_magn_loop:  ldf addf stf addi  Save f f t , R l R0,R1 Rl,@ave f f t 1, IRO  ldf ldf  @ave f f t , R 0 197,Rl  call stf  FDIV RO,@ave_fft  pop pop pop pop pop pop pop pop pop pop pop retsu  IRO R4 R3 R2 Rl RO AR6 AR5 RC RE DP  ;ave_fft:=ave_fft+max_fft ;inc(IRO) ;get average total ;get number o f a d d i t i o n s ; n o t e 197 f o r s a m p l e r a t e ; o f 8000 Hz ;save i t  fft_mag_end:  ********************** t Reset  and  intialize  the  AIC  Operations: S e t up t i m e r 0 t o s u p p l y A I C Reset the AIC I n t i a l the s e r i a l p o r t s Take AIC out o f r e s e t I n t i a l i z e the AIC  master  clock * * * *  125  *  Enable  receive interrupts  * *********************************************  *  *  aicreset: ldi ldi  2, i o f ;xfO @t0 c t l a d d r , a r O  ldi sti ldi sti  l,rl rl,*+arO(8) @tO_ctlinit,r l rl,*arO  ldi ldi sti sti ldi sti xor sti  @p0 a d d r , a r O lllh,rl rl,*+arO(2) rl,*+arO(3) @p0 g l o b a l , r l rl,*arO rl, rl rl,*+arO(8)  t o output, s e t xfO t o 0 ;get address of timer  control  register  ldi rpts nop ldi  ;tclkO  w i l l equal h l / 2 ;set the p e r i o d r e g i s t e r t o 1 ;get t i m e r 0 setup v a l u e ; s e t t i m e r 0 t o r u n i n p u l s e mode ;get  address  of serial  port  0  ; i n t i a l i z e transmit port control ;intialize receive port control ;intialize port 0 global control  ;set  transmit data  to 0  0,R7 99 ; w a i t f o r 50 t i m e r o u t c l o c k s ; s e t x f O t o 1, ! r e s e t A I C ; s e t up t h e a i c ;poll f o r transmit interrupt wait transmit 0 3, r l ;secondary t r a n s m i t t i o n rl,*+arO(8) wait transmit 0 la34h,rl ;set the sampling r a t e rl,*+arO(8) *+arO(12),rl 6, i o f  call ldi sti call ldi sti ldi call ldi sti call ldi ldi ldi sti ldi  wait  transmit 0 3, r l rl,*+ar0(8) wait transmit 0 3872h,rl 3C7Ah,rl 346Ah,rl rl,*+arO(8) *+arO(12),rl  ;poll  call ldi sti call ldi sti ldi xor xor or rets  wait  ;setup a i c t r a n s m i t and r e c i e v e /sampling r a t e s  transmit 0 3, r l rl,*+arO(8) wait transmit 0 2a7h,rl rl,*+arO(8) *+arO(12),rl if,if ENBL_XINTO, I E @enbl_spO_r, i e  f o r transmit  interrupt  ;secondary t r a n s m i t t i o n ;set ;set ;set  the sampling the sampling the sampling  r a t e f o r 10.3kHz r a t e f o r 9.6kHz r a t e f o r 11kHz  /clear out a l l i n t e r r u p t f l a g s /disable serial port 0 tx i n t ;enable s e r i a l p o r t 0  /wait_transmit_0:  126  xor wloop:  tstb wloop  bz rets  if,if 10h,if  wait_transmit_0: wloop: tstb bz wloop ldi 0,R7 rets  transmitO:  l d i reti  transmitl: recievel: timerl:  reti reti reti  lh,R7  f o r the transmit t o be s e t .  ;flag  t o be s e t .  ;save  registers  interrupt  1,R7  st receiveO:; push rO push push arO push dp ldp ldi ldi ldi lsh ash float sti pop pop pop ; pop rets reti  ;wait ;flag  PARMS @pO_addr, a r O *+arO(12),rO RO, R7 16,R7 -18,R7 R7,R7 rO,*+arO(8) dp arO rO st  ;get p o r t a d d r e s s ;read input  ;send o u t p u t •restore r e g i s t e r s  ************************************************ *  hread()  *  Read d a t a  *  *  * f r o m c 3 0 memory a n d w r i t e  t o communications r e g .  * * ***************************************************************** hreadl6: push push push push push ldp ldi ldi cmpi beq ldi  st rO ar6 IRO dp process_mode,DP @ p e a k _ c t a b l e , AR6 @ p e a k s _ h c n t , IRO @ p e a k s _ t c n t , IRO send_zero *+AR6(IR0) ,R0  ;save  registers  ;get a d d r e s s o f o u t p u t b u f f e r ;get p o i n t e r t o head o f b u f f e r ;get p o i n t e r t o t a i l o f b u f f e r ; i f e q u a l do n o t h i n g ; e l s e g e t n e s t message  127  ldi sti addi cmpi bne  Qhostport,ar6 ;load host port address r0,*ar6 ;store data 1,IR0 / i n c head p o i n t e r 10,IRO ;have we r o l l e d o v e r m i s s _ r e s e t _ j p o i n t e r s ;no t h e n s a v e new h e a d p o i n t e r  xor IRO,IRO ; e l s e r e s e t head and t a i l so b u f f e r sti IRO,@peaks_hcnt ; d o e s n ; t o v e r f l o w (10 w o r d s max) sti IRO,@peaks_tcnt br no_reset_pointers miss_reset_jpointers: sti IRO,@peaks_hcnt ;save head p o i n t e r no_reset_pointers: pop dp /restore registers pop IRO pop ar6 pop rO pop st , rets send_zero: xor R0,R0 ldi Shostport,ar6 ;load host port address sti r0,*ar6 /store data pop dp /restore registers pop IRO pop ar6 pop rO pop st rets /command  write  cmd_write: push push push push push ldp xor ldi ldi cmpi beq call cmpi bne not sti  st rO ar6 dp R7  /save  registers  p r o c e s s _ m o d e , DP R0,R0 Shostport,ar6 *ar6,R7 0, R7 no_echo w r i t e queue 1,R7 not 1 R0,R7 R 7 , @ p r o c e s s mode  /set  hreadl6  /write  /load host /get input  port address command  /echo t o o u t p u t  flag  queue  forlearning  mode  not_l: no e c h o : call pop pop pop pop  next  queue e n t r y t o  R7 dp ar6 rO  /restore  registers  128  st  pop reti write_queue: push push ldi . ldi sti addi cmpi bne xor  AR4 IRO Speak c t a b l e , A R 4 @peaks t e n t , I R O R7,*+AR4(IRO) 1, IRO 10,IRO nov3 IRO,IRO  sti pop pop rets  IRO,Speaks IRO AR4  s t o r e message  i n output  queue  nov3: tent  end.  129  ********************************************************* * * *  *  File  : warnmath.asm  *  * ************************** ************************************** ** ********** * ********************************************************* *  SUBROUTINE:  FPINV  * * * *  WRITTEN BY:  GARY A. S I T T 0 N GAS LIGHT SOFTWARE HOUSTON, TEXAS MARCH 1989.  *  FLOATING POINT  *  *  INVERSE: RO  *  *  <=  * * * *  * 1/RO  *  *  *  * APPROXIMATE ACCURACY: 8 DECIMAL D I G I T S . * * INPUT RESTRICTIONS: RO != 0.0. * * REGISTERS FOR INPUT: RO. * * REGISTERS USED AND RESTORED: DP AND SP. * * REGISTERS ALTERED: RO-2 AND R4. * * REGISTERS FOR OUTPUT: RO. , * * ROUTINES NEEDED: NONE. • ' * * EXECUTION CYCLES (MIN, MAX): 33 , 33. * ********************************************************* EXTERNAL .GLOBL INTERNAL  PROGRAM NAMES FPINV CONSTANTS  .DATA ONE TWO  .SET .SET  1.0 2.0  MSK  .WORD  0FF7FFFFFH  .TEXT .sect  ".mtext"  START OF FPINV PROGRAM FPINV: LDF RETSZ  R0,R0  . ; TEST F ; RETURN NOW  IF F = 0  GET APPROXIMATION TO 1/F. FOR F = (1+M) * 2**E AND 0 <= M < 1, USE: X [ 0 ] = (l-M/2) * 2**-E PUSH  DP  ; SAVE DATA  PAGE  POINTER  130  LDP PUSHF POP XOR PUSH POPF POP  LOAD DATA PAGE POINTER SAVE AS F L T . PT. F = (1+M) * 2**E FETCH BACK AS INTEGER COMPLEMENT E & M BUT NOT SIGN B I T SAVE AS INTEGER, AND BY MAGIC... R l <= X f O ] = ( l - M / 2 ) * 2**-E. UNSAVE DP  @MSK RO Rl @MSK, R l Rl Rl DP  NEWTON ITERATION FOR: Y(X) = X - 1/F = 0 ... MPYF SUBRF MPYF  R1,R0,R4 TWO,R4 R4,R1  ; R4 <= F * X f O ] ; R4 <= 2 - F * X f O ] ; R l <= X f l ] = X f O ] *  (2 -  F * XfO])  MPYF SUBRF MPYF  R1,R0,R4 TWO,R4 R4,R1  ; R4 <= F * X f l ] ; R4 <= 2 - F * X f l ] ; R l <= X [ 2 ] = X f l ] *  (2 -  F * Xfl])  MPYF SUBRF MPYF  R1,R0,R4 TWO,R4 R4,R1  ; R4 <= F * X [ 2 ] ; R4 <= 2 - F * X [ 2 ] ; R l <= X [ 3 ] = X [ 2 ] * (2 -  F * X[2])  FOR THE LAST RND RND MPYF  ITERATION : X [ 4 ] =  R0,R4 R1,R0 R0,R4  (X[3]  * (1 - (F  *  X[3])))  + X[3]  ; ROUND F BEFORE LAST MULTIPLY ; ROUND X [ 3 ] BEFORE M U L T I P L I E S ; R4 <= F * X [ 3 ] = 1 + EPS  F I N I S H ITERATION AND RETURN POP BUD SUBRF MPYF ADDF  R2 R2 ONE,R4 R0,R4 R4,R1,R0  R2 <= RETURN ADDRESS RETURN (DELAYED) R4 <= 1 - F * X [ 3 ] = EPS R4 <= X [ 3 ] * EPS ; RO <= X [ 4 ] = ( X [ 3 ] * ( l - ( F * X [ 3 ] ) ) )  + X[3]  ******************************************** SUBROTUINE:  FDIV  WRITTEN BY: GARY A . SITTON GAS LIGHT SOFTWARE HOUSTON, TEXAS A P R I L 1989. FLOATING POINT DIVIDE  FUNCTION: RO <= R0/R1.  *  *  APPROXIMATE ACCURACY: 8 DECIMAL D I G I T S . * INPUT RESTRICTIONS: R l != 0.0. * REGISTERS FOR INPUT: RO (DIVIDEND) AND R l ( D I V I S O R ) . * REGISTERS USED AND RESTORED: DP AND SP. * REGISTERS ALTERED: RO-4. * REGISTERS FOR OUTPUT: RO (QUOTIENT). * * ROUTINES NEEDED: FPINV. * * EXECUTION CYCLES (MIN, MAX): 43 , 43. * ********************************************************* EXTERNAL PROGRAM NAMES  131  GLOBL GLOBL  FDIV FPINV  .TEXT .sect  ".mtext"  START OF FDIV  PROGRAM  FDIV: RND LDF CALL RND MPYF RETS  RO, R3 R l , RO FPINV RO R3, RO  R3 <= R l <= RO <= ROUND RO <=  RND X Y 1/Y BEFORE X  RETURN  .END  ***************************************************** ****  132  ***************************************** **** * FILENAME  *  : warnfft.asm  * ADAPTED FROM  : Texas Instrument  * DATE  : 23rd June  *  *  * VERSION  *  :  1994  3.0  ************************************************************************* **** * VER *  DATE  COMMENTS  1 8 t h J u l y 91 O r i g i n a l Release. J u l y 91 Most S t a g e s M o d i f i e d . Minimum FFT S i z e i n c r e a s e d f r o m 32 t o 64. Faster i n place b i t reversing algorithm. P r o g r a m s i z e i n c r e a s e d b y a b o u t 100 w o r d s . One e x t r a d a t a w o r d r e q u i r e d . 2 3 r d J u n e 94 U s e d as 2 512 w o r d FFT b a n k s B o t h Bank2 t o r e s i d e i n RAMI i n t e r n a l b a n k Code t o r e s i d e i n RAMO i n t e n a l b a n k NOT c a l l e d as a C s u b r o u t i n e C a l l e d a s an a s s e m b l y l a n g u a g e r o u t i n e o n l y ! 23rd  3.0  ************************************************************************* **** * SYNOPSIS: i n t  int int float float float int  f f f t _ r l ( F F T _ S I Z E , LOG_SIZE, SOURCE_ADDR, SINE TABLE, B I T REVERSE ) ;  DEST_ADDR,  FFT_SIZE 64, 128, 256, 512, 1024, ... LOG_SIZE 6, 7, 8, 9, 10, ... *SOURCE_ADDR ; Points to l o c a t i o n of source *DEST_ADDR ; P o i n t s t o where d a t a w i l l be o p e r a t e d on a n d s t o r e d . *SINE_TABLE ; P o i n t s t o t h e SIN/COS t a b l e . 0, B i t R e v e r s i n g i s d i s a b l e d . B I T REVERSE ; = <> 0, B i t R e v e r s i n g i s e n a b l e d .  data.  NOTE: 1)  I f SOURCE_ADDR = DEST_ADDR, t h e n i n p l a c e b i t r e v e r s i n g i s p e r f o r m e d , i f e n a b l e d (more processor intensive). 2) FFT S I Z E must be >= 64 ( t h i s i s n o t c h e c k e d ) .  * DESCRIPTION: G e n e r i c f u n c t i o n t o do a r a d i x - 2 FFT c o m p u t a t i o n o n t h e C30. * T h e d a t a a r r a y i s one o f 2 F F T _ S I Z E - l o n g t a b l e s w i t h o n l y * r e a l d a t a . The o u t p u t i s s t o r e d i n t h e same l o c a t i o n s w i t h * r e a l and i m a g i n a r y p o i n t s R and I as f o l l o w s : DEST ADDR[0]  -> R(D R(2) R(3)  R(0)  133  R(FFT_SIZE/2) I ( F F T SIZE/2  DEST_ADDR[FFT_SIZE  - 1)  I (2) - 1] -> 1 ( 1 )  T h i s s u b r o u t i n e i s b a s e d on t h e FORTRAN p r o g r a m i n t h e p a p e r b y S o r e n s e n e t a l . , J u n e 1987 i s s u e o f T r a n s , o n A S S P . B i t r e v e r s a l i s o p t i o n a l l y implemented of the function.  at the beginning  The s i n e / c o s i n e t a b l e f o r t h e t w i d d l e f a c t o r s t o be s u p p l i e d i n t h e f o l l o w i n g f o r m a t : SINE  TABLE[0]  i s expected  -> s i n ( 0 * 2 * p i / F F T _ S I Z E ) sin(l*2*pi/FFT_SIZE)  sin((FFT_SIZE/2-2)*2*pi/FFT_SIZE) SINE_TABLE [FFT_SIZE/2 - 1] -> s i n ( ( F F T _ S I Z E / 2 - l ) * 2 * p i / F F T _ S I Z E ) * NOTE: The t a b l e i s t h e f i r s t * * S t a c k s t r u c t u r e upon c a l l : * * + + * -FP(7) B I T REVERSE | * -FP(6) SINE TABLE | * -FP(5) DEST ADDR | * -FP(4) SOURCE ADDR | * -FP(3) LOG S I Z E | * -FP(2) FFT_SIZE | * r e t u r n addr | -FP(1) * -FP(0) o l d FP | * + +— * ****************************************  * * *  WARNING: DP i n i t i a l i s e d o n l y o n c e i n t h e p r o g r a m . Be w a r y w i t h i n t e r r u p t s e r v i c e r o u t i n e s . Make s u r e i n t e r r u p t s e r v i c e r o u t i n e s s a v e t h e DP p o i n t e r .  * * *  WARNING: T h e DEST_ADDR must b e a l i g n e d s u c h t h a t t h e f i r s t LOG_SIZE b i t s a r e z e r o ( t h i s i s n o t c h e c k e d b y t h e program).  *  * ************************************************************************* **** * REGISTERS USED: RO, R l , R2, R3, R4, R5, R6, R7 * ARO, AR1, AR2, AR3, AR4, AR5, AR6, AR7 * IRO, IR1  134  * *  RC, RS, RE DP  * * MEMORY REQUIREMENTS: P r o g r a m = 405 Words * Data = 7 Words * Stack = 12 Words  (approximately)  * **************************************** **** * * BENCHMARKS: * * * * *  Assumptions - P r o g r a m i n RAMO - R e s e r v e d d a t a i n RAMO - S t a c k o n P r i m a r y / E x p a n s i o n B u s RAM - S i n e / C o s i n e t a b l e s i n RAMO - P r o c e s s i n g a n d d a t a d e s t i n a t i o n i n RAMI. - P r i m a r y / E x p a n s i o n Bus RAM, 0 w a i t s t a t e .  *  *  FFT S i z e  *  * approx. * *  B i tReversing  1024  Data Source C y c l e s ( C 3 0 )  OFF  RAMI  19816  N o t e : T h i s number does n o t i n c l u d e t h e C c a l l a b l e o v e r h e a d s . A d d 57 c y c l e s f o r t h e s e o v e r h e a d s .  * ************************************************************************* *** *  ENBL_GIE FP  FFT_SIZE: LOG_SIZE: SOURCE_ADDR: DEST_ADDR: SINE_TABLE: BIT_REVERSE: SEPARATION:  Initialise  .set . s e t AR3  2000h  ;global  interrupt  enable  .global  _ffft_rl  ; Entry  execution  point.  .usect .usect  ".fftdata",l ; R e s e r v e memory f o r a r g u m e n t s . ".fftdata",l .usect ".fftdata",l .usect ".fftdata",l .usect ".fftdata",l .usect ".fftdata",l .usect ".fftdata",1  C Function.  .sect ffft  r l :  PUSH LDI PUSH PUSH PUSH PUSH PUSH PUSH  ".ffttext"  FP FP SP, FP RO Rl R2 R3 R4 R5 PUSH R6 PUSH R7 PUSH ARO PUSH AR1  ; Preserve  environment.  135  PUSH PUSH PUSH PUSH PUSH PUSH  AR2 AR3 AR4 AR5 AR6 AR7 PUSH PUSH PUSH DP  Check  IRO IR1  LDP  FFT_SIZE  ; Initialise  LDI STI LDI STI LDI STI LDI STI LDI STI LDI STI  *-FP(2),R0 ; Move a r g u m e n t s RO,@FFT_SIZE *-FP(3),R0 RO, @LOG_SIZE *-FP(4),R0 RO,@SOURCE_ADDR *-FP(5),R0 RO,@DEST_ADDR *-FP(6),R0 RO,@SINE_TABLE *-FP(7),R0 RO,@BIT REVERSE  B i t R e v e r s i n g Mode  DP p o i n t e r . from  stack.  (on o r o f f ) .  BIT_REVERSING = 0, t h e n OFF (no b i t r e v e r s i n g ) . BIT_REVERSING <> 0, T h e n ON. LDI CMPI BZ  Check If If  @BIT_REVERSE,RO 0,R0 MOVE DATA  B i t Reversing  Type.  SourceAddr = DestAddr, Then S o u r c e A d d r <> D e s t A d d r , T h e n  LDI CMPI BEQ  ; B i t reversing ; NOTE: checked.  @SOURCE_ADDR,R0 @DEST_ADDR,RO I N PLACE  Type  1 (From S o u r c e t o D e s t i n a t i o n ) .  a b s (SOURCE_ADDR  LDI SUBI LDI LSH LDI  In Place B i t Reversing. Standard B i t Reversing.  -  DEST_ADDR) must  @FFT_SIZE,R0 2,R0 @FFT_SIZE,IRO -1,IR0 @SOURCE ADDR,ARO  be  >  FFT_SIZE,  ; IRO = H a l f  this  i s not  FFT s i z e .  136  LDI  @DEST_ADDR,AR1  LDF  *AR0++,R1  RPTS LDF ||  RO *ARO++,Rl STF Rl,*AR1++(IR0)B  STF  R1,*AR1++(IR0)B BR  In  Place  B i t Reversing.  ; IN_PLACE:  START  B i t Reversing  On E v e n L o c a t i o n s ,  LDI LSH LDI  @FFT_SIZE, IRO -2,IRO 2,IR1  LDI LSH SUBI LDI LDI LDI  @FFT_SIZE,RC -2,RC 3,RC @DEST_ADDR,ARO ARO,AR1 ARO,AR2  1st Half  ; IRO = Q u a r t e r  FFT  NOP *AR1++(IR0)B NOP *AR2++(IR0)B LDF *++AR0(IR1),RO LDF *AR1,R1 CMPI AR1,ARO ; Xchange L o c a t i o n s LDFGT R0,R1 LDFGT *AR1++(IR0)B,R1 RPTB LDF || S T F LDF || S T F CMPI LDFGT BITRV1: STF  ;  size.  only  i f AR0<AR1.  BITRV1 *++AR0(IR1),R0 RO,*AR0 *AR1,R1 Rl,*AR2++(IRO)B AR1,ARO R0,R1 LDFGT *AR1++(IRO)B,RO R0,*AR0 STF R1,*AR2  Perform B i t Reversing  LDI LSH LDI ADDI ADDI  Only.  On Odd L o c a t i o n s ,  2nd H a l f  Only.  @FFT_SIZE,RC -1,RC @DEST_ADDR,ARO RC,AR0 1,AR0  137  LDI LDI LSH SUBI  ARO,AR1 ARO,AR2 -1,RC 3,RC  NOP NOP LDF LDF CMPI LDFGT LDFGT  *AR1++(IR0)B *AR2++(IR0)B *++AR0(IR1) ,R0 *AR1,R1 AR1,ARO R0,R1 *AR1++(IR0)B,R1  RPTB LDF | | STF LDF M STF CMPI LDFGT BITRV2: STF  only  i f AR0<AR1.  BITRV2 *++AR0(IR1),RO RO,*AR0 *AR1,R1 Rl,*AR2++(IR0)B AR1,ARO R0,R1 LDFGT *AR1++(IR0)B,R0 R0,*AR0 STF  ;  ; Xchange L o c a t i o n s  R1,*AR2  Perform B i t Reversing  LDI  @FFT_SIZE,RC  LSH LDI LDI LDI ADDI ADDI LSH LDI SUBI  -1,RC RC,IR0 @DEST_ADDR,ARO ARO, AR1 1,AR0 IR0,AR1 -1,RC RC,IRO 2,RC  LDF LDF  *AR0,RO *AR1,R1  On Odd L o c a t i o n s ,  1st Half  Only.  y  RPTB LDF || S T F BITRV3:  BITRV3 *++AR0(IR1),RO RO,*AR1++(IRO)B LDF *AR1,R1 | | STF Rl,*-AR0(IR1) STF  BR  RO, *AR1 STF Rl,*AR0 START  Check Data S o u r c e If If  Locations.  SourceAddr = DestAddr, S o u r c e A d d r <> D e s t A d d r ,  T h e n do n o t h i n g . T h e n move d a t a .  138  MOVEJDATA:  LDI CMPI BEQ  @SOURCE_ADDR,RO 0DEST ADDR,R0 START  LDI SUBI LDI LDI  @FFT_SIZE,RO 2,R0 @SOURCE_ADDR,ARO @DEST_ADDR,ARl  LDF  *ARO++,Rl  RPTS LDF  RO *ARO++,Rl STF R l , *AR1++  11  STF  Perform  f i r s t and  | ARl | AR2 | AR3 |_ AR4 ARl _  Rl,*AR1  -> -> -> -> ->  START: LDI LDI LDI ADDI ADDI ADDI LDI LDI LSH SUBI  11 12 13 14  s e c o n d FFT I | | | 1  0 1 2 3 4  <<<<-  loops. [X(I1) [X(I1) [X(I1) ~[X(I3)  + X(I2)] + - X(I2)] + X(I2)] - X(I4)]  [X(I3) + X ( I 4 ) ] [X(I3) + X(I4) ]  LDI 0DESTJ ARl,AR2 ARl,AR3 ARl,AR4 1, AR2 2,AR3 3, AR4 4, IRO @FFT_SIZE,RC -2, RC 2,RC  LDF *AR2,R0 RO = X ( I 2 ) Rl = | | LDF *AR3,R1 ADDF3 Rl,*AR4,R4 R4 = X ( I 3 ) SUBF3 Rl,*AR4++(IRO) ,R5 ; R5 = SUBF3 R0,*AR1,R6 R6 = X ( I 1 ) ADDF3 RO,*AR1++(IRO) , R7 R7 = ADDF3 R7,R4,R2 SUBF3  R4,R7,R3  R3  X(I3) + X(I4) - [ X ( I 3 ) - X ( I 4 ) ] --+ - X(I2) — + | X(I1) + X(I2) R2 = R7 + R4 R7  R4 — +  | I  RPTB LOOPl_2 LDF *+AR2(IRO) , RO | | LDF *+AR3(IRO) , R l ADDF3 R1,*AR4,R4  I  I I I  I  I I I  139  || S T F R3,*AR3++(IR0) SUBF3 Rl,*AR4++(IR0),R5 || S T F R5, *-AR4 (IRO) SUBF3 R0,*AR1,R6 ; || S T F R6,*AR2++(IRO) ADDF3 RO,*AR1++(IRO),R7 || S T F R2, * - A R l (IRO) ADDF3 R7,R4,R2 SUBF3 R4,R7,R3  LOOPl_2:  ; X(I3) < ; ;X(I4)< I ; X(I2) < ;  +  I  I I I I I 1 — I ~+  I 1 — + I  ; X(I1) <  +  S T F R3,*AR3 || S T F R5,*-AR4(IRO) STF R6,*AR2 I| S T F R2,*-ARl(IRO)  Perform T h i r d Part  FFT Loop  A: ~~ A R l ->  AR2  ->  AR3  ->  ARl  ->  LDI LDI LDI ADDI ADDI LDI LDI LSH SUBI  II I 12 I 13 I 14 I  | 0  <I 1  X(I1) + X(I3)  | 2 | 4 | 6  I 3 <X(I1) - X(I3) I 5 <- - X ( I 4 ) I 7  I 8 I 9 I  @DEST ADDR,ARl A R l , AR2 A R l , AR3 4,AR2 6,AR3 8, IRO @FFT S I Z E , R C -3, RC 2,RC  SUBF3 *AR2,*AR1,R1 ADDF3 *AR2, *AR1,R2 *AR3,R3 NEGF RPTB LDF I | STF SUBF3 | | STF ADDF3 | | STF NEGF  LOOP3_A *+AR2(IRO),RO ; RO = X ( I 3 ) R2,*AR1++(IRO) Rl = X(I1) - X(I3) R0,*AR1,R1 Rl,*AR2++(IRO) t X(I1) + X(I3) —+ R0,*AR1,R2 ; R2 = R3,*AR3++(IRO) *AR3,R3 ; R3 = - X ( I 4 ) —+  140  STF I | STF STF  Part  R2,*AR1 Rl,*AR2 R3,*AR3  X(I1) X(I3) X(I4)  <  <  I I  <  +  I  I  +  | +  B:  ARO ARl AR2  1 o  -> 1  11  1  -> 1  12  1  -> 1  AR3 ->  4  13  1  1  1  1 <-  X(I1)  +  [X(I3)*COS + X(14)*COS]  | 3 <-  X(I1)  -  [X(I3)*COS + X(14)*COS]  -  [X(I3)*COS -  | 5 <- - X ( I 2 )  X(14)*COS]  6 - [X(I3)*COS - X(I4)*COS] | 7 <- X ( I 2 ) 8 NOTE: C O S ( 2 * p i / 8 ) = S I N ( 2 * p i / 8 )  14  1  |9  ARO  2  "l  LDI LSH LDI SUBI LDI LDI LDI LDI LDI ADDI ADDI ADDI ADDI  @FFT_SIZE,RC -3,RC RC,IR1 3,RC 8,IRO @DEST_ADDR,ARO ARO,ARl ARO,AR2 ARO,AR3 l,ARO 3,ARl 5,AR2 7,AR3  LDI  0SINE TABLE,AR7  LDF  *++AR7(IR1),R7 ; R7 = COS(2*pi/8) ; *AR7 = C O S ( 2 * p i / 8 )  MPYF3  *AR7,*AR2,R0  Initialise  ;  RO =  table  pointers.  X(I3)*COS  MPYF3 *AR3,R7,R1 ; R5 = X(I4)*COS ADDF3 R0,R1,R2 ; R2 = [X(I3)*COS + X(I4)*COS] MPYF3 *AR7,*+AR2(IRO),RO || SUBF3 R0,R1,R3 ; R3 = - [ X ( I 3 ) * C O S - X ( I 4 ) * C O S ] SUBF3 *AR1,R3,R4 ; R4 = - X ( I 2 ) + R3 — + ADDF3 *AR1,R3,R4 R4 = X ( I 2 ) + R3 —|—+ || S T F R4,*AR2++(IRO) X(I3) < + | SUBF3 R2,*AR0,R4 R4 = X ( I 1 ) - R2 — + | || S T F R4,*AR3++(IRO) X(I4) < : |—+ ADDF3 *AR0,R2,R4 R4 = X ( I I ) + R2 — | — + || S T F R4,*AR1++(IR0) X(I2) < + | RPTB  LOOP3 B  141  MPYF3 *AR3,R7,R1 || S T F R4,*ARO++(IRO) ; ADDF3 R0,R1,R2 MPYF3 *AR7,*+AR2(IRO),RO I| SUBF3 R0,R1,R3 SUBF3 *AR1,R3,R4 ADDF3 *AR1,R3,R4 || S T F R4,*AR2++(IRO) SUBF3 R2,*AR0,R4 || S T F R4,*AR3++(IRO) ADDF3 *AR0,R2,R4 || S T F R4,*AR1++(IRO)  L 0 0 P 3 B:  x(il)  <-  MPYF3 *AR3,R7,Rl || S T F R4,*ARO++(IRO) ADDF3 RO,Rl,R2 SUBF3 R0,R1,R3 SUBF3 *AR1,R3,R4 ADDF3 *AR1,R3,R4 || S T F R4,*AR2 SUBF3 R2,*ARO,R4 || S T F R4,*AR3 ADDF3 *AR0,R2,R4 || S T F R4,*AR1 STF  Perform Part  R4,*AR0  F o u r t h FFT Loop.  A: _  A R l ->  II  | 0  I  I 2  I 12  X(I1) + X(I3)  I 3  | 4  I AR2 ->  <-  I 1  I 6 I 7  13  I 5 <-  X(I1) - X(I3)  J I 10i I 11 9  AR3 ->  14 f  I ARl  ->  15  I  I  12 <- - X ( I 4 ) I 13 I 14 I 15 | 16 17  \l/ LDI LDI LDI  @DEST_ADDR,ARl A R l , AR2 ARl,AR3  142  LOOP4_A:  ADDI ADDI LDI LDI LSH SUBI  8,AR2 12,AR3 16,IRO @FFT_SIZE,RC -4,RC 2,RC  SUBF3 ADDF3 NEGF  *AR2,*AR1,R1 *AR2,*AR1,R2 *AR3,R3  RPTB LDF || S T F SUBF3 || S T F ADDF3 II S T F NEGF  LOOP4_A *+AR2(IRO),RO ; RO = X ( I 3 ) R2,*ARl++(IRO) R0,*AR1,R1 ; Rl = X(I1) - X(I3) Rl,*AR2++(IR0) ; R0,*AR1,R2 ; R2 = X(I1) + X(I3) — + R3,*AR3++(IRO) ; *AR3,R3 ; R3 = - X ( I 4 ) — +  + I | I I |  I I  STF || S T F STF  Part  R2,*AR1 R1,*AR2 R3,*AR3  ; X(I1) < ; X(I3) < ; X(I4) <  I  — I 1 +  +  | .-+  B:  I 0 -> | I l _ ( 3 r d ) _ | I Il_(2nd)_| 2 I Il_(lst)_| 3 I I 4 I I2_(lst)_| I I2_(2nd)_| 6 ARl -> | I 2 _ ( 3 r d ) _ | 7 I _ l 8 AR2 -> | I 3 _ ( 3 r d ) _ | | I 3 _ ( 2 n d ) _ | 10 AR4 -> | I 3 _ ( l s t ) _ | 11 I I 12 I I 4 _ ( l s t ) _ | 13 | I 4 _ ( 2 n d ) _ | 14 AR3 -> | I 4 _ ( 3 r d ) _ | I I 16 ARO -> | | 17 I  ARO  LDI LSH LDI LDI SUBI  1  <-  X(I1) + [X(I3)*COS  + X(I4)*SIN]  5 ; <9  X(Il) <  15 <-  [X(I3)*COS  + X(I4)*SIN]  X(I2) - [ X ( I 3 ) * S I N -  X(I2) - [X(I3)*SIN  X(I4)*COS]  - X(I4)*C0S]  @FFT_SIZE,RC -4,RC RC,IR1 2,IRO 3,RC  143  LDI LDI LDI LDI LDI ADDI ADDI ADDI ADDI ADDI  @DEST_ADDR,ARO ARO,ARl ARO,AR2 AR0,AR3 ARO,AR4 l,ARO 7,ARl 9,AR2 15,AR3 11,AR4  LDI LDF  @SINE_TABLE,AR7 *++AR7(IR1),R7 ; R7 = S I N ( 1 * [ 2 * p i / 1 6 ] ) ; *AR7 = C O S ( 3 * [ 2 * p i / 1 6 ] ) AR7,AR6 *++AR6(IRl) ,R6 ; R6 = S I N ( 2 * [ 2 * p i / 1 6 ] ) ; *AR6 = C O S ( 2 * [ 2 * p i / 1 6 ] ) AR6,AR5 *++AR5(IR1),R5 ; R5 = S I N ( 3 * [ 2 * p i / 1 6 ] ) ; *AR5 = C O S ( 1 * [ 2 * p i / 1 6 ] )  LDI LDF LDI LDF  LDI  16,IR1  MPYF3  *AR7,*AR4,R0  MPYF3 *++AR2(IRO),R5,R4 ; R4 MPYF3 * — A R 3 ( I R O ) , R 5 , R 1 ; R l MPYF3 *AR7,*AR3,R0 | ADDF3 R0,R1,R2 MPYF3 *AR6,*-AR4,R0 | SUBF3 R4,R0,R3  RO =  X(I3)*COS(3)  X(I3)*SIN(3) X(I4)*SIN(3) RO = X(I4)*COS(3) R2 = [X(I3)*C0S + R3  =  X(I4)*SIN]  -[X(I3)*SIN  -  X(14)*COS] SUBF3 * — A R l ( I R O ) , R 3 , R 4 ; R4 = •-X(I2) + R3 — + X ( I 2 ) + R3 — | — + ADDF3 *AR1,R3,R4 ; R4 = + I I STF R4,*AR2— ; X(I3) < R4 = X ( I 1 ) - R2 — + | SUBF3 R2,*++ARO(IRO),R4 X(I4) < | S T F R4,*AR3 I—+ |—+ ADDF3 *AR0,R2,R4 R4 = X ( I 1 ) + R2 | S T F R4,*AR1 X(I2) <  +  MPYF3 *++AR3,R6,Rl | S T F R4,*AR0 ADDF3 R0,R1,R2 MPYF3 *AR5,*-AR4(IRO) , RO | SUBF3 R0,R1,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | S T F R4,*AR2 SUBF3 R 2 , * — A R 0 , R 4 I S T F R4,*AR3 ADDF3 *AR0,R2,R4 | S T F R4,*AR1  X(I1)  <-  I I +  MPYF3 * — A R 2 , R 7 , R 4 | S T F R4,*AR0 MPYF3 *++AR3,R7,Rl MPYF3 *AR5,*AR3,R0 | ADDF3 R0,R1,R2  144  MPYF3 *AR7,*++AR4(IR1) , RO I SUBF3 R4,R0,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | S T F R4,*AR2++(IR1) SUBF3 R2,*—ARO,R4 | S T F R4,*AR3++(IRl) ADDF3 *AR0,R2,R4 | S T F R4,*AR1++(IRl) RPTB LOOP4_B MPYF3 *++AR2(IRO) , R5, R4 I S T F R4,*ARO++(IRl) MPYF3 * — A R 3 ( I R O ) , R 5 , R l MPYF3 *AR7,*AR3,R0 | ADDF3 R0,R1,R2 MPYF3 *AR6,*-AR4,R0 | SUBF3 R4,R0,R3 SUBF3 * — A R l ( I R O ) , R 3 , R 4 ADDF3 *AR1,R3,R4 | STF R4,*AR2— SUBF3 R2,*++ARO(IRO) ,R4 | S T F R4,*AR3 ADDF3 *AR0,R2,R4 | S T F R4,*AR1 MPYF3 *++AR3,R6,Rl | S T F R4,*AR0 ADDF3 R0,R1,R2 MPYF3 *AR5,*-AR4(IRO) , RO | SUBF3 R0,R1,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | S T F R4,*AR2 SUBF3 R2,*—ARO,R4 | S T F R4,*AR3 ADDF3 *AR0,R2,R4 | S T F R4,*AR1 MPYF3 *—AR2,R7,R4 I S T F R4,*ARO MPYF3 *++AR3,R7,Rl MPYF3 *AR5,*AR3,RO | ADDF3 R0,R1,R2 MPYF3 *AR7,*++AR4(IRl),RO | SUBF3 R4,R0,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | S T F R4,*AR2++(IRl) SUBF3 R2,*—ARO,R4 I S T F R4,*AR3++(IRl) ADDF3 *AR0,R2,R4 | S T F R4,*AR1++(IR1)  MPYF3 *++AR2(IRO),R5,R4 | | S T F R4,*ARO++(IRl) MPYF3 * — A R 3 ( I R O ) , R 5 , R 1  MPYF3 *AR7,*AR3,R0 | | ADDF3 R0,R1,R2 MPYF3 *AR6,*-AR4,RO | | SUBF3 R4,R0,R3 SUBF3 * — A R l ( I R O ) ,R3,R4 ADDF3 *AR1,R3,R4 | | S T F R4,*AR2 — SUBF3 R2,*++ARO(IRO),R4 | | S T F R4,*AR3 ADDF3 *AR0,R2,R4 I | S T F R4,*AR1 MPYF3 *++AR3,R6,Rl | | S T F R4,*ARO ADDF3 R0,R1,R2 MPYF3 *AR5,*-AR4(IRO),RO | | SUBF3 RO,Rl,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | | S T F R4,*AR2 SUBF3 R 2 , * — A R 0 , R 4 I | S T F R4,*AR3 ADDF3 *AR0,R2,R4 | | S T F R4,*AR1 MPYF3 *—AR2,R7,R4 | | S T F R4,*ARO MPYF3 *++AR3,R7,Rl MPYF3 *AR5,*AR3,R0 | | ADDF3 R0,R1,R2 SUBF3 R4,R0,R3 SUBF3 *++ARl,R3,R4 ADDF3 *AR1,R3,R4 | | S T F R4,*AR2 SUBF3 R 2 , * — A R 0 , R 4 | | S T F R4,*AR3 ADDF3 *AR0,R2,R4 | | S T F R4,*AR1 STF  R4,*AR0  Perform Remaining  FFT l o o p s  (loop  4 onwards).  LOOP  1st  2nd  \/ | | X(I4)*SIN] | I  | ARl | I  A ->  |  B ->  | |  \/  X (II) | 0 0 <| X (Il)_(lst)_| 1 1  ->  X(Il)_(2nd)_| 2 x ( I l ) (3rd) | 3  X' ( I I ) + X' (13) 1 <X(I1) +  [X(I3)*COS  2 3  I X'(I2)  .  | 8  16  I  146  I X ( I 2 ) _ ( 3 r d ) _ | 13 29 _X(I2)_(2nd)_| 14 30 • I AR2 -> | _ X ( I 2 ) _ ( l s t ) _ | 15 31 <- X ( I 1 ) - [ X ( I 3 ) * C O S + X ( I 4 ) * S I N ] X' ( I I ) - X (13) X' (13) | 16 32 < 33 <- - X ( I 2 ) - [X(I3)*SIN AR3 -> | X(I3)_(lst)_| 17 X(14)*COS] _X(I3)_(2nd)_| 18 34 X ( I 3 ) ( 3 r d ) | 19 35 1  X' (14)  | 24  48 <- - X ' ( 1 4 )  D -> |  I | I AR4 X(14)*COS] ARl  X ( I 4 ) _ ( 3 r d ) _ | 29 61 X ( I 4 ) _ ( 2 n d ) _ | 30 62 -> | X ( I 4 ) ( 1 s t ) | 31  I  I 32 "| 33 "l  -> |  f  63  <-  X(I2) -  [X(I3)*SIN  64 65  \l/  LOOP:  INLOP: —+  LDI LSH STI LSH LDI LDI LDI LDI LDI LSH LSH ADDI LSH LDI ADDI LDI ADDI ADDI SUBI LDI SUBI  @FFT_SIZE, IRO -2,IRO IRO,0SEPARATION -2,IRO 5,R5 3,R7 16, R6 @DEST_ADDR,AR5 @DEST_ADDR,ARl -1,IR0 1,R7 1,R7 1,R6 ARl,AR4 R7,AR1 ARl,AR2 2,AR2 R6,AR4 R7,AR4 AR4,AR3 2,AR3  LDI LDI LDI  @SINE_TABLE,ARO R7,IR1 R7,RC ADDF3  ARl  points  a t A.  AR2 p o i n t s  a t B.  AR4 p o i n t s  a t D.  AR3 p o i n t s  a t C.  ARO p o i n t s  a t SIN/COS  -ARl(1R1),*++AR2(IR1),RO  SUBF3 *- -AR3(IR1),*AR1++,R1 NEGF *- -AR4, R2  table.  RO = X ( I I )  ; R l = X'(II) R2 = -X' (14) — +  1  + X (13) 1  - X'(13)  I |  -+|  147  I I S T F R0,*-AR1 STF R1,*AR2— | | S T F R2,*AR4++(IRl) LDI SUBI  OSEPARATION, I R l 3,RC  ; X' ( I I ) < ; X' (13) < ; X' (14) < ;  I  I +  |+  +  IR1=SEPARATI0N BETWEEN SIN/COS T B L S  MPYF3 *++AR0(IRO) , *AR4, R4 R4 = X ( I 4 ) * S I N MPYF3 *AR0,*++AR3,Rl Rl = X(13)*SIN MPYF3 *++AR0(IRl),*AR4,RO RO = X ( 1 4 ) * C O S MPYF3 *AR0,*AR3,R0 RO = X ( I 3 ) * C O S I SUBF3 R1,R0,R3 R3 = - [ X ( 1 3 ) * S I N - X ( 1 4 ) * C O S ] MPYF3 *++ARO(IRO),*-AR4,RO ; R2 = X ( I 3 ) * C O S + X ( 1 4 ) * S I N I ADDF3 R0,R4,R2 R4 = R3 - X ( I 2 ) — * SUBF3 *AR2,R3,R4 R4 = R3 + X ( I 2 ) — | — * ADDF3 *AR2,R3,R4 | S T F R4,*AR3++ X(I3) < * | SUBF3 R2,*AR1,R4 R4 = X ( I 1 ) - R2 — * | | STF R4,*AR4— X(I4) < I — * ADDF3 *AR1,R2,R4 R4 = X ( I 1 ) + R2 — I — * X(I2) < * | I STF R4,*AR2— RPTB IN_BLK LDF *-ARO(IRl),R3 MPYF3 *AR4,R3,R4 | S T F R4,*AR1++ X ( I 1 ) <MPYF3 *AR3,R3,R1 MPYF3 *AR0,*AR3,R0 I SUBF3 R1,R0,R3 MPYF3 *++AR0(IRO),*-AR4,R0 | ADDF3 R0,R4,R2 SUBF3 *AR2,R3,R4 ADDF3 *AR2,R3,R4 | S T F R4,*AR3++ SUBF3 R2,*AR1,R4 | STF R4,*AR4— ADDF3 *AR1,R2,R4 | STF R4,*AR2— LDF * - A R 0 ( I R l ) ,R3 MPYF3 *AR4,R3,R4 | S T F R4,*AR1++ MPYF3 *AR3,R3,R1 MPYF3 *AR0,*AR3,RO | SUBF3 R1,R0,R3 LDI R6,IR1 ADDF3 R0,R4,R2 SUBF3 *AR2,R3,R4 ADDF3 *AR2,R3,R4 | S T F R4,*AR3++(IR1) SUBF3 R2,*AR1,R4 | S T F R4,*AR4++(IR1) ADDF3 *AR1,R2,R4 | S T F R4,*AR2++(IRl) S T F R4,*AR1++(IR1) SUBI3 AR5,AR1,R0  148  Return  CMPI BLTD LDI LDI LDI  @FFT_SIZE,RO INLOP @SINE_TABLE,ARO R7,IR1 R7,RC  ADDI CMPI BLED LDI LSH LSH  1,R5 @LOG_SIZE,R5. LOOP @DEST_ADDR,ARl -1,IR0 1,R7  LOOP BACK TO THE INNER LOOP ; ARO POINTS TO SIN/COS TABLE  t o C environment.  POP  POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP RETS  DP POP POP AR7 AR6 AR5 AR4 AR3 AR2 ARl ARO R7 R6 R5 R4 R3 R2 Rl RO FP  ; Restore IR1 IRO  environment  variables.  . end  * No more.  ******************************************** ****  149  ******************************************** * * *  warntwid.asm  FFT S I Z E :  512  . global . data  sinetab  .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float .float  0.00000000000 0. 01227153829 0. 02454122852 0.03680722294 0. 04906767433 0.06132073630 0.07356456360 0. 08579731234 0. 09801714033 0.11022220729 0.12241067520 0.13458070851 0.14673047446 0.15885814333 0.17096188876 0.18303988796 0.19509032202 0.20711137619 0.21910124016 0.23105810828 0.24298017990 0.25486565960 0.26671275748 0.27851968939 0.29028467725 0.30200594932 0.31368174040 0.32531029216 0.33688985339 0.34841868025 0.35989503654 0.37131719395 0.38268343236 0.39399204006 0.40524131400 0.41642956010 0.42755509343 0.43861623854 0.44961132965 0.46053871096  sinetab  150  float float float float float float float float float. float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float  0. 47139673683 0. 48218377208 0. 49289819223 0. 50353838372 0. 51410274419 0. 52458968268 0. 53499761989 0. 54532498842 0. 55557023302 0. 56573181078 0. 57580819142 0. 58579785746 0. 59569930449 0. 60551104140 0. 61523159058 0. 62485948814 0. 63439328416 0. 64383154289 0. 65317284295 0. 66241577759 0. 67155895485 0. 68060099779 0. 68954054474 0. 69837624941 0. 70710678119 0. 71573082528 0. 72424708295 0. 73265427167 0. 74095112535 0. 74913639452 0. 75720884651 0. 76516726562 0. 77301045336 0. 78073722857 0. 78834642763 0. 79583690461 0. 80320753148 0. 81045719825 0. 81758481315 0. 82458930279 0. 83146961230 0. 83822470555 0. 84485356525 0. 85135519310 0. 85772861000 0. 86397285612 0. 87008699111 0. 87607009419 0. 88192126435 0. 88763962040 0. 89322430120 0. 89867446569 0. 90398929312 0. 90916798309 0. 91420975570 0. 91911385169 0. 92387953251 0. 92850608047  float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float  0. 93299279884 0. 93733901191 0. 94154406518 0. 94560732538 0. 94952818059 0. 95330604035 0. 95694033573 0. 96043051942 0. 96377606579 0. 96697647104 0. 97003125319 0. 97293995221 0. 97570213004 0. 97831737072 0. 98078528040 0. 98310548743 0. 98527764239 0. 98730141816 0. 98917650996 0. 99090263543 0. 99247953460 0. 99390697000 0. 99518472667 0. 99631261218 0. 99729045668 0. 99811811290 0. 99879545620 0. 99932238459 0. 99969881869 0. 99992470183 0. 99999999999 0. 99992470183 0. 99969881869 0. 99932238459 0. 99879545620 0. 99811811290 0. 99729045668 0. 99631261218 0. 99518472667 0. 99390697000 0. 99247953460 0. 99090263543 0. 98917650996 0. 98730141816 0. 98527764239 0. 98310548743 0. 98078528040 0. 97831737072 0. 97570213004 0. 97293995221 0. 97003125319 0. 96697647104 0. 96377606579 0. 96043051942 0. 95694033573 0. 95330604035 0. 94952818059 0. 94560732538  float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float  0. 94154406518 0. 93733901191 0. 93299279884 0. 92850608047 0. 92387953251 0. 91911385169 0. 91420975570 0. 90916798309 0. 90398929312 0. 89867446569 0. 89322430120 0. 88763962040 0. 88192126435 0. 87607009419 0. 87008699111 0. 86397285612 0. 85772861000 0. 85135519311 0. 84485356525 0. 83822470555 0. 83146961230 0. 82458930278 0. 81758481315 0. 81045719825 0. 80320753148 0. 79583690461 0. 78834642763 0. 78073722857 0. 77301045336 0. 76516726562 0. 75720884651 0. 74913639452 0. 74095112536 0. 73265427167 0. 72424708295 0. 71573082528 0. 70710678119 0. 69837624941 0. 68954054474 0. 68060099780 0. 67155895485 0. 66241577759 0. 65317284295 0. 64383154289 0. 63439328416 0. 62485948814 0. 61523159058 0. 60551104140 0. 59569930449 0. 58579785746 0. 57580819142 0. 56573181078 0. 55557023302 0. 54532498842 0. 53499761989 0. 52458968268 0. 51410274419 0. 50353838373  float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float  0. 49289819223 0. 48218377208 0. 47139673683 0. 46053871096 0. 44961132965 0. 43861623854 0. 42755509343 0. 41642956010 0. 40524131400 0. 39399204006 0. 38268343236 0. 37131719395 0. 35989503654 0. 34841868025 0. 33688985339 0. 32531029216 0. 31368174040 0. 30200594932 0. 29028467725 0. 27851968939 0. 26671275748 0. 25486565961 0. 24298017990 0. 23105810828 0. 21910124016 0. 20711137619 0. 19509032202' 0. 18303988796 0. 17096188876 0. 15885814334 0. 14673047446 0. 13458070851 0. 12241067520 0. 11022220729 0. 09801714033 0. 08579731234 0. 07356456360 0. 06132073630 0. 04906767433 0. 03680722294 0. 02454122852 0. 01227153829  /***************************************** /*  File  : WARNSIS.CMD  */ /* • /* TMS320C30 EVALUATION MODULE REAL F F T /* PROGRAM LINK COMMAND F I L E /* /* K i m D o t t o J u n e 22 1994 /* /***************************************  */ */ */ */ */ */  warnsis.obj warnfft.obj warntwid.obj warnmath.obj -o w a r n s i s . o u t -m w a r n s i s . 1 s t - f 0x00000000  MEMORY {  VECS: SRAM: RAMO: RAMla: RAMlb:  org org org org org  = = = = =  0 0x40 0x809800 0x809C00 0x809E00  len = len = len = len len =  0x40 0x3FC0 0x400 0x200 0x200  /* /* /* /* /*  RESERVED VECTOR LOCATIONS PRIMARY BUS SRAM (16K) INTERNAL RAMO(IK) INTERNAL RAMI(IK) INTERNAL RAMI(IK)  */ */ */ */ */  } SECTIONS {  .vecs: .text: .tmpdata: .fft_3sg: .fftsrcO: .fftsrcl: .ffttext: .fftdata: .mtext: .mdata: . bss: .data: .stack: .fft_voc: .aicdata:  { { { { { { { { { { { {  { ) > VECS U > SRAM {} > SRAM } > RAMla ) > RAMla } > RAMlb } > RAMO } > RAMO } > RAMO } > RAMO } > RAMO 1 > RAMO } > SRAM } > SRAM } > SRAM  /* RESET/INTERRUPT VECTORS / * CODE /* t e m p o r a r y c a l c u l a t i o n t a b l e /* 2000 Hz t e s t d a t a /* 1 s t 512 w o r d s o f F F T SOURCE /* 2nd 512 w o r d s o f F F T SOURCE /* FFT SUBROUTINE /* FFT SUBROUTINE DATA /* MATH SUBROUTINE /* MATH SUBROUTINE DATA /* VARIABLES /* ASSEMBLY CODE CONSTANTS  /* T e m p o r a r y v o c f i l e /* A I C I n f o  storage  */ */ */ */ */ */ */ */ */ */ */ */ */  155  

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0064798/manifest

Comment

Related Items