다음은 javascript를 사용한 빠른 구현입니다.
결과 문자열을 쉽게 다운로드 할 수있는 BLOB로 변환하는 연습으로 남겨 두겠다. 채널 선택, 스테레오 결과 및 처리를 위해 오디오 트랙의 작은 부분을 선택할 수있는 기능을 남겨 두겠다.
<!doctype html>
<html>
<head>
<script>
"use strict";
function byId(id){return document.getElementById(id)}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.addEventListener('load', onDocLoaded, false);
var audioCtx;
function onDocLoaded(evt)
{
audioCtx = new AudioContext();
byId('fileInput').addEventListener('change', onFileInputChangedGeneric, false);
}
function onFileInputChangedGeneric(evt)
{
// load file if chosen
if (this.files.length != 0)
{
var fileObj = this.files[0];
loadAndTabulateAudioFile(fileObj, byId('output'));
}
// clear output otherwise
else
byId('output').textContent = '';
}
// processes channel 0 only
//
// creates a string that represents a 2 column table, where each row contains the time and amplitude of a sample
// columns are tab seperated
function loadAndTabulateAudioFile(fileObj, tgtElement)
{
var a = new FileReader();
a.onload = loadedCallback;
a.readAsArrayBuffer(fileObj);
function loadedCallback(evt)
{
audioCtx.decodeAudioData(evt.target.result, onDataDecoded);
}
function onDataDecoded(buffer)
{
//console.log(buffer);
var leftChannel = buffer.getChannelData(0);
//var rightChannel = buffer.getChannelData(1);
console.log("# samples: " + buffer.length);
console.log(buffer);
var result = '';
var i, n = buffer.length, invSampleRate = 1.0/buffer.sampleRate;
for (i=0; i<n; i++)
{
var curResult = (invSampleRate*i).toFixed(8) + "\t" + leftChannel[i] + "\n";
result += curResult;
}
tgtElement.textContent = result;
}
}
</script>
<style>
</style>
</head>
<body>
<label>Select audio file: <input type='file' id='fileInput'/></label>
<hr>
<pre id='output'></pre>
</body>
</html>
이 작업을 수행 할 수있는 소프트웨어를 사용하고 계시겠습니까? 질문을 편집하여 입력 샘플과 예상 출력을 제공하면 답변을 받게됩니다. – enhzflep