Skip to content
/ WavePlayerView Public template

A Java library for analyzing sound directly by recording sound and plotting waves according to frequencies instantly. Do you think that's the only thing!? No, on the contrary, there is also a drawing of waves according to an audio file from a track or from a file within the application.

License

Notifications You must be signed in to change notification settings

alex11111115/WavePlayerView

Repository files navigation

StandWithPalestine

ReadMeSupportPalestine

WavePlayerView http://developer.android.com/index.html

WavePlayerView Logo

WavePlayerView is an advanced library for real-time sound analysis by recording sound and instantly plotting waves based on frequencies and visualizing waves from an audio file or a track within your application.

Features

  • Real-time Sound Analysis: Display sound waves in real-time while recording or playing an audio file.
  • Customizable Display: Easily adjust wave colors, stroke widths, and wave speed.
  • User-friendly: Simple and intuitive API for seamless integration.
  • Wide Compatibility: Supports Android API level 21 and above. API
  • Advanced Controls: Control playback speed, pause/resume functionality, and monitor audio progress.

Screenshot

Screenshot_٢٠٢٤٠٦٠٥-١٠٢٤٥٠_Sound Wave Visualization Screenshot_٢٠٢٤٠٦٠٥-١٠٢٤١٨_Sound Wave Visualization Screenshot_٢٠٢٤٠٦٠٥-١٤٥١٥٨_Wave Player Screenshot_٢٠٢٤٠٦٠٥-١٤٥٢٠٢_Wave Player Screenshot_٢٠٢٤٠٦٠٥-١٤٥٢٠٥_Wave Player

Screenshot_٢٠٢٤٠٦٠٧-٠٩٢٣٠٢_WavePlayerView

Why Use WavePlayerView? 68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3136353766333032633330663437393738653762383233643164323863363439

  • High Performance: Engineered for high efficiency with minimal impact on your application's performance.
  • Open Source: Full access to source code for customization and enhancement.
  • Community Support: Supported by a dedicated community, with opportunities for contributions and improvements.

How to Use the Library? GitHub top language

1. Add it in your root build.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
            //...
			maven { url 'https://jitpack.io' }
		}
	}

2. Add the Library to Your Project

Add the following to your project's build.gradle file:

dependencies {
    implementation 'com.github.alex11111115:WavePlayerView:1.10'
}

3. Use WavePlayerView in Your Layout

Add WavePlayerView to your activity layout file activity_main.xml:

<sound.wave.kilobyte.WavePlayerView
    android:id="@+id/waveView"
    android:layout_width="250dp"
    android:layout_height="75dp"
    android:padding="2dp"
    android:gravity="center"
    android:orientation="horizontal"
    android:layout_gravity="center"
    app:waveColor1="#FF8E8DE5"
    app:waveStrokeWidth1="5dp"
    app:waveColor2="#FFE8D8FB"
    app:waveStrokeWidth2="5dp"
    app:waveSpeed="0.5"
    app:wave2Visible="true" />

4. Control the Waves from Your Code

In your MainActivity.java file, you can control the WavePlayerView as follows:

To play from file path:

// Play audio from a file path
waveView.playAudioWithWaveFromPath(filePath);

To play from your app resources:

// Play audio from app resources
waveView.playAudioWithWave(R.raw.mus); //Replace 'mus' with your audio

To pause media and waves:

// Pause media and waves
waveView.pauseAudioWithWave();

To resume media and waves:

// Resume media and waves
waveView.resumeAudioWithWave();

To stop media and waves:

// Stop media and waves
waveView.stopAudioWithWave();

To start listening and show waves live:

// Start listening and show live waves
waveView.startListening();

To stop listening:

// Stop listening
waveView.stopListening();

To set playback speed:

// Set playback speed (default is "1.0")
waveView.setPlaybackSpeed("1.0");

To set wave properties:

// Set wave properties
waveView.setWaveProperties(color1, wave1Width, color2, wave2Width, waveSpeed);

To control the visibility of the second wave:

// Hide the second wave
waveView.setWave2Visible(false);

// Show the second wave
waveView.setWave2Visible(true);

To handle audio completion events:

// Handle audio completion events
waveView.setOnAudioCompleteListener(() -> progressbar1.setProgress(0));

To track audio progress:

// Track audio progress
waveView.setOnAudioProgressListener(currentMilliSec -> {
    //your codes here
});

To seek to a position in the media:

// Seek to a position in the media
progressbar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        value = progress; // Store value
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        waveView.pauseAudioWithWave(); // Pause media
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        waveView.seekToPosition((int) value); // Seek to new position
        waveView.setPlaybackSpeed(s);
    }
});

Permissions

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

Put this in "onDestroy" as follows

if (waveView != null) {
  waveView.release();
}

Credits

WavePlayerView is developed and maintained by alex11111115.

Contribution GitHub contributors

We welcome contributions from the community! If you have ideas or improvements, feel free to submit pull requests or open issues on the GitHub repository.

Thanks to these amazing people for their contributions

This project follows the all-contributors specification. Contributions of any kind are welcome!

License

WavePlayerView is licensed under the Apache License 2.0. GitHub license

StandWithPalestine StandWithPalestineBadgeBordered

More Info

Repo Size

Repo Size

Code Size

Code Size

Last Commit

Last Commit

Latest Release

Latest Release

Project Status

Project Status

Build Status

Build Status

About

A Java library for analyzing sound directly by recording sound and plotting waves according to frequencies instantly. Do you think that's the only thing!? No, on the contrary, there is also a drawing of waves according to an audio file from a track or from a file within the application.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages