javascript pitch shift with time stretch

前端 未结 4 1809
难免孤独
难免孤独 2020-12-17 18:48

I\'m a beginner learning javascript. I\'ve got various projects in mind with an interactive page on my site related to microtonal frequencies and planetary frequencies. I ne

4条回答
  •  清歌不尽
    2020-12-17 19:07

    you can set the mozPreservesPitch property to false to change the pitch of an element or soundfile with Firefox. webkitPreservesPitch is supposed to work with webkit browsers but note that "this API is not yet standardized" ...

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement

    This worked for me:

    var soundPlayer = new Audio();
    
    function playLowerNote() {
        soundPlayer.src = "piano.mp3";
        soundPlayer.mozPreservesPitch = false;
        soundPlayer.playbackRate = 0.5;
        soundPlayer.play();
    }
    
    playLowerNote();
    

    Still looking myself for a better way to loop.

提交回复
热议问题