前段时间,在尝试音乐节拍数的提取时,终于有了突破性的进展,效果基本上比市面上的许多商业软件还要好,在作节拍数检测时,高频信息作用不大,

通过重采样减小运算量。重采样让我想起了在学校里面做的变速变调算法,在这里顺便回顾一下。

OLA(Overlap-and-Add, OLA)重叠叠加算法是音频变速算法中最简单的时域方法,它是后续时域算法(SOLA, SOLA-FS, TD-PSOLA, WSOLA)的基础。

OLA分为分解与合成两个部分,公式看起来很复杂,所以不贴出了,基本思路从图中更能清晰的表现出来。

分解阶段:语音首先分帧,帧长为N,假设帧移为Sa。

合成阶段:分解出来的语音帧,以帧移为Ss的间隔重新合成起来,得到变速之后的音频。

Rate = Ss/ Sa,如果Sa=Ss,则原速;Ss<Sa时,加速;Ss>Sa时,减速。

功能性代码:

function [ RSound ] = OLA(Speech, Fs, Rate)
%OLA Summary of this function goes here
% Detailed explanation goes here
frame_ms = 25;
frame_len = frame_ms * Fs /1000;
window = hanning(frame_len);
Sa = 1/2 * frame_len;
AnalysisSplice = enframe(Speech, window, Sa);
AnalysisSplice = AnalysisSplice';%each column corresponding to each frame data
Ss = Rate*Sa;
RSound = Synthesis(AnalysisSplice, Ss);
end function RSound = Synthesis(AnalysisSplice, Ss)
[frame_len, nframes] = size(AnalysisSplice);
N = Ss*(nframes - 1) + frame_len;
RSound = zeros(1, N);
for q = 1:nframes
RSound(1 + (q-1)* Ss : frame_len + (q-1)*Ss) = RSound(1 + (q-1)* Ss : frame_len + (q-1)*Ss) + AnalysisSplice(:,q)';
end
end

Script执行代码:

clc;
clear;
close all;
Path = 'D:\Experiment\OLA\';
file = [Path, 'test.wav'];
faster = [Path, 'faster.wav'];
[Speech, Fs] = wavread(file);
Rate = 0.7;
%wavread wavwrite enframe function comes from voicebox tools
RSound = OLA(Speech,Fs,Rate);
wavwrite(RSound,Fs,faster);
figure;
subplot(2,1,1);
plot(Speech);
title('original');
axis([1 length(Speech) -0.5 0.5]);
subplot(2,1,2);
plot(RSound);
title('0.7 faster');
axis([1 length(Speech) -0.5 0.5]);

变速前后的时域波形对比图

OLA算法在重叠部分会造成基频断裂,甚至语音失真。所以后期许多算法基于此缺点进行了相关的改进。

测试文件:

http://pan.baidu.com/s/1hq4540G

来自:http://www.cnblogs.com/welen

http://blog.csdn.net/weiqiwu1986

最新文章

  1. [LeetCode] N-Queens N皇后问题
  2. IBM WebSphere MQ的oracle的jdbc
  3. 【BZOJ-3895】取石子 记忆化搜索 + 博弈
  4. js弹出对话框的方法总结
  5. Sql practice
  6. 开源软件架构总结之——Bash(readline做输入交互式,词法语法分析,进程交互)
  7. linxu php连接sqlserver
  8. 【Java/Android性能优2】Android性能调优工具TraceView介绍
  9. 最火的.NET开源项目(转)
  10. MAC SVN Phonegap
  11. 第六篇、AVplayer定制视频播放控件
  12. Android开发笔记:安卓程序截屏方法
  13. break在switch中的使用例子
  14. Android——用户登陆及用户名和密码的保存
  15. VB高清图标制作方法
  16. 第一个程序python.py
  17. css超出内容以省略号显示
  18. 洛谷P2617 Dynamic Ranking(主席树,树套树,树状数组)
  19. cocoa编程第4版 8.5 挑战1 解答
  20. mvc路由报错

热门文章

  1. JAVA数组的典型操作
  2. Hibernate与Mybatis的概念区别
  3. SmartUpLoad自动上传包
  4. Make命令
  5. Python基础之--常用模块
  6. javascript Date 总结
  7. ASP.NET MVC Global.cs - 应用程序事件
  8. VisualStudio基本使用(1)-显示行号
  9. [Bug]IIs Cannot read configuration file due to insufficient permissions
  10. flask 知识点总结