spafe: Simplified Python Audio-Features Extraction

Overview

spafe: Simplified Python Audio-Features Extraction

Build Status Documentation Status License Python Coverage Status codecov PyPI version anaconda Downloads Codacy Badge codebeat badge

spafe aims to simplify features extractions from mono audio files. The library can extract of the following features: BFCC, LFCC, LPC, LPCC, MFCC, IMFCC, MSRCC, NGCC, PNCC, PSRCC, PLP, RPLP, Frequency-stats etc. It also provides various filterbank modules (Mel, Bark and Gammatone filterbanks) and other spectral statistics.

Installation

Dependencies

spafe requires:

  • Python (>= 3.5)
  • NumPy (>= 1.17.2)
  • SciPy (>= 1.3.1)

User installation

If you already have a working installation of numpy and scipy, you can simply install spafe using pip:

pip install -U spafe

or conda (not available at the moment):

conda install spafe

How to use

Various examples on how to use spafe filter banks or feature extraction techniques are available under examples.

Contributing

Contributions are welcome and encouraged. To learn more about how to contribute to spafe please refer to the Contributing guidelines

Comments
  • Comparing Spafe with librosa and surfboard

    Comparing Spafe with librosa and surfboard

    This is both a comment for the paper and for the repo's README: the first python lib that came to my mind when I saw the review request was librosa. Could you - in the paper's statement of need - elaborate on why this lib is relevant in comparison to what librosa already provides? This would neatly fit with the other challengers (namely, Bob, SpeechPy and python_speech_features). The same argument could be made with the less well-known surfboard.

    As a side note and quasi-request, it'd be nice to have such a comparison outlined in the README. If I were someone that came across this repo, i'd like to know how this is not "yet another audio feature extraction lib", and how this one might fit my needs (especially in comparison to other libs). If I were of bad faith, i'd say i'd like to see a bit of marketing :smiling_imp:

    opened by hadware 8
  • Run examples has TypeError:

    Run examples has TypeError:

    TypeError: dct(): incompatible function arguments. The following argument types are supported: 1. (a: array, type: int, axes: object = None, inorm: int = 0, out: object = None, nthreads: int = 1) -> array

    opened by Amforever 8
  • segmentation fault

    segmentation fault

    segmentation fault occured when my program attempted to access the frames which returned by the function stride_trick the signal length is 1852416 in "stride_trick" a.size returns 3704832

    question 
    opened by weixiu00 6
  • Type hinting and general code review

    Type hinting and general code review

    Reference Issue

    This is part of the code review for JOSS: https://github.com/openjournals/joss-reviews/issues/4739

    This PR is based on the edits from #44 . That other PR should probably be merged before this one.

    What does this implement/fix? Explain your changes.

    This PR has has three aims:

    • I'll add type hints to the function signatures (I hope you don't mind, but I really do love type hints, @hbredin might testify on this)
    • Adding type hints sort of forces me to comb through the code and get a better understanding it of it
    • If I see fishy things I might :
      • either add a # TODO or # WARNING comment for you to solve. You can probably solve them by directly pushing in this PR if you wish
      • correct them myself if they're extremely obvious. In this case you might want to check that I haven't done anything bad.
    opened by hadware 4
  • Fixes to setup, dependencies and CI

    Fixes to setup, dependencies and CI

    Reference Issue

    This is a PR relating to https://github.com/openjournals/joss-reviews/issues/4739#issuecomment-1260768703

    First of all, since this is our first contact, I have to say that this lib is very well made :smiley: , thanks a lot for your work! The code is very clean, the API is very clear, the tests are very exhaustive, and the documentation seems to be very complete.

    The changes in this PR are somewhat nickpicky, but I think they really help making the lib more "standard".

    What does this implement/fix? Explain your changes.

    This fixes and "standardizes" a couple of things:

    • I move most of the constants from the spafe/version.py to the setup.py , as this was not a standard thing to do. If this choice was very opinionated (i.e., you had a very good reason to do so), you can obviously revert that.
    • I put the test and documentation dependencies in tests and docs , in the extras_require field. This is somewhat more standard, and allows the user to run pip install spafe[docs] or pip install spafe[tests] which I think is a bit cleaner. Note that running pip install spafe[anything] installs the "main" dependencies by default.
    • I left the "main" dependencies in the requirements.txt, as i think this to be pretty practical.
    • Having the ability to plot things is very good, but requiring the install of matplotlib by default is, I think, a bit bloated. I made this dependency optional, and added its install through pip install spafe[plotting]. You should probably say something about that in the install instructions.
    • I relaxed the required versions for scipy/numpy ( >= instead of == , this is very useful if spafe has to share its env with some other libraries)
    • I fixed the github actions in several ways:
      • I used a pip install instead of conda install, this makes the tests setup faster and much simpler
      • The old config didn't use the python-version matrix
      • I removed the tests for python 3.5 and 3.6 (they wouldn't be able to run anyway, the required numpy/scipy versions were not available for theses versions of python).
      • I added an action for the documentation. This couldn't run with the others actions, as you don't want a PR branch to activate a doc build.
    opened by hadware 4
  • The discription of

    The discription of " gammatone_fbanks.gammatone_filter_banks" of document is out of the version

    By written in pycharm of the piece of the code in the document, I found that the "return" of the method is not a array of fbanks but a array of "a array of fbanks" and another array that I dont know its mean, I guess it is an array of center frequencies by print it out. Please fix up the document.

    opened by WindDevil 3
  • IndexError: index 3806427 is out of bounds for axis 0 with size 39168

    IndexError: index 3806427 is out of bounds for axis 0 with size 39168

      File "/usr/local/lib/python3.9/site-packages/spafe/features/spfeats.py", line 279, in extract_feats
        feats["mode_frequency"] = frequencies[amplitudes.argmax()]
    IndexError: index 3806427 is out of bounds for axis 0 with size 39168
    
      File "/usr/local/lib/python3.9/site-packages/spafe/features/spfeats.py", line 270, in extract_feats
        feats["peak_frequency"] = frequencies[np.argmax(amplitudes)]
    IndexError: index 3806427 is out of bounds for axis 0 with size 39168
    

    We are getting in the wrong way the argmax() of amplitudes when amplitudes dimensions is greater than 1.

    Moreover, mode_frequency and peak_frequency have the same value, because amplitudes.argmax() and np.argmax(amplitudes) are the same, but this is a different issue https://github.com/SuperKogito/spafe/issues/34

    opened by Helias 3
  • Value error: negative dimensions are not allowed when using spafe library

    Value error: negative dimensions are not allowed when using spafe library

    I am working in audio files and I use this code to extract lfcc features:

    audio_path = '03-01-02-02-01-01-01_norm.wav'

    fs, sig = scipy.io.wavfile.read(audio_path)

    lfcc = lfcc(sig, 13)

    but I have this value error:

    negative dimensions are not allowed
    

    I think that it is because my sig array has negative values, can you give me a way to fix it? Thank you for yor help

    question 
    opened by barrydjenaba 3
  • 'value error: shapes not aligned' while using pncc

    'value error: shapes not aligned' while using pncc

    pnccs = pncc(sig,fs,13) Traceback (most recent call last): File "", line 1, in File "D:\old data\Python\Python35\lib\site-packages\spafe\features\pncc.py", line 205, in pncc b=gammatone_filter.T) File "<array_function internals>", line 6, in dot ValueError: shapes (400,46) and (257,26) not aligned: 46 (dim 1) != 257 (dim 0)

    bug spafe.features 
    opened by mohammadalihumayun 3
  • MFE not found

    MFE not found

    i try this https://spafe.readthedocs.io/en/latest/features/mfcc.html, but got this "ImportError: cannot import name 'mfe' from 'spafe.features.mfcc'"

    bug documentation question 
    opened by ibnudaqiqil 3
  • fix: non-int issue and remove useless variables

    fix: non-int issue and remove useless variables

    Reference Issue

    closes https://github.com/SuperKogito/spafe/issues/14

    What does this implement/fix? Explain your changes.

    • Cast to int frame_length and frame_step as suggested from the issue.
    • Remove unused variables

    Any other comments?

    Thanks https://github.com/aacarneiro/spafe/commit/95a8c785a7982db697a2ee5ff9f57845f5f56f5f @aacarneiro

    opened by Helias 2
Releases(v0.2.0)
Owner
Ayoub Malek
MSc. in EE & IT from TUM, ML engineer, programming enthusiast and coffee addict.
Ayoub Malek
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 02, 2023
Analysis of voices based on the Mel-frequency band

Speaker_partition_module Analysis of voices based on the Mel-frequency band. Goal: Identification of voices speaking (diarization) and calculation of

1 Feb 06, 2022
Tradutor de um arquivo MIDI para ser usado em um simulador RISC-V(RARS)

Tradutor_MIDI-RISC-V Tradutor de um arquivo MIDI para ser usado em um simulador RISC-V(RARS) *O resultado sai com essa formatação: nota,duração,nota,d

Gabriel B. G. 4 Sep 02, 2022
A collection of free MIDI chords and progressions ready to be used in your DAW, Akai MPC, or Roland MC-707/101

A collection of free MIDI chords and progressions ready to be used in your DAW, Akai MPC, or Roland MC-707/101

921 Jan 05, 2023
❤️ Hi There Im Cozmo Music Bot A next gen powerful telegram group Music bot for get your Songs and music @Venuja_Sadew

🎵 Cozmo MUSIC 🎵 Cozmo Music is a Music powerfull bot for playing music on telegram voice chat groups. Requirements FFmpeg NodeJS nodesource.com Pyth

Venuja Sadew 3 Jan 08, 2022
GNOME powered sound conversion

SoundConverter A simple sound converter application for the GNOME environment. It reads anything the GStreamer library can read, and writes Ogg Vorbis

Gautier Portet 188 Dec 17, 2022
Dataset and baseline code for the VocalSound dataset (ICASSP2022).

VocalSound: A Dataset for Improving Human Vocal Sounds Recognition Introduction Citing Download VocalSound Dataset Details Baseline Experiment Contact

Yuan Gong 58 Jan 03, 2023
A simple voice detection system which can be applied practically for designing a device with capability to detect a baby’s cry and automatically turning on music

Auto-Baby-Cry-Detection-with-Music-Player A simple voice detection system which can be applied practically for designing a device with capability to d

2 Dec 15, 2021
SolidMusic rewrite version, need help

Telegram Streamer Bot This is rewrite version of solidmusic, but it can't be deployed now, help me to make this bot running fast and good. If anyone w

Shohih Abdul 63 Jan 06, 2022
🎵 Python sound notifications made easy

chime Python sound notifications made easy. Table of contents Table of contents Motivation Installation Basic usage Theming IPython/Jupyter magic Exce

Max Halford 231 Jan 09, 2023
TwitterMusicBot - A Twitter bot with Spotify integration.

A Twitter Music Bot 🤖 🎵 🎶 I created this project to learn more about APIs, so it only works for student purposes. Initially, delving into the Spoti

Gustavo Oliveira 2 Jan 02, 2022
Use android as mic/speaker for ubuntu

Pulse Audio Control Panel Platforms Requirements sudo apt install ffmpeg pactl (already installed) Download Download the AppImage from release page ch

19 Dec 01, 2022
Analyze, visualize and process sound field data recorded by spherical microphone arrays.

Sound Field Analysis toolbox for Python The sound_field_analysis toolbox (short: sfa) is a Python port of the Sound Field Analysis Toolbox (SOFiA) too

Division of Applied Acoustics at Chalmers University of Technology 69 Nov 23, 2022
A simple music player, powered by Python, utilising various libraries such as Tkinter and Pygame

A simple music player, powered by Python, utilising various libraries such as Tkinter and Pygame

PotentialCoding 2 May 12, 2022
Okaeri-Music is a telegram music bot project, allow you to play music on voice chat group telegram.

🗄️ PROJECT MUSIC,THIS IS MAINTAINED Okaeri-Music is a telegram bot project that's allow you to play music on telegram voice chat group Features 🔥 Th

Okaeri-Project 2 Dec 23, 2021
Code for paper 'Audio-Driven Emotional Video Portraits'.

Audio-Driven Emotional Video Portraits [CVPR2021] Xinya Ji, Zhou Hang, Kaisiyuan Wang, Wayne Wu, Chen Change Loy, Xun Cao, Feng Xu [Project] [Paper] G

197 Dec 31, 2022
Multi-Track Music Generation with the Transfomer and the Johann Sebastian Bach Chorales dataset

MMM: Exploring Conditional Multi-Track Music Generation with the Transformer and the Johann Sebastian Bach Chorales Dataset. Implementation of the pap

102 Dec 08, 2022
MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling

MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling Demos | Blog Post | Colab Notebook | Paper | MIDI-DDSP is a hierarchical

Magenta 239 Jan 03, 2023
Sparse Beta-Divergence Tensor Factorization Library

NTFLib Sparse Beta-Divergence Tensor Factorization Library Based off of this beta-NTF project this library is specially-built to handle tensors where

Stitch Fix Technology 46 Jan 08, 2022
Implicit neural differentiable FM synthesizer

Implicit neural differentiable FM synthesizer The purpose of this project is to emulate arbitrary sounds with FM synthesis, where the parameters of th

Andreas Jansson 34 Nov 06, 2022