Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use #5

Closed
peakandyuri opened this issue Sep 28, 2022 · 0 comments
Closed

can't use #5

peakandyuri opened this issue Sep 28, 2022 · 0 comments

Comments

@peakandyuri
Copy link

from 'https://github.com/jussi-kalliokoski/pcmdata.js/tree/master/js ' download javascript

	<script src="http://localhost/binarystream.js"></script>
	<script src="http://localhost/pcmdata.js"></script>
<script>
  fetch("https://raw.githubusercontent.com/Binaryify/amrToMp3/master/src/amr/abcdef 1544497148360.1526463056869.amr").then(resp=>resp.arrayBuffer()).then(ab=>{		
    var incomingData = new Uint8Array(ab); // create a uint8 view on the ArrayBuffer
    var i, l = incomingData.length; // length, we need this for the loop
    var outputData = new Float32Array(incomingData.length); // create the Float32Array for output
    for (i = 0; i < l; i++) {
        outputData[i] = (incomingData[i] - 128) / 128.0; // convert audio to float
    }
    var waveData = PCMData.encode({
      sampleRate: 8000,
      channelCount:   1,
      bytesPerSample: 2,
      data: outputData
    });
	
    var element = new Audio();
    element.src = "data:audio/wav;base64,"+btoa(waveData);
    element.play();	
  });
</script>
@peakandyuri peakandyuri changed the title use can't use Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant