# Sound Basics #

Dr Michael Towsey  ## Five Key Concepts #

1. Decibels
2. Clipping & gain
3. ADC: Sample rate & bit depth
4. Fast Fourier Transform (FFT)

## 1: Decibels #

Sound pressure level (spl) (Pascals)

Volts
(V)

Signed 16 bit integer
(-32768 to +32767)

Real value
(-1.00 to +1.00)

$dB(spl) = 30 dB$

$db(V) = 35 dB$

$db = -70dB$

## Decibels #

Decibels are always the log of a ratio

$$10 \log_{10}{\left( \frac{\text{Power}}{\text{Reference Power}} \right)}$$

$$20 \log_{10}{\left( \frac{\text{Amplitude}}{\text{Reference Amplitude}} \right)}$$

dB(spl) dB
reference = 0.00002 Pa = 0 dB reference = 1.00 = 0 dB
quiet room = 30 dB bird call ≈ -50 dB
conversation = 60 dB cold morning ≈ -80 dB
long-term damage = 85 dB least sound = 1/32767 = -90 dB

## 2: Clipping and Gain #

• Rule 1: Do not increase gain if it clips sounds of interest!
• Rule 2: Use the factory settings!!

## 3: Analogue to digital conversion # ## 4: Fourier transform #

• An FFT converts a waveform into a spectrogram
• A sound wave can be represented as the sum of a series of sine waves
• We can convert from time domain to frequency domain ## 4: Fourier transform # Maximum frequency in spectrograms = sample rate / 2 = Nyquist

## 4: Fourier transform #

Function FFT($array){$Len = $array.Count If($Len -le 1){Return $array}$Len_Over_2 = [Math]::Floor(($Len/2))$Output = New-Object Complex[] $Len$EvenArray = @()
$OddArray = @() For($i = 0; $i -lt$Len; $i++){ If($i % 2){ $OddArray +=$array[$i] } Else {$EvenArray += $array[$i] }
}

$Even = FFT($EvenArray)
$Odd = FFT($OddArray)

For($i = 0;$i -lt $Len_Over_2;$i++){
$Twiddle = [Complex]::Exp( [Complex]::ImaginaryOne*[Math]::Pi*($i*-2/$Len) ) *$Odd[$i]$Output[$i] =$Even[$i] +$Twiddle
$Output[$i+$Len_Over_2] =$Even[$i] -$Twiddle
}

Return \$Output
}

• 20 lines of code that changed human civilization
• Thanks to Cooley and Tukey in 1965 (or Gauss 1805)

## 5: Spectrograms: time/frequency trade-off #

Waveform

Spectrogram  STFT
➡️ ## 5: Spectrograms: time/frequency trade-off #

Finished. Next up: recording and labelling .