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
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
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

4 Dec 21, 2022
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
This is a python package that turns any images into MIDI files that views the same as them

image_to_midi This is a python package that turns any images into MIDI files that views the same as them. This package firstly convert the image to AS

Rainbow Dreamer 4 Mar 10, 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
A voice based calculator by using termux api in Android

termux_voice_calculator This is. A voice based calculator by using termux api in Android Instagram account 👉 👈 Requirements and installation Downloa

ʕ´•ᴥ•`ʔ╠ŞĦỮβĦa̷m̷╣ʕ´•ᴥ•`ʔ 2 Apr 29, 2022
Stevan KZ 1 Oct 27, 2021
The venturimeter works on the principle of Bernoulli's equation, i.e., the pressure decreases as the velocity increases.

The venturimeter works on the principle of Bernoulli's equation, i.e., the pressure decreases as the velocity increases. The cross-section of the throat is less than the cross-section of the inlet pi

Shankar Mahadevan L 1 Dec 03, 2021
A voice assistant which can be used to interact with your computer and controls your pc operations

Introduction 👨‍💻 It is a voice assistant which can be used to interact with your computer and also you have been seeing it in Iron man movies, but t

Sujith 84 Dec 22, 2022
This is a realtime voice translator program which gets input from user at any language and converts it to the desired language that the user asks

This is a realtime voice translator program which gets input from user at any language and converts it to the desired language that the user asks ...

Mohan Ram S 1 Dec 30, 2021
Carnatic Notes Predictor for audio files

Carnatic Notes Predictor for audio files Link for live application: https://share.streamlit.io/pradeepak1/carnatic-notes-predictor-for-audio-files/mai

1 Nov 06, 2021
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
📺Headless全自动B站直播录播、切片、上传一体工具

DDRecorder Headless全自动B站直播录播、切片、上传一体工具 感谢 FortuneDayssss/BilibiliUploader 安装指南(Windows) 在Release下载zip包解压。 修改配置文件config.json 双击运行DDRecorder.exe (这将使用co

322 Dec 27, 2022
A python wrapper for REAPER

pyreaper A python wrapper for REAPER (Robust Epoch And Pitch EstimatoR) Installation pip install pyreaper Demonstration notebnook http://nbviewer.jupy

Ryuichi Yamamoto 56 Dec 27, 2022
Nayeli: cool telegram groups vc music project

Nayeli-music Nayeli 🥀 is cool telegram 🍎 groups vc music project 🎋 . Nayeli-music Nayeli Deployment 🎋 📲 Esy deploy 🐾️ Source Owner ♥️ ❄️ He is s

Kasun bandara 2 Dec 20, 2021
Official implementation of A cappella: Audio-visual Singing VoiceSeparation, from BMVC21

Y-Net Official implementation of A cappella: Audio-visual Singing VoiceSeparation, British Machine Vision Conference 2021 Project page: ipcv.github.io

Juan F. Montesinos 12 Oct 22, 2022
Mina - A Telegram Music Bot 5 mandatory Assistant written in Python using Pyrogram and Py-Tgcalls

Mina - A Telegram Music Bot 5 mandatory Assistant written in Python using Pyrogram and Py-Tgcalls

3 Feb 07, 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
Algorithmic and AI MIDI Drums Generator Implementation

Algorithmic and AI MIDI Drums Generator Implementation

Tegridy Code 8 Dec 30, 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