简体   繁体   English

即使使用AVAudioTimePitchAlgorithmSpectral,使用AVPlayer缓慢播放的音质也不够好

[英]The sound quality of slow playback using AVPlayer is not good enough even when using AVAudioTimePitchAlgorithmSpectral

In iOS, playback rate can be changed by setting AVPlayer.rate . 在iOS中,可以通过设置AVPlayer.rate来更改播放速率。 When AVPlayback rate is set to 0.5, the playback becomes slow. 当AVPlayback rate设置为0.5时,播放变慢。

By default, the sound quality of the playback at 0.5 playback rate is terrible. 默认情况下,以0.5播放速率播放的音质非常糟糕。 To increase the quality, you need to set AVPlayerItem.audioTimePitchAlgorithm . 要提高质量,需要设置AVPlayerItem.audioTimePitchAlgorithm

According to the API documentation, setting AVPlayerItem.audioTimePitchAlgorithm to AVAudioTimePitchAlgorithmSpectral makes the quality the highest. 根据API文档,将AVPlayerItem.audioTimePitchAlgorithm设置为AVAudioTimePitchAlgorithmSpectral可使质量最高。

The swift code is: 快速代码是:

AVPlayerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.spectral // AVAudioTimePitchAlgorithmSpectral

AVAudioTimePitchAlgorithmSpectral increases the quality more than default quality. AVAudioTimePitchAlgorithmSpectral提高质量而不是默认质量。 But the sound quality of AVAudioTimePitchAlgorithmSpectral is not good enough. AVAudioTimePitchAlgorithmSpectral还不够好。 The sound still echoed and it is stressful to listen to it. 声音仍然响起,听起来很紧张。

In Podcast App of Apple, when I set playback speed to 1/2, the playback becomes slow and the sound quality is very high, no echo at all. 在Apple的Podcast App中,当我将播放速度设置为1/2时,播放速度变慢,音质非常高,完全没有回声。

I want my app to provide the same quality as the Podcast App of Apple. 我希望我的应用程序提供与Apple的Podcast App相同的质量。

Are there iOS APIs to increase sound quality much higher than AVAudioTimePitchAlgorithmSpectral ? 是否有iOS API来提高声音质量远高于AVAudioTimePitchAlgorithmSpectral

If not, why Apple doesn't provide it, even though they use it in their own Podcast App? 如果没有,为什么Apple不提供它,即使他们在自己的播客应用程序中使用它?

Or should I use third party library? 或者我应该使用第三方库? Are there good libraries which is free or low price and which many people use to change playback speed? 是否有免费或低价的好图书馆,许多人用它来改变播放速度?

I've encountered the same issues with increasing/decreasing speed while maintaining some level of quality. 我在增加/降低速度的同时遇到了同样的问题,同时保持了一定的质量水平。 I couldn't get it to work well using Apples API's. 我使用Apples API无法正常工作。 In the end I found that it's worth taking a look at this excellent 3rd party framework: 最后我发现值得一看这个优秀的第三方框架:

https://github.com/AudioKit/AudioKit https://github.com/AudioKit/AudioKit

which allows you to do that and much more, in a straightforward manner. 这使您能够以直截了当的方式完成更多工作。 Hope this helps 希望这可以帮助

I've been searching and trying to learn AudioKit and Audio Unit or even considering purchasing a third party time-stretch audio processing library to fix the quality issue of slow playback for the last 3 weeks. 我一直在寻找并尝试学习AudioKit和音频单元,甚至考虑购买第三方时间延长音频处理库来解决过去3周内慢速播放的质量问题。

Now finally I found a super easy solution. 现在终于找到了一个超级简单的解决方案

AVPlayer can slow down audio with very good quality by setting AVPlayerItem.audioTimePitchAlgorithm to AVAudioTimePitchAlgorithm.timeDomain instead of AVAudioTimePitchAlgorithm.spectral . 通过将AVPlayerItem.audioTimePitchAlgorithm设置为AVAudioTimePitchAlgorithm.timeDomain而不是AVAudioTimePitchAlgorithm.spectral AVPlayer可以以非常好的质量降低音频速度。

The documentation says: 文件说:

timeDomain is a modest quality pitch algorithm that is less computationally intensive. timeDomain是一种适度的质量音调算法,计算密集度较低。 Suitable for voice . 适合声音

This means spectral is suitable for music . 这意味着spectral适合音乐 timeDomain is suitable for voice . timeDomain适合语音

That's why the voice files which my app uses was echoed. 这就是为什么我的应用程序使用的语音文件得到了回应。

And that's why Apple's Podcasts App's slowed down audio quality is very high. 这就是为什么Apple的Podcasts App降低音频质量的原因非常高。 It must also uses this time domain algorithm. 它还必须使用此时域算法。

And that's why AudioKit, which seems to be developed for music use, plays voice audio with bad quality. 这就是为什么AudioKit,它似乎是为音乐使用而开发的,它播放质量差的语音音频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 AVPlayer 时保持良好的滚动性能 - Maintaining good scroll performance when using AVPlayer AVPlayer断断续续的播放,仅当使用AVMutableComposition时网络行为不良 - AVPlayer choppy playback, bad networking behavior only when using AVMutableComposition 使用 AVPlayer 进行流式传输很慢 - Using AVPlayer for streaming is slow 在AVPlayer上使用periodicObserver跟踪播放进度 - Using periodicObserver on AVPlayer to track playback progress 如何使用AVPlayer更改Video PlayBack质量? - How to change Video PlayBack Quality with AVPlayer? 使用 HLS 视频时,仅在带有 AVPlayerViewController 和 AVPlayer 的 iOS 13 上出现视频播放问题 - Video playback issues only on iOS 13 with AVPlayerViewController and AVPlayer when using HLS video AVPlayer / AVPlayerItem返回播放错误太慢 - AVPlayer / AVPlayerItem returns playback error too slow 使用 AVPlayer 在 iOS 中音频流期间的播放速度 - Playback speed during Audio Streaming in iOS using AVPlayer (编辑:iOS Simulator 5.x错误)使用AudioQueue在iOS中播放声音时EXC_BAD_ACCESS - (Edit: iOS Simulator 5.x bug) EXC_BAD_ACCESS when using AudioQueue for sound playback in iOS 在Swift中使用AVPlayer。 没有错误,但在iPhone上没有声音播放 - Using AVPlayer in Swift. No error but no sound playing on iPhone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM