I'm a beginner of audio signal processing, and trying to understand some basic things about audio signals.
I primary work with .wav files, so please allow me to use wav as my data to describe my questions.
Q1: Sample values in .wav file represent the waveform amplitude?
When we load data from .wav file, we will have the audio sample values (typically signed ints), and I searched on google, these values are the amplitude of the audio signal, right?
See example code
In [69]: from scipy.io import wavfile
In [70]: frame_rate, values = wavfile.read("data/test.wav")
In [71]: frame_rate
Out[71]: 48000
In [72]: values
Out[72]:
array([[ 0, 0],
[ 0, 0],
[ 0, 0],
...,
[385, 247],
[412, 266],
[359, 232]], dtype=int16)
Q2: What is silence?
If the answer to Q1 is YES, then given bit-16, I tried to create a numpy array with all values of 10000, expecting it should be loud sound. However, to my surprise it's just no sound at all. Why? I though value=0 is silence, but it's obviously not.
See example code
import numpy as np
from IPython.display import Audio
# 100k frames
x = np.arange(0, 100000)
# sine wave, max value=10000
sine = np.sin(x) * 10000
Audio(sine, rate=50000) # i.e. 2sec audio, and I can hear the sound
# dummy, all values = 10000
dummy = np.ones(x.shape[0]) * 10000
Audio(dummy, rate=50000) # same 2sec, but silence
Q3: How to compute decibels from the .wav amplitude values?
Given Q2, now I'm lost and don't know how decibels look like given amplitude values, I thought bigger amplitude values should mean higher decibels, but now it's apparently not the case.