Logo

void sapi_lipsync::finalize_phoneme_alignment  )  [virtual]
 

pretties up the phoneme alignment

This method tweeks the phoneme alignment. It first adds 'x' to areas not covered by the existing m_results. At the same time, it maps the phonemes and estimates timings for them in the words.

SAPI 5.1 does not produce phoneme timing, we use some heuristics to guess at the appropriate timings for the phoneme.

This should be called before print_results.

assign the new "finalized" results;

Definition at line 297 of file sapi_lipsync.cpp.

00298 {
00299     std::vector<alignment_result>::iterator p, pEnd;
00300     std::vector<alignment_result> result;
00301     result.reserve(m_results.size() * 3 + 2);
00302     p = m_results.begin();
00303     pEnd = m_results.end();
00304     long lastEndTime = 0;
00305     while (p != pEnd)
00306     {
00307         if (p->m_msStart > lastEndTime)
00308         {
00309             alignment_result r;
00310             r.m_msEnd = p->m_msStart;
00311             r.m_msStart = lastEndTime;
00312             r.m_phonemes.push_back(std::wstring(L"x"));
00313             r.m_phonemeEndTimes.push_back(p->m_msStart);            
00314             lastEndTime = p->m_msStart;
00315             result.push_back(r);
00316         }
00317         if (m_pPhnEstimator)
00318             m_pPhnEstimator->EstimatePhonemeAlignment(*p);
00319         else
00320             phoneme_estimator::TrivialPhonemeAlignment(*p);
00321         result.push_back(*p);
00322         lastEndTime = p->m_msEnd;
00323         p++;
00324     }
00326     this->m_results = result;
00327 }


Copyright (C) 2002-2005 Annosoft LLC. All Rights Reserved.
Visit us at www.annosoft.com