在python中对音频数据执行PCA
我正在尝试对一些音频数据进行预处理,以用于某些特征学习算法。直接在STFT或FFT的幅度谱上执行PCA有意义吗?还是需要在两者之间进行一步?我看到,对于图像,数据矩阵在PCA之前通常是平坦的在python中对音频数据执行PCA,python,audio,feature-detection,deep-learning,Python,Audio,Feature Detection,Deep Learning,我正在尝试对一些音频数据进行预处理,以用于某些特征学习算法。直接在STFT或FFT的幅度谱上执行PCA有意义吗?还是需要在两者之间进行一步?我看到,对于图像,数据矩阵在PCA之前通常是平坦的 from scipy.io.wavfile import read from scipy import signal from scipy.fftpack import fft import numpy as np import matplotlib.pyplot as plt import pylab
from scipy.io.wavfile import read
from scipy import signal
from scipy.fftpack import fft
import numpy as np
import matplotlib.pyplot as plt
import pylab
# Read file to get samplerate and numpy array containing the signal
(fs, x) = read("../someaudio.wav")
channels = [
np.array(x[:, 0]),
np.array(x[:, 1])
]
# Combine channels to make a mono signal out of stereo
channel = np.mean(channels, axis=0)
# Generate spectrogram
## Freqs is the same with different songs, t differs slightly
Pxx, freqs, t, plot = pylab.specgram(
channel,
NFFT=2048,
Fs=44100,
detrend=pylab.detrend_none,
window=pylab.window_hanning,
noverlap=int(2048 * 0.5))
假设我构建了一个包含多个光谱(Pxx)的数据集。我可以直接在其上应用PCA,还是需要另一个步骤(如展平)
谢谢