所以我有一些代码,
function playRandom() {
var soundFile = document.getElementById("soundRandom").value;
var playRate = document.getElementById("soundRandomPitch").value;
var audio = new Audio(soundFile);
audio.playbackRate = playRate;
audio.play();
}
<select id="soundRandom" name="soundRandom"></label>
<option value="sounds/AMBIENCE_CAVE.ogg">Cave</option>
<option value="sounds/BLOCK_BEACON_ACTIVATE.ogg">Beacon Activate</option>
</select>
但是playbackRate
似乎并没有影响声音的音调,只会使声音变长/变短。我怎样才能真正改变音高和长度?