2016-04-28 9 views
2

とにかくオーディオファイルの再生速度をプログラムで変更して新しいファイルとして保存できますか?オーディオ速度を変更して新しいファイルとして保存

私が考えることができる唯一の解決策は、オーディオファイルをWebオーディオAPIノードにパイプし、再生レートを変更し、出力をwavファイルとして記録することです。これは理想的ではありませんが、私は新しいバージョンを記録するためにファイルをすべて再生する必要があるためです。

答えて

0

offline audio context(Web Audio API)を使用してオーディオを処理できます。 リアルタイム再生を待つことなく、オーディオを処理します。

//will hold the sped up audio 
var spedUpBuffer; 

//Create the context 
var offlineCtx = new OfflineAudioContext(2,44100*40,44100);//(channels,length,Sample rate); 

//create source node and load buffer 
var source = offlineCtx.createBufferSource(); 
source.buffer = yourBuffer; 

//speed the playback up 
source.playbackRate.value = 1.25; 

//lines the audio for rendering 
source.start(0); 

//renders everything you lined up 
offlineCtx.startRendering(); 
offlineCtx.oncomplete = function(e) { 
//copies the rendered buffer into your variable. 
spedUpBuffer = e.renderedBuffer; 
} 
関連する問題