Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python中对音频数据执行PCA_Python_Audio_Feature Detection_Deep Learning - Fatal编程技术网

在python中对音频数据执行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

我正在尝试对一些音频数据进行预处理,以用于某些特征学习算法。直接在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

# 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,还是需要另一个步骤(如展平)

谢谢