Audio features extraction

Related tags

Audio Yaafe
Overview

Yaafe

Yet Another Audio Feature Extractor

Build status

  • Branch master : travis_master
  • Branch dev : travis_dev
  • Anaconda : anaconda_build

Install

Conda

conda

Yaafe can be easily install with conda. To install this package with conda run:

conda install -c conda-forge yaafe

Docker

docker

Yaafe can also be install through Docker.

Get the official Yaafe image from Yaafe repository on Docker Hub:

docker pull yaafe/yaafe
docker tag yaafe yaafe/yaafe

or build it from the sources directory:

docker build --tag=yaafe .

Following both of the method above, you then have a docker image tagged as yaafe. The yaafe command is the entrypoint for that docker image so you can run 'yaafe' from the command line through docker run yaafe. For example:

docker run -it yaafe --help
docker run -it yaafe --volume=$(pwd):/wd  --workdir=/wd -c resources/featureplan -r 16000 --resample resources/yaafe_check.wav

On Linux, it can be usefull to create an alias for it:

alias yaafe='docker run -it --rm=true --volume=$(pwd):/wd  --workdir=/wd yaafe'

You could then simply run:

yaafe --help
yaafe -l

et voilà !

If you need to set the docker user as the current user on the host, you could try to run docker with the -u $(id -u):$(id -g) option

docker run -it --rm=true --volume=$(pwd):/wd  --workdir=/wd -u $(id -u):$(id -g) yaafe -c resources/featureplan -o h5 -r 16000 --resample resources/yaafe_check.wav

Last but not least, the entry-point for the yaafe docker image is smart :

  • every command that start with a dash - will be pass as options to the yaafe command inside the docker container

  • every command that does not start with a dash will be treated as a regular command. For example:

    docker run -it yaafe /bin/bash
    

will give you access to a bash terminal inside the docker. And

docker run -it yaafe yaafe-engine --help

will launch the ``yaafe-engine` batch processing tool.

From sources

Yaafe source code should compile on linux and MacOsX platform, and uses CMake as compilation tool. Yaafe requires third-party libraries to enable specific features. Some of these libraries may already be available on your system.

The argtable library is required.

The eigen library is also required. You could either installed it through your regular packages manager (e.g. libeigen3-dev on Debian) and then pass the -DWITH_EIGEN_LIBRARY=ON option flag to ccmake. Or you can use the source code provided through the git submodule included in the Yaafe git repository and which you can get with the git submodule update --init command. If you used ``git clone --recursive`` to clone Yaafe, you don't need this.

Depending on optional features you want to use, other librairies may be used:

  • libsndfile: enable reading WAV files format (highly recommanded)
  • libmpg123: enable reading MP3 audio files
  • HDF5 >= 1.8: enable H5 output format
  • liblapack: enable some audio features (LSF)
  • FFTW3: use FFTW instead of Eigen for FFT computations (pay attention to licensing issues when linking with the GPL FFTW3 library).

To use the yaafe script you need Python >= 2.5, and the numpy package.

Once previous libraries are installed (some may have been locally installed in <lib-path>), you can compile with the following steps:

mkdir build
cd build
ccmake -DCMAKE_PREFIX_PATH=<lib-path> -DCMAKE_INSTALL_PREFIX=<install-path> ..
make
make install

If you use an external eigen library (and not the one provided by git submodule), don't forget to add the flag:

ccmake -DCMAKE_PREFIX_PATH=<lib-path> -DCMAKE_INSTALL_PREFIX=<install-path> -DWITH_EIGEN_LIBRARY=ON ..
Several options can control Yaafe compilation. More details can be found at:
http://yaafe.sourceforge.net/manual/install.html

Environment

To easily use Yaafe, you should set the following environment vars:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEST_DIR/lib

On MacOSX replace LD_LIBRARY_PATH by DYLD_FALLBACK_LIBRARY_PATH

The output of make install should give you the INSTALL_DIR path (defaults to /usr/local). The python files are installed in /usr/local/lib/python2.7/site-packages, which is not by default in the python path on MacOSX. The consequence is the error ERROR: cannot load yaafe packages: No module named yaafelib. There are 3 ways to solve this problem :

  • The simplest way is to add the line sys.path.append("/usr/local/lib/python2.7/site-packages") in /usr/local/bin/yaafe after from optparse import OptionParser, but it won't let you use the yaafelib unless you add this line (and import sys) before each import of yaafelib.
  • You can use export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH or add it to your ~/.bash_profile, but this will affect other versions of python.
  • You can move the files to a site-package folder that is in your PYTHONPATH:
    • if you use Python 2: mv /usr/local/lib/python2.7/site-packages/yaafefeatures.py /usr/local/lib/python2.7/site-packages/yaafelib `python -c 'import sys, re ; print next(i for i in sys.path if re.match(".*site-packages$", i))'
    • if you use Python 3: mv /usr/local/lib/python2.7/site-packages/yaafefeatures.py /usr/local/lib/python2.7/site-packages/yaafelib `python3 -c 'import sys, re ; print(next(i for i in sys.path if re.match(".*site-packages$", i)))'

If you use Matlab, you can set your MATLABPATH var:

export MATLABPATH=$MATLABPATH:$DEST_DIR/matlab

Documentation

Documentation is also available online: http://yaafe.github.io/Yaafe/ (mirror: http://yaafe.sourceforge.net/)

To build documentation, you need Sphinx. Before building documentation, you should set your environment correctly so that sphinx builds documentation with automatic features documentation.

To build documentation, just run make doc_python in the build directory. Documentation is built in doc/doc_python/html.

License

YAAFE is released under the version 3 of the GNU Lesser General Public License. Read COPYING and COPYING.LESSER for more details. The user should also read DISCLAIMER before linking with optional libraries which have different license policy.

Support

To get help with YAAFE, use the mailing-list [email protected] (registration at https://lists.sourceforge.net/lists/listinfo/yaafe-users ).

Credits

Yaafe was first developed at Telecom Paristech / AAO Team. It uses several great open-source projects like Eigen, Smarc, libsndfile, mpg123, HDF5.

If you want to cite Yaafe in a publication, please see CITATION.

Comments
  • Python 3

    Python 3

    Hi, I started from the version #21 by @AbdealiJK, made some minor changes for pathes, and added a cast to make the extensions work.

    The command yaafe works with all the features I tested with both python 2 and 3 installations.

    The interface should work since I think it is used by the command. I'll test the block per block extraction next week.

    opened by louisabraham 21
  • feat: add Python 3 support and get ready for conda-forge

    feat: add Python 3 support and get ready for conda-forge

    This pull request starts from @louisabraham and @AbdealiJK work.

    • fixes #41 in order to get ready for a later conda-forge automated build
    • fixes py3 str/bytes bug (see commit 5353880313067923da60a38efb12b2c46746b35b)
    opened by hbredin 12
  • conda-forge packages

    conda-forge packages

    This issue is meant to keep track of my work on conda-forge packages.

    • [x] mpg123
      • Code: https://github.com/hbredin/staged-recipes/tree/master
      • Pull request: https://github.com/conda-forge/staged-recipes/pull/2685
    • [x] libsndfile:
      • Code: https://github.com/hbredin/staged-recipes/tree/feature/libsndfile
      • Pull request: https://github.com/conda-forge/staged-recipes/pull/2689
    • [x] argtable2
      • Code: https://github.com/hbredin/staged-recipes/tree/feature/argtable2
      • Pull request: https://github.com/conda-forge/staged-recipes/pull/2688
    • [x] yaafe
      • Code: https://github.com/hbredin/staged-recipes/tree/feature/yaafe
      • Pull request: https://github.com/conda-forge/staged-recipes/pull/2709
      • ~~For now, it is based on my own fork of Yaafe (https://github.com/hbredin/staged-recipes/blob/feature/yaafe/recipes/yaafe/meta.yaml#L15).~~
      • ~~A new release of Yaafe with Py3 support and that fixes #41 is still missing.~~
    • [ ] Windows support
      • For now, all these packages are Linux and macOS only.
    enhancement 
    opened by hbredin 9
  • fix some memleaks; time_start, time_limit for yaafe-io; pickling for Dataflow; misc

    fix some memleaks; time_start, time_limit for yaafe-io; pickling for Dataflow; misc

    I apologize that you may find it a little bit hard to review the PR as too many files are changed in https://github.com/mckelvin/Yaafe/commit/a4c37503d0ecd84d72b4a2ecc2ab9da24bf6c667 and https://github.com/mckelvin/Yaafe/commit/4ba7c408141da8ae9773e2eca304330115cd2cdb, may be commit-by-commit review is a better choice. I'm not sure whether all the commits are welcomed, and if not so, please comment in the thread without any hesitating.

    here are the main changes:

    • fix memleaks in:
      • Smarc
      • MP3FileReader
      • freeOutputFormatDescription
    • support time_start, time_limit for MP3FileReader and AudioFileReader so that we can extract features in a specific time range.
    • src_cpp: DataFlow: support stringify, loads
    • src_python: Dataflow: support pickling

    this PR should also fix #3

    opened by mckelvin 8
  • core::Engine: Fix memory leaks, misc

    core::Engine: Fix memory leaks, misc

    this PR consists of 2 parts;

    1. fix compilation error while compiling using llvm(clang++ ) as reference to 'end' is ambiguous in llvm.
    2. fix memory leaks in core::Engine, the following code may be useful to prove that the memory leak do exists while reload DataFlow again and again:
    import resource
    from yaafelib import Engine, FeaturePlan
    
    def main():
        fp = FeaturePlan()
        fp.addFeature("mfcc: MFCC blockSize=1024 stepSize=1024 CepsNbCoeffs=11")
        df = fp.getDataFlow()
    
        for i in range(10):
            for j in range(100):
                eng = Engine()
                eng.load(df)
            print i, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
    
    if __name__ == '__main__':
        main()
    
    

    the output is something like:

    0 19640
    1 22808
    2 25712
    3 28616
    4 31784
    5 34688
    6 37592
    7 40760
    8 43664
    9 46568
    

    if no memory leaks happened, it should be something like:

    0 19640
    1 19640
    2 19640
    ...
    

    I've check and test the code. Please review it again!

    BTW, I use the great tool valgrind to find the leak code.

    opened by mckelvin 7
  • Sample rate has no default value

    Sample rate has no default value

    When I use yaafe -f "cqt: CQT" KR.mp3 for example, I get the error "ERROR: please specify sample rate !" though the file has a sample rate (I can see it in its metadata), and the help (yaafe -h) specifies : -r SAMPLE_RATE, --rate=SAMPLE_RATE working samplerate in Hz. If not set, use input file sample rate.

    If I add the parameter yaafe -r 44100 -f "cqt: CQT" KR.mp3, it just works fine.

    opened by louisabraham 6
  • Build error with HDF5

    Build error with HDF5

    Hi,

    I'm trying to compile with macOS Sierra. With the option WITH_HDF5=ON, I get the following error :

    /Users/louisabraham/Downloads/yaafe-v0.65/src_cpp/yaafe-python/yaafecoreH5.cpp:69:56: error: 'H5P_DEFAULT' was not declared in this scope
         hid_t h5file = H5Fopen(h5filename, H5F_ACC_RDONLY, H5P_DEFAULT);
    

    I used the command : cmake -DWITH_FFTW3=ON -DWITH_HDF5=ON -DWITH_LAPACK=ON -DWITH_MPG123=ON configure .. And it found HDF5. -- Found HDF5: /opt/local/lib/libhdf5.dylib

    When I try without HDF5 (cmake -DWITH_FFTW3=ON -DWITH_HDF5=OFF -DWITH_LAPACK=ON -DWITH_MPG123=ON configure ..), it works fine !

    opened by louisabraham 6
  • Update the documentation

    Update the documentation

    The documentation should be update to reflect the merge of the former TP Yaafe Extension. The TP Yaafe extension features (including CQT and Chroma) should be added to the list of yaafe core feauture

    opened by thomasfillon 6
  • Cmake Issue

    Cmake Issue

    Hey- I am getting this error when I try to ccmake yaafe. Any help?

    CMake Error at src_cpp/yaafe-core/CMakeLists.txt:24 (add_library):
      Cannot find source file:   /Users/rees/Yaafe/externals/fmemopen/fmemopen.c
     Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
      .hxx .in .txx
    
    
    CMake Error: CMake can not determine linker language for target: yaafe-core
    CMake Error in src_cpp/yaafe-core/CMakeLists.txt:
      Exporting the target "yaafe-core" is not allowed since its linker language
      cannot be determined
    
    opened by relliottsmith 4
  • Windows native compilation, minor fixes

    Windows native compilation, minor fixes

    I compiled Yaafe on a Windows system using CMake and MinGW. I fixed some minor runtime and compilation issues along the way and documented everything in a tutorial: https://crococode.wordpress.com/2015/04/01/compiling-yaafe-on-windows-using-cmake-and-mingw/

    opened by Crococode 4
  • os x install using hp5

    os x install using hp5

    Hi, if I configure an install WITH_HDF5 I get the following error (and 4 more similar) with make:

    /yaafe/src_cpp/yaafe-python/yaafecoreH5.cpp:69:56: error: use of undeclared identifier  'H5P_DEFAULT'
    hid_t h5file = H5Fopen(h5filename, H5F_ACC_RDONLY, H5P_DEFAULT);
    

    H5P_DEFAULT is defined in "H5Ppublic.h" so, by including this file in "yaafe-python/yaafecoreH5.cpp" :

    #ifdef WITH_HDF5
    #include "H5Fpublic.h"
    #include "H5Gpublic.h"
    #include "H5Opublic.h"
    #include "H5Dpublic.h"
    #include "H5Ppublic.h"
    #include "H5PTpublic.h"
    #include "H5LTpublic.h"
    #include "H5Tpublic.h"
    #include "H5Apublic.h"
    #endif
    

    the problem goes away. The question is, is this the proper solution? many thanks Dave Greenwood

    opened by davegreenwood 4
  • Easier way to install yaafe?

    Easier way to install yaafe?

    Hi, Python novice here. I'm trying to figure out how to use yaafe in Linux.

    • One option is to install it using "Conda", which points to "Anaconda" which points to "Miniconda" which doesn't have any command line install as far as I can see, I don't have a GUI on Linux. It also pointed to another application called "fish" for "silent installation" but at so many levels down I just gave up.

    • Then I see you can build it from scratch - but if this is Python, an interpreted language, why does anything have to be compiled?

    • Isn't there just a pip installer (it's the default package manager that comes with Python) or python files I can download? I don't see why this Conda/docker/cmake thing is necessary. I just want to use this .py library :(

    Thanks.

    opened by RichardJECooke 1
  • How to supress console output in yaafelib?

    How to supress console output in yaafelib?

    Hello,

    I would like to supress console output when processing audio files. I always get messages like: "process file SOME_FILE done in 0.000296s"

    Is there a way to get rid of these messages?

    Thank you

    opened by bastian-f 0
  • Docker version asks for python3

    Docker version asks for python3

    I have tried the docker build of Yaafe, but I get the following error (both in the image downloaded from Dockerhub and in the image built from the Dockerfile):

    ~> docker run -it yaafe --help /usr/bin/env: python3: No such file or directory

    I think there is also a typo in the README:

    docker tag yaafe yaafe/yaafe

    should be

    docker tag yaafe/yaafe yaafe

    Best.

    opened by helma 4
  • Segmentation Fault with Derivate" on some files">

    Segmentation Fault with "TemporalShapeStatistics > Derivate" on some files

    Hallo!

    I get crashes when computing the derivative of a TemporalShapeStatistics feature on some rare input audio files (all tested with latest Yaafe master branch, on Ubuntu).

    How to reproduce the crash:

    from yaafelib import *
    
    # Link to the example audiofile:
    # https://www.dropbox.com/s/0ypcwyhp8exzq1z/crash-yaafe-derivative-16k.wav?dl=0
    audiofile = "crash-yaafe-derivative-16k.wav" 
    
    fp = FeaturePlan(sample_rate=16000)
    fp.addFeature('tempshape_d1: TemporalShapeStatistics blockSize=1024 stepSize=512 > Derivate DOrder=1')
    df = fp.getDataFlow()
    engine = Engine()
    engine.load(df)
    
    
    afp = AudioFileProcessor()
    afp.processFile(engine, audiofile)
    feats = engine.readAllOutputs()
    

    The segmentation fault happens in Yaafe/src_cpp/yaafe-core/ComponentHelpers.h, line 189:

          while (!in->empty())
          {
            const double* inPtr = in->readToken();  // <- here it crashes !!!!!!
            double* outPtr = out->writeToken();
            for (int i=0;i<m_size;i++)
            {
                ...
    

    I tried to fix the problem, but I am not really sure how to not interfere with the underlying algorithm. It would be highly appreciated, if anyone has some tips how to fix that - please let me know if I can help in any way!

    Thanks a lot, LG Georg

    opened by gholzmann 6
  • Can not open libyaafe-python.so

    Can not open libyaafe-python.so

    OSError: libyaafe-python.so: cannot open shared object file: No such file or directory I don't know why this happen.Everything is good when I was installing this.But I can not import yaafelib.Thanks a lot for your help.

    opened by MXuer 0
Releases(0.70)
  • 0.70(Mar 29, 2017)

    This is a major release incorporating many bug fixes from contributors.

    It also merge the former Telecom Paristech Yaafe extension including many great audio features into Yaafe. Last but not least it adds Python 3 support to Yaafe.

    Source code(tar.gz)
    Source code(zip)
Owner
Yaafe
Yaafe
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 5.1k Jan 2, 2023
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 3.8k Feb 17, 2021
LibXtract is a simple, portable, lightweight library of audio feature extraction functions.

LibXtract LibXtract is a simple, portable, lightweight library of audio feature extraction functions. The purpose of the library is to provide a relat

Jamie Bullock 215 Nov 16, 2022
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 419 Dec 26, 2022
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 359 Feb 15, 2021
Audio spatialization over WebRTC and JACK Audio Connection Kit

Audio spatialization over WebRTC Spatify provides a framework for building multichannel installations using WebRTC.

Bruno Gola 34 Jun 29, 2022
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 8, 2023
praudio provides audio preprocessing framework for Deep Learning audio applications

praudio provides objects and a script for performing complex preprocessing operations on entire audio datasets with one command.

Valerio Velardo 105 Dec 26, 2022
convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format.

convert-to-opus-cli convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format. Installation Must have installed ffmp

null 4 Dec 21, 2022
L-SpEx: Localized Target Speaker Extraction

L-SpEx: Localized Target Speaker Extraction The data configuration and simulation of L-SpEx. The code scripts will be released in the future. Data Gen

Meng Ge 20 Jan 2, 2023
Audio fingerprinting and recognition in Python

dejavu Audio fingerprinting and recognition algorithm implemented in Python, see the explanation here: How it works Dejavu can memorize audio by liste

Will Drevo 6k Jan 6, 2023
kapre: Keras Audio Preprocessors

Kapre Keras Audio Preprocessors - compute STFT, ISTFT, Melspectrogram, and others on GPU real-time. Tested on Python 3.6 and 3.7 Why Kapre? vs. Pre-co

Keunwoo Choi 867 Dec 29, 2022
Python library for audio and music analysis

librosa A python package for music and audio analysis. Documentation See https://librosa.org/doc/ for a complete reference manual and introductory tut

librosa 5.6k Jan 6, 2023
?️ Open Source Audio Matching and Mastering

Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

Sergey Grishakov 781 Jan 5, 2023
Manipulate audio with a simple and easy high level interface

Pydub Pydub lets you do stuff to audio in a way that isn't stupid. Stuff you might be looking for: Installing Pydub API Documentation Dependencies Pla

James Robert 6.6k Jan 1, 2023
Scalable audio processing framework written in Python with a RESTful API

TimeSide : scalable audio processing framework and server written in Python TimeSide is a python framework enabling low and high level audio analysis,

Parisson 340 Jan 4, 2023
Python module for handling audio metadata

Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, MP4, Monkey's Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg The

Quod Libet 1.1k Dec 31, 2022
Python I/O for STEM audio files

stempeg = stems + ffmpeg Python package to read and write STEM audio files. Technically, stems are audio containers that combine multiple audio stream

Fabian-Robert Stöter 72 Dec 23, 2022
Python library for handling audio datasets.

AUDIOMATE Audiomate is a library for easy access to audio datasets. It provides the datastructures for accessing/loading different datasets in a gener

Matthias 121 Nov 27, 2022