【问题标题】:iOS: audio files used in app sound harsher than when played outside the appiOS:应用中使用的音频文件听起来比在应用外播放时更刺耳
【发布时间】:2017-11-15 21:17:43
【问题描述】:

我们的 iOS 应用程序的音频文件在通过应用程序播放时比在应用程序外播放时听起来更糟糕。声音似乎更刺耳,更“环保”。

这是我们播放音频的代码。我们是否以某种方式改变了音频的播放或自然声音?

我们使用的两个音频文件可以是found here

private func createAudioPlayer(filename: String) -> AVAudioPlayer  {
    // Define file URL
    let path = Bundle.main.path(forResource: filename, ofType: nil)
    let url = URL(fileURLWithPath: path!)

    // Create player
    let audioPlayer: AVAudioPlayer!
    do {
        audioPlayer = try AVAudioPlayer(contentsOf: url)
    } catch {
        audioPlayer = nil
        printError("Error creating audio player for \(url): \(error)")
        logEvent("Audio Error", userData: nil)
    }

    // Print status
    print("Created audio player for \(filename)")

    // Return player
    return audioPlayer
}


func play(file: AudioFileEnum) {
    if let player = audioPlayers[file] {
        if player.isPlaying {
            player.pause()
        }
        player.currentTime = 0
        player.play()
    } else {
        printError("Error finding audio player for \(file)")
    }
}

【问题讨论】:

  • 在应用程序之外如何以及在何处播放文件?
  • 例如,@hotpaw2 就像在桌面上一样。有什么建议吗?
  • 您的桌面系统使用的音量、DAC、放大器和扬声器可能与您的 iPhone 不同。
  • @hotpaw2 我们如何调整音频播放器以在移动设备上重现相同的声音?
  • 这听起来像是一个专业音响工程师的问题。它可能需要一些非常昂贵的音频设备。尝试在 sound.stackexchange.com 上询问

标签: ios swift audio core-audio


【解决方案1】:

您是否尝试过将 audioPlayer 对象的音量设置为较小的值,例如 0.05f,然后从那里进行调整?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-02
    • 1970-01-01
    • 2017-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-11
    相关资源
    最近更新 更多