question: private void predictAndSetF0 ( List < Element > applyToElements , HTSUttModel um ) throws MaryConfigurationException { HTSModel m ; try { String f0AttributeName = "f0" ; HTSParameterGeneration pdf2par = new HTSParameterGeneration ( ) ; boolean debug = false ; pdf2par . htsMaximumLikelihoodParameterGeneration ( um , htsData ) ; boolean voiced [ ] = pdf2par . getVoicedArray ( ) ; int numVoiced = 0 ; assert applyToElements . size ( ) == um . getNumModel ( ) ; float f0 ; String formattedTargetValue ; int t = 0 ; for ( int i = 0 ; i < applyToElements . size ( ) ; i ++ ) { m = um . getUttModel ( i ) ; int k = 1 ; int numVoicedInModel = m . getNumVoiced ( ) ; formattedTargetValue = "" ; for ( int mstate = 0 ; mstate < cart . getNumStates ( ) ; mstate ++ ) { for ( int frame = 0 ; frame < m . getDur ( mstate ) ; frame ++ ) { if ( voiced [ t ++ ] ) { f0 = ( float ) Math . exp ( pdf2par . getlf0Pst ( ) . getPar ( numVoiced ++ , 0 ) ) ; formattedTargetValue += "(" + Integer . toString ( ( int ) ( ( k * 100.0 ) / numVoicedInModel ) ) + "," + Integer . toString ( ( int ) f0 ) + ")" ; k ++ ; } } } Element element = applyToElements . get ( i ) ; if ( f0AttributeName . startsWith ( "@" ) ) { f0AttributeName = f0AttributeName . replaceFirst ( "@" , "" ) ; } if ( formattedTargetValue . length ( ) > 0 ) element . setAttribute ( f0AttributeName , formattedTargetValue ) ; } } catch ( Exception e ) { throw new MaryConfigurationException ( "Error generating F0 out of HMMs trees and pdfs. " , e ) ; } }
target:  Predict F0 from the utterance model and apply to elements