All Projects → justinsalamon → Scaper

justinsalamon / Scaper

Licence: bsd-3-clause
A library for soundscape synthesis and augmentation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Scaper

Edsp
A cross-platform DSP library written in C++ 11/14. This library harnesses the power of C++ templates to implement a complete set of DSP algorithms.
Stars: ✭ 116 (-37.63%)
Mutual labels:  audio, audio-processing
Avdemo
Demo projects for iOS Audio & Video development.
Stars: ✭ 136 (-26.88%)
Mutual labels:  audio, audio-processing
Dawdreamer
Digital Audio Workstation with Python; VST instruments/effects, parameter automation, and native processors
Stars: ✭ 119 (-36.02%)
Mutual labels:  audio, audio-processing
Audio Snr
Mixing an audio file with a noise file at any Signal-to-Noise Ratio (SNR)
Stars: ✭ 100 (-46.24%)
Mutual labels:  audio, audio-processing
Torch Audiomentations
Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning.
Stars: ✭ 164 (-11.83%)
Mutual labels:  data-augmentation, audio
Aukit
audio toolkit. 好用的语音处理工具箱,包含语音降噪、音频格式转换、特征频谱生成等模块。
Stars: ✭ 105 (-43.55%)
Mutual labels:  audio, audio-processing
Noise reduction
Speech noise reduction which was generated using existing post-production techniques implemented in Python
Stars: ✭ 130 (-30.11%)
Mutual labels:  audio, audio-processing
Beep
A little package that brings sound to any Go application. Suitable for playback and audio-processing.
Stars: ✭ 1,168 (+527.96%)
Mutual labels:  audio, audio-processing
Img Encode
Encode an image to sound and view it as a spectrogram - turn your images into music
Stars: ✭ 157 (-15.59%)
Mutual labels:  audio, audio-processing
Dtln
Tensorflow 2.x implementation of the DTLN real time speech denoising model. With TF-lite, ONNX and real-time audio processing support.
Stars: ✭ 147 (-20.97%)
Mutual labels:  audio, audio-processing
Mad Twinnet
The code for the MaD TwinNet. Demo page:
Stars: ✭ 99 (-46.77%)
Mutual labels:  audio, audio-processing
Awesome Deep Learning Music
List of articles related to deep learning applied to music
Stars: ✭ 2,195 (+1080.11%)
Mutual labels:  audio, audio-processing
Aurio
Audio Fingerprinting & Retrieval for .NET
Stars: ✭ 84 (-54.84%)
Mutual labels:  audio, audio-processing
Soul
The SOUL programming language and API
Stars: ✭ 1,566 (+741.94%)
Mutual labels:  audio, synthesis
Awesome Web Audio
A list of resources and projects to help learn about audio
Stars: ✭ 73 (-60.75%)
Mutual labels:  audio, audio-processing
Libopenshot Audio
OpenShot Audio Library (libopenshot-audio) is a free, open-source project that enables high-quality editing and playback of audio, and is based on the amazing JUCE library.
Stars: ✭ 120 (-35.48%)
Mutual labels:  audio, audio-processing
Sonic Pi
Code. Music. Live.
Stars: ✭ 8,736 (+4596.77%)
Mutual labels:  audio, synthesis
Audio Pretrained Model
A collection of Audio and Speech pre-trained models.
Stars: ✭ 61 (-67.2%)
Mutual labels:  audio, audio-processing
Prism Media
Easily transcode media using Node.js 🎶
Stars: ✭ 136 (-26.88%)
Mutual labels:  audio, audio-processing
Supriya
A Python API for SuperCollider
Stars: ✭ 167 (-10.22%)
Mutual labels:  audio, synthesis

scaper

A library for soundscape synthesis and augmentation

PyPI License Build Status Coverage Status Documentation Status Downloads PyPI

Please refer to the documentation for details.

For the motivation behind scaper and its applications check out the scaper-paper:

Scaper: A library for soundscape synthesis and augmentation
J. Salamon, D. MacConnell, M. Cartwright, P. Li, and J. P. Bello
In IEEE Workshop on Applications of Signal Processing to Audio and Acoustics (WASPAA), New Paltz, NY, USA, Oct. 2017.

Installation

Non-python dependencies

Scaper has one non-python dependency:

If you are installing Scaper on Windows, you will also need:

On Linux/macOS SoX is replaced by SoxBindings which is significantly faster, giving better runtime performance in Scaper. On these platforms SoxBindings is installed automatically when calling pip install scaper (see below).

Linux/macOS

If you're using Anaconda (or miniconda) to manage your python environment (recommended), you can install FFmpeg using conda on macOS/Linux:

conda install -c conda-forge ffmpeg

macOS

On macOS FFmpeg can be installed using homebrew:

brew install ffmpeg

Linux

On linux you can use your distribution's package manager, e.g. on Ubuntu (15.04 "Vivid Vervet" or newer):

sudo apt-get install ffmpeg

NOTE: on earlier versions of Ubuntu ffmpeg may point to a Libav binary which is not the correct binary. If you are using Anaconda, you can install the correct version as described earlier by calling conda install -c conda-forge ffmpeg. Otherwise, you can obtain a static binary from the ffmpeg website.

Windows

On windows you can use the provided installation binaries:

Installing Scaper

The simplest way to install scaper is by using pip, which will also install the required python dependencies if needed. To install scaper using pip, simply run:

pip install scaper

To install the latest version of scaper from source, clone or pull the lastest version:

git clone [email protected]:justinsalamon/scaper.git

Then enter the source folder and install using pip to handle python dependencies:

cd scaper
pip install -e .

Tutorial

To help you get started with scaper, please see this step-by-step tutorial.

Example

import scaper
import numpy as np

# OUTPUT FOLDER
outfolder = 'audio/soundscapes/'

# SCAPER SETTINGS
fg_folder = 'audio/soundbank/foreground/'
bg_folder = 'audio/soundbank/background/'

n_soundscapes = 1000
ref_db = -50
duration = 10.0 

min_events = 1
max_events = 9

event_time_dist = 'truncnorm'
event_time_mean = 5.0
event_time_std = 2.0
event_time_min = 0.0
event_time_max = 10.0

source_time_dist = 'const'
source_time = 0.0

event_duration_dist = 'uniform'
event_duration_min = 0.5
event_duration_max = 4.0

snr_dist = 'uniform'
snr_min = 6
snr_max = 30

pitch_dist = 'uniform'
pitch_min = -3.0
pitch_max = 3.0

time_stretch_dist = 'uniform'
time_stretch_min = 0.8
time_stretch_max = 1.2
    
# Generate 1000 soundscapes using a truncated normal distribution of start times

for n in range(n_soundscapes):
    
    print('Generating soundscape: {:d}/{:d}'.format(n+1, n_soundscapes))
    
    # create a scaper
    sc = scaper.Scaper(duration, fg_folder, bg_folder)
    sc.protected_labels = []
    sc.ref_db = ref_db
    
    # add background
    sc.add_background(label=('const', 'noise'), 
                      source_file=('choose', []), 
                      source_time=('const', 0))

    # add random number of foreground events
    n_events = np.random.randint(min_events, max_events+1)
    for _ in range(n_events):
        sc.add_event(label=('choose', []), 
                     source_file=('choose', []), 
                     source_time=(source_time_dist, source_time), 
                     event_time=(event_time_dist, event_time_mean, event_time_std, event_time_min, event_time_max), 
                     event_duration=(event_duration_dist, event_duration_min, event_duration_max), 
                     snr=(snr_dist, snr_min, snr_max),
                     pitch_shift=(pitch_dist, pitch_min, pitch_max),
                     time_stretch=(time_stretch_dist, time_stretch_min, time_stretch_max))
    
    # generate
    audiofile = os.path.join(outfolder, "soundscape_unimodal{:d}.wav".format(n))
    jamsfile = os.path.join(outfolder, "soundscape_unimodal{:d}.jams".format(n))
    txtfile = os.path.join(outfolder, "soundscape_unimodal{:d}.txt".format(n))
    
    sc.generate(audiofile, jamsfile,
                allow_repeated_label=True,
                allow_repeated_source=False,
                reverb=0.1,
                disable_sox_warnings=True,
                no_audio=False,
                txt_path=txtfile)

How to contribute

If you would like to contribute a feature and/or bugfix to this repository, please follow the following steps:

  1. Create an issue describing the feature/fix.
  2. I will reply on the issue thread to determine whether the feature/fix can/should be added.
  3. Discuss design/implementation details in the issue thread and reach consensus.
  4. Once consensus is reached (and only then), start a pull request (PR). Further discsussion can continue in the PR thread.
  5. Implement feature/fix, ensuring all current unit tests pass and new tests are added to maintain 100% test coverage. Inline docstrings as well as the main docs files should also be updated accordingly.
  6. Request code review once the pull request is ready for review.
  7. Fix requested changes to the pull request if any. Repeat steps 5-7 until the PR is approved.
  8. once the PR is approved I will merge it into master (and most likely create a new release).

IMPORTANT: please be sure to always discuss a proposed feature/fix in an issue before creating a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].