- From: Grant Galitz <grantgalitz@gmail.com>
- Date: Fri, 11 Feb 2011 15:41:13 -0500
- To: public-xg-audio@w3.org
- Message-ID: <AANLkTimEBT4LxC7ghKT-T=GZmU3STcJeQnUGF37n8nAA@mail.gmail.com>
Hey, you probably already know my JS GameBoy Color emulator project https://github.com/grantgalitz/GameBoy-Online The thing is, I'm wondering why the web audio API refuses to allow me to set my own sample rate (I want 70khz). Right now I have to set the sample rate to that already found in the API itself: audioSource = audioContextHandle.createBufferSource(); //We need to create a false input to get the chain started. audioSource.loop = false; //Keep this alive forever (Event handler will know when to ouput.) settings[14] = audioContextHandle.sampleRate; audioSource.buffer = audioContextHandle.createBuffer(1, 1, settings[14]); //Create a zero'd input buffer for the input to be valid. audioNode = audioContextHandle.createJavaScriptNode(settings[18], 1, 2); //Create 2 outputs and ignore the input buffer (Just copy buffer 1 over if mono) audioNode.onaudioprocess = audioOutputEvent; //Connect the audio processing event to a handling function so we can manipulate output audioSource.connect(audioNode); //Send and chain the input to the audio manipulation. audioNode.connect(audioContextHandle.destination); //Send and chain the output of the audio manipulation to the system audio output. audioSource.noteOn(0); settings[14] being the sample rate 70000. I need to do this to get it to work: settings[14] = audioContextHandle.sampleRate; Which effectively forces me to use the API's arbitrary sample rate instead of one I want to use.
Received on Saturday, 12 February 2011 22:02:49 UTC