Android 手机上音效的适当音频格式(关于效率)

发布于 2024-10-24 11:56:19 字数 253 浏览 2 评论 0原文

我分析了我的程序,结果发现很大一部分 CPU 都花在了 SoundPool.play() 上。

游戏有大约 10 个声音文件,每个声音文件不到 1 秒。目前它们是 64kbs 可变 MP3。它们在开始时加载到 SoundPool 中,并在整个游戏中频繁播放。

我的问题:什么音频格式(例如mp3、ogg等)对移动设备上的CPU和电池消耗最友好?我仅将它们用于音效,不需要同时播放。

非常感谢。

I profiled my programs, and it turned out a large portion of CPU was spent on SoundPool.play().

The game has ~10 sound files, each under 1 second. Currently they are 64kbs variable MP3s. They are loaded to a SoundPool at the beginning and played frequently throughout the game.

My question: What audio format (e.g. mp3, ogg, etc.) is most friendly to cpu and battery consumption on mobile devices? I use them only for sound effects, and there's no need for simultaneous playbacks.

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

几度春秋 2024-10-31 11:56:19

据我所知,不会有太大区别,因为Android会在将音频文件放入SoundPool之前对其进行解压缩,以便之后能够快速播放它们。
这也是您无法在不耗尽内存的情况下将大量(或大量)声音放入声音池的原因。

As far as I know, there will be not much difference, as Android uncompresses the audio files before putting them into the SoundPool, in order to be able to quickly play them afterwards.
That's also the reason that you cannot put very many (or large) sounds into a sound pool without running out of memory.

浅暮の光 2024-10-31 11:56:19

我预计 WAV 和 MIDI 等压缩程度较低的音频格式会比 MP3 或 Ogg 消耗更少的 CPU 周期,但代价是 RAM 使用量更高。

I'd expect audio formats with little compression like WAV and MIDI to consume fewer CPU cycles than MP3 or Ogg at the cost of higher RAM usage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文