<prompt> Unda programu-jalizi ya JavaScript inayotumia API ya Sauti ya Wavuti ili kutoa aina tofauti za mawimbi ya sauti sine, mraba, pembetatu, na sawtooth katika masafa na ukubwa mbalimbali.  <response>: Ili kuunda programu ya JavaScript inayotumia API ya Sauti ya Wavuti kutengeneza aina tofauti za mawimbi ya sauti, unaweza kufuata hatua hizi:1. Unda faili ya HTML yenye muundo wa msingi na ujumuishe vifungo kwa kila aina ya mawimbi na mashamba ya pembejeo kwa mzunguko na amplitude.html Mawimbi ya Sauti ya API ya Wavuti kichwa Mawimbi ya Sauti ya API ya Wavuti Sine Wave Mwimbi wa Mraba Wimbi la Pembetatu Wimbi la Sawtooth Mara kwa mara: Amplitude: mwili html2. Unda faili ya JavaScript app.js na uanze kwa kuanzisha muktadha wa API ya Sauti ya Wavuti na kuunda oscillator na kupata nodi. javascriptconst audioContext mpya window.AudioContext window.webkitAudioContext;basi oscillator;acha gainNode;kazi playSoundwaveType, frequency, amplitude Acha oscillator yoyote iliyopo ikiwa oscillator oscillator.stop; Unda nodi mpya ya oscillator oscillator audioContext.createOscillator ; Weka aina ya wimbi, frequency, na amplitude oscillator.type waveType; oscillator.frequency.value frequency; Unda nodi ya faida ili kudhibiti amplitude gainNode audioContext.createGain; gainNode.gain.value amplitude; Unganisha oscillator kwa nodi ya faida na nodi ya faida kwa pato oscillator.connectgainNode; gainNode.connectaudioContext.destination; Anzisha oscillator oscillator.start;3. Ongeza wasikilizaji wa tukio kwa kila kitufe na uga wa ingizo, ukipitisha aina zinazofaa za wimbi, marudio na viwango vya amplitude. javascriptdocument.getElementByIdsine.addEventListenerbonyeza, const frequency document.getElementByIdfrequency.thamani; const amplitude document.getElementByIdamplitude.thamani; playSoundsine, frequency, amplitude;;document.getElementByIdsquare.addEventListenerbonyeza, const frequency document.getElementByIdfrequency.thamani; const amplitude document.getElementByIdamplitude.thamani; playSoundmraba, frequency, amplitude;;document.getElementByIdpembetatu.addEventListenerbonyeza, const frequency document.getElementByIdfrequency.thamani; const amplitude document.getElementByIdamplitude.thamani; playSoundpembetatu, frequency, amplitude;;document.getElementByIdsawtooth.addEventListenerbonyeza, const frequency document.getElementByIdfrequency.thamani; const amplitude document.getElementByIdamplitude.thamani; playSoundsawtooth, frequency, amplitude;;document.getElementByIdfrequency.addEventListenerinput, tukio ikiwa oscillator oscillator.frequency.value event.target.value; ;document.getElementByIdamplitude.addEventListenerinput, tukio ikiwa gainNode gainNode.gain.value event.target.value; ;Sasa una programu rahisi ya JavaScript inayotumia API ya Sauti ya Wavuti ili kutoa aina tofauti za mawimbi ya sauti katika masafa na ukubwa mbalimbali. Ili kujaribu programu, fungua faili ya HTML katika kivinjari cha wavuti kinachotumia API ya Sauti ya Wavuti kama vile Google Chrome au Mozilla Firefox. 