the use of sound information is a growing area of application of signal processing techniques in healthcare and biomedicine .
in particular , multiple groups have reported on the development of systems that analyze audio recordings of patients and identify bouts of coughing [ 15 ] or other sounds indicative of health concerns [ 69 ] .
in addition to their value as a monitoring or screening tool , the automated nature of these systems potentially enables new modes of disease management , especially in conjunction with advances in mobile technology .
moreover , the type of approach presented here may be especially suited to improving outcomes and addressing chronic disease in populations that have been previously underserved .
this paper studies cough as a symptom of asthma in adolescents . for a variety of reasons , including social and developmental pressures ,
adolescents with an asthma diagnosis typically have an inaccurate understanding of their disease condition primarily due to poor symptom perception or downplaying symptoms [ 11 , 12 ] .
these issues can undermine effective symptom monitoring and medication adherence which can ultimately lead to poor condition management and high healthcare utilization . to address this problem a device
is proposed that continuously monitors asthma symptoms , particularly coughing which is the most common symptom in pediatric asthma patients [ 13 , 14 ] .
the identified symptoms can be stored and later retrieved by a patient or healthcare provider as an objective reference indicating the levels of asthma control .
mobile technology has advanced sufficiently such that the hardware requirements of a personal asthma monitoring device are already met in existing consumer electronics platforms .
the problem may , therefore , be approached within the context of mobile application development .
owing to its broad install base and mature software development kit ( sdk ) apple 's ios devices were the target platform ( the 4 g ipod touch specifically ) .
like other audio systems for cough monitoring reported in the literature the present approach is based upon proven technology and methods in the fields of speech recognition , keyword and key audio effect detection [ 1517 ] , machine learning , and content - based audio analysis [ 1823 ] .
the symptom recognition algorithm consists of a frame - based feature extractor followed by temporal analysis with a hidden markov model ( hmm ) based viterbi decoder .
mel - frequency cepstral coefficients ( mfcc ) plus a log - energy measure were employed as the audio features while both left - to - right and ergodic / connected hmm topologies were investigated .
the mfcc / hmm recognition framework has also been reported for cough monitoring by , for example , matos et al . [ 3 , 25 ] .
use a similar method however ; in their case , they use an original variant of cepstral analysis dubbed energy cepstral coefficients ( ecc ) and have inserted an artificial neural network discriminator prior to the hmm decoder .
the cough detection algorithm presented here processed the audio data in two steps . in the initial preprocessing step
the incoming stream of digital audio samples was rearranged into fixed - length frames from which a set of audio features ( feature vector ) were computed .
the sequence of feature vectors was then passed to a hmm viterbi decoder ( using a token passing implementation as described in ) using hmms trained on the collected database of symptom and background sounds . as discussed in detail in the following sections the hmm was a composite consisting of separate models for coughing , background , and silence connected together with a simple parallel grammar .
prior to development of the automated device for asthma monitoring ( adam ) application , a large amount of audio data was collected in trial recordings intended to closely approximate the circumstances in which the device would be expected to function .
participants with asthma were 1317 years old , had active asthma symptoms within the previous 24 hours , and used english as a primary language .
those with other health conditions producing respiratory symptoms ( e.g. , cold , cardiac disease , or cystic fibrosis ) were excluded .
twenty - nine adolescents participated in the audio data collection trials ; details of the sample characteristics are provided elsewhere .
participants with asthma were 1317 years old , had active asthma symptoms within the previous 24 hours , and used english as a primary language .
those with other health conditions producing respiratory symptoms ( e.g. , cold , cardiac disease , or cystic fibrosis ) were excluded .
the participants were instructed to continuously record the sounds of their respiration for 24 hours in vivo wearing a personal digital recorder ( olympus ws-331  m ) and lapel microphone while they went about their daily routines .
the external microphone was attached to the shirt collar to optimally capture the respiratory sounds of the subject .
the recorder was carried in a pocket or in a carrying case provided by the study .
were instructed to place the recorder and microphone near the head of the bed to capture any symptoms that occurred during the night .
for the purposes of developing the signal processing component of the adam device the large dataset was split into a series of files of more manageable size .
representative selections of the audio containing cough sounds , silence , and background noise across all of the participants were aggregated into individual files .
the classification and validation of symptomatic sounds were carried out by the principal investigator and three other clinicians trained in pediatric medicine and pulmonology .
coughing sounds that were used to train the recognition algorithm were cropped to only include the sound itself . as a consequence
the corresponding audio files had variable length ( i.e. , the duration of the cough ) .
all other audio files ( including the training data for the silence and background hmms ) had a fixed duration of 6 seconds .
the files were standard mono 16-bit pulse code modulation ( pcm ) audio format with a sample rate of 11025  hz . to keep training times manageable ( especially for the hmms with a large number of mixture components and states )
representative portions were selected from the audio database totaling approximately 2 hours for the training of background and silence hmms .
the performance metrics that were of most practical interest , given the task , were the false positive rates rfp and true positive rates rtp ( sensitivity ) .
to estimate rfp , approximately 6 hours of representative , cough - free , background noise was compiled .
to estimate rtp the recognition algorithm was tested on 30 examples of cough that were withheld during training .
the preprocessing step consisted of dividing the time - domain digital audio data into frames and then computing a sequence of per - frame descriptive feature vectors .
these are implemented natively by the open source hidden markov toolkit ( htk ) which was used to train the symptom recognition algorithm .
frame size was chosen to be 256 samples overlapping by one - half of a frame .
the overall frame rate was thus 0.0116 seconds . to compute the mfccs features a 256-point hanning window multiplied the given frame of audio samples and
the results were stored in an array a[k ] . a 32-point mel - filterbank ( figure 2 )
, setting array sizes to an appropriate power of 2 greatly simplifies programming when discrete fourier transforms are needed .
importantly , the indices of a[k ] were reordered to introduce the symmetries needed to compute a discrete cosine transform ( dct ) with a dft .
the result of the second dft was stored in an array c[k ] and the dct coefficients were found via the following formula : 
 ( 1)mfcc[k]=r{q[k]}r{c[k]}i{q[k]}i{c[k]}2 . 
 here , q[k ] is a fixed array arising from the definition of the discrete cosine transform .
for k  ( 1,31 )  q[k ] is equal to a complex exponential with an additional factor of 1/2 when k = 0 : 
 ( 2)q[k]={22neik/(2n),k(1,31),22neik/(2n),k=0 .
this value was not retained because a different log - energy measure was used instead to track sound intensity .
the base of the logarithm is e , n is the frame size equal to 256 , and x[n ] are the values of the time - domain audio samples .
although the computation of the mel - cepstrum is not an invertible operation it is reasonable to assume , based upon the performance of the classifier , that these mfccs contained enough discriminative acoustic information for the task .
as stated above , the zeroth mfcc is an energy measure . in speech recognition ,
the higher mfccs , however , are not known to admit any simple perceptual interpretations [ 27 , 28 ] . the first twelve mfccs and the log - energy defined one - half of the feature vector for each frame .
an example of these features for a given frame is shown ( figure 3 ) .
the other half of the feature vector was defined to be the first differences of the mfccs and log - energy .
if i is the index of the frames in time then the first difference of any quantity f at time i is defined as ( fi+1  fi1)/2 . at frame boundaries
for simplicity in eventually transferring the recognition algorithm to a mobile application a preemphasis filter was not applied .
hidden markov models   are often used to describe a sequence of observations as the probabilistic evolution of a finite state machine .
associated with each state is a probability distribution that describes the elements of the observation vector .
the sequential nature of the relevant data or process is captured in the state - to - state transition probabilities .
hmms are partially specified as directed graphs and two example topologies are shown ( figure 5 ) .
the nodes in the graph represent states and the arrows represent allowed transitions between states .
two topologies were examined : an ergodic or connected topology and a left - to - right topology ( 5 ) .
following , connected models were used for background and silence hmms while both the connected and left - to - right topologies were tested for identifying coughs ( the key effect ) .
clearly , for a fixed number of states , left - to - right models are much more constrained than connected models as quantified by the total number of possible paths through the model . comparing the two ,
the role of context partially determines the grammar for the recognition task ( equivalently , context determines how the background , silence , and cough models should fit together in a composite hmm ) .
generally , for coarse segmentation of the audio stream , contextual information was not expected to greatly improve the performance of the classifier .
this contrasts with speech where context can provide a significant assistance for recognition and even help to overcome poor phoneme level transcription ( i.e. , possible sequences of phonemes are constrained by the vocabulary of the language and , moreover , the sequence of words is constrained by grammatical rules ) .
the gray boxes at the left and right indicate dummy states that route all of the output states to all of the input states so that the system can be run in a continuous fashion .
ultimately , the structure of the composite hmm reflects in the transition matrix pij of the model .
in addition to the topology , an hmm is also specified by an output probability distribution in the feature space for each state of the model .
usually , for a given hmm , these probability distributions all have the same functional form . for the recognizer ,
the feature vector is denoted by f = [ f1 ,  , fm ] .
the mixture model is a weighted sum of such terms : 
 ( 5)bf(f)=i=1jibf,i,i . 
 the total number of mixture components is denoted by l in this case .
the silence model used in this paper was a 3-state connected model with 3 mixtures per state . for background
, a variety of connected hmms were tested with the number of states ranging over the values ( 3,6 ) and the number of mixture components per state ranging over the values ( 10,30,60 ) .
likewise , for cough , connected and left - to - right topologies were tested with 5 states and the number of mixtures ranging over the values ( 10,60 ) . after selecting the orders of the hmms the models were trained .
as stated above , the hmms reported on in this paper were trained with tools provided in the hidden markov toolkit ( htk ) .
specifically , each hmm was initialized using a single pass of viterbi training until convergence followed by a single pass of baum - welch training until convergence . in the nomenclature of htk
this is accomplished with the command line programs hinit and hrest , respectively ( using the  whole - word  strategy ) . to recognize a new audio stream viterbi decoding
the viterbi decoding is implemented with token passing [ 24 , 29 ] . in the recognition context
the behavior of hidden markov models is best understood using a lattice where the horizontal axis is the discrete time index and the vertical axis an index of the states .
a token can be visualized as an entity which moves through the state lattice and keeps a record of the path and the likelihood of the path it has taken .
the likelihood is simply the sum of the appropriate values of the emission probabilities b(fn ) ( where n is a timing variable at the frame rate ) and the state - to - state transition probabilities pij .
viterbi decoding finds the most likely path through the lattice given the data . using the token idea the decoding algorithm
( rule1 ) to update a new frame of data , or equivalently to move to the next time step in the lattice , compute all possible transitions for the current set of tokens ; ( rule2 ) for each state keep the incoming token that has the highest likelihood . in general ,
if there are n frames of data and l states then arrays of size n  l must be kept in memory .
in particular , the likelihoods and the states where the tokens originated are retained in memory . to recover the actual state alignment
the algorithm begins at the end of these arrays and works backwards , following the path of the most likely token .
the update rule can also be stated mathematically as a recursion : 
 ( 6)sj[n]=maxi(si[n1]+logpij)+logbj(fn ) .
an example of a decoding pass for some audio data containing coughs is presented ( figure 7 ) ( note that for continuity this is the same audio data shown above ( figure 3 ) ) .
a time - domain waveform of the audio being decoded and the resultant state sequence are shown ( figure 7 ) .
the horizontal axis represents time ( at the frame rate ) while the vertical axis is an integer of the state index .
the black marks indicate states associated with the cough model ( in this case , a left - to - right topology ) . after the viterbi decoder ,
the rule for deciding whether a frame of audio data contains coughing is simply whether the state sequence ever passed through the cough model .
this is equivalent to observing when the maximum likelihood path passed through the middle branch of the composite hmm ( figure 6 ) .
note that when the cough model uses a left - to - right topology it forces any detected cough event to have visited each state of the cough hmm in a linear manner which is observed in the state sequence ( figure 7 ) .
as discussed briefly above , this constraint partially explains why the rates of false positive are generally better for the left - to - right versus connected cough models .
as stated in the introduction , the ultimate goal of this project was to create a symptom recognition application for asthmatics that could run , continuously , on a mobile device .
consequently , apple developer credentials were obtained and the recognition algorithm described above was implemented in the xcode software development environment and ios software development kit .
standard core audio apis were used for interfacing to the audio hardware of the mobile platform ( 4 g ipod touches ) .
all of the required signal processing was facilitated by the fast fourier transform routines provided in the accelerate framework .
moreover , custom cabling assemblies were constructed that allowed olympus me-15 tie - clip microphones to interface with the ipod .
numerical underflow ( or overflow ) is a potential pitfall of working with hmms and the viterbi algorithm .
equations ( 4 ) and ( 5 ) show that the probabilities involved can quickly accrue large exponents especially for a greater number of features and especially in conjunction with the viterbi algorithm .
therefore , computations are carried out , where possible , with log - likelihoods . by taking care of computing the probability for each mixture component it was found that 64-bit floating point arithmetic could be used without underflowing . the exact algorithm for this computation
again , the feature vector was 26-dimensional consisting of twelve mfccs , the log - energy measures , and the first differences of these quantities . here , f ,  , v , and  are , respectively , the feature vector , the mean vector for the given component , a vector of the values along the main diagonal of  , and the mixture weight .
the likelihood for the entire state is found by running algorithm 1 for each associated mixture component and then taking the natural log .
two example instances of the mobile adam application running in a demonstration mode that was used for debugging are shown ( figure 8) .
the data presented in the screenshots is similar to the viterbi decoding examples shown earlier ( figure 7 ) with the exception that the audio is being obtained and processed live on a mobile device .
the top trace is the time - domain audio waveform and the bottom trace is a consolidation of the corresponding maximum likelihood state sequence found by token passing .
let aseq[m ] for 0 < m < 514 be maximum likelihood state sequence ( for the chosen frame rate , 6 second blocks of audio result in 515 feature vectors ) . from aseq another sequence is created that is defined as 
 ( 7)acough[m]={1,aseq[m]coughstate,0,aseq[m]otherwise . 

thus acough[m ] indicates where coughs occur in the audio according to the recognition algorithm .
the left screenshot shows the application identifying a sequence of coughs from the database while the right screenshot shows the device discounting some nonsymptom speech ( figure 8) .
these tests were conducted in an anechoic environment with the test sounds played through high - quality active speakers .
this is not to claim that such tests recreate the conditions of a patient wearing the device in a nonlaboratory setting .
rather , the tests were meant to verify that the recognition framework and application could return positive results in circumstances where any concerns over the reproducibility of test signals were minimized .
it should be stated here that the performance measures given in the next section were determined by cross - validation trials with the test database .
the logical next step in evaluating the device is to trial it with a population of patients .
such a trial will not only measure the accuracy of the recognition algorithm but will also measure the scope of the test database ( i.e. , how well the algorithm generalizes ) .
the columns in table 1 are from left to right as follows : the number of states in the background model , the number of mixtures per state for the background model , the number of states in the cough model , the number of mixtures per state for the cough model , the topology of the cough model , the rate of false positive per 1 hour , and the sensitivity .
it is also noted that the number of states listed in table 1 follows an htk convention of including the dummy states .
therefore , the number of states that are actually active during decoding is the given number minus two .
firstly , 6 seconds of pcm audio was collected and split into frames with 256 points and half a frame overlap .
feature vectors for each frame were computed and the audio was segmented in time by a hidden markov model based viterbi decoder .
the entire 6 seconds of audio was classified as either containing a cough or not containing a cough based upon the criterion explained above ( figure 7 ) . in the classification task
the data is skewed since it was expected that cough would occur relatively infrequently when compared to the frequency of other background noises . here
, a pair of metrics was used : the rate of false positive ( or false alarms ) per 1 hour fp/1  h and sensitivity or true positive rate .
the rate of false positive is found by counting the number of false positives and dividing by the total length of time that was analyzed ( in units of hours ) . this can be estimated robustly
since it is not a particular challenge to collect large volumes of audio data that are free of coughs ( i.e. , any hit is guaranteed to be a false alarm , and these are easy to count ) .
let tp , tn , fp , and fn be , respectively , the total number of true positives , true negatives , false positives , and false negatives returned by a classifier . the sensitivity is defined as 
 ( 8)sensitivity = tptp+fn . sensitivity measures how often the classifier misses symptoms .
the composite hmm was tested with 30 examples of cough that were withheld during training .
the results presented in the previous section show that certain model topologies and complexities provide a reliable detection and segmentation of cough and background sounds . clearly , the prototype used for the cough hmm has a powerful effect upon both performance measures .
as expected , the connected cough models result in a higher false alarm rate ( keeping the other variables fixed ) .
also , it is noted that the cough model requires a larger number of mixture components per state to achieve a decent rate of false positive . in trying to select among these alternative algorithms
the goal is to provide data to the asthma patients that can give them a clearer picture of their disease state .
a significant rate of false alarm will negatively impact the user 's trust in the feedback provided by the device .
thus , aiming for low fp/1  h a large background hmm and a left - to - right cough hmm were used .
describe the leicester cough monitor ( lcm ) [ 3 , 25 ] . like the system presented here , the lcm uses a recognition system consisting of preprocessing to calculate the cepstral features followed by hmm analysis . a very high sensitivity ( 85.7% ) and
low false positive ( 0.8 per hour ) rate were achieved using this approach . however , in the lcm the audio analysis is performed offline and the ambulatory component of the study consisted strictly of an audio recorder .
this differs critically from the present study where all of the processing is performed on the mobile device and the results are provided as feedback in real time .
the inherent time and computational restrictions in the present study prevented the use of hmms of the same complexity ( in terms of the number of hidden states ) as the lcm . like adam and the lcm , shin et al .  
report on a cough detection system that uses hmm analysis of audio features . instead of using cepstral features directly shin et al .
processed cepstral features with an artificial neural network before passing them to the hmm viterbi decoder .
while their system successfully discriminated cough from environmental noise it was only validated using synthetic examples at most 10 minutes in length so it is not directly comparable to the in vivo situation that is of concern here . also , the present study is the first to examine the feasibility of ambulatory cough detection on a consumer mobile device in an adolescent asthma population .
effective asthma management relies upon the accurate monitoring of symptoms by patients . however , current monitoring techniques have had limited success with adolescent groups
. around their peers , adolescents with asthma may feel embarrassed about their condition and may also be reluctant to take medication when needed .
adam provides reliable and objective symptom monitoring throughout the day that can be accessed privately through an attractive mobile interface .
also , since adam is deployed on an already popular consumer platform , the device can be used inconspicuously and the self - management benefits it provides will not be hampered by social pressures .
overall , it is expected that adolescents who have access to a technology such as adam will demonstrate greater adherence to treatment regimens , better awareness of symptom severity and , in the long term , require fewer emergency room visits .
although cough is the most common symptom found in pediatric patients with uncontrolled asthma [ 13 , 14 ] there are other respiratory symptoms such as wheeze and the initial intention was to design a device to monitor both coughing and wheezing .
however , wheeze was encountered infrequently during the data collection phase and the examples of wheeze that were recorded showed significant audio variations between each other . this frustrated attempts to design a reliable algorithm for identifying wheeze and distinguishing it from background noise . in principal ,
the methods described that were used for detecting cough could be applied to wheeze but it would require a more representative audio database than was available in the present study .
firstly , because adam continuously records and processes sounds it is more resource intensive than typical current generation mobile applications .
this impacts battery life negatively and may interfere with other applications that may be running on the device concurrently .
future iterations of the application with better optimized code and power management will be needed to address these concerns .
although mobile technology is becoming increasingly ubiquitous adam is still not appropriate for all situations .
the device generally needs to be carried on the person and the lapel microphone must be positioned appropriately .
certain activities , such as sports , may require the patient to set the device aside or the patient may be dressed in a manner that makes the adam device awkward to carry ( i.e. , clothing without a convenient pocket ) .
moreover , in certain social settings , an adolescent may not want to be seen wearing a microphone .
these practical limitations are expected however ; as long as patients make reasonable effort to use adam whenever possible the device will provide benefit in terms of asthma self - management .
using a large audio database collected in a controlled study an algorithmic approach to the automated assessment of coughing in adolescent asthmatics was explored .
this work represents the technical development of a device ( adam ) capable of providing objective round - the - clock feedback to adolescents with an asthma diagnosis .
the eventual goal is to leverage the semantic information that can be gleaned from an audio stream to benefit the patient . in conjunction with the user interface capabilities and also
the ubiquity of modern mobile phones this work enables new standards in 24-hour asthma symptom monitoring .
 the development of an automated system for asthma monitoring ( adam ) is described . 
 this consists of a consumer electronics mobile platform running a custom application . 
 the application acquires an audio signal from an external user - worn microphone connected to the device analog - to - digital converter ( microphone input ) . 
 this signal is processed to determine the presence or absence of cough sounds . 
 symptom tallies and raw audio waveforms are recorded and made easily accessible for later review by a healthcare provider . 
 the symptom detection algorithm is based upon standard speech recognition and machine learning paradigms and consists of an audio feature extraction step followed by a hidden markov model based viterbi decoder that has been trained on a large database of audio examples from a variety of subjects . 
 multiple hidden markov model topologies and orders are studied . 
 performance of the recognizer is presented in terms of the sensitivity and the rate of false alarm as determined in a cross - validation test . 
1. Introduction
2. Methods
3. Results
4. Discussion
5. Conclusion