开发者

How to slow down voices using withVoice: argument in FliteController class?

开发者 https://www.devze.com 2023-03-10 17:19 出处:网络
I am using the OpenEars开发者_开发知识库 FliteController class to convert text to speech. I am using the method:

I am using the OpenEars开发者_开发知识库 FliteController class to convert text to speech.

I am using the method:

[self.fliteController say:@"A phrase I'd like my app to speak out loud." withVoice:@"cmu_us_awb8k"];

The options for arguments one can enter after withVoice: are as follows:

cmu_us_awb8k
cmu_us_rms8k
cmu_us_slt8k
cmu_time_awb
cmu_us_awb
cmu_us_kal
cmu_us_kal16
cmu_us_rms
cmu_us_slt

I tried all of these arguments with withVoice:

However, my client is not happy with the voices. He told me these all are fast. So, I need a way to slow down speech using the withVoice: argument. How can I do it? Are there any other speech voices available?


Speed/pitch/variance shift is now a feature of OpenEars as of version .911. You can use it as follows:

Change the speed, pitch and variability of a voice by using the following properties of FliteController:

duration_stretch // Duration of speech
target_mean // Average pitch of speech
target_stddev // Variance

For instance, right before sending this message:

[self.fliteController say:@"A phrase I'd like my app to speak out loud." withVoice:@"cmu_us_awb8k"];

You could make the following settings to self.fliteController:

self.fliteController.duration_stretch = 1.5; // Slow down the speed a bit
self.fliteController.target_mean = 1.2; // Raise the pitch
self.fliteController.target_stddev = 1.5; // Increase the variance

1.0 is the default, 0.0 is the minimum value and 2.0 is a likely maximum useful value (although you can go higher than 2.0, it probably isn't going to be a useful value).

A duration_stretch of .5 will be twice as fast as 1.0, a duration_stretch of 2.0 will be half the speed of 1.0. A target_mean or target_stddev of 2.0 will double the average pitch frequency or double the variance, while 0.5 will reduce them by half.

You do not have to set or override these settings — if you don’t use them, they will be set to the defaults for the voice. If you want to return them to the defaults after overriding them, simply set them all to 1.0:

self.fliteController.duration_stretch = 1.0; // Reset the speed
self.fliteController.target_mean = 1.0; // Reset the pitch
self.fliteController.target_stddev = 1.0; // Reset the variance


I believe this is with OpenEars. Don't know about configuring this in OpenEars. But you can have a look at this demo which can be customizable as per your requirement. Like you can set Pitch/Variance/Speed for the voices. Clone the repository from the link.

If you can migrate to this it would be your solution. If you have any doubt in this demo I can surely help as I prepared 1 demo with Play/Pause/Stop options for TextToSpeech.

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号