473,549 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 401

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

Similar topics

0
1447
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 a Python DLL (and if so, how can it be done) or to distribute the "raw" sourcecode of these classes etc.? What would be the best solution, so that...
3
6669
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
1683
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 module seems be broken down in a somewhat abitrary way. You have to get use to it to find the way around. ...
0
1239
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 library) http://pyxmpp.jabberstudio.org/ xmpp.py (a russian alternative. Very well documented and apparently quite complete)
6
3579
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 library or module. [I used google, and the module search tools on python. Can somebody point me to an MSAccess library/module that does that?
10
1724
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 it exist in pdf or chm form? Q2. In some other languages (for instance PHP if I recall correctly) readers can add comments and give examples to...
2
1660
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
940
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
1263
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 as string methods and string services are dispersed. Another annoyance is that it is so verbose: this is good for Python newbies, but frustrating...
0
1136
by: Jonas | last post by:
Quoting Christopher Lenz: ----------------------------------------------------------------------------------------- Babel 0.8 - Jun 20, 2007 ======================== We're proud to present the latest release of the Babel: 0.8. Babel is a Python library that provides an integrated collection of utilities that assist with...
0
7520
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7470
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.