MATLAB-音调转换音频信号 [英] MATLAB - Pitch Shifting an Audio Signal

查看:319
本文介绍了MATLAB-音调转换音频信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的小组正在开发一个简单的MATLAB图形用户界面(GUI),该界面应该用于记录来自麦克风的音频(插入或内置到计算机中)并播放信号.到目前为止,我们已经完成了.我们的GUI也可以加载样本(.wav文件等),并使用GUI上相同的播放"按钮进行播放.我们有一个播放",记录",加载"和保存"按钮.现在,对于加载或记录的样本的音调移位,我们知道我们需要一个峰值选择算法来找到信号的基频.然后,我们想到可以将这些值中的每一个乘以一个常数,以移动所有这些频率的音调.我们的目标是使用此算法并将单独的班次分配给不同的按钮"或单选按钮",在其中我们可以加载样本,按下按钮并以此来操纵音高,然后进行回放.使用峰值拾取算法会充分改变信号的音调,还是在播放过程中将信号弄糟?

My group is developing a simple MATLAB Graphical User Interface (GUI) that is supposed to record audio from a microphone - plugged in or built in to the computer - and play back the signal. So far we have that completed. Our GUI also can load a sample (a .wav file, etc..) and play it back using the same "Play" pushbutton on the GUI. We have a Play, Record, Load, and Save push button. Now for the pitch-shifting of loaded or recorded samples... We know we need a peak-picking algorithm to find the fundamental frequencies of the signals. We were then thinking that we could multiply each of those values by a constant to shift the pitch of all those frequencies. What we aim to do it use this algorithm and assign the separate shifts to different Pushbuttons or radiobuttons, in which we can load our sample, press the button and manipulate the pitch by doing so, then play it back. Will using a peak-picking algorithm sufficiently shift the pitch of our signals, or will the signal be screwed up during playback?

(这不是实时处理)

推荐答案

正如我在上面的评论中所提到的,实际上可以使用两种方法:相位声码器或更高的采样率.第一种使用声码器的方法将保持信号长度,同时将所包含的频率移位得更高.我将不介绍如何执行此算法,但是可从哥伦比亚大学(Columbia University)公开获取相关代码-

As mentioned in my comments above, there are really two approaches you can use, Phase Vocoders or higher sampling rates. The first method, using a vocoder will maintain signal length while shifting the contained frequencies higher. I am not going to go through the algorithm on how to do this, but code is openly available for this from Columbia University - http://www.ee.columbia.edu/ln/labrosa/matlab/pvoc/

第二种方法是简单地将* .wav文件写入更高的采样率.

The second method is simply writing the *.wav file to a higher sampling rate.

假设您有一个440 Hz信号,想要为880 Hz,只需将采样率加倍即可.

say you have a 440 Hz signal you want to be 880 Hz, simply double the sampling rate.

使用wavwrite(signal,2*fs,'file')

但这会以增加采样率的任何因素缩短音频文件的长度.

This however, will shorten the length of the audio file by whatever factor you increased the sampling rate.

总的来说,我认为更好,更令人印象深刻的方法是声码器,我不建议您盲目使用Columbia的代码,而实际上要花一些时间来理解它并能够在数学上解释其背后的逻辑

Overall I think the better and more impressive method is the vocoder, I would not recommend just blindly using the code from Columbia, but actually taking time to understand it and being able to explain the logic behind it all mathematically

这篇关于MATLAB-音调转换音频信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆