简体   繁体   中英

The NoiseSynth in Tone.js makes no sound

The NoiseSynth of Tone.js isn't making any noise

I'm trying to learn Tone.js but when I try to play a sound with the NoiseSynth it doesn't make a noise. Am I missing something?

<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/13.0.1/Tone.min.js"></script>
<button id="button">TCHSSS</button>
var noiseSynth = new Tone.NoiseSynth().toMaster();
document.getElementById('button').addEventListener('click', () => {
    noiseSynth.triggerAttackRelease('8n');
});

I expected this to make a white noise of the length of an 8th note. but it doesn't do anything. Here is a JSFiddle

Seems to be an issue with NoiseSynth on the version of Tone.js that you're using. Works with tone@13.4.9 instead of tone@13.0.1

<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/13.4.9/Tone.min.js"></script>

Modified jsfiddle: https://jsfiddle.net/yotammann/xjtL19u5/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM