Audio features extraction

Related tags

AudioYaafe
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
Open-Source Tools & Data for Music Source Separation: A Pragmatic Guide for the MIR Practitioner

Open-Source Tools & Data for Music Source Separation: A Pragmatic Guide for the MIR Practitioner

IELab@ Korea University 0 Nov 12, 2021
A2DP agent for promiscuous/permissive audio sinc.

Promiscuous Bluetooth audio sinc A2DP agent for promiscuous/permissive audio sinc for Linux. Once installed, a Bluetooth client, such as a smart phone

Jasper Aorangi 4 May 27, 2022
A tool for retrieving audio in the past

Rewinder A tool for retrieving audio in the past. Ever felt like, I need to remember that discussion which happened 10 min back. Now you can! Rewind a

Bharat 1 Jan 24, 2022
Convert complex chord names to midi notes

ezchord Simple python script that can convert complex chord names to midi notes Prerequisites pip install midiutil Usage ./ezchord.py Dmin7 G7 C timi

Alex Zhang 2 Dec 20, 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
Minimal command-line music player written in Python

pyms Minimal command-line music player written in Python. Designed with elegance and minimalism. Resizes dynamically with your terminal. Dependencies

12 Sep 23, 2022
:speech_balloon: SpeechPy - A Library for Speech Processing and Recognition: http://speechpy.readthedocs.io/en/latest/

SpeechPy Official Project Documentation Table of Contents Documentation Which Python versions are supported Citation How to Install? Local Installatio

Amirsina Torfi 870 Dec 27, 2022
This Bot can extract audios and subtitles from video files

Send any valid video file and the bot shows you available streams in it that can be extracted!!

TroJanzHEX 56 Nov 22, 2022
ianZiPu is a way to write notation for Guqin (古琴) music.

PyBetween Wrapper for Between - 비트윈을 위한 파이썬 라이브러리 Legal Disclaimer 오직 교육적 목적으로만 사용할수 있으며, 비트윈은 VCNC의 자산입니다. 악의적 공격에 이용할시 처벌 받을수 있습니다. 사용에 따른 책임은 사용자가

Nancy Yi Liang 8 Nov 25, 2022
Python game programming in Jupyter notebooks.

Jupylet Jupylet is a Python library for programming 2D and 3D games, graphics, music and sound synthesizers, interactively in a Jupyter notebook. It i

Nir Aides 178 Dec 09, 2022
Basically Play Pauses the song when it is safe to do so. when you die in a round

Basically Play Pauses the song when it is safe to do so. when you die in a round

AG_1436 1 Feb 13, 2022
gentle forced aligner

Gentle Robust yet lenient forced-aligner built on Kaldi. A tool for aligning speech with text. Getting Started There are three ways to install Gentle.

1.2k Dec 30, 2022
Praat in Python, the Pythonic way

Parselmouth - Praat in Python, the Pythonic way Parselmouth is a Python library for the Praat software. Though other attempts have been made at portin

Yannick Jadoul 786 Jan 09, 2023
Make an audio file (really) long-winded

longwind Make an audio file (really) long-winded Daily repetitions are an illusion anyway.

Vincent Lostanlen 2 Sep 12, 2022
Speech Algorithms Collections

Speech Algorithms Collections

Ryuk 498 Jan 06, 2023
An audio digital processing toolbox based on a workflow/pipeline principle

AudioTK Audio ToolKit is a set of audio filters. It helps assembling workflows for specific audio processing workloads. The audio workflow is split in

Matthieu Brucher 238 Oct 18, 2022
PatrikZero's CS:GO Hearing protection

Program that lowers volume when you die and get flashed in CS:GO. It aims to lower the chance of hearing damage by reducing overall sound exposure. Uses game state integration. Anti-cheat safe.

Patrik Žúdel 224 Dec 04, 2022
In this project we can see how we can generate automatic music using character RNN.

Automatic Music Genaration Table of Contents Project Description Approach towards the problem Limitations Libraries Used Summary Applications Referenc

Pronay Ghosh 2 May 27, 2022
OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

1.1k Jan 05, 2023
Spotify Song Recommendation Program

Spotify-Song-Recommendation-Program Made by Esra Nur Özüm Written in Python The aim of this project was to build a recommendation system that recommen

esra nur özüm 1 Jun 30, 2022