I am experimenting with audio (wav files) using Short-Time Fourier Transform (STFT) in
As I understand we get data for
for e.g. (shortened for illustration)
freq, time, Zxx = scipy.signal.stft(signal, fs=fs , .. and some other parms)
If I take a single value from
Zxx , e.g.
x = -0.01224990-0.01877387j ,
I would like to convert this value to
dB, do some modification such as
- add/reduce few dB's
- Also change angle or phase
- and reconstruct the value back to
So far I have,
#Magnitude m = np.abs(-0.01224990-0.01877387j) 0.022416918717497732 #angle in degrees ad =np.angle(-0.01224990-0.01877387j, deg=True) -123.12434072219258 #phase cmath.phase(-0.01224990-0.01877387j) -2.1489251349495935 #magnitude in dB dB = 20*np.log10(abs(p)) -32.988481658150704 #modified magnitude dB = dB + 10.0 #Modified angle ad = -123.12434072219258 + 50.0
Now, How do I convert it back to modified
x. using above values?
I researched but couldn't find a straightforward solution. Before reinventing the wheel of constructing the complex mathematical functions, i thought I would ask the experts.
The only reference I found was
matlab, but not sure how to access or implement these in
Please note: I am not trying to reconstruct original signal (or
x value) back. I need to modify
Zxx values and hence I know I will get a different signal back using
Although I can directly manipulate
x+jy which affect both
phase, I would like to modify them individually and Hence this question.
Thanks in advance.