ADTLib

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 5d98c12979807220976aacabc46cefa93efb1bc7
parent 5a596dcbbbdf447676caae9e226b5aa41669c502
Author: CarlSouthall <carl.southall@bcu.ac.uk>
Date:   Mon,  1 Aug 2016 15:48:02 +0100

Add files via upload
Diffstat:
AADTLib.egg-info/PKG-INFO | 19+++++++++++++++++++
AADTLib.egg-info/SOURCES.txt | 19+++++++++++++++++++
AADTLib.egg-info/dependency_links.txt | 1+
AADTLib.egg-info/requires.txt | 5+++++
AADTLib.egg-info/top_level.txt | 1+
AADTLib/__init__.py | 11+++++++++++
AADTLib/models/__init__.py | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AADTLib/nn/NNFiles/BDHAll-1000 | 0
AADTLib/nn/NNFiles/BDHAll-1000.meta | 0
AADTLib/nn/NNFiles/BDKAll-1000 | 0
AADTLib/nn/NNFiles/BDKAll-1000.meta | 0
AADTLib/nn/NNFiles/BDSAll-1000 | 0
AADTLib/nn/NNFiles/BDSAll-1000.meta | 0
AADTLib/nn/__init__.py | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AADTLib/utils/__init__.py | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALICENSE.txt | 23+++++++++++++++++++++++
MREADME.md | 72+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Abin/ADTBDRNN | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adist/ADTLib-0.1.tar.gz | 0
Adist/ADTLib-1.0.tar.gz | 0
Adist/ADTLib-1.1.tar.gz | 0
Adist/ADTLib-1.2.tar.gz | 0
Adist/ADTLib-2.0.tar.gz | 0
Adist/ADTLibrary-0.1.tar.gz | 0
Adist/ADTLibrary-0.2.tar.gz | 0
Adist/ADTLibrary-0.3.tar.gz | 0
Adist/ADTLibrary-0.4.tar.gz | 0
Adist/ADTLibrary-0.5.tar.gz | 0
Ainstall.md | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asetup.cfg | 3+++
Asetup.py | 30++++++++++++++++++++++++++++++
Ausage.md | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 files changed, 639 insertions(+), 1 deletion(-)

diff --git a/ADTLib.egg-info/PKG-INFO b/ADTLib.egg-info/PKG-INFO @@ -0,0 +1,19 @@ +Metadata-Version: 1.1 +Name: ADTLib +Version: 2.0 +Summary: Automated Drum Trancription Libray +Home-page: https://github.com/CarlSouthall/ADTLib +Author: Carl Southall +Author-email: c-southall@live.co.uk +License: BSD +Download-URL: https://github.com/CarlSouthall/ADTLib +Description: UNKNOWN +Keywords: testing,logging,example +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.2 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 diff --git a/ADTLib.egg-info/SOURCES.txt b/ADTLib.egg-info/SOURCES.txt @@ -0,0 +1,18 @@ +setup.cfg +setup.py +ADTLib/__init__.py +ADTLib.egg-info/PKG-INFO +ADTLib.egg-info/SOURCES.txt +ADTLib.egg-info/dependency_links.txt +ADTLib.egg-info/requires.txt +ADTLib.egg-info/top_level.txt +ADTLib/models/__init__.py +ADTLib/nn/__init__.py +ADTLib/nn/NNFiles/BDHAll-1000 +ADTLib/nn/NNFiles/BDHAll-1000.meta +ADTLib/nn/NNFiles/BDKAll-1000 +ADTLib/nn/NNFiles/BDKAll-1000.meta +ADTLib/nn/NNFiles/BDSAll-1000 +ADTLib/nn/NNFiles/BDSAll-1000.meta +ADTLib/utils/__init__.py +bin/ADTBDRNN +\ No newline at end of file diff --git a/ADTLib.egg-info/dependency_links.txt b/ADTLib.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/ADTLib.egg-info/requires.txt b/ADTLib.egg-info/requires.txt @@ -0,0 +1,5 @@ +numpy +scipy +cython +madmom +tensorflow diff --git a/ADTLib.egg-info/top_level.txt b/ADTLib.egg-info/top_level.txt @@ -0,0 +1 @@ +ADTLib diff --git a/ADTLib/__init__.py b/ADTLib/__init__.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Jul 20 19:18:52 2016 + +@author: CarlSouthall +""" + + +from __future__ import absolute_import, division, print_function + +from . import utils, nn, models diff --git a/ADTLib/models/__init__.py b/ADTLib/models/__init__.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +""" +@author: CarlSouthall +""" + + +from __future__ import absolute_import, division, print_function + +import madmom +import tensorflow as tf +import numpy as np +import scipy +import os +import inspect +import ADTLib.nn as ADTnn +from ADTLib.utils import Wavread, MeanPP, arrange_output, write_text + +def ADTBDRNN(TrackNames, out_sort='time',ret='yes', out_text='no', savedir='current',close_error=0.05,lambd=[9.7,9.9,4.9]): + + Time_Steps=1 + WL=2048 + HS=512 + + names=list(np.zeros(len(TrackNames))) + + Track=list(np.zeros(len(TrackNames))) + for i in xrange(len(TrackNames)): + Track[i]=Wavread(TrackNames[i]) + name=TrackNames[i].split('.wav') + names[i]=name[0] + + Frames=list(np.zeros(len(Track))) + Train=list(np.zeros(len(Track))) + for j in xrange(len(Track)): + NFrames=int(np.ceil(len(Track[j])/float(HS))) + Frames[j]=np.zeros((NFrames,WL)) + for i in xrange(NFrames): + Frames[j][i]=np.squeeze(madmom.audio.signal.signal_frame(Track[j],i,WL,HS,origin=-HS)) + + Spectrogram=madmom.audio.spectrogram.spec(madmom.audio.stft.stft(Frames[j],np.hanning(WL), fft_size=WL)) + Train[j]=np.zeros((len(Spectrogram),Time_Steps,len(Spectrogram[0]))) + + for i in xrange(len(Spectrogram)): + for k in xrange(Time_Steps): + if i-k >= 0: + Train[j][i][Time_Steps-k-1]=Spectrogram[i-k,:] + + Path=os.path.split(inspect.getfile(ADTnn)) + NNPath=Path[0] + + Kout=ADTnn.BDRNNRestoreAll(Train,NNPath+'/NNFiles/BDKAll-1000') + Sout=ADTnn.BDRNNRestoreAll(Train,NNPath+'/NNFiles/BDSAll-1000') + Hout=ADTnn.BDRNNRestoreAll(Train,NNPath+'/NNFiles/BDHAll-1000') + + + AF=list(np.zeros(len(Track))) + P=list(np.zeros(len(Track))) + for j in xrange(len(Track)): + AF[j]=list([Kout[j][:,0],Sout[j][:,0],Hout[j][:,0]]) + P[j]=list(np.zeros(3)) + for i in xrange(len(AF[j])): + P[j][i]=MeanPP(AF[j][i],lambd[i]) + x=np.sort(P[j][i]) + peak=[] + if len(x) > 0: + peak=np.append(peak,x[0]) + + for k in xrange(len(x)-1): + if (x[k+1]-peak[len(peak)-1]) >= close_error: + peak=np.append(peak,x[k+1]) + + P[j][i]=peak + + P=arrange_output(P,output_sort=out_sort) + + if out_text == 'yes': + write_text(P,names,save_dir=savedir) + for i in xrange(len(P)): + Pnew=list(np.zeros(2)) + Pnew[0]=np.array(P[i][:,0],dtype=float) + Pnew[1]=np.array(P[i][:,1],dtype=str) + P[i]=Pnew + + if len(P)==1: + P=P[0] + + if ret=='yes': + return P + + +\ No newline at end of file diff --git a/ADTLib/nn/NNFiles/BDHAll-1000 b/ADTLib/nn/NNFiles/BDHAll-1000 Binary files differ. diff --git a/ADTLib/nn/NNFiles/BDHAll-1000.meta b/ADTLib/nn/NNFiles/BDHAll-1000.meta Binary files differ. diff --git a/ADTLib/nn/NNFiles/BDKAll-1000 b/ADTLib/nn/NNFiles/BDKAll-1000 Binary files differ. diff --git a/ADTLib/nn/NNFiles/BDKAll-1000.meta b/ADTLib/nn/NNFiles/BDKAll-1000.meta Binary files differ. diff --git a/ADTLib/nn/NNFiles/BDSAll-1000 b/ADTLib/nn/NNFiles/BDSAll-1000 Binary files differ. diff --git a/ADTLib/nn/NNFiles/BDSAll-1000.meta b/ADTLib/nn/NNFiles/BDSAll-1000.meta Binary files differ. diff --git a/ADTLib/nn/__init__.py b/ADTLib/nn/__init__.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +""" +@author: CarlSouthall +""" +from __future__ import absolute_import, division, print_function +import numpy as np +import tensorflow as tf +from tensorflow.python.ops import rnn, rnn_cell + +def BDRNNRestoreAll(X, RestoreFileName, num_layers=3,Truncated=1,n_hidden=50,n_classes=2,cells='tanh'): + + tf.reset_default_graph() + batch_size=0; + for i in xrange(len(X)): + if len(X[i]) > batch_size: + batch_size=len(X[i]) + + n_input = len(X[0][0][0]) + n_steps = len(X[0][0]) + state_len=num_layers + + x = tf.placeholder("float", [None, n_steps, n_input]) + y = tf.placeholder("float", [None, n_classes]) + istate_fw = tf.placeholder("float", [None, (state_len)*n_hidden]) + istate_bw = tf.placeholder("float", [None, (state_len)*n_hidden]) + + weights = { 'out': tf.Variable(tf.random_normal([n_hidden*2, n_classes]))} + biases = { 'out': tf.Variable(tf.random_normal([n_classes]))} + + def BiRNN(_X, _istate_fw, _istate_bw, _weights, _biases): + + _X = tf.transpose(_X, [1, 0, 2]) + _X = tf.reshape(_X, [-1, n_input]) + + fw_cell_1 = rnn_cell.BasicRNNCell(n_hidden) + bw_cell_1 = rnn_cell.BasicRNNCell(n_hidden) + fw_cell=rnn_cell.MultiRNNCell([fw_cell_1]*num_layers) + bw_cell=rnn_cell.MultiRNNCell([bw_cell_1]*num_layers) + _X = tf.split(0, n_steps, _X) + seq=np.int32(np.ones(batch_size)*Truncated) + + outputs, statefw,statebw = rnn.bidirectional_rnn(fw_cell, bw_cell, _X, + initial_state_fw=_istate_fw, + initial_state_bw=_istate_bw, + sequence_length=seq) + + return tf.matmul(outputs[-1], _weights['out']) + _biases['out'] + + pred = BiRNN(x, istate_fw, istate_bw, weights, biases) + out=tf.nn.softmax(pred) + + init = tf.initialize_all_variables() + saver = tf.train.Saver() + Test=X + oh=list(np.zeros(len(Test))) + with tf.Session() as sess: + + sess.run(init) + saver.restore(sess,RestoreFileName) + for i in xrange (len(Test)): + test_len = len(Test[i]) + if test_len != batch_size: + e=np.zeros((batch_size-test_len,1,len(Test[i][0,0]))) + f=np.concatenate((Test[i],e)) + else: + f=Test[i] + + o = sess.run(out, feed_dict={x: f, + istate_fw: np.zeros((batch_size, (state_len)*n_hidden)), + istate_bw: np.zeros((batch_size, (state_len)*n_hidden)) + }) + oh[i]=o[:test_len] + + + + return oh diff --git a/ADTLib/utils/__init__.py b/ADTLib/utils/__init__.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +""" +@author: CarlSouthall +""" +from __future__ import absolute_import, division, print_function +import scipy.io.wavfile as wav +import numpy as np +import os + + +def MeanPP(Track,Lambda): + + m=np.mean(Track)*Lambda + onsets=[] + Track=np.append(Track,0) + for i in xrange(len(Track)): + if Track[i]>Track[i-1] and Track[i]>Track[i+1] and Track[i]> m: + onsets=np.append(onsets,i) + + if len(onsets) > 0: + onsets=(onsets*512)/float(44100) + return onsets + +def Wavread(TrackName): + x=wav.read(TrackName) + y=x[1] + if len(y.shape)>1: + y=np.squeeze(np.sum(y,axis=1)) + y=y/float(np.max(abs(y))) + + return y + +def arrange_output(Inputs,output_sort='time'): + + Names=['BD','SD','HH'] + Out=list(np.zeros(len(Inputs))) + for i in xrange(len(Inputs)): + Out[i]=list(np.zeros(len(Inputs[i]))) + for j in xrange(len(Inputs[i])): + Out[i][j]=list(np.zeros((len(Inputs[i][j])))) + for k in xrange(len(Inputs[i][j])): + Out[i][j][k]=list(np.zeros(2)) + Out[i][j][k][0]=Inputs[i][j][k] + Out[i][j][k][1]=Names[j] + + Out[i]=np.concatenate([Out[i][0],Out[i][1],Out[i][2]],axis=0) + + if output_sort=='time': + Out1=np.array(Out[i][:,0],dtype=float) + Out[i][:,0]=np.array(np.sort(Out1),dtype=str) + indexs=np.argsort(Out1) + out_names=list(Out[i][:,1]) + for j in xrange(len(indexs)): + Out[i][j,1]=out_names[indexs[j]] + + return Out + +def write_text(X,names,suffix='.ADT.txt',save_dir='current'): + + if save_dir != 'current': + current_dir=os.getcwd() + os.chdir(save_dir) + + for i in xrange(len(names)): + file = open(names[i]+suffix, "w") + for j in xrange(len(X[i])): + X[i][j][0]=X[i][j][0][0:8] + item=" ".join(X[i][j]) + file.write("%s\n" % item) + + if save_dir != 'current': + os.chdir(current_dir) + + + + +\ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt @@ -0,0 +1,23 @@ +Copyright (c) 2016, CarlSouthall +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md @@ -1 +1,71 @@ -# +# Automated Drum Transcription Library (ADTLib) + +The automated drum transcription (ADT) Libarary contains open source ADT algorithms to aid other researchers in areas of music information retrieval (MIR). + +## License + +This library is published under the BSD license which allows redistribution and modification as long as the copyright and disclaimers are contained. The full license information can be found on the [license](https://github.com/CarlSouthall/AutoDrumTranscritpion/blob/master/LICENSE) page. + +## Installation + +#### Required Packages + +• [numpy](https://www.numpy.org) +• [scipy](https://www.scipy.org) +• [cython](https://www.cython.org) +• [madmom](https://github.com/CPJKU/madmom) +• [tensorflow](https://www.tensorflow.org/) + +The easiest and suggested method to install the libary is to use pip. + + pip install ADTLib + +To update the libary use + + pip install --upgrade ADTlib + +For futher install information see the [install](https://github.com/CarlSouthall/ADTLib/blob/master/install.md) page. + + +## Algorithms + +The algorithms that are currently contained within the libary are: + +• ADTBDRNN: Bi-directional architecture outlined in [1] + +## Usage + +Algorithms contained within the toolbox are both available as functions for use within python and as command line executable programmes. + +###Examples + +#### Command line + + ADTBDRNN DrumFile1.wav DrumFile2.wav + + +#### Python function + +```Python +from ADTLib.models import ADTBDRNN + +TrackNames=['DrumFile1.wav','DrumFile2.wav'] +out=ADTBDRNN(TrackNames) +``` + +See the [usage](https://github.com/CarlSouthall/ADTLib/blob/master/usage.md) page for more information. + +## References + + +| **[1]** | **[Carl Southall, Ryan Stables, Jason Hockman, Automatic Drum Transcription Using Bi-directional Recurrent Neural Networks, Proceedings of the 17th International Society for Music Information Retrieval Conference (ISMIR), 2016.](https://wp.nyu.edu/ismir2016/wp-content/uploads/sites/2294/2016/07/217_Paper.pdf)**| +| :---- | :--- | + +##Help + +Any questions please feel free to contact me on carl.southall@bcu.ac.uk + + + + + diff --git a/bin/ADTBDRNN b/bin/ADTBDRNN @@ -0,0 +1,84 @@ +#!/usr/bin/env python2.7 +# -*- coding: utf-8 -*- +""" +@author: CarlSouthall +""" + +from __future__ import absolute_import, division, print_function +import argparse +import ADTLib as ADT +from subprocess import call + + + +p = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,description=''' +ADTBDRNN is based on the BDRNN architecture outlined within: + + Carl Southall, Ryan Stables, Jason Hockman, + Automatic Drum Transcription Using Bi-directional Recurrent Neural Networks, + Proceedings of the 17th International Society for Music Information + Retrieval Conference (ISMIR), 2016. + + Flag Name Description Default setting + -h help displays help file n/a + -os output_sort defines configuration of the output time + -od output_dir location output textfiles are saved current + -p print defines whether the output is displayed in the terminal or not yes + -ot output_text defines whether the ouput is stored in a textfile or not yes + I input_file_names single or list of wav file names seperated by spaces n/a + + ''') +p = argparse.ArgumentParser(prog='ADTBDRNN') +p.add_argument('I', nargs='*',help='InputFileNames',) +p.add_argument('-os', nargs=1,help='output_sort', choices=['time', 'instrument'], default='time') +p.add_argument('-od', nargs=1,help='output_dir', default='current') +p.add_argument('-p', nargs=1,help='print', default='yes',choices=['yes', 'no']) +p.add_argument('-ot', nargs=1,help='output_text', choices=['yes','no'], default='yes') +args=p.parse_args() +TrackNames=args.I +suffix='.ADT.txt' + +if args.os!='time': + args.os=args.os[0] +if args.od!='current': + args.od=args.od[0] +if args.p!='yes': + args.p=args.p[0] +if args.ot!='yes': + args.ot=args.ot[0] + +out=ADT.models.ADTBDRNN(TrackNames, out_sort=args.os, out_text=args.ot, savedir=args.od) + +if args.p=='yes' and args.ot=='no': + print(out) +elif args.p=='yes' and args.ot=='yes': + for i in xrange(len(TrackNames)): + name=TrackNames[i].split('.wav') + TrackName=name[0] + + if args.od=='current': + d=TrackName+suffix + if i==0: + print() + print ("Track"+str(i)) + print(TrackNames[i]) + print() + call(["cat", d]) + if i < len(TrackNames)-1: + print() + else: + d=savedir+TrackName+suffix + if i==0: + print() + print ("Track"+str(i)) + print(TrackNames[i]) + print() + call(["less", d]) + if i < len(TrackNames)-1: + print() + + + + + + diff --git a/dist/ADTLib-0.1.tar.gz b/dist/ADTLib-0.1.tar.gz Binary files differ. diff --git a/dist/ADTLib-1.0.tar.gz b/dist/ADTLib-1.0.tar.gz Binary files differ. diff --git a/dist/ADTLib-1.1.tar.gz b/dist/ADTLib-1.1.tar.gz Binary files differ. diff --git a/dist/ADTLib-1.2.tar.gz b/dist/ADTLib-1.2.tar.gz Binary files differ. diff --git a/dist/ADTLib-2.0.tar.gz b/dist/ADTLib-2.0.tar.gz Binary files differ. diff --git a/dist/ADTLibrary-0.1.tar.gz b/dist/ADTLibrary-0.1.tar.gz Binary files differ. diff --git a/dist/ADTLibrary-0.2.tar.gz b/dist/ADTLibrary-0.2.tar.gz Binary files differ. diff --git a/dist/ADTLibrary-0.3.tar.gz b/dist/ADTLibrary-0.3.tar.gz Binary files differ. diff --git a/dist/ADTLibrary-0.4.tar.gz b/dist/ADTLibrary-0.4.tar.gz Binary files differ. diff --git a/dist/ADTLibrary-0.5.tar.gz b/dist/ADTLibrary-0.5.tar.gz Binary files differ. diff --git a/install.md b/install.md @@ -0,0 +1,58 @@ +# Install + +This page contains information regarding installing ADTLib. It is suggested to install the package using [pip](https://pypi.python.org/pypi/pip). If pip is not already installed install it using. + + easy_install pip + +Then install the automated drum transcription libarary using the following + + pip install ADTLib + +To update the libary use + + pip install --upgrade ADTlib + +This should install all of the extra required packages. If errors occur, try installing each package one by one as demonstrated below. + +#### Required packages. + +• [numpy](https://www.numpy.org) +• [scipy](https://www.scipy.org) +• [cython](https://www.cython.org) +• [madmom](https://github.com/CPJKU/madmom) +• [tensorflow](https://www.tensorflow.org/) + +To install numpy + + pip install numpy + +To install scipy + + pip install scipy + +To install cython + + pip install cython + +To install madmom + + pip install madmom + +madmom requires [nose](http://nose.readthedocs.io/en/latest/) in addition to the above packages, if this does not automatically install with madmom use. + + pip install nose + +Although you can use + + pip install tensorflow + +to install tensorflow, problems sometimes occur. It is suggested to install tensorflow using the instructions on the tensorflow github https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md + +Once you have installed all of those dependencies you can install ADTLib using pip as demonstrated at the top of this page. + + + + + + + diff --git a/setup.cfg b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md +\ No newline at end of file diff --git a/setup.py b/setup.py @@ -0,0 +1,30 @@ +from distutils.core import setup +from setuptools import find_packages +import glob + +package_data = ['nn/NNFiles/*'] +scripts = glob.glob('bin/*') + +setup( + name = 'ADTLib', + packages=find_packages(exclude=[]), # this must be the same as the name above + version = '2.0', + description = 'Automated Drum Trancription Libray', + author = 'Carl Southall', + author_email = 'c-southall@live.co.uk', + license='BSD', + url = 'https://github.com/CarlSouthall/ADTLib', # use the URL to the github repo + download_url = 'https://github.com/CarlSouthall/ADTLib', # I'll explain this in a second + keywords = ['testing', 'logging', 'example'], # arbitrary keywords + classifiers = ['Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4',], + scripts=scripts, + + install_requires=['numpy','scipy','cython','madmom','tensorflow'], + package_data={'ADTLib': package_data}, +) diff --git a/usage.md b/usage.md @@ -0,0 +1,70 @@ +#Usage + +This file contains infromation regarding using the algorithms within the toolbox. + +##ADTBDRNN + +ADT architecture defined in [1]. + +Input: wavfiles names along with control parameters + +Output: kick, snare, hihat onsets in seconds. + +###Command line + + ADTBDRNN [-h] [-os {time,instrument}] [-od OD] [-p {yes,no}] [-ot {yes,no}] [I [I ...]] + +| Flag | Name | Description | Default setting | +| ---- | ------- | ----- | ------ | +| -h | help | displays help file | n/a | +| -os | output_sort | defines configuration of the output | time | +| -od | output_dir | location output textfiles are saved | current| +| -p | print | defines whether the output is displayed in the terminal or not | yes| +| -ot | output_text | defines whether the ouput is stored in a textfile or not | yes| +| I | input_file_names| single or list of wav file names seperated by spaces | n/a | + +#####Examples + + ADTBDRNN DrumFile.wav + + Output ordered by time printed to a text file in current directory and printed in terminal + + ADTBDRNN -os instrument -od Desktop -p no -ot yes Drum.wav DrumFile1.wav DrumFile2.wav + + Output ordered by instrument printed to a text file on the desktop. + + +###Python function +```Python +ADTBDRNN(TrackNames, out_sort='time',ret='yes', out_text='no', savedir='current',close_error=0.05,lambd=[9.7,9.9,4.9]) +``` +| Name | Description | Default setting | +| ------- | ----- | ------ | +| TrackNames | Drum.wav files, must be in a list if more than one. | n/a | +| out_sort | defines configuration of the output | time | +| savedir | location output textfiles are saved | current| +| ret | defines whether the output is returned from the function | yes| +| out_text | defines whether the ouput is stored in a textfile or not | no| +| close_error| Maximum distance between two onsets without onsets being combined, in seconds. | 0.05 | +| lambd| Value used for each instrument within the peak picking stage | 9.7 9.9 9.4 | + +#####Examples + +```Python +from ADTLib.models import ADTBDRNN + +Filenames='Drumfile.wav' +X=ADTBDRNN(Filenames) +``` +Output stored in variable X ordered by time. + +```Python +from ADTLib.models import ADTBDRNN + +Filenames=['Drumfile.wav','Drumfile1.wav'] +ADTBDRNN(Filenames,out_sort='instrument',ret='no',out_text='yes',savedir='Desktop') +``` +Output ordered by instrument printed to a text file on the desktop. + + +