text to speech

Tts example on S60 3rd edition

[Update by Artem: This code example has been submitted by Michele. I included the code excerpt into the post. Artem]

The following example allows for using the text to speech in Nokia S60 3rd edition phones. See also the 2nd edition text to speech example

...
void CTtsPlayer::ConstructL()
{
iPlayer = CMdaAudioPlayerUtility::NewL( *this );
iWaiter = new (ELeave) CActiveSchedulerWait;
}

void CTtsPlayer::PlayTextL( TDesC& aText )
{
__ASSERT_ALWAYS( iPlaybackInProgress == EFalse,
User::Leave( KErrNotReady ) );
HBufC8* playableText = HBufC8::NewLC( aText.Length() +
KTtsPrefix().Length() );
playableText->Des().Append( KTtsPrefix );
playableText->Des().Append( aText );
iPlayer->OpenDesL( *playableText );
iPlaybackInProgress = ETrue;
iWaiter->Start();
// At this point playback is already completed or failed
User::LeaveIfError( iErr );
CleanupStack::PopAndDestroy( playableText );
}
...

Text to speech in Nokia/S60. All your voices are belong to us

Latest S60 devices from Nokia (starting from N70 and N90) include speaker independent name dialing (SIND) and enhanced voice commands. You don't have to train your phone voice dialing anymore. To make a call you simply need to push the voice key and say the name from the phonebook.

SIND feature is closed for third party developers. However, there is a shortcut for using the Text-to-Speech part of SIND. You can make your phone synthesize a piece of arbitrary text by passing a specially formed descriptor to the CMdaAudioPlayerUtility.


iPlayer->OpenDesL( _L8( "(tts)Say this" ) );

Experience your phone speaking. After XP2006

I am leaving for the XP2006 conference and won't be doing programming until the conference is completed next week.

The good news is that the Text-to-Speech example is almost completed. See it coming next weekend.

Feel free to post your own examples or blog posts meanwhile.

Syndicate content