Skip to content

Android library that provides audio manipulation functions like increase/decrease speed, pitch, volume, bass, etc. Library also provides cut, noise remover, and other interesting and helpfull functions

License

Notifications You must be signed in to change notification settings

lincollincol/AudioTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AudioTool

GitHub GitHub release (latest by date) GitHub All Releases

GitHub followers GitHub stars GitHub forks

AudioTool - an android library that provides useful audio processing functions. This library based on FFMPEG and uses mobile-ffmpeg library

AudioTool provides:

  • Filters
    • filterAudio(. . .)
    • removeAudioNoise(. . .) - remove noise from audio
    • normalizeAudioVolume(. . .) - normalize audio volume
  • Equalizer
    • changeAudioBass(. . .) - reduce or increase audio bass
    • changeAudioVolume(. . .) - reduce or increase audio volume
    • changeAudioPitch(. . .) - reduce or increase audio pitch
    • changeAudioSpeed(. . .) - reduce or increase audio speed
  • Effects
    • applyShifterEffect(. . .) - apply audio pan shifter effect
    • applyReverbEffect(. . .) - apply audio reverb effect
    • applyEchoEffect(. . .) - apply audio echo effect
    • reverseAudio(. . .) - reverse audio
  • Modificators
    • cutAudio(. . .) - cut audio
    • convertVideoToAudio(. . .) - convert video to audio
    • joinAudios(. . .) - join few audio files to single
  • Other
    • generateWaveform(. . .) - generate image waveform (png)
    • getMaxLevelData(. . .) - retrive audio max level data (data can be used to draw waveform)
    • getDuration(. . .) - retrive audio duration

Example

Note: every function will modify previous audio.

Input audio -> cut -> apply effect -> filter -> output audio with all these modifications

AudioTool.getInstance(this)
  .withAudio(new File("/storage/emulated/0/Music/Linc - AudioTool.mp3"))
  .removeVocal(new OnFileComplete() {
    @Override
    public void onComplete(File output) {
      // Output file - audio without vocal
    }
  })
  .applyEchoEffect(Echo.ECHO_OPEN_AIR, new OnFileComplete() {
    @Override
    public void onComplete(File output) {
      // Output file - audio file with echo effect and without vocal 
    }
  })
                      
  /* calls */
  .release();

If you want to save current audio file state - use saveCurrentTo(path). Current audio will be saved as separate file and AudioTool continue modify input file from withAudio() parameters.

AudioTool.getInstance(this)
  .withAudio(new File("/storage/emulated/0/Music/Linc - AudioTool.mp3"))
  .removeVocal(output-> {/* do something with output */})
  .applyEchoEffect(Echo.ECHO_OPEN_AIR, output-> {/* do something with output */})
  .saveCurrentTo("/storage/emulated/0/Music/NewAudio.mp3") // Audio file with echo and without vocal
  .release();

You can save audio to new file after every function call

AudioTool.getInstance(this)
  .withAudio(new File("/storage/emulated/0/Music/Linc - AudioTool.mp3"))
  .removeVocal(output-> {/* do something with output */})
  .saveCurrentTo("/storage/emulated/0/Music/Instrumental.mp3") // Audio file without vocal
  .applyEchoEffect(Echo.ECHO_OPEN_AIR, output-> {/* do something with output */})
  .saveCurrentTo("/storage/emulated/0/Music/NewAudio.mp3") // Audio file with echo and without vocal
  .release();

If don't need result from callbacks, you can pass null as a parameter

AudioTool.getInstance(this)
  .withAudio(new File("/storage/emulated/0/Music/Linc - AudioTool.mp3"))
  .removeVocal(null) // It's ok. 
  .saveCurrentTo("/storage/emulated/0/Music/Instrumental.mp3") // Save audio without vocal to local file 
  .release();

Also, don't forget to call release() function when you finish work with AudioTool. The function remove buffer files from storage and clear other resources.

AudioTool.getInstance(this)
  .withAudio(new File("/storage/emulated/0/Music/Linc - AudioTool.mp3"))
  /* calls */
  .release(); // Always call this function 

FFmpeg

When you add AudioTool to your project, you also should implement tanersener mobile-ffmpeg library which provides you full access to ffmpeg funcitons!

Download

Gradle

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.lincollincol:AudioTool:1.2.1'
  implementation 'com.arthenica:mobile-ffmpeg-full:4.3.1.LTS'
}

Maven

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>
<dependency>
  <groupId>com.github.lincollincol</groupId>
  <artifactId>AudioTool</artifactId>
  <version>1.2.1</version>
</dependency>

Permissions

Add permissions to Manifest.xml file in your app and grant it, before using AudioTool

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

WARNING

AudioTool process audio in the main thread ! You can run AudioTool functions with RxJava, Kotlin coroutines and Java Threads to process audio in the background therad.

AudioTool don't process audio in the background thread because of :

  • You can use your own approach to work in the background thread. It makes AudioTool library more flexible.
  • Reduce library size. Third-party library uses a lot of space and AudioTool delegates this task to user.

Feedback

linc.apps.sup@gmail.com

License

   Copyright 2020 lincollincol

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

About

Android library that provides audio manipulation functions like increase/decrease speed, pitch, volume, bass, etc. Library also provides cut, noise remover, and other interesting and helpfull functions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages