Home

OscillatorNode changes tone on slow machine in Edge Dev

YaakovKaston
New Contributor

Hello,

 

When trying the HTML below on Edge Dev, on a slow or busy machine, the tone produced by the oscillator changes. The easiest way to reproduce it is to set the affinity of all the msedge.exe processes to a single, same, CPU/core/thread press the "Toggle Play" to start the tone and then play with the size of the window.

2 things may happen in this case:

1. The tone is interrupted at some points

2. After a while the tone changes

#2 is the problematic issue.

Can anyone confirm/explain/suggest a fix?

 

<html>
<head>
<title>Reuse Audio Stream</title>
<script
src="https://code.jquery.com/jquery-1.9.1.min.js"
integrity="sha256-wS9gmOZBqsqWxgIVgA8Y9WcQOa7PgSIX+rPA0VL2rbQ="
crossorigin="anonymous">
</script>

<script type="text/javascript">
$(window).load(function(){
var ac = new AudioContext();
var dest = ac.createMediaStreamDestination();
var empty = ac.createBufferSource();
empty.connect(dest);
var audio = new Audio();
audio.srcObject = dest.stream;

var graph = {
dest:dest,
audio:audio
};

function play(){
var source = ac.createOscillator();
graph.source = source;
var gainNode = ac.createGain();
source.connect(gainNode);
gainNode.connect(graph.dest);
graph.gainNode = gainNode;
source.start();
graph.isPlaying = true;
}

function stop(){
graph.source.stop();
graph.gainNode.disconnect();
graph.isPlaying = false;
}

function toggle(){
if (graph.isPlaying) {
stop();
}
else {
play();
}
}

$('#toggle').click(function(e) {
audio.play();
toggle();
});
});
</script>

</head>
<body>
<button id="toggle">Toggle Play</button>
</body>
</html>

 

2 Replies

@YaakovKaston 

 

That is a very surprising activity, are you running other programs at the same time?

 

Gabriel

When setting the affinity, to simulate a slow machine, I am not running anything else. Just use the task manager to limit the process to a single core.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies