Giter Club home page Giter Club logo

kapre's Introduction

kapre

Keras Audio PREprocessors

Installation

$ git clone https://github.com/keunwoochoi/kapre.git
cd kapre
$ python setup.py install

Usage

Spectrogram

from keras.models import Sequential
from kapre.TimeFrequency import Spectrogram
from kapre.Utils import Normalization2D

# stereo channel, maybe 1-sec audio signal
input_shape = (2, 44100) 
sr = 44100
model = Sequential()
# A "power-spectrogram in decibel scale" layer
model.add(Spectrogram(n_dft=512, n_hop=256, input_shape=src_shape, 
                      return_decibel=True, power=2.0, trainable=False,
                      name='trainable_stft'))
# If you wanna normalise it per-frequency
model.add(Normalization2D(str_axis='freq')) # or 'time', 'channel', 'batch', 'data_sample'
# Then add your model
# E.g., model.add(some convolution layers...)

Mel-spectrogram

from keras.models import Sequential
from kapre.TimeFrequency import Melspectrogram
from kapre.Utils import Normalization2D

# 6 channels (!), maybe 1-sec audio signal
input_shape = (6, 44100) 
sr = 44100
model = Sequential()
# A mel-spectrogram layer with
# no decibel conversion for some reasons and (return_decibel=False)
# amplitude, not power (power=1.0)
model.add(Melspectrogram(n_dft=512, n_hop=256, input_shape=src_shape, 
                         return_decibel=False, power=1.0, trainable=False,
                         name='trainable_stft'))
# If you wanna normalise it per-channel
model.add(Normalization2D(str_axis='channel')) # or 'freq', 'time', 'batch', 'data_sample'
# Then add your model
# E.g., model.add(some convolution layers...)

More info

Please read docstrings at this moment.

Plan

  • TimeFrequency: Spectrogram, Mel-spectrogram
  • Utils: AmplitudeToDB, Normalization2D
  • DataAugmentation: Random-gain Gaussian noise, random cropping 1D/2D, Dynamic Range Compression1D
  • Filterbank: Parameteric Filter bank
  • Decompose: Harmonic-Percussive separation

Copyright, Citation,...

I don't know yet...

kapre's People

Contributors

keunwoochoi avatar

Watchers

 avatar  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.