GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - derlio/audio-waveform: Show audio file's waveform, not spectrum

BranchesTags
Open more actions menu

Latest commit

 

History

28 Commits
28 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
library
library
 
 
.gitignore
.gitignore
 
 
AudioWaveform.iml
AudioWaveform.iml
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

audio-waveform (for Android)[No longer Support]


##What #####Show audio file's waveform, not spectrum. #####This lib based on ringdroid, but only contains WaveformView and related classes.
##How

  • Add this to your build.gradle
    compile 'com.github.derlio.waveform:library:1.0.3@aar'
  • Use SimpleWaveformView in your layout
        <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"
        />

app:waveformColor is the waveform line's color, app:indicatorColor 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);

This library is just satisfied my current situation. It has much more works to do. Hope you can help me~

About

Show audio file's waveform, not spectrum

Resources

Readme
Activity

Stars

41 stars

Watchers

2 watching

Forks

11 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.