aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-04-20 15:52:30 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-04-20 15:52:30 +0200
commita001a9322f71ec5dc589884c8d6ad761c58dd03b (patch)
tree381bfea7da555b2ad63c46ed8a48bc2a639b96c2
parent1174032a180acd0a01615dc52eaf3e6e2f295e3b (diff)
downloadapplause2-a001a9322f71ec5dc589884c8d6ad761c58dd03b.tar.gz
added bit-crusher effect
-rw-r--r--applause.lua6
1 files changed, 6 insertions, 0 deletions
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