Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@youpy
CreatedJanuary 9, 2017 23:53
    • Star(0)You must be signed in to star a gist
    • Fork(0)You must be signed in to fork a gist
    Save youpy/2e59a7e0cddfa8d232077a50ea22cb91 to your computer and use it in GitHub Desktop.
    tape degradation sim (wip)
    constc=newAudioContext();
    constreq=newRequest('https://dl.dropboxusercontent.com/u/334064/tmp/wh.mp3');
    constsource=c.createBufferSource();
    constosc=c.createOscillator();
    constgain=c.createGain();
    osc.frequency.value=0.4;
    gain.gain.value=0.0;
    osc.connect(gain)
    source.loop=true;
    fetch(req).then((res)=>{
    res.arrayBuffer().then((buffer)=>{
    c.decodeAudioData(buffer,(decodedData)=>{
    source.buffer=decodedData;
    source.connect(c.destination);
    gain.connect(source.playbackRate);
    osc.start(0);
    source.start(0);
    });
    });
    });
    constfn=()=>{
    constt=(Math.random() *0.1) +0.05;
    gain.gain.exponentialRampToValueAtTime(3.0,c.currentTime +t);
    gain.gain.exponentialRampToValueAtTime(Math.random() *0.02,c.currentTime +(t *2));
    setTimeout(()=>{
    fn();
    },Math.random() *4000);
    };
    fn();
    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp