Some time ago, when trying to extract music beats, there was a breakthrough. The effect was basically better than that of many commercial software on the market, high-frequency information has little effect,
Reduce the computational workload by means of re-sampling. The re-sampling reminds me of the variable speed adjustment algorithm in school. Let's review it here.
OLA (Overlap-and-add, OLA) Overlapping algorithm is the simplest time domain method of audio speed control algorithm, it is the basis of the subsequent time domain algorithm (Sola, SOLA-FS, TD-PSOLA, wsola.
OLA is divided into two parts: Decomposition and synthesis. The formula looks complicated, so it is better to express the basic idea without being pasted out.
Decomposition phase: speech is divided into frames, with a frame length of N. Assume that the frame is transferred to sa.
Merging phase: the decomposed voice frames are re-synthesized at the interval of frame shifting to SS to obtain the audio with a variable speed.
Rate = SS/SA, if SA = SS, the original speed; SS <SA, acceleration; SS> SA, deceleration.
Functional code:
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);endfunction 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)‘; endend
Script Execution Code:
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 toolsRSound = 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]);
Comparison of Time-domain waveforms before and after transmission
The overlapping part of the OLA algorithm causes the fundamental frequency to break, and even the Speech distortion. Therefore, many algorithms have made improvements based on these shortcomings.
Test file:
Http://pan.baidu.com/s/1hq4540G
From: http://www.cnblogs.com/welen
Http://blog.csdn.net/weiqiwu1986