signal-processing

Sampling rate issue with Librosa

被刻印的时光 ゝ 提交于 2021-01-02 05:58:06
问题 When doing a STFT, and then an inverse STFT (iSTFT) on a 16 bits 44.1 khz audio file with the library Librosa : import librosa y, sr = librosa.load('test.wav', mono=False) y1 = y[0,] S = librosa.core.stft(y1) z1 = librosa.core.istft(S, dtype=y1.dtype) librosa.output.write_wav('test2.wav', z1, sr) the output is only a 22 khz audio file. Why? Where is there the sampling rate change in librosa ? 回答1: The librosa.load() function enables target sampling, wherein the audio file you import can be re

equivalence scipy.signal welch to matlab pwelch

寵の児 提交于 2020-12-25 05:19:34
问题 I have the following MATLAB code to compute the PSD of a signal: x = linspace(0, 10, 100001); dt = x(2) - x(1); Fs = 1 / dt; a1 = 1; f1 = 500; a2 = 10; f2 = 2000; y = a1 * sin(2*pi*f1*x) + a2 * sin(2*pi*f2*x); nblock=1024; overlap=128; windowsel=hann(nblock); [Pxx,f]=pwelch(y,windowsel,overlap,nblock,Fs,'onesided'); figure() semilogy(f,Pxx, '-o') I have tried to reproduce the same calculation using welch in scipy.signal . However, for low frequency, the behavior is clearly not the same. I

equivalence scipy.signal welch to matlab pwelch

随声附和 提交于 2020-12-25 05:15:35
问题 I have the following MATLAB code to compute the PSD of a signal: x = linspace(0, 10, 100001); dt = x(2) - x(1); Fs = 1 / dt; a1 = 1; f1 = 500; a2 = 10; f2 = 2000; y = a1 * sin(2*pi*f1*x) + a2 * sin(2*pi*f2*x); nblock=1024; overlap=128; windowsel=hann(nblock); [Pxx,f]=pwelch(y,windowsel,overlap,nblock,Fs,'onesided'); figure() semilogy(f,Pxx, '-o') I have tried to reproduce the same calculation using welch in scipy.signal . However, for low frequency, the behavior is clearly not the same. I