diff --git a/README.md b/README.md index 0fe547a..42de4e8 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,6 @@ Generates an estimate for the attack start and end of a monophonic audio file. Will only work on single event audio files Estimation algorithm needs improvments. -## Project Roadmap: -Choose best audio descriptors for implementation [ ] -Create a few basic descriptors to test matching on [x] -Create database object matching algorithm [ ] -- Starting with a brute force algorithm that tests every entry against every other entry [ ] -Create simple synthesis algorithm [ ] -Create all descriptors required for project [ ] -Work on improving matching and synthesis algorithms [ ] -Create front-end? [ ] - ## Package Installation Simply run: pip install . diff --git a/requirements.txt b/requirements.txt index 0e1565a..e69de29 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +0,0 @@ -funcsigs==0.4 -matplotlib==1.4.3 -mock==1.3.0 -nose==1.3.7 -numpy==1.9.2 -pbr==1.7.0 -pyparsing==2.0.3 -pysndfile==0.2.11 -python-dateutil==2.4.2 -pytz==2015.4 -scipy==0.16.0 -six==1.9.0 -wheel==0.24.0 diff --git a/setup.py b/setup.py index e345842..e569b39 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def read(fname): setup( name="sppysound", - version="0.1", + version="1.0", author="Sam Perry", author_email="u1265119@unimail.hud.ac.uk", description=("A library for audio analysis and synthesis."), @@ -22,7 +22,7 @@ setup( keywords="synthesis audio", url="https://github.com/Pezz89/pysound", package_dir={'': 'src'}, - packages=find_packages(where='src', exclude=['tests']), - setup_requires=['numpy'], - install_requires=read('requirements.txt'), + packages=find_packages(where='src'), + setup_requires=["numpy"], # Just numpy here + install_requires=read('requirements.txt') ) diff --git a/src/sppysound/audiofile.py b/src/sppysound/audiofile.py index de3050d..64c61a3 100644 --- a/src/sppysound/audiofile.py +++ b/src/sppysound/audiofile.py @@ -5,7 +5,6 @@ import collections from scipy import signal import numpy as np import pysndfile -import matplotlib.pyplot as plt import pdb import sys import traceback @@ -600,15 +599,6 @@ class AudioFile(object): """ return float(samps) / self.samplerate * 1000.0 - def plot_grain_to_graph(self, start_index, number_of_samps): - """ - Convenience method. - - Use matplotlib to create a graph of the audio file. - """ - samps = self.read_grain(start_index, self.ms_to_samps(number_of_samps)) - self.plot_array_to_graph(samps) - def fade_audio(self, audio, position, fade_time, mode): """ Fade the audio in or out linearly from the position specified over the @@ -764,13 +754,6 @@ class AudioFile(object): raise ValueError("'{0}' is not a valid window" " type".format(window_type)) - @staticmethod - def plot_array_to_graph(array): - plt.plot(array, 'r') - plt.xlabel('Time (samples)') - plt.ylabel('sample value') - plt.show() - @staticmethod def normalize_audio(audio, maximum=1.0): """ diff --git a/src/sppysound/docs/DatabaseMatchingExample.ipynb b/src/sppysound/docs/DatabaseMatchingExample.ipynb index 327d6c0..743114b 100644 --- a/src/sppysound/docs/DatabaseMatchingExample.ipynb +++ b/src/sppysound/docs/DatabaseMatchingExample.ipynb @@ -94,26 +94,7 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "ename": "IOError", - "evalue": "Unable to create file (Unable to open file: name = './exampleoutput/data/analysis_data.hdf5', errno = 17, error message = 'file exists', flags = 15, o_flags = a02)", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mIOError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0moutput_database\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload_database\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreanalyse\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/Users/samuelperry/PerryPerrySource/pysource/sppysound/src/sppysound/database.pyc\u001b[0m in \u001b[0;36mload_database\u001b[0;34m(self, reanalyse)\u001b[0m\n\u001b[1;32m 107\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0morganize_audio\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubdir_paths\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 108\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 109\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0manalyse_database\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubdir_paths\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreanalyse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 110\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0manalyse_database\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubdir_paths\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreanalyse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/Users/samuelperry/PerryPerrySource/pysource/sppysound/src/sppysound/database.pyc\u001b[0m in \u001b[0;36manalyse_database\u001b[0;34m(self, subdir_paths, reanalyse)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0;31m# Create data file for storing analysis data for the database\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[0mdatapath\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubdir_paths\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'analysis_data.hdf5'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 121\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mh5py\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mFile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdatapath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'a'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 122\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0manalysed_audio\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/Users/samuelperry/.pyenv/versions/2.7.11/lib/python2.7/site-packages/h5py/_hl/files.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, name, mode, driver, libver, userblock_size, swmr, **kwds)\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 259\u001b[0m \u001b[0mfapl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmake_fapl\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdriver\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlibver\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 260\u001b[0;31m \u001b[0mfid\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmake_fid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0muserblock_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfapl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mswmr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mswmr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 261\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 262\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mswmr_support\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/Users/samuelperry/.pyenv/versions/2.7.11/lib/python2.7/site-packages/h5py/_hl/files.pyc\u001b[0m in \u001b[0;36mmake_fid\u001b[0;34m(name, mode, userblock_size, fapl, fcpl, swmr)\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0mfid\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mh5f\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mh5f\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mACC_RDWR\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfapl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfapl\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mIOError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 103\u001b[0;31m \u001b[0mfid\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mh5f\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mh5f\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mACC_EXCL\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfapl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfapl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfcpl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfcpl\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 104\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mmode\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[0;31m# Try to open in append mode (read/write).\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32mh5py/_objects.pyx\u001b[0m in \u001b[0;36mh5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2458)\u001b[0;34m()\u001b[0m\n", - "\u001b[0;32mh5py/_objects.pyx\u001b[0m in \u001b[0;36mh5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2415)\u001b[0;34m()\u001b[0m\n", - "\u001b[0;32mh5py/h5f.pyx\u001b[0m in \u001b[0;36mh5py.h5f.create (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/h5f.c:1965)\u001b[0;34m()\u001b[0m\n", - "\u001b[0;31mIOError\u001b[0m: Unable to create file (Unable to open file: name = './exampleoutput/data/analysis_data.hdf5', errno = 17, error message = 'file exists', flags = 15, o_flags = a02)" - ] - } - ], + "outputs": [], "source": [ "output_database.load_database(reanalyse=False)" ] diff --git a/src/sppysound/docs/MatchSynthesisExample.ipynb b/src/sppysound/docs/MatchSynthesisExample.ipynb index 85c19bd..9ac8ea8 100644 --- a/src/sppysound/docs/MatchSynthesisExample.ipynb +++ b/src/sppysound/docs/MatchSynthesisExample.ipynb @@ -71,18 +71,7 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/samuelperry/.pyenv/versions/2.7.11/lib/python2.7/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.\n", - " warnings.warn(\"Mean of empty slice.\", RuntimeWarning)\n", - "/Users/samuelperry/.pyenv/versions/2.7.11/lib/python2.7/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars\n", - " ret = ret.dtype.type(ret / rcount)\n" - ] - } - ], + "outputs": [], "source": [ "target_database = AudioDatabase(\n", " target_dir,\n", @@ -146,18 +135,7 @@ "collapsed": false, "scrolled": true }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/samuelperry/PerryPerrySource/pysource/sppysound/src/sppysound/audiofile.py:665: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.\n", - " if self.times == None:\n", - "/Users/samuelperry/PerryPerrySource/pysource/sppysound/src/sppysound/audiofile.py:297: UserWarning: write_frames::warning::audio data has been clipped while writing to file ./.shift_input.wav.\n", - " return self.pysndfile_object.write_frames(input)\n" - ] - } - ], + "outputs": [], "source": [ "synthesizer.synthesize()" ] diff --git a/src/sppysound/docs/conf.py b/src/sppysound/docs/conf.py index 2575fe2..2801c2a 100644 --- a/src/sppysound/docs/conf.py +++ b/src/sppysound/docs/conf.py @@ -39,7 +39,6 @@ extensions = [ 'sphinxcontrib.bibtex', 'sphinx.ext.graphviz' ] -exclude_patterns = ['_build', '**.ipynb_checkpoints'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -84,7 +83,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ['_build', '**.ipynb_checkpoints'] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -300,6 +299,3 @@ if os.environ.get('READTHEDOCS', None) == 'True': os.environ["PATH"] += os.pathsep + os.path.abspath('_bin') os.environ["LD_LIBRARY_PATH"] = os.path.abspath('_bin') -latex_elements = { -'preamble': '\usepackage{tikz}', -}