AVSpeechUtterance最大音量真的很安静,速度真快 [英] AVSpeechUtterance maximum volume really quiet and rate really fast

查看:1583
本文介绍了AVSpeechUtterance最大音量真的很安静,速度真快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为我的应用程序添加语音提示并且正在测试iOS 7中的AVSpeechUtterance,但默认语音速率非常快。最低语速更容易理解。但是最大音量值1太安静了!我在iPhone 4上测试了它,音量一直在变高。有些东西一定是错的,否则怎么可以用呢。

I was toying with adding speech cues to my app and was testing out AVSpeechUtterance in iOS 7, but the default speech rate is REALLY fast. The minimum speech rate is much more understandable. But the maximum volume value of 1 is soooo quiet! I tested it on my iPhone 4 with the volume turned all the way up. Something must be wrong or else how would this be usuable at all.

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
            NSString *mystring = [NSString stringWithFormat:@"Talk String Here %@",myObject.name];
            AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:mystring];
            [utterance setRate:AVSpeechUtteranceMinimumSpeechRate];
            [utterance setVolume:1];
            [synthesizer speakUtterance:utterance];


推荐答案

这对我有用(Swift 3.0)

This worked for me ( Swift 3.0 )

let audioSession = AVAudioSession.sharedInstance()  
do {
  try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.defaultToSpeaker)  
} catch {   
  print("audioSession properties weren't set because of an error.")   
}

这篇关于AVSpeechUtterance最大音量真的很安静,速度真快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆