Osc wont end leaving a hanging tone #2

Closed
opened 2025-04-09 15:03:08 +00:00 by tcsenpai · 0 comments
Owner

Originally created by @gwashark on 2/11/2025

Uncaught TypeError: oscillator.end is not a function

startButton.onclick = () => {

	if(modeSelect.value == "none") {
		warningText.textContent = "You must select a mode";
		startButton.disabled = true;
		return;
	}

	if(!imageLoaded){
		warningText.textContent = "You must upload an image";
		startButton.disabled = true;
		return;
	}

	let canvasData = canvasCtx.getImageData(0, 0, canvas.width, canvas.height);

	warningText.textContent = "";
	if (audioCtx.state === "suspended") {
    	audioCtx.resume();
    }

    let oscillator = audioCtx.createOscillator();
    oscillator.type = "sine";

    oscillator.connect(audioCtx.destination);

    sstvFormat.prepareImage(canvasData.data);
    let startTime = audioCtx.currentTime + 1;
    let endTime = sstvFormat.encodeSSTV(oscillator, audioCtx.currentTime + 1);
    oscillator.start(startTime);
-   oscillator.end(endTime);
};
*Originally created by @gwashark on 2/11/2025* Uncaught TypeError: oscillator.end is not a function ```diff startButton.onclick = () => { if(modeSelect.value == "none") { warningText.textContent = "You must select a mode"; startButton.disabled = true; return; } if(!imageLoaded){ warningText.textContent = "You must upload an image"; startButton.disabled = true; return; } let canvasData = canvasCtx.getImageData(0, 0, canvas.width, canvas.height); warningText.textContent = ""; if (audioCtx.state === "suspended") { audioCtx.resume(); } let oscillator = audioCtx.createOscillator(); oscillator.type = "sine"; oscillator.connect(audioCtx.destination); sstvFormat.prepareImage(canvasData.data); let startTime = audioCtx.currentTime + 1; let endTime = sstvFormat.encodeSSTV(oscillator, audioCtx.currentTime + 1); oscillator.start(startTime); - oscillator.end(endTime); }; ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/Web-SSTV#2
No description provided.