# audio-waveform (for Android)
--------------------------
##What
#####Show audio file's <strong>waveform</strong>, not spectrum.
#####This lib based on ringdroid, but only contains WaveformView and related classes.
<br/>
##How
* Add this to your build.gradle</br>
`compile 'com.github.derlio.waveform:library:1.0.3@aar'`
* Use **SimpleWaveformView** in your layout<br/>
```
<com.github.derlio.waveform.SimpleWaveformView
android:id="@+id/waveform"
android:layout_width="match_parent"
android:layout_height="144dp"
app:waveformColor="#fb6155"
app:indicatorColor="@android:color/holo_green_dark"
/>
```
<strong>*app:waveformColor*</strong> is the waveform line's color, <strong>*app:indicatorColor*</strong> is the current playing indicator's color.
* Then get it from Activity, and prepare your audio file
```
final File file = new File(dir, "qudali.mp3");
final SoundFile soundFile = SoundFile.create(file.getPath(), new SoundFile.ProgressListener() {
int lastProgress = 0;
@Override
public boolean reportProgress(double fractionComplete) {
final int progress = (int) (fractionComplete * 100);
if (lastProgress == progress) {
return true;
}
lastProgress = progress;
Log.i(TAG, "LOAD FILE PROGRESS:" + progress);
return true;
}
});
```
***Make sure below codes should not be in the Main Thread.***
User **SoundFile.ProgressListener** to get file load progress, param **fractionComplete** is from 0.0 to 1.0, and return *true* means to continue decode, return *false* will abort the decode.
* Then use
```
mWaveformView.setAudioFile(soundFile);
mWaveformView.invalidate();
```
to set the audio file to WaveformView. It does work.
* If you want to show current playing indicator, just implements **SimpleWaveformView.WaveformListener**, use below codes in **onWaveformDraw**.
```
int now = mPlayer.getCurrentPosition();
mWaveformView.setPlaybackPosition(now);
```
<br/>
This library is just satisfied my current situation. It has much more works to do. Hope you can help me~
没有合适的资源?快使用搜索试试~ 我知道了~
使用JavaFX编写的API,从任何音频文件创建波谱
共47个文件
xml:17个
java:8个
png:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 158 浏览量
2022-04-29
16:09:08
上传
评论
收藏 103KB RAR 举报
温馨提示
音频波形 ##显示音频文件的波形,而不是频谱##### 库基于ringdroid,包含WaveformView和相关类。 将此添加到构建中. compile
资源推荐
资源详情
资源评论
收起资源包目录
audio-waveform-develop.rar (47个子文件)
gradlew.bat 2KB
gradlew 5KB
gradle.properties 855B
library
proguard-rules.pro 666B
src
androidTest
java
fm
jiecao
audio
waveform
library
ApplicationTest.java 363B
main
res
values
colors.xml 1KB
strings.xml 70B
styles.xml 303B
java
com
github
derlio
waveform
SamplePlayer.java 6KB
soundfile
MP4Header.java 24KB
SoundFile.java 25KB
SimpleWaveformView.java 8KB
WaveformView.java 20KB
AndroidManifest.xml 223B
.gitignore 7B
build.gradle 3KB
library.iml 7KB
app
proguard-rules.pro 666B
src
androidTest
java
fm
jiecao
audio
waveform
ApplicationTest.java 355B
main
res
menu
menu_main.xml 361B
mipmap-hdpi
ic_launcher.png 3KB
values
strings.xml 183B
styles.xml 194B
dimens.xml 211B
mipmap-xxhdpi
ic_launcher.png 8KB
mipmap-mdpi
ic_launcher.png 2KB
mipmap-xhdpi
ic_launcher.png 5KB
layout
activity_main.xml 1KB
values-w820dp
dimens.xml 358B
java
fm
jiecao
audio
waveform
MainActivity.java 5KB
AndroidManifest.xml 1KB
app.iml 8KB
.gitignore 7B
build.gradle 742B
gradle
wrapper
gradle-wrapper.jar 49KB
gradle-wrapper.properties 232B
.idea
gradle.xml 661B
misc.xml 1KB
vcs.xml 180B
.name 13B
copyright
profiles_settings.xml 74B
modules.xml 476B
compiler.xml 686B
AudioWaveform.iml 919B
README.md 2KB
settings.gradle 27B
build.gradle 629B
共 47 条
- 1
资源评论
- Qichue2022-07-09资源很受用,资源主总结的很全面,内容与描述一致,解决了我当下的问题。
自不量力的A同学
- 粉丝: 46
- 资源: 2711
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功