AutoWave is a complete audio automatic classification package with plottings, audio analysis, data loading, and other capabilities.
Project description
AutoWave - Automatic Audio Classification Library
AutoWave is an complete audio automatic classification library with other features plottings,audio agumentaion, data loading etc.
Creators
Nilesh Verma
Satyajit Pattnaik
Kalash Jindal
Features
- Training the model fastly
- Augumentation can be done easily on one or multiple file and while training model we can use augumentation
- Plotting of single or multiples files can be done by just running one function
- Multiple models can be trained simultaneously
Installation
This library is compatible with both windows and Linux system you can just use PIP command to install this library on your system:
pip install AutoWave
How To Use?
We have provided the Demo folder under the GitHub repository, you can find the example in both .py and .ipynb file. Following are the ideal flow of the code:
1. Importing the Important Classes
There are three important classes you need to load AudioPlayer - for playing the audio , audioConversion - for converting the single audio file, read_file_properties - for getting the info of any wave file ,augumentOneFile - for augumenting any single file ,augumentFolder - for augumenting the whole folder,plotOneFile - for plotting one file,plotMultipleFile -n for plotting multiple files ,gen_data_from_folder - for generating the data for classification,Auto_Audio_Classification - for training the model
# Importing the proper classes
from AutoWave.audio_player import AudioPlayer
from AutoWave.audio_conversion import audioConversion
from AutoWave.WaveInfo import read_file_properties
from AutoWave.augumentor import augumentOneFile,augumentFolder
from AutoWave.plotting import plotOneFile,plotMultipleFile
from AutoWave.DataLoad import gen_data_from_folder
from AutoWave.Auto_Audio_Classification import Auto_Audio_Classification
2. For playing the audio
For playing the audio you can use AudioPlayer which takes the path of the file as input
AudioPlayer('Test_Data/car_horn/107090-1-1-0.wav')
3. For converting the audio format
For converting the format of single file using audioConversion which take input the filename, input format and output format. It return the converted file in the same path
audioConversion('test.mp3','mp3','wav')
4. For Augumenting the audio file
For augumenting the single file augumentOneFile which take audio file path, output path, by default it augument one file 10 time by shifing, adding noise, changing pitch and streching. We can Off any one this functionality by making it False.
augumentOneFile('test.wav','augumented_data',aug_times=10,noise=True,shift=True,stretch=True,pitch=True)
For folder **augementFolder** which takes a dataframe generated using the **gen_data_from_folder**, output path, by default it augument one file 10 time by shifing, adding noise, changing pitch and streching. We can Off any one this functionality by making it False.
5. Reading the Info of the Wave file
For Reading the Wave file read_file_properties take the path of audio file and returns the filename, number of channels, sample rate and bit depth.
read_file_properties('test.wav')
6. ForPloting the audio file
For augumenting the single file plotOneFile which has different functions for ploting like time_fre_domain for plotting in time and frequency domain, fre_doman for ploting in frequency domain, time_domain for ploting in time doamin, waveplot for ploting the waveplot, spectrogram for ploting the spectrogram, spectral_centroid for ploting the spectral centroid, spectraal_rolloff for ploting the spectral rolloff, spectral_brandwidth for ploting the spectral brandwidth.
For folder plotMultipleFile which takes a dataframe generated using the gen_data_from_folder, which has different functions for ploting like time_fre_domain for plotting in time and frequency domain, fre_doman for ploting in frequency domain, time_domain for ploting in time doamin, waveplot for ploting the waveplot, spectrogram for ploting the spectrogram, spectral_centroid for ploting the spectral centroid, spectraal_rolloff for ploting the spectral rolloff, spectral_brandwidth for ploting the spectral brandwidth.
plotOneFile.time_freq_domain('Test.wav')
plotMultipleFile.time_freq_domain(data)
7. Loading the data
For loading the data from the folder gen_data_from_folder which takes the input the folder containing the different classes of the audio file in different folders in a sinlge folder and it returns the dataframe tha path of the each and every file with there label.
dataset_dir = 'Test_Data/'
data = gen_data_from_folder(dataset_dir,get_dataframe=True,label_folder=True)
8. For Training the model
For training the model we use Auto_Audio_Classification which takes the input the size of the test data, we can augument the data to by making aug_data = True, if want the trainned model then we can make get_prediction_model which will return the best model with higher accuracy, by making return _dataframe = True it will return the results in the dataframe format.
model = Auto_Audio_Classification(test_size=0.2,label_encoding=True,result_dataframe=False,aug_data=True)
model.fit(data)
audio_file = 'Test_Data/class_2/test1.wav'
model.predict(audio_file)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file AutoWave-0.5.tar.gz
.
File metadata
- Download URL: AutoWave-0.5.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19e2a054b425c0c7af2cc36beac330f8c83e30e5251bf8b75660585be780803d |
|
MD5 | 4d3863ac59a6c9a772374bcfca62dde9 |
|
BLAKE2b-256 | 2150dca707f78025cdb22f294d0498c8ce68a6a9874b8313c1f044fa79221648 |