Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

natanbc/lavadsp

Repository files navigation

Download

lavadsp

A bunch of lavaplayer audio filters implemented with native code

Getting Started

Installing

Replace VERSION with the version you want to use. The latest version can be found in the badge above.

Maven

<repositories>
    <repository>
        <id>jcenter</id>
        <name>jcenter</name>
        <url>http://jcenter.bintray.com/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.natanbc</groupId>
        <artifactId>lavadsp</artifactId>
        <version>VERSION</version>
    </dependency>
</dependencies>

Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.natanbc:lavadsp:VERSION'
}

Basic Usage

AudioPlayer player = manager.createPlayer();
player.setFilterFactory((track, format, output)->{
    TimescalePcmAudioFilter audioFilter = new TimescalePcmAudioFilter(output, format.channelCount, format.sampleRate);
    audioFilter.setSpeed(1.5); //1.5x normal speed
    return Collections.singletonList(audioFilter);
});

Chaining

Filters may be chained to merge their effects:

AudioPlayer player = manager.createPlayer();
player.setFilterFactory((track, format, output)->{
    TremoloPcmAudioFilter tremolo = new TremoloPcmAudioFilter(output, format.channelCount, format.sampleRate);
    tremolo.setDepth(0.75);
    TimescalePcmAudioFilter timescale = new TimescalePcmAudioFilter(tremolo, format.channelCount, format.sampleRate);
    timescale.setSpeed(1.5);
    return Arrays.asList(timescale, tremolo);
});

To dynamically choose which filters to use, you can see this example