473,395 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,395 developers and data experts.

Python: A library for audio and music analysis, feature extraction

2
https://github.com/libAudioFlux/audioFlux

AudioFlux is a library for audio and music analysis and feature extraction, which supports dozens of time-frequency analysis and transformation methods, as well as hundreds of corresponding time-domain and frequency-domain feature combinations, which can be provided to the deep learning network for training and can be used to study the classification, separation, music information retrieval (MIR), ASR and other tasks in the audio field.




Project highlights
1. Systematic and multi-dimensional feature extraction and the combination can be flexibly used for various task research and analysis.
2. The performance is efficient, the core is mostly implemented in C, and FFT hardware acceleration based on different platforms is convenient for large-scale data feature extraction.
3. It applies to the mobile end and supports real-time calculation of the audio stream at the mobile end.

Code Demo
An example of Mel and MFCC features.
Expand|Select|Wrap|Line Numbers
  1.  pip install audioflux
Expand|Select|Wrap|Line Numbers
  1. import numpy as np
  2. import audioflux as af
  3.  
  4. import matplotlib.pyplot as plt
  5. from audioflux.display import fill_spec
  6.  
  7. # Get a 220Hz's audio file path
  8. sample_path = af.utils.sample_path('220')
  9.  
  10. # Read audio data and sample rate
  11. audio_arr, sr = af.read(sample_path)
  12.  
  13. # Extract mel spectrogram
  14. spec_arr, mel_fre_band_arr = af.mel_spectrogram(audio_arr, num=128, radix2_exp=12, samplate=sr)
  15. spec_arr = np.abs(spec_arr)
  16.  
  17. # Extract mfcc
  18. mfcc_arr, _ = af.mfcc(audio_arr, cc_num=13, mel_num=128, radix2_exp=12, samplate=sr)
  19.  
  20. # Display
  21. audio_len = audio_arr.shape[0]
  22. # calculate x/y-coords
  23. x_coords = np.linspace(0, audio_len / sr, spec_arr.shape[1] + 1)
  24. y_coords = np.insert(mel_fre_band_arr, 0, 0)
  25. fig, ax = plt.subplots()
  26. img = fill_spec(spec_arr, axes=ax,
  27.                 x_coords=x_coords, y_coords=y_coords,
  28.                 x_axis='time', y_axis='log',
  29.                 title='Mel Spectrogram')
  30. fig.colorbar(img, ax=ax)
  31.  
  32. fig, ax = plt.subplots()
  33. img = fill_spec(mfcc_arr, axes=ax,
  34.                 x_coords=x_coords, x_axis='time',
  35.                 title='MFCC')
  36. fig.colorbar(img, ax=ax)
  37.  
  38. plt.show()

Mar 15 '23 #1
0 353

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Henning Kage | last post by:
I'm writing a small Python library with some generic classes and interfaces, that can be used within other Python projects in our company. Would it be a better solution to compile this library into...
3
by: Parano | last post by:
Is there a Python library to access CVS? I tried to google search for it, but with "python cvs" you actually find alot of python projects that have CVS repository...
6
by: aurora | last post by:
Sometimes it is rather frustrated to use the Python Library Reference. It seems each section is hand crafted and it is up to the author decide the organization and coverage. For example the os...
0
by: Alessandro Bottoni | last post by:
Which Python library would you use for developing a small Jabber client? jabber.py (seems to be dead since 2003) http://jabberpy.sourceforge.net/ pyxmpp (looks like the "official" python...
6
by: Jonathon Blake | last post by:
All: I thought I had seen a python library/module that easily enabled one to read / write / create MSAccess databases a couple of years ago. Now, I can't find it, or any reference to such a...
10
by: bobueland | last post by:
The "Python LIbrary Reference" at http://docs.python.org/lib/contents.html seems to be an important document. I have two questions Q1. How do you search inside "Python LibraryReference" ? Does...
2
by: Allerdyce.John | last post by:
Is there a python library to parse C++ code file? If yes, can you please tell me where is it? Thank you.
0
by: buzzer | last post by:
Hi, anyone can advise or provide any source for performing feature extraction for images/patterns/character recognition in matlab environment? thanks
1
by: m.n.summerfield | last post by:
Although a fan of Python, I find the Python Library Reference page (lib.html) very inconvenient because of its book contents-like layout. Also, some things that seem to me to belong together, such...
0
by: Jonas | last post by:
Quoting Christopher Lenz: ----------------------------------------------------------------------------------------- Babel 0.8 - Jun 20, 2007 ======================== We're proud to present the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.