python将音频转换成声谱图,如何在python3中将.wav文件转换为频谱图

本文讲述了尝试在Python3中将.wav音频文件转换为具有颜色的声谱图的过程。作者遇到了代码不包含所需颜色以及TypeError的问题。通过使用scipy.signal.spectrogram函数,成功解决了问题,实现了彩色声谱图的生成。确保音频文件为单声道是关键。
摘要由CSDN通过智能技术生成

I am trying to create a spectrogram from a .wav file in python3.

I want the final saved image to look similar to this image:

f5828856ded8fa8caeade881bf90cb57.png

I have tried the following:

This post worked, somewhat. After running it, I got

f35be447de12b235d5bb03ac41663221.png

However, This graph does not contain the colors that I need. I need a spectrogram that has colors. I tried to tinker with this code to try and add the colors however after spending significant time and effort on this, I couldn't figure it out!

I then tried this tutorial.

This code crashed(on line 17) when I tried to run it with the error T

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值