Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Anastasia Dunbar
    How do you get inputs such as mouse and keyboard?
    Hello! I'm trying out TinyRave, but it seems like the value passed to buildSample ascends a little too quickly to be seconds?
    also, the 'BuildTrack demo' just says "err is not defined" and doesn't play.
    Anastasia Dunbar
    What happened to TinyRave.com?
    Ed McManus
    Whoops sorry I let the domain lapse – it's back up now!
    @AnastasiaDunbar ^
    Anastasia Dunbar
    Uploaded mine here just to make sure that they won't go away.
    Safari only? Both Chrome and Firefox fail with errors for me
    Anastasia Dunbar
    Chrome works completely fine for me but Firefox doesn't have importScripts so I cannot use TinyRave functions I've made here. Is there a workaround?
    Anastasia Dunbar

    (repost where I solved the pitch problem)
    Does your code look like this? (the output audio pitch goes higher when you decrease the sampleRate and vice versa):

    //inside the audio processor (input is buffer data)

    Did you know that you can't change the audioContext's sampleRate? The default is 48000Hz (but not for all browsers probably) so you should do this instead:


    Make sure you do time+(sample/audioContext.sampleRate) for the DSP output data.

    As @omgitsraven said that "it seems like the value passed to buildSample ascends a little too quickly to be seconds?".
    A workaround for the people using TinyRave do time*=44100/48000;.
    Anastasia Dunbar
    Now I have tinnitus.
    I'm glad I learned using audio processing in vanilla JavaScript.
    Ed McManus
    Hey @AnastasiaDunbar ! This looks like a workaround for downsampling a 48000Hz script to 44100? (44100 is what I use in the tinyrave AudioContext)
    And yeah mistakes when doing DSP in JS are painful. Hopefully it means you make fewer mistakes :-P
    John Ranck

    Hi! I'm pretty new to this but i've been trying to use tinyrave in Atom. I've installed the package and can make a sine wave to sound but when adding certain types of example code I get this error:

    Uncaught TypeError: Cannot read property 'remove' of undefined
    Show Stack Trace
    The error was thrown from the TinyRave package. You can help by creating an issue. Please explain what actions triggered this error.

    Once I get this error tinyrave doesn't work at all in Atom until I quit and restart again. This seems really cool so I'd love to be able to get some help. Thanks in advance for your time.

    Ed McManus
    Hey @johnranck ! I didn't think anyone was using that plugin :-P I just took a look and it appears a lot has changed in the ~2yrs since it was written, so it may not be a simple fix. I'll try to take another look this weekend, and will let you know if I modernize the plugin. In the mean time thanks for filing the issue, that was helpful! Without that plugin you may want to experiment using Atom, and copy/paste periodically into the editor on Tinyrave.com. Not ideal for quick experiments, so lemme see if I can get the plugin working. Thanks!
    Martin Roberts
    I'm having the exact same issue as John - can't get Atom to play any scripts, with the same error. It would be great if you could update the plugin package!
    Anastasia Dunbar
    @emcmanus Can you fix this‽ Because if you do the 440 Hz test by return Math.sin(Math.PI*2*440*time); you'll notice that it's a bit higher than it's supposed to be.
    Because you wrote var SAMPLE_RATE = 44100; and AudioContext's default sampleRate value is 48000.
    You could just do var SAMPLE_RATE = audioCtx.sampleRate; or var time = tr_samplesGenerated / audioCtx.sampleRate;. Please fix it.
    sampleRate is read-only and cannot be changed.
    Anastasia Dunbar
    (Sorry for assuming you used AudioContext instead of WebSockets.)
    Is anyone on right now?
    Anastasia Dunbar
    I'm here.
    But I'm definitely more active on Discord.