justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: How would you code in JS an effect that sounds exactly like a bitcrusher, but you are not allowed to use anu JS function/module/effect/whatever that actually does bitcrushing (nothing else than 16-bit (say) is allowed all along). Please be as specific as you can :)
Asked by OPUS 500 (31.37.8.x) on September 20 2023, 9:39am
Reply on September 20 2023, 1:16pm (edited at September 20 2023, 1:18pm):
    If you mean JS as in JSFX:
    @init
    scale = 2^15; // 16-bit
    iscale = 1 / scale;
    
    @sample
    spl0 = floor(spl0 * scale + 0.5) * iscale;
    spl1 = floor(spl1 * scale + 0.5) * iscale;
    
    If you mean JavaScript, well, not sure what that would look like but the same logic of Math.floor would be useful...


Comments:
  • Posted by Name (95.134.60.x) on September 21 2023, 12:09pm:
    Is this a code of a bitcrusher which reduces bitrate down to 16 bit and not lower?

  • Posted by Justin on September 23 2023, 12:31am:
    it makes the noise floor around -96dB, but doesn't limit the maximum volume (if you send it a very hot signal you can get more than 16-bit dynamic range)

  • Posted by Name (95.134.60.x) on September 23 2023, 6:40am:
    Thank you


Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2024 Justin Frankel. | RSS