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
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
A Python port and library-fication of the midicsv tool by John Walker.

A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.

Tim Wedde 52 Dec 29, 2022
Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm.

LPC_for_TTS Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm. ๅŸบไบŽLevinson-Durbin

Zewang ZHANG 58 Nov 17, 2022
A python program to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks.

I'm writing a python script to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks called ReCut. So far there are two

Dรถnerspiess 1 Oct 27, 2021
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
Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Sadew Jayasekara 15 Nov 12, 2022
:notes: Cross-platform music player

Exaile Exaile is a music player with a simple interface and powerful music management capabilities. Features include automatic fetching of album art,

Exaile 327 Dec 19, 2022
Suyash More 111 Jan 07, 2023
Enhanced Audio Player for Discord

Discodo is an enhanced audio player for discord

Mary 42 Oct 05, 2022
A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream).

rfsoapyfile A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream). The script is threaded fo

4 Dec 19, 2022
An 8D music player made to enjoy Halloween this year!๐Ÿค˜

HAPPY HALLOWEEN buddy! Split Player Hello There! Welcome to SplitPlayer... Supposed To Be A 8DPlayer.... You Decide.... It can play the ordinary audio

Akshat Kumar Singh 1 Nov 04, 2021
Small Python application that links a Digico console and Reaper, handling automatic marker insertion and tracking.

Digico-Reaper-Link This is a small GUI based helper application designed to help with using Digico's Copy Audio function with a Reaper DAW used for re

Justin Stasiw 10 Oct 24, 2022
Python tools for the corpus analysis of popular music.

CATCHY Corpus Analysis Tools for Computational Hook discovery Python tools for the corpus analysis of popular music recordings. The tools can be used

Jan VB 20 Aug 20, 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
A telegram bot for which is help to play songs in vc ๐Ÿฅฐ give ๐ŸŒŸ and fork this repo before use ๐Ÿ˜

TamilVcMusic ๐ŸŒŸ TamilVCMusicBot ๐ŸŒŸ Give your ๐Ÿ’™ Before clicking on deploy to heroku just click on fork and star just below How to deploy Click the bel

TamilBots 150 Dec 13, 2022
A Music Player Bot for Discord Servers

A Music Player Bot for Discord Servers

Halil Acar 2 Oct 25, 2021
Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.

Summary Pyroomacoustics is a software package aimed at the rapid development and testing of audio array processing algorithms. The content of the pack

Audiovisual Communications Laboratory 1k Jan 09, 2023
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
Voice package for Pycord adding extra features.

VoiceIO Voice package for Pycord adding extra features. Example Down bellow is an example of what you can currently do. import voiceio process = voic

pycord 1 Dec 24, 2021
GNU Radio โ€“ the Free and Open Software Radio Ecosystem

GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used wit

GNU Radio 4.1k Jan 06, 2023