Giter VIP home page Giter VIP logo

pyaca's Introduction

GitHub top language PyPI - Python Version GitHub release (latest SemVer) DOI GitHub issues GitHub last commit GitHub

pyACA

Python scripts accompanying the book "An Introduction to Audio Content Analysis". The source code shows example implementations of basic approaches, features, and algorithms for music audio content analysis.

All implementations are also available in:

functionality

The top-level functions are (alphabetical):

The names of the additional functions follow the following conventions:

documentation

The latest full documentation of this package can be found at https://alexanderlerch.github.io/pyACA.

design principles

Please note that the provided code examples are only intended to showcase algorithmic principles โ€“ they are not entirely suitable for practical usage without parameter optimization and additional algorithmic tuning. Rather, they intend to show how to implement audio analysis solutions and to facilitate algorithmic understanding to enable the reader to design and implement their own analysis approaches.

minimal dependencies

The required dependencies are reduced to a minimum, more specifically to only numpy and scipy, for the following reasons:

  • accessibility, i.e., clear algorithmic implementation from scratch without obfuscation by using 3rd party implementations,
  • maintainability through independence of 3rd party code. This design choice brings, however, some limitations; for instance, reading of non-RIFF audio files is not supported and the machine learning models are very simple.

readability

Consistent variable naming and formatting, as well as the choice for simple implementations allow for easier parsing. The readability of the source code will sometimes come at the cost of lower performance.

cross-language comparability

All code is matched exactly with Matlab implementations and the equations in the book. This also means that the python code might violate typical python style conventions in order to be consistent.

related repositories and links

The python source code in this repository is matched with corresponding source code in the Matlab repository. A C++ implementation with identical functionality can be found in the C++ repository.

Other, related repositories are

  • ACA-Slides: slide decks for teaching and learning audio content analysis
  • ACA-Plots: Matlab scripts for generating all plots in the book and slides

The main entry point to all book-related information is AudioContentAnalysis.org

getting started

installation

pip install pyACA 

code examples

example 1: computation and plot of the Spectral Centroid

import pyACA
import matplotlib.pyplot as plt 

# file to analyze
cPath = "c:/temp/test.wav"

# extract feature
[v, t] = pyACA.computeFeatureCl(cPath, "SpectralCentroid")

# plot feature output
plt.plot(t,np.squeeze(v))

example 2: Computation of two features (here: Spectral Centroid and Spectral Flux)

import pyACA

# read audio file
cPath = "c:/temp/test.wav"
[f_s, afAudioData] = pyACA.ToolReadAudio(cPath)

# compute feature
[vsc, t] = pyACA.computeFeature("SpectralCentroid", afAudioData, f_s)
[vsf, t] = pyACA.computeFeature("SpectralFlux", afAudioData, f_s)

pyaca's People

Contributors

alexanderlerch avatar kaushalsali avatar richard-yang-bose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyaca's Issues

Issue insalling with pip on a macos venv

I'm trying to install pyACA in a venv but I can't succed to install pyACA.

The erros is :
pip install https://github.com/alexanderlerch/pyACA.git
Collecting https://github.com/alexanderlerch/pyACA.git
Downloading https://github.com/alexanderlerch/pyACA.git
/ 162 kB 2.4 MB/s
ERROR: Cannot unpack file /private/var/folders/23/_3qwnfqc8xj09j006s6mmcgr0000gp/T/pip-unpack-7hnq4j91/pyACA.git (downloaded from /private/var/folders/23/_3qwnfqc8xj09j006s6mmcgr0000gp/T/pip-req-build-768hmqvn, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of /private/var/folders/23/_3qwnfqc8xj09j006s6mmcgr0000gp/T/pip-req-build-768hmqvn

All the best
Yan

add computeSpectrogram

replace scipy spectrogram function (who would come up with this absurd function signature?) with self-made block by block np fft

script computepitch

Dear Professor Lerch,

I used one of your scripts,
computepitch, in order to list F0 values and time stamps,

Would it be possible that for values that should be zero, or in Praat tool 'undefined', extremely high values are generated. Do you have an idea, what the issue is ?

Thanks

Best regards

refactor

Check for consistent variable/function/file naming, order of function parameters, and order of return values.

Ensure that helper functions (e.g., ToolDownmix} are used where relevant to avoid code duplication

A little oversight in sample code

Hi Professor Alexander,

There is a little oversight in the code that may be confusing when running the sample code, not a problem though.

In the function computeFeatureCl https://github.com/alexa nderlerch/pyACA/blob/cd1bcad2f0fee38037ef4e9b9929e03a95ae8491/pyACA/computeFeature.py#L111

def computeFeatureCl(cPath, cFeatureName, bPlotOutput = False):

    # read audio file
    [f_s, afAudioData] = ToolReadAudio(cPath)
    afAudioData = np.sin(2*np.pi * np.arange(f_s*1)*440./f_s)

The test code was not commented so 'afAudioData' is always overwritten after reading from a wav file.

Thanks for your work!

Sincerely,
Zhe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.