javascript - Playing raw audio PCM samples in Web Audio -


i have array of sound samples (16-bit):

[0, 120, 320, 120, 0, -100, -30000, 65, 2, 3, 10, ...] 

they range -32768 32767. able play samples using web audio api.

i know expects source buffer arraybuffer, can't quite figure out how convert bunch of samples arraybuffer played web audio api.

any tips?

create new audiocontext, use createbuffer create audiobuffer of right length , number of channels, , use getchanneldata access bits - run through loop each sample sets bufferdata[i] = (original_data[i] / 32768);


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -