{"id":1525,"date":"2021-04-06T12:47:17","date_gmt":"2021-04-06T07:17:17","guid":{"rendered":"https:\/\/dphi.tech\/blog\/?p=1525"},"modified":"2022-11-15T14:58:07","modified_gmt":"2022-11-15T09:28:07","slug":"audio-data-analysis-using-deep-learning-with-python-part-1","status":"publish","type":"post","link":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/","title":{"rendered":"Audio Data Analysis Using Deep Learning with Python (Part 1)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A brief introduction to audio data processing and genre classification using Neural Networks and python.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"500\" height=\"167\" data-id=\"1527\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\" alt=\"\" class=\"wp-image-1527\"\/><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-5tkng\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">While much of the literature and buzz on deep learning concerns computer vision and natural language processing(NLP), audio analysis \u2014 a field that includes automatic speech recognition(ASR), digital signal processing, and music classification, tagging, and generation \u2014 is a growing subdomain of deep learning applications. Some of the most popular and widespread machine learning systems, virtual assistants Alexa, Siri, and Google Home, are largely products built atop models that can extract information from audio signals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Audio data analysis is about analyzing and understanding audio signals captured by digital devices, with numerous applications in the enterprise, healthcare, productivity, and smart cities. Applications include customer satisfaction analysis from customer support calls, media content analysis and retrieval, medical diagnostic aids and patient monitoring, assistive technologies for people with hearing impairments, and audio analysis for public safety.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the first part of this article series, we will talk about all you need to know before getting started with the audio data analysis and extract necessary features from a sound\/audio file. We will also build an Artificial Neural Network(ANN) for the music genre classification. In the second part, we will accomplish the same by creating the Convolutional Neural Network and will compare their accuracy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-6019l\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Audio file overview<\/li><li>Applications of Audio Processing<\/li><li>Audio Processing with Python<\/li><li>Spectrogram<\/li><li>Feature extraction from Audio signal<\/li><li>Genre classification using Artificial Neural Networks(ANN).<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-aob89\">Audio file overview<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The sound excerpts are digital audio files in .wav format. Sound waves are digitized by sampling them at discrete intervals known as the sampling rate (typically 44.1kHz for CD-quality audio meaning samples are taken 44,100 times per second).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each sample is the amplitude of the wave at a particular time interval, where the bit depth determines how detailed the sample will be also known as the dynamic range of the signal (typically 16bit which means a sample can range from 65,536 amplitude values).<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em><strong>What is Sampling and Sampling frequency?<\/strong><\/em> <em>In signal processing, sampling is the reduction of a continuous signal into a series of discrete values. The sampling frequency or rate is the number of samples taken over some fixed amount of time. A high sampling frequency results in less information loss but higher computational expense, and low sampling frequencies have higher information loss but are fast and cheap to compute.<\/em><\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"562\" data-id=\"1528\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114012-1024x562.jpg\" alt=\"\" class=\"wp-image-1528\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114012-1024x562.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114012-300x165.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114012-768x421.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114012.jpg 1050w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A sound wave, in red, represented digitally, in blue (after sampling and 4-bit quantization), with the resulting array shown on the right. Original \u00a9 Aquegg | Wikimedia Commons<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-8j92m\">Applications of Audio Processing<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">What are the potential applications of audio processing? Here I would list a few of them:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Indexing music collections according to their audio features.<\/li><li>Recommending music for radio channels<\/li><li>Similarity search for audio files (aka Shazam)<\/li><li>Speech processing and synthesis \u2014 generating artificial voice for conversational agents<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-7k34m\">Audio Data Handling using Python<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sound is represented in the form of an <strong>audio<\/strong> signal having parameters such as frequency, bandwidth, decibel, etc. A typical audio signal can be expressed as a function of Amplitude and Time.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"540\" height=\"378\" data-id=\"1529\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/FFT-Time-Frequency-View.png\" alt=\"\" class=\"wp-image-1529\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/FFT-Time-Frequency-View.png 540w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/FFT-Time-Frequency-View-300x210.png 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/commons.wikimedia.org\/wiki\/File:FFT-Time-Frequency-View.png\" target=\"_blank\" rel=\"noreferrer noopener\"><u>Frequency vs Time<\/u><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are devices built that help you catch these sounds and represent it in a computer-readable format. Examples of these formats are<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>wav (Waveform Audio File) format<\/li><li>mp3 (MPEG-1 Audio Layer 3) format<\/li><li>WMA (Windows Media Audio) format<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A typical audio processing process involves the extraction of acoustics features relevant to the task at hand, followed by decision-making schemes that involve detection, classification, and knowledge fusion. Thankfully we have some useful python libraries which make this task easier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Python Audio Libraries:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python has some great libraries for audio processing like Librosa and PyAudio.There are also built-in modules for some basic audio functionalities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will mainly use two libraries for audio acquisition and playback:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Librosa<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a Python module to analyze audio signals in general but geared more towards music. It includes the nuts and bolts to build a MIR(Music information retrieval) system. It has been very well <a href=\"https:\/\/librosa.github.io\/librosa\/\" target=\"_blank\" rel=\"noreferrer noopener\"><u>documented<\/u><\/a> along with a lot of examples and tutorials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Installation:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install librosa\nor\nconda install -c conda-forge librosa<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To fuel more audio-decoding power, you can install <em><strong>ffmpeg<\/strong><\/em> which ships with many audio decoders.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. IPython.display.Audio<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/ipython.org\/ipython-doc\/stable\/api\/generated\/IPython.display.html#IPython.display.Audio\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>IPython.display.Audio<\/strong><\/u><\/a> lets you play audio directly in a jupyter notebook.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have uploaded a random audio file on the below page. Let us now load the file in your jupyter console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/vocaroo.com\/iMPozIbzB8T\">https:\/\/vocaroo.com\/iMPozIbzB8T<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Loading an audio file:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import librosa\naudio_data = '\/..\/..\/gruesome.wav'\nx , sr = librosa.load(audio_data)\nprint(type(x), type(sr))#&lt;class 'numpy.ndarray'&gt; &lt;class 'int'&gt;print(x.shape, sr)#(94316,) 22050<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This returns an audio time series as a numpy array with a default sampling rate(sr) of 22KHZ mono. We can change this behavior by resampling at 44.1KHz.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">librosa.load(audio_data, sr=44100)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">, or to disable resampling.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">librosa.load(audio_path, sr=None)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The sample<strong> rate<\/strong> is the number of samples of audio carried per second, measured in Hz or kHz.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Playing Audio:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using,<strong>IPython.display.Audio<\/strong> you can play the audio in your jupyter notebook.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import IPython.display as ipd\nipd.Audio(audio_data)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This returns an audio widget:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"167\" data-id=\"1530\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114247.jpg\" alt=\"\" class=\"wp-image-1530\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114247.jpg 757w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114247-300x66.jpg 300w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Visualizing Audio:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can plot the audio array using <a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.display.waveplot.html#librosa.display.waveplot\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>librosa.display.waveplot<\/strong><\/u><\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">%matplotlib inline\nimport matplotlib.pyplot as plt\nimport librosa.display\nplt.figure(figsize=(14, 5))\nlibrosa.display.waveplot(x, sr=sr)<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"374\" data-id=\"1531\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114322-1024x374.jpg\" alt=\"\" class=\"wp-image-1531\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114322-1024x374.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114322-300x110.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114322-768x281.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-114322.jpg 1040w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here, we have the plot of the amplitude envelope of a waveform.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"375\" data-id=\"1534\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif-3-207fd1fb8e6f.gif\" alt=\"\" class=\"wp-image-1534\"\/><\/figure>\n<\/figure>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gfycat.com\/ickyfilthybobolink\" target=\"_blank\" rel=\"noreferrer noopener\"><u>What is Amplitude, Wavelength, and Phase in a signal?<\/u><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-6cn1r\">Spectrogram<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A spectrogram is a visual way of representing the signal strength, or \u201c<strong>loudness<\/strong>\u201d, of a signal over time at various frequencies present in a particular waveform. Not only can one see whether there is more or less energy at, for example, 2 Hz vs 10 Hz, but one can also see how energy levels vary over time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A spectrogram is usually depicted as a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Heat_map\" target=\"_blank\" rel=\"noreferrer noopener\"><u>heat map<\/u><\/a>, i.e., as an image with the intensity shown by varying the color or brightness.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can display a spectrogram using. <a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.display.specshow.html\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>librosa.display.specshow<\/strong><\/u><\/a><strong>.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">X = librosa.stft(x)\nXdb = librosa.amplitude_to_db(abs(X))\nplt.figure(figsize=(14, 5))\nlibrosa.display.specshow(Xdb, sr=sr, x_axis='time', y_axis='hz')\nplt.colorbar()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">.stft() converts data into short term Fourier transform. <a href=\"https:\/\/www.youtube.com\/watch?v=g1_wcbGUcDY\" target=\"_blank\" rel=\"noreferrer noopener\"><u>STFT<\/u><\/a> converts signals such that we can know the amplitude of the given frequency at a given time. Using STFT we can determine the amplitude of various frequencies playing at a given time of an audio signal. .specshow is used to display a spectrogram.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-7 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"380\" data-id=\"1535\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115105.jpg\" alt=\"\" class=\"wp-image-1535\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115105.jpg 956w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115105-300x119.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115105-768x305.jpg 768w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The vertical axis shows frequencies (from 0 to 10kHz), and the horizontal axis shows the time of the clip. Since we see that all action is taking place at the bottom of the spectrum, we can convert the frequency axis to a logarithmic one.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">librosa.display.specshow(Xdb, sr=sr, x_axis='time', y_axis='log')\nplt.colorbar()<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-8 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"406\" data-id=\"1536\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115141.jpg\" alt=\"\" class=\"wp-image-1536\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115141.jpg 613w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115141-300x199.jpg 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create an Audio Signal:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import numpy as np\nsr = 22050 # sample rate\nT = 5.0    # seconds\nt = np.linspace(0, T, int(T*sr), endpoint=False) # time variable\nx = 0.5*np.sin(2*np.pi*220*t)# pure sine wave at 220 Hz\n#Playing the audio\nipd.Audio(x, rate=sr) # load a NumPy array\n#Saving the audio\nlibrosa.output.write_wav('tone_220.wav', x, sr)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-vu76\">Feature extraction from Audio signal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every audio signal consists of many features. However, we must extract the characteristics that are relevant to the problem we are trying to solve. The process of extracting features to use them for analysis is called feature extraction. Let us study a few of the features in detail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>spectral features<\/strong> (frequency-based <strong>features<\/strong>), which are obtained by converting the time-based signal into the frequency domain using the Fourier Transform, like fundamental frequency, frequency components, <strong>spectral<\/strong> centroid, <strong>spectral<\/strong> flux, <strong>spectral<\/strong> density, <strong>spectral<\/strong> roll-off, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Spectral Centroid<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>spectral centroid<\/strong> indicates at which frequency the energy of a spectrum is centered upon or in other words It indicates where the \u201d center of mass\u201d for a sound is located. This is like a weighted mean:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-9 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"547\" height=\"195\" data-id=\"1538\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115245.jpg\" alt=\"\" class=\"wp-image-1538\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115245.jpg 547w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115245-300x107.jpg 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">where S(k) is the spectral magnitude at frequency bin k, f(k) is the frequency at bin k.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.feature.spectral_centroid.html#librosa.feature.spectral_centroid\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>librosa.feature.spectral_centroid<\/strong><\/u><\/a> computes the spectral centroid for each frame in a signal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import sklearn\nspectral_centroids = librosa.feature.spectral_centroid(x, sr=sr)[0]\nspectral_centroids.shape\n(775,)\n# Computing the time variable for visualization\nplt.figure(figsize=(12, 4))frames = range(len(spectral_centroids))\nt = librosa.frames_to_time(frames)\n# Normalising the spectral centroid for visualisation\ndef normalize(x, axis=0):\n    return sklearn.preprocessing.minmax_scale(x, axis=axis)\n#Plotting the Spectral Centroid along the waveform\nlibrosa.display.waveplot(x, sr=sr, alpha=0.4)\nplt.plot(t, normalize(spectral_centroids), color='b')<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>.spectral_centroid<\/strong> will return an array with columns equal to the number of frames present in your sample.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-10 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1003\" height=\"372\" data-id=\"1539\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115330.jpg\" alt=\"\" class=\"wp-image-1539\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115330.jpg 1003w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115330-300x111.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115330-768x285.jpg 768w\" sizes=\"(max-width: 1003px) 100vw, 1003px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">There is a rise in the spectral centroid in the beginning.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Spectral Rolloff<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a measure of the shape of the signal. It represents the frequency at which high frequencies decline to 0. To obtain it, we have to calculate the fraction of bins in the power spectrum where 85% of its power is at lower frequencies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.feature.spectral_rolloff.html#librosa.feature.spectral_rolloff\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>librosa.feature.spectral_rolloff<\/strong><\/u><\/a> computes the roll off frequency for each frame in a signal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">spectral_rolloff = librosa.feature.spectral_rolloff(x+0.01, sr=sr)[0]\nplt.figure(figsize=(12, 4))librosa.display.waveplot(x, sr=sr, alpha=0.4)\nplt.plot(t, normalize(spectral_rolloff), color='r')<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-11 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"367\" data-id=\"1540\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115435-1024x367.jpg\" alt=\"\" class=\"wp-image-1540\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115435-1024x367.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115435-300x108.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115435-768x276.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115435.jpg 1037w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Spectral Bandwidth<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The spectral bandwidth is defined as the width of the band of light at one-half the peak maximum (or full width at half maximum [FWHM]) and is represented by the two vertical red lines and \u03bbSB on the wavelength axis.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-12 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"765\" height=\"838\" data-id=\"1541\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115528.jpg\" alt=\"\" class=\"wp-image-1541\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115528.jpg 765w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115528-274x300.jpg 274w\" sizes=\"(max-width: 765px) 100vw, 765px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.feature.spectral_bandwidth.html#librosa.feature.spectral_bandwidth\" target=\"_blank\" rel=\"noreferrer noopener\"><u><strong>librosa.feature.spectral_bandwidth<\/strong><\/u><\/a> computes the order-p spectral bandwidth:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">spectral_bandwidth_2 = librosa.feature.spectral_bandwidth(x+0.01, sr=sr)[0]\nspectral_bandwidth_3 = librosa.feature.spectral_bandwidth(x+0.01, sr=sr, p=3)[0]\nspectral_bandwidth_4 = librosa.feature.spectral_bandwidth(x+0.01, sr=sr, p=4)[0]\nplt.figure(figsize=(15, 9))librosa.display.waveplot(x, sr=sr, alpha=0.4)\nplt.plot(t, normalize(spectral_bandwidth_2), color='r')\nplt.plot(t, normalize(spectral_bandwidth_3), color='g')\nplt.plot(t, normalize(spectral_bandwidth_4), color='y')\nplt.legend(('p = 2', 'p = 3', 'p = 4'))<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-13 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"477\" data-id=\"1542\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115605.jpg\" alt=\"\" class=\"wp-image-1542\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115605.jpg 1025w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115605-300x140.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115605-768x357.jpg 768w\" sizes=\"(max-width: 1025px) 100vw, 1025px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Zero-Crossing Rate<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A very simple way for measuring the smoothness of a signal is to calculate the number of zero-crossing within a segment of that signal. A voice signal oscillates slowly \u2014 for example, a 100 Hz signal will cross zero 100 per second \u2014 whereas an unvoiced fricative can have 3000 zero crossings per second.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-14 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"363\" data-id=\"1543\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115636-1024x363.jpg\" alt=\"\" class=\"wp-image-1543\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115636-1024x363.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115636-300x106.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115636-768x272.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115636.jpg 1032w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It usually has higher values for highly percussive sounds like those in metal and rock. Now let us visualize it and see how we calculate the zero-crossing rate.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">x, sr = librosa.load('\/..\/..\/gruesome.wav')\n#Plot the signal:\nplt.figure(figsize=(14, 5))\nlibrosa.display.waveplot(x, sr=sr)\n# Zooming in\nn0 = 9000\nn1 = 9100\nplt.figure(figsize=(14, 5))\nplt.plot(x[n0:n1])\nplt.grid()<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-15 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"370\" data-id=\"1544\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115717-1024x370.jpg\" alt=\"\" class=\"wp-image-1544\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115717-1024x370.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115717-300x108.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115717-768x277.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115717.jpg 1038w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Zooming in<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">n0 = 9000\nn1 = 9100\nplt.figure(figsize=(14, 5))\nplt.plot(x[n0:n1])\nplt.grid()<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-16 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"354\" data-id=\"1545\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115754-1024x354.jpg\" alt=\"\" class=\"wp-image-1545\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115754-1024x354.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115754-300x104.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115754-768x265.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115754.jpg 1031w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">There appear to be 16 zero crossings. Let\u2019s verify it with Librosa.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">zero_crossings = librosa.zero_crossings(x[n0:n1], pad=False)\nprint(sum(zero_crossings))#16<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5. Mel-Frequency Cepstral Coefficients(MFCCs)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Mel frequency cepstral coefficients (MFCCs) of a signal are a small set of features (usually about 10\u201320) that concisely describe the overall shape of a spectral envelope. It models the characteristics of the human voice.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mfccs = librosa.feature.mfcc(x, sr=fs)\nprint(mfccs.shape)\n(20, 97)\n#Displaying  the MFCCs:\nplt.figure(figsize=(15, 7))\nlibrosa.display.specshow(mfccs, sr=sr, x_axis='time')<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-17 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"475\" data-id=\"1546\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115833.jpg\" alt=\"\" class=\"wp-image-1546\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115833.jpg 1017w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115833-300x140.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115833-768x359.jpg 768w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>6. Chroma feature<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A <strong>chroma feature or vector<\/strong> is typically a 12-element feature vector indicating how much energy of each pitch class, {C, C#, D, D#, E, \u2026, B}, is present in the signal. In short, It provides a robust way to describe a similarity measure between music pieces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/librosa.github.io\/librosa\/generated\/librosa.feature.chroma_stft.html#librosa.feature.chroma_stft\" target=\"_blank\" rel=\"noreferrer noopener\"><u>librosa.feature.chroma_stft<\/u><\/a> is used for the computation of Chroma features.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chromagram = librosa.feature.chroma_stft(x, sr=sr, hop_length=hop_length)\nplt.figure(figsize=(15, 5))\nlibrosa.display.specshow(chromagram, x_axis='time', y_axis='chroma', hop_length=hop_length, cmap='coolwarm')<\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-18 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"368\" data-id=\"1547\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115904-1024x368.jpg\" alt=\"\" class=\"wp-image-1547\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115904-1024x368.jpg 1024w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115904-300x108.jpg 300w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115904-768x276.jpg 768w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-115904.jpg 1047w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we understood how we can play around with audio data and extract important features using python. In the following section, we are going to use these features and build an ANN model for music genre classification.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-cnjfv\">Music genre classification using Artificial Neural Network<\/h2>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-19 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"281\" data-id=\"1548\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/1505480568music-band-cool-animated-gif-image-2.gif\" alt=\"\" class=\"wp-image-1548\"\/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/bestanimations.com\/Music\/Music.html\" target=\"_blank\" rel=\"noreferrer noopener\"><u>Credits<\/u><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This dataset was used for the well-known paper in genre classification \u201cMusical genre classification of audio signals\u201d by G. Tzanetakis and P. Cook in IEEE Transactions on Audio and Speech Processing 2002.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The dataset consists of 1000 audio tracks each 30 seconds long. It contains 10 genres, each represented by 100 tracks. The tracks are all 22050 Hz monophonic 16-bit audio files in .wav format.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The dataset can be download from <a href=\"http:\/\/marsyas.info\/downloads\/datasets.html\" target=\"_blank\" rel=\"noreferrer noopener\"><u>marsyas website.<\/u><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The dataset consists of 10 genres i.e<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Blues<\/li><li>Classical<\/li><li>Country<\/li><li>Disco<\/li><li>Hip-hop<\/li><li>Jazz<\/li><li>Metal<\/li><li>Pop<\/li><li>Reggae<\/li><li>Rock<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Each genre contains 100 songs. Total dataset: 1000 songs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before moving ahead, I would recommend using <a href=\"https:\/\/colab.research.google.com\/notebooks\/intro.ipynb#recent=true\" target=\"_blank\" rel=\"noreferrer noopener\"><u>Google Colab<\/u><\/a> for doing everything related to Neural networks because it is <strong>free<\/strong> and provides GPUs and TPUs as runtime environments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Roadmap:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, we need to convert the audio files into PNG format images(spectrograms). From these spectrograms, we have to extract meaningful features, i.e. MFCCs, Spectral Centroid, Zero Crossing Rate, Chroma Frequencies, Spectral Roll-off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the features have been extracted, they can be appended into a CSV file so that ANN can be used for classification.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we wanna work with image data instead of CSV we will use CNN(Scope of part 2).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So let&#8217;s begin.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Extract and load your data to google drive then mount the drive in Colab.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-20 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"700\" data-id=\"1549\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124438.jpg\" alt=\"\" class=\"wp-image-1549\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124438.jpg 558w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124438-239x300.jpg 239w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Google Colab directory structure after data is loaded.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Import all the required libraries.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>import<\/strong> <strong>librosa<\/strong>\n<strong>import<\/strong> <strong>pandas<\/strong> <strong>as<\/strong> <strong>pd<\/strong>\n<strong>import<\/strong> <strong>numpy<\/strong> <strong>as<\/strong> <strong>np<\/strong>\n<strong>import<\/strong> <strong>matplotlib<\/strong><strong>.<\/strong><strong>pyplot<\/strong> <strong>as<\/strong> <strong>plt<\/strong>\n%matplotlib inline\n<strong>import<\/strong> <strong>os<\/strong>\n<strong>from<\/strong> <strong>PIL<\/strong> <strong>import<\/strong> <strong>Image<\/strong>\n<strong>import<\/strong> <strong>pathlib<\/strong>\n<strong>import<\/strong> <strong>csvfrom<\/strong> <strong>sklearn<\/strong><strong>.<\/strong><strong>model_selection<\/strong> <strong>import<\/strong><strong> train_test_split<\/strong>\n<strong>from<\/strong><strong> sklearn<\/strong><strong>.<\/strong><strong>preprocessing <\/strong><strong>import<\/strong><strong> LabelEncoder<\/strong><strong>,<\/strong><strong> StandardScalerimport keras<\/strong>\n<strong>from<\/strong><strong> keras <\/strong><strong>import<\/strong><strong> layers<\/strong>\n<strong>from<\/strong><strong> keras <\/strong><strong>import<\/strong><strong> layers<\/strong>\n<strong>import<\/strong><strong> keras<\/strong>\n<strong>from<\/strong><strong> keras<\/strong><strong>.<\/strong><strong>models <\/strong><strong>import<\/strong><strong> Sequentialimport<\/strong> <strong>warnings<\/strong>\nwarnings.filterwarnings('ignore')<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Now convert the audio data files into PNG format images or basically extracting the Spectrogram for every Audio.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cmap = plt.get_cmap('inferno')\nplt.figure(figsize=(8,8))\ngenres = 'blues classical country disco hiphop jazz metal pop reggae rock'.split()\nfor g in genres:\n    pathlib.Path(f'img_data\/{g}').mkdir(parents=True, exist_ok=True)\n    for filename in os.listdir(f'.\/drive\/My Drive\/genres\/{g}'):\n        songname = f'.\/drive\/My Drive\/genres\/{g}\/{filename}'\n        y, sr = librosa.load(songname, mono=True, duration=5)\n        plt.specgram(y, NFFT=2048, Fs=2, Fc=0, noverlap=128, cmap=cmap, sides='default', mode='default', scale='dB');\n        plt.axis('off');\n        plt.savefig(f'img_data\/{g}\/{filename[:-3].replace(\".\", \"\")}.png')\n        plt.clf()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sample spectrogram of a song having genre as blues.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-21 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"561\" height=\"518\" data-id=\"1550\" src=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124611.jpg\" alt=\"\" class=\"wp-image-1550\" srcset=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124611.jpg 561w, https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-06-124611-300x277.jpg 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">spectrogram of a song having genre as Blues<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now since all the audio files got converted into their respective spectrograms it\u2019s easier to extract features.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Creating a header for our CSV file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">header = 'filename chroma_stft rmse spectral_centroid spectral_bandwidth rolloff zero_crossing_rate'\nfor i in range(1, 21):\n    header += f' mfcc{i}'\nheader += ' label'\nheader = header.split()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. Extracting features from Spectrogram: We will extract Mel-frequency cepstral coefficients (MFCC), Spectral Centroid, Zero Crossing Rate, Chroma Frequencies, and Spectral Roll-off.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">file = open('dataset.csv', 'w', newline='')\nwith file:\n    writer = csv.writer(file)\n    writer.writerow(header)\ngenres = 'blues classical country disco hiphop jazz metal pop reggae rock'.split()\nfor g in genres:\n    for filename in os.listdir(f'.\/drive\/My Drive\/genres\/{g}'):\n        songname = f'.\/drive\/My Drive\/genres\/{g}\/{filename}'\n        y, sr = librosa.load(songname, mono=True, duration=30)\n        rmse = librosa.feature.rmse(y=y)\n        chroma_stft = librosa.feature.chroma_stft(y=y, sr=sr)\n        spec_cent = librosa.feature.spectral_centroid(y=y, sr=sr)\n        spec_bw = librosa.feature.spectral_bandwidth(y=y, sr=sr)\n        rolloff = librosa.feature.spectral_rolloff(y=y, sr=sr)\n        zcr = librosa.feature.zero_crossing_rate(y)\n        mfcc = librosa.feature.mfcc(y=y, sr=sr)\n        to_append = f'{filename} {np.mean(chroma_stft)} {np.mean(rmse)} {np.mean(spec_cent)} {np.mean(spec_bw)} {np.mean(rolloff)} {np.mean(zcr)}'    \n        for e in mfcc:\n            to_append += f' {np.mean(e)}'\n        to_append += f' {g}'\n        file = open('dataset.csv', 'a', newline='')\n        with file:\n            writer = csv.writer(file)\n            writer.writerow(to_append.split())<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6. Data preprocessing: It involves loading CSV data, label encoding, feature scaling and data split into training and test set.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = pd.read_csv('dataset.csv')\ndata.head()# Dropping unneccesary columns\ndata = data.drop(['filename'],axis=1)#Encoding the Labels\ngenre_list = data.iloc[:, -1]\nencoder = LabelEncoder()\ny = encoder.fit_transform(genre_list)#Scaling the Feature columns\nscaler = StandardScaler()\nX = scaler.fit_transform(np.array(data.iloc[:, :-1], dtype = float))#Dividing data into training and Testing set\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">7. Building an ANN model.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">model = Sequential()\nmodel.add(layers.Dense(256, activation='relu', input_shape=(X_train.shape[1],)))\nmodel.add(layers.Dense(128, activation='relu'))\nmodel.add(layers.Dense(64, activation='relu'))\nmodel.add(layers.Dense(10, activation='softmax'))model.compile(optimizer='adam',\n              loss='sparse_categorical_crossentropy',\n              metrics=['accuracy'])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">8. Fit the model<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">classifier = model.fit(X_train,\n                    y_train,\n                    epochs=100,\n                    batch_size=128)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After 100 epochs, Accuracy: 0.67<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also find code on my Github: <a href=\"https:\/\/github.com\/nageshsinghc4\/Audio-Data-Analysis-Using-Deep-Learning\" target=\"_blank\" rel=\"noreferrer noopener\"><u>https:\/\/github.com\/nageshsinghc4\/Audio-Data-Analysis-Using-Deep-Learning<\/u><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"viewer-iset\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Well, part 1 ends here. In this article, we did a pretty good analysis of audio data. We understood how to extract important features and also implemented Artificial Neural Networks(ANN) to classify the music genre.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In part 2, we are going to do the same using Convolutional Neural Networks directly on the Spectrogram.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope you guys have enjoyed reading it. Please share your thoughts\/doubts in the comment section.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"viewer-d3k46\">Thanks for reading.<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Note:\u00a0<\/strong>T<em>his article was originally published on\u00a0<a href=\"https:\/\/www.theaidream.com\/post\/audio-data-analysis-using-deep-learning-with-python-part-1\">theaidream<\/a>, and kindly contributed to AI Planet (formerly DPhi) to spread the knowledge.<\/em><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A brief introduction to audio data processing and genre classification using Neural Networks and python. Introduction While much of the literature and buzz on deep learning concerns computer vision and natural language processing(NLP), audio analysis \u2014 a field that includes automatic speech recognition(ASR), digital signal processing, and music classification, tagging, and generation \u2014 is a [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[68,20,69,22],"class_list":["post-1525","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-audio-analysis","tag-datascience","tag-deep-learning","tag-machine-learning"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet\" \/>\n<meta property=\"og:description\" content=\"A brief introduction to audio data processing and genre classification using Neural Networks and python. Introduction While much of the literature and buzz on deep learning concerns computer vision and natural language processing(NLP), audio analysis \u2014 a field that includes automatic speech recognition(ASR), digital signal processing, and music classification, tagging, and generation \u2014 is a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"AI Planet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/aiplanet\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-06T07:17:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-15T09:28:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\" \/>\n<meta name=\"author\" content=\"Nagesh Singh Chauhan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nagesh Singh Chauhan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/\"},\"author\":{\"name\":\"Nagesh Singh Chauhan\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#\\\/schema\\\/person\\\/f7f7394ec66e5136b2b07cc29ebf1fb8\"},\"headline\":\"Audio Data Analysis Using Deep Learning with Python (Part 1)\",\"datePublished\":\"2021-04-06T07:17:17+00:00\",\"dateModified\":\"2022-11-15T09:28:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/\"},\"wordCount\":2010,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\",\"keywords\":[\"audio analysis\",\"datascience\",\"deep learning\",\"machine learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/\",\"name\":\"Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\",\"datePublished\":\"2021-04-06T07:17:17+00:00\",\"dateModified\":\"2022-11-15T09:28:07+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\",\"contentUrl\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif\",\"width\":500,\"height\":167},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/audio-data-analysis-using-deep-learning-with-python-part-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Audio Data Analysis Using Deep Learning with Python (Part 1)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/\",\"name\":\"AI Planet, Formerly DPhi\",\"description\":\"AI Planet (formerly DPhi) is a global ecosystem that aims to educate and empower individuals and organizations to build and utilize artificial intelligence (AI). With a community of over 300,000 AI specialists and enthusiasts, we offer a range of products and have helped drive innovative solutions for various industries. Our ultimate goal is to make AI education accessible to everyone and use AI to tackle important business and social challenges.\",\"publisher\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#organization\",\"name\":\"AI Planet, Formerly DPhi\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Size48-Large-1.png\",\"contentUrl\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Size48-Large-1.png\",\"width\":48,\"height\":48,\"caption\":\"AI Planet, Formerly DPhi\"},\"image\":{\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/aiplanet\\\/\",\"https:\\\/\\\/www.instagram.com\\\/aiplanet_community\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/aiplanet\\\/\",\"https:\\\/\\\/www.youtube.com\\\/@aiplanet\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/#\\\/schema\\\/person\\\/f7f7394ec66e5136b2b07cc29ebf1fb8\",\"name\":\"Nagesh Singh Chauhan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g\",\"caption\":\"Nagesh Singh Chauhan\"},\"description\":\"Nagesh is Medium's Official Top writer in Artificial Intelligence. He loves to share knowledge through his articles and comes with rich experience across various domains related to Data Science, Machine learning, Neural networks, Text Analysis, NLP and others.\",\"url\":\"https:\\\/\\\/aiplanet.com\\\/blog\\\/author\\\/nagesh\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet","og_description":"A brief introduction to audio data processing and genre classification using Neural Networks and python. Introduction While much of the literature and buzz on deep learning concerns computer vision and natural language processing(NLP), audio analysis \u2014 a field that includes automatic speech recognition(ASR), digital signal processing, and music classification, tagging, and generation \u2014 is a [&hellip;]","og_url":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/","og_site_name":"AI Planet","article_publisher":"https:\/\/www.facebook.com\/aiplanet\/","article_published_time":"2021-04-06T07:17:17+00:00","article_modified_time":"2022-11-15T09:28:07+00:00","og_image":[{"url":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif","type":"","width":"","height":""}],"author":"Nagesh Singh Chauhan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nagesh Singh Chauhan","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#article","isPartOf":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/"},"author":{"name":"Nagesh Singh Chauhan","@id":"https:\/\/aiplanet.com\/blog\/#\/schema\/person\/f7f7394ec66e5136b2b07cc29ebf1fb8"},"headline":"Audio Data Analysis Using Deep Learning with Python (Part 1)","datePublished":"2021-04-06T07:17:17+00:00","dateModified":"2022-11-15T09:28:07+00:00","mainEntityOfPage":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/"},"wordCount":2010,"commentCount":0,"publisher":{"@id":"https:\/\/aiplanet.com\/blog\/#organization"},"image":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif","keywords":["audio analysis","datascience","deep learning","machine learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/","url":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/","name":"Audio Data Analysis Using Deep Learning with Python (Part 1) - AI Planet","isPartOf":{"@id":"https:\/\/aiplanet.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#primaryimage"},"image":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif","datePublished":"2021-04-06T07:17:17+00:00","dateModified":"2022-11-15T09:28:07+00:00","breadcrumb":{"@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#primaryimage","url":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif","contentUrl":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2021\/04\/tumblr_mjxl2mmonE1s5nl47o3_r1_500.gif","width":500,"height":167},{"@type":"BreadcrumbList","@id":"https:\/\/aiplanet.com\/blog\/audio-data-analysis-using-deep-learning-with-python-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/aiplanet.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Audio Data Analysis Using Deep Learning with Python (Part 1)"}]},{"@type":"WebSite","@id":"https:\/\/aiplanet.com\/blog\/#website","url":"https:\/\/aiplanet.com\/blog\/","name":"AI Planet, Formerly DPhi","description":"AI Planet (formerly DPhi) is a global ecosystem that aims to educate and empower individuals and organizations to build and utilize artificial intelligence (AI). With a community of over 300,000 AI specialists and enthusiasts, we offer a range of products and have helped drive innovative solutions for various industries. Our ultimate goal is to make AI education accessible to everyone and use AI to tackle important business and social challenges.","publisher":{"@id":"https:\/\/aiplanet.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/aiplanet.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/aiplanet.com\/blog\/#organization","name":"AI Planet, Formerly DPhi","url":"https:\/\/aiplanet.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/aiplanet.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2022\/11\/Size48-Large-1.png","contentUrl":"https:\/\/aiplanet.com\/blog\/wp-content\/uploads\/2022\/11\/Size48-Large-1.png","width":48,"height":48,"caption":"AI Planet, Formerly DPhi"},"image":{"@id":"https:\/\/aiplanet.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/aiplanet\/","https:\/\/www.instagram.com\/aiplanet_community\/","https:\/\/www.linkedin.com\/company\/aiplanet\/","https:\/\/www.youtube.com\/@aiplanet"]},{"@type":"Person","@id":"https:\/\/aiplanet.com\/blog\/#\/schema\/person\/f7f7394ec66e5136b2b07cc29ebf1fb8","name":"Nagesh Singh Chauhan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b8a063fd73beeb4a06ec6a22acb32b5ceeb60ee5896f3583d09eaf03ffc7537b?s=96&d=mm&r=g","caption":"Nagesh Singh Chauhan"},"description":"Nagesh is Medium's Official Top writer in Artificial Intelligence. He loves to share knowledge through his articles and comes with rich experience across various domains related to Data Science, Machine learning, Neural networks, Text Analysis, NLP and others.","url":"https:\/\/aiplanet.com\/blog\/author\/nagesh\/"}]}},"_links":{"self":[{"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/posts\/1525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/comments?post=1525"}],"version-history":[{"count":3,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/posts\/1525\/revisions"}],"predecessor-version":[{"id":4912,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/posts\/1525\/revisions\/4912"}],"wp:attachment":[{"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/media?parent=1525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/categories?post=1525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiplanet.com\/blog\/wp-json\/wp\/v2\/tags?post=1525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}