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
๐™ฐ ๐™ผ๐šž๐šœ๐š’๐šŒ ๐™ฑ๐š˜๐š ๐™ฒ๐š›๐šŽ๐šŠ๐š๐šŽ๐š ๐™ฑ๐šข ๐šƒ๐šŽ๐šŠ๐š–๐™ณ๐š•๐š ๐Ÿ’–

TeamDltmusic ๐™ฐ ๐™ผ๐šž๐šœ๐š’๐šŒ ๐™ฑ๐š˜๐š ๐™ฒ๐š›๐šŽ๐šŠ๐š๐šŽ๐š ๐™ฑ๐šข ๐šƒ๐šŽ๐šŠ๐š–๐™ณ๐š•๐š ๐Ÿ’– Deploy String Session String Click hear you can find string session OR join He

TeamDlt 5 Jan 18, 2022
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
music library manager and MusicBrainz tagger

beets Beets is the media library management system for obsessive music geeks. The purpose of beets is to get your music collection right once and for

beetbox 11.3k Dec 31, 2022
Music player - endlessly plays your music

Music player First, if you wonder about what is supposed to be a music player or what makes a music player different from a simple media player, read

Albert Zeyer 482 Dec 19, 2022
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
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
Python CD-DA ripper preferring accuracy over speed

Whipper Whipper is a Python 3 (3.6+) CD-DA ripper based on the morituri project (CDDA ripper for *nix systems aiming for accuracy over speed). It star

671 Jan 04, 2023
Music generation using ml / dl

Data analysis Document here the project: deep_music Description: Project Description Data Source: Type of analysis: Please document the project the be

0 Jul 03, 2022
MUSIC-AVQA, CVPR2022 (ORAL)

Audio-Visual Question Answering (AVQA) PyTorch code accompanies our CVPR 2022 paper: Learning to Answer Questions in Dynamic Audio-Visual Scenarios (O

44 Dec 23, 2022
Port Hitsuboku Kumi Chinese CVVC voicebank to deepvocal. / ็ญ†ๅขจใ‚ฏใƒŸDeepvocalไธญๆ–‡้Ÿณๆบ

Hitsuboku Kumi (็ญ†ๅขจใ‚ฏใƒŸ) is a UTAU virtual singer developed by Cubialpha. This project ports Hitsuboku Kumi Chinese CVVC voicebank to deepvocal. This is the first open-source deepvocal voicebank on Gith

8 Apr 26, 2022
extract unpack asset file (form unreal engine 4 pak) with extenstion *.uexp which contain awb/acb (cri/cpk like) sound or music resource

Uexp2Awb extract unpack asset file (form unreal engine 4 pak) with extenstion .uexp which contain awb/acb (cri/cpk like) sound or music resource. i ju

max 6 Jun 22, 2022
Audio Retrieval with Natural Language Queries: A Benchmark Study

Audio Retrieval with Natural Language Queries: A Benchmark Study Paper | Project page | Text-to-audio search demo This repository is the implementatio

21 Oct 31, 2022
Terminal-based audio-to-text converter

att Terminal-based audio-to-text converter Project description A terminal-based audio-to-text converter written in python, enabling you to convert .wa

Sven Eschlbeck 4 Dec 15, 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
Use python MIDI to write some simple music

Use Python MIDI to write songs

ๅฐๅฎ 1 Nov 19, 2021
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
Stevan KZ 1 Oct 27, 2021
Simple discord bot by @merive ๐Ÿค–

Parzibot Powerful and Useful Discord Bot on Python. The source code of the bot is available to everyone. Parzibot uses English language. This is free

merive_ 3 Dec 28, 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
Omniscient Mozart, being able to transcribe everything in the music, including vocal, drum, chord, beat, instruments, and more.

OMNIZART Omnizart is a Python library that aims for democratizing automatic music transcription. Given polyphonic music, it is able to transcribe pitc

MCTLab 1.3k Jan 08, 2023