From a001a9322f71ec5dc589884c8d6ad761c58dd03b Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 20 Apr 2015 15:52:30 +0200 Subject: added bit-crusher effect --- applause.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applause.lua b/applause.lua index c4a27d8..1da9f10 100644 --- a/applause.lua +++ b/applause.lua @@ -188,6 +188,12 @@ function Stream:BRF(freq, quality) return BRFStream:new(self, freq, quality) end +-- Bit crusher effect +function Stream:crush(bits) + bits = bits or 8 + return (self * (2^bits) + 0.5):floor() * (1/2^bits) +end + -- The len() method is the main way to get a stream's -- length (at least in this code) and classes should overwrite -- this method since LuaJIT has problems -- cgit v1.2.3