I am trying to plot my voice signal, with different dtypes (the bits/sample obviously). So i tried to capture my voice with dtype = 'int16
' and the plot made sense. But i tried to speak in the same sound level with dtype = 'int8
' and my plot is a zero line.
Why is this happening?
One thought that came across is that maybe the quantizer with 8 bits has a bigger dead zone, so for the same input voice level the quantizer drops the value at 0
. Of course i made a hypothesis for the type of the quantizer. I have not seen if the quantizer is uniform dead zone.
Below is my code and my plots
import matplotlib.pyplot as plt
import numpy as np
import sounddevice as sd
Fs = 8000 # Sampling frequency
duration = 5 # Recording duration in seconds
voice = sd.rec(frames=duration * Fs, samplerate=Fs, channels=1, dtype='int16') # Capture the voice
# frames indicate indirectly the duration of record, dtype is 16 bits per sample.
sd.wait() # close after recording finish
time = np.linspace(0, len(voice - 1) / Fs, len(voice - 1)) # split x axis in voice-1 points
print(voice) # points have 1/Fs distance each other
plt.plot(time, voice) # plot in seconds
plt.title("Voice Signal")
plt.xlabel("Time [seconds]")
plt.ylabel("Voice amplitude")
plt.show()
Here are my voice arrays https://www.mediafire.com/file/7bbfbz0jltszmb6/16bit.csv/file https://www.mediafire.com/file/k627wmbeayutc20/8bit.csv/file