On Tuesday, December 21, 2021 at 6:32:23 PM UTC-6,
[email protected] wrote:
Could someone explain for me howto set volume on the played audio.
I do not speak monkey gibberish.
/* Here is some unintelligble syntax to decipher......
// Create a gain node.
var gainNode = audiostream.createGain();
// Connect the source to the gain node.
source.connect(gainNode);
// Connect the gain node to the destination. gainNode.connect(audiostream.destination);
*/ Yeah what the fuck is source and destination....
I think you're just frustrated. The answer is right under your nose.
// Code below works and play up the audiostream of the URL
const audiostream = new AudioContext();
async function audioPlay(url){
const audioBuffer = await fetch(url)
.then(res => res.arrayBuffer())
.then(ArrayBuffer => audiostream.decodeAudioData(ArrayBuffer));
const playwav = audiostream.createBufferSource();
playwav.buffer = audioBuffer;
playwav.connect(audiostream.destination);
^^^ Right here ^^^
Bust up that call to playwav.connect() and put your gain node in the middle there.
"playwav" is your "source". And "audiostream.destination" is already literally in
the example.
playwav.start();
};
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)