Mono
, IMA WAV APDCM Audio (ms)
의 파일이 16 bits per sample
일 때 24000Hz
에 샘플링 된 VLC에서 재생되는 this WAV file을 재생하는 데 어려움을 겪고 있습니다. 내가 new Audio()
를 사용하여 프로그래밍 방식으로 재생하려고하면JavaScript로 AudioBuffer를 구성하여 WAV 파일을 올바르게 재생하는 방법은 무엇입니까?
나는 WAV 파일 자체에 문제가 내가<audio>
를 통해 직접 를 삽입하여 재생하려고 할 때부터가 의심, 재생 버튼이 나는 ... 비활성 오류 여기 Failed to load because no supported source was found.
을받을 것은 내가 오디오를로드 Unable to decode audio data
을 던지는에 AudioContext.decodeAudioData
모든 초크를 사용하려고 내가 해봤 일부 소리 ... 다른 시도를 생산하는 시도했습니다 무엇의 간단한 예입니다.
이 예는 어떤, 어느 정도 인식 사운드를하지만, 그렇게 나의 이해는 AudioBuffer
이하지 않는, 그 값 [-1,1]
사이 거두지 못하고 Float32Array
을 필요로한다는 것이다 scratchy- 때문에 나는 분명 뭔가 잘못하고 있어요. 그러나 많은 값들이 10e32
의 순서에 있기 때문에 나는 그들을 정상화하는 방법을 모른다.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
</style>
</head>
<body>
<script>
var context = new AudioContext();
function loadSound(url) {
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "arraybuffer";
request.onload = function() {
data = new Uint8Array(request.response);
var buffer = context.createBuffer(1, data.length, 24000);
var channelData = buffer.getChannelData(0);
for (var i = 0; i < data.length; i++) {
channelData[i] = data[i];
}
var source = context.createBufferSource();
source.buffer = buffer;
source.connect(context.destination);
source.start(0);
}
request.send();
}
loadSound('./test.wav');
</script>
</body>
</html>
아무 도움이됩니다; 고맙습니다!