170619 利用python读取wav文件及声音图形的绘制

A very convenient way to get a quick impression of how the songs of
the diverse genres “look” like is to draw a spectrogram for a set of
songs of a genre. A spectrogram is a visual representation of the
frequencies that occur in a song. It shows the intensity of the
frequencies on the y axis in the specifed time intervals on the axis;
that is, the darker the color, the stronger the frequency is in the
particular time window of the song. — Building Machine Learning
Systems with Python

代码

# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 16:59:32 2017

@author: Administrator
"""

#import scipy
from matplotlib.pyplot import specgram
from scipy.io import wavfile
sample_rate, X = wavfile.read('music.wav')
print (sample_rate, X.shape)
specgram(X, Fs=sample_rate, xextent=(0,192000))

注:这样导入wav文件会报错,所以推荐上述方法

import scipy
sample_rate, X = scipy.io.wavfile.read(wave_filename)

结果(将X单独绘制后,再运行上面图形,可以看出草绿色的就是背景)
这里写图片描述

附:梅尔频率倒谱系数(MFCC)
http://blog.csdn.net/zouxy09/article/details/9156785/

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GuokLiu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值