简体   繁体   English

有没有一种方法可以以更快的速度在Android中播放.ogg文件?

[英]Is there a way to play an .ogg file in Android at an increased speed?

I have sound files that I want to play at 1x speed, 2x speed and 3x speed. 我有要以1倍速,2倍速和3倍速播放的声音文件。 It should be pitch corrected. 应该对其进行音高校正。 There are many solutions for changing the file offline and simple having three files. 有许多解决方案可以离线更改文件,并且简单地拥有三个文件。 However that means that my app takes more disc space. 但是,这意味着我的应用占用更多的磁盘空间。

Is there a straightforward way for online speed increase, so that I only have to include one version of the file in my App? 有没有一种直接的在线速度提高方法,因此我只需要在我的App中包括该文件的一个版本?

My App is closed source, so I can't use a GLP library. 我的应用程序是封闭源,因此我不能使用GLP库。

The feature you are probably looking for is Audio Time Stretching. 您可能正在寻找的功能是音频时间拉伸。 Simply changing the sample rate is not an option as it will induce pitch variation (similar to the effect produced by analogue records or cassettes) 不能简单地更改采样率,因为它会引起音高变化(类似于模拟记录或录音带产生的效果)

If you want true time stretching, try using a real-time Digital Signal Processing Library. 如果要进行实时拉伸,请尝试使用实时数字信号处理库。 If you're willing to add an additional library to your project, TarsosDSP is a native Java framework works on Android on default. 如果您愿意在项目中添加其他库,则TarsosDSP是默认情况下可在Android上运行的本机Java框架。

https://github.com/JorenSix/TarsosDSP https://github.com/JorenSix/TarsosDSP

There is even Audio Time Stretching example code included in their repository which even comes with a swing interface. 他们的存储库中甚至还包含Audio Time Stretching示例代码,该代码甚至带有一个swing接口。

EDIT: TarsosDSP is GPL'd. 编辑:TarsosDSP是GPL。 Audio timestretching is a big deal in the audio industry so many of the algorithms used are either proprietary or GPL'd. 音频timestretching是在音响行业这么多的使用的算法或者是专有或GPL的一个问题。

If you are willing to learn some DSP, I would recommend checking out https://github.com/philburk/jsyn It is under the Apache license and supports Android. 如果您愿意学习一些DSP,我建议您查看https://github.com/philburk/jsyn,它已获得Apache许可,并且支持Android。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM