GithubHelp home page GithubHelp logo

tedmoore / audio_transport Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sportdeath/audio_transport

0.0 0.0 0.0 50 KB

Interpolating between audio signals with optimal transport.

License: GNU General Public License v3.0

C++ 82.18% Python 9.77% CMake 8.05%

audio_transport's Introduction

Audio Transport

This code implements a novel effect for transitioning between audio signals that we call "audio transport". As an interpolation parameter is changed, the pitches in one signal slide to the pitches in the other, producing a portamento, or musical glide. The assignment of pitches in one sound to pitches in the other is accomplished by solving a 1-dimensional optimal transport problem.

The effect is described in this paper which won "Best Student Paper" at the 22nd International Conference on Digital Audio Effects. Audio examples can be found here, or click on the image below for a video demonstration:

video

This code provides the static effect, meaning it provides an executable that takes two audio files as input and combines the two using the effect to produce and output audio file. The code demonstrated in the video that uses the effect live uses the functions provided by this library on portaudio streams. The live code is super hacky and you could probably make something much better, which is why I haven't included it here. But if you really want it, I can send it to you. All of the important stuff is in this library.

Usage

Static Use

Using the static effect does not require writing any more code but it does require several dependencies. You will need fftw3, ffmpeg and audiorw.

Install fftw3 and ffmpeg via your system package manager. This code has been tested on versions 3.3.8 and 4.2.3 respectively on a machine running Arch Linux. Hopefully things don't break on your system but if they do, please make a pull request :-) !

Then install the audiorw library with cmake:

git clone https://github.com/sportdeath/audiorw
mkdir audiorw/build
cd audiorw/build
cmake ..
make
sudo make install

Once the dependencies are installed, install audio_transport with cmake:

git clone https://github.com/sportdeath/audio_transport
mkdir audio_transport/build
cd audio_transport/build
cmake .. -D BUILD_EXAMPLES=ON
make

Then, to apply the effect use the transport binary. For example, below we tranform piano audio into guitar audio. The output starts by sounding like the piano audio for the first 20% of the duration. Then between 20% and 70% of the duration, the piano is transformed into a guitar. In the last 30% the audio is simply the guitar.

./transport piano.wav guitar.mp3 20 70 out.flac

You can also apply the effect to a single file with the glide binary. The input file serves as one input to the "transport" and the output of the effect is fed back into the second input. This slurs all of the frequencies in the input like the glide/lag/portamento knob found on some synthesizers ... however it works on any audio input.

In this example we apply the glide effect to a piano with a time constant of 1 millisecond:

./glide piano.wav 1 piano_glide.ogg

External Use

If you want to use the audio transport functions provided by this library in another project (e.g. to make a live effect) then this library only requires fftw3. Once you have it, install audio_transport with cmake:

git clone https://github.com/sportdeath/audio_transport
mkdir audio_transport/build
cd audio_transport/build
cmake ..
sudo make install

Then in your own project, include these headers:

#include <audio_transport/spectral.hpp>
#include <audio_transport/audio_transport.hpp>

spectral.hpp provides functions that turn vectors of audio into spectral objects, incapsulating time and frequency as well as their reassigned counterparts which are necessary for the effect. It also provides the inverse.

audio_tranport.hpp provides an interpolate function that takes windows of audio (that are in the spectral format) and combines them according the effect.

audio_transport's People

Contributors

sportdeath avatar tedmoore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.