Permalink
Browse files

Add noise gen

  • Loading branch information...
1 parent fe89e34 commit 1d024e35cdba9c739afb2a24686464e71818781f @awwaiid committed Feb 6, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 noise_state.pl
View
@@ -293,6 +293,31 @@ sub segment_gen {
sequence_gen(@gens);
}
+sub noise_gen {
+ my $formula = shift;
+ my $volume = shift || 0.1;
+ my $bits = shift || 8;
+ my $max = 2 ** $bits;
+ my $t = 0;
+ return sub {
+ $t++;
+ $_ = $t;
+ return (((
+ $formula->($t)
+ ) % $max - ($max/2))/($max/2)) * $volume
+ }
+}
+
+play(
+ envelope_gen(
+ noise_gen( sub {
+ # $_ * (42 & $_ >> 10)
+ (( $_ *( $_ >>8| $_ >>9)&46& $_ >>8))^( $_ & $_ >>13| $_ >>6)
+ }),
+ 0.5, 20, 0.5
+ )
+);
+
play(
envelope_gen(
combine_gen(

0 comments on commit 1d024e3

Please sign in to comment.