我正在将 Python 代码转换为 MATLAB。Python 代码,使用以下命令:
stft_ch = librosa.core.stft(audio_input[:, ch_cnt], n_fft=self._nfft, hop_length=self._hop_len, win_length=self._win_len, window='hann')
其中audio_input.shape=(2880000, 4)
, self._nfft=2048
,self._hop_len=960
和self._win_len=1920
。
转换为 MATLAB 时,我使用了:
stft_ch = spectrogram(audio_input(:, ch_cnt), hann(win_len), win_len-hop_len, nfft);
在那里我核实size(audio_input)=2880000, 4
,win_len=1920
,win_len-hop_len=960
和nfft=2048
。
我从 MATLAB 得到一个输出,size(stft_ch)=1025, 2999
其中 Python 显示stft_ch.shape=(1025, 3001)
。2999
MATLAB 输出中的大小很清楚,并且在if window 是向量的文档中表现出色k = ⌊(Nx – noverlap)/(length(window) – noverlap)⌋
。
但是,我在Python 文档中找不到t
set的长度。
为什么尺寸之间存在差异?我的转换好吗?
是否有一个 Python 函数可以产生更类似于 MATLAB 的spectrogram()
输出,以便我可以获得相同大小的复数输出?
万千封印
相关分类