dc_offset.jsfx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. desc: DC Offset
  2. version: 1.8.3
  3. author: chokehold
  4. tags: utility dc offset
  5. link: https://github.com/chkhld/jsfx/
  6. screenshot: https://github.com/chkhld/jsfx/blob/main/assets/screenshots/dc_offset.png
  7. about:
  8. # DC Offset
  9. Adds a DC Offset (0 Hz non-moving frequency) to all channels of a signal.
  10. This will usually not be a desirable thing, but it will help you when testing
  11. DC filters for functionality. :)
  12. // ----------------------------------------------------------------------------
  13. // The range [-1,+1] adds DC of up to 0 dBfs, so that should be sufficient...
  14. slider1:dcOffset=0<-1,1,0.00001>DC Offset
  15. // By not having in_pin and out_pin assignments, this plugin is able to adapt to
  16. // the number of channels on its track automatically.
  17. @sample // ---------------------------------------------------------------------
  18. // Start at channel 0
  19. channel = 0;
  20. // Cycle through all channels on this track
  21. while (channel < num_ch)
  22. (
  23. // Replace this channel's sample by a DC filtered version of itself
  24. spl(channel) += dcOffset;
  25. // Advance to the sample on the next channel
  26. channel += 1;
  27. );