473,419 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software 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 1111

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: 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.