Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. unsigned char overdrive(unsigned char t, unsigned char cut){
  5.     int realSignal = t - 127;
  6.     int sign = (realSignal > 0) ? 1 : -1;
  7.     int overdrivenSignal = abs(realSignal) < cut ? realSignal : cut*sign;
  8.     return overdrivenSignal+127;
  9. }
  10.  
  11. unsigned char amp(unsigned char t, unsigned char power){
  12.     int realSignal = t - 127;
  13.     return realSignal*power - 127;
  14. }
  15.  
  16.  
  17. main(t){
  18.     for(t=0;;t++) {
  19.         //printf("%d\n",
  20.         putchar((unsigned char)(
  21.             overdrive(127*(1+sin(t*0.0003925*440)), 64*(1+sin((double)t/6000)))
  22.         ));
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement