concept audio in category machine learning

appears as: udio, audio
Machine Learning with TensorFlow, Second Edition

This is an excerpt from Manning's book Machine Learning with TensorFlow, Second Edition.

It helps to understand how these files are represented. If you’ve ever seen a vinyl record, you’ve probably noticed the representation of audio as grooves indented in the disk. Our ears interpret audio from a series of vibrations through air. By recording the vibration properties, an algorithm can store sound in a data format.

So, how did ASR get so performant and become a part of everyday life? Mostly because previous ASR systems relied upon brittle statistical models dependent on language-specific grammars, whereas today’s ASR systems are built on top of robust recurrent neural networks (RNNs) and in particular long short-term memory (LSTM) networks, which are a specific type of RNN. Using LSTMs, you can teach a computer to hear audio in segments and to convert those segments to characters in language over time. Similar to CNNs and other biologically inspired neural networks discussed in the book, LSTMs for speech recognition learn like humans learn. Each small audio segment corresponds to a character of language and you use as many cells as there are characters in the speech. You are trying teach the network to understand language like a human would. As the network learns over time through each invocation, the network weights are updated and fed forward and backward to the LSTM cells, which learn each sound and the letters it corresponds to. The combination of letters learned mapping to each sound becomes language.

Machine Learning with TensorFlow

This is an excerpt from Manning's book Machine Learning with TensorFlow.

It helps to understand how these files are represented. If you’ve ever seen a vinyl record, you’ve probably noticed the representation of audio as grooves indented in the disk. Our ears interpret audio from a series of vibrations through air. By recording the vibration properties, an algorithm can store sound in a data format.

A sound may produce 12 kinds of pitches. In music terminology, the 12 pitches are C, C#, D, D#, E, F, F#, G, G#, A, A#, and B. Listing 5.2 shows how to retrieve the contribution of each pitch in a 0.1-second interval, resulting in a matrix with 12 rows. The number of columns grows as the length of the audio file increases. Specifically, there will be 10 × t columns for a t-second audio. This matrix is also called a chromagram of the audio.

Listing 5.2. Representing audio in Python
from bregman.suite import * def get_chromagram(audio_file): 1 F = Chromagram(audio_file, nfft=16384, wfft=8192, nhop=2205) 2 return F.X 3

The chromagram output is a matrix, shown in figure 5.2. A sound clip can be read as a chromagram, and a chromagram is a recipe for generating a sound clip. Now you have a way to convert between audio and matrices. And as you’ve learned, most machine-learning algorithms accept feature vectors as a valid form of data. That said, the first machine-learning algorithm you’ll look at is k-means clustering.

Figure 5.2. The chromagram matrix, where the x-axis represents time, and the y-axis represents pitch class. The green parallelograms indicate the presence of that pitch at that time.

To run machine-learning algorithms on your chromagram, you first need to decide how you’re going to represent a feature vector. One idea is to simplify the audio by looking only at the most significant pitch class per time interval, as shown in figure 5.3.

Figure 5.3. The most influential pitch at every time interval is highlighted. You can think of it as the loudest pitch at each time interval.

Then you count the number of times each pitch shows up in the audio file. Figure 5.4 shows this data as a histogram, forming a 12-dimensional vector. If you normalize the vector so that all the counts add up to 1, you can easily compare audio of different lengths.