GuitarBoy

The 'GuitarBoy' was a bit depth reducer and foldover effect box for electric instruments inspired by the sounds and aesthetic of the 1989 Nintendo GameBoy. I used Csound to create the effect and ran it on the BeagleBone development platform. An LFO could modulate the amount of sample rate reduction.

GUITARBOY Bitcrusher  
Trev Wignall  
8/24/15 

-+rtaudio=alsa -odac -iadc:hw:1,0 -b64 -B1024  
  
  
sr              =       44100  
ksmps           =       1  

alwayson 1  
instr 1  

k_clock metro 100  

read:  

k_adc1_raw  readk "/sys/bus/iio/devices/iio:device0/in_voltage1_raw", 7, .5  
k_adc2_raw  readk "/sys/bus/iio/devices/iio:device0/in_voltage2_raw", 7, .5  
k_adc3_raw  readk "/sys/bus/iio/devices/iio:device0/in_voltage3_raw", 7, .5  
k_adc4_raw  readk "/sys/bus/iio/devices/iio:device0/in_voltage4_raw", 7, .5  
k_gpio66_raw  readk "/sys/class/gpio/gpio66/value", 7, .5  
rireturn  

if (k_clock == 1) then  
reinit read  
endif  

;printk2 k_adc4_raw  

;INPUT AND NOISE GATE  

a_in in  

;BIT DEPTH REDUX  

k_adc1          =       (k_adc1_raw / 4096)  

;Change These Numbers ! ! ! ! ! ! !  
k_starting_gain         =       1  
k_added_gain            =       8;16  
;ben is happy with 8 ^  
k_gain         =     ((k_adc1 * k_added_gain) + k_starting_gain)  

a_prc           =       (a_in * k_gain)  

k_bit           =               (-1 * k_adc1_raw * .00146 + 8.00)  
k_values        pow             2, k_bit  
k_16bit         pow             2, 16  
k_sig           downsamp        a_prc  
k_sig           =               int(k_sig * (k_values/k_16bit))  
k_sig           =               k_sig * (k_16bit/k_values)  
a_prc           interp          k_sig  

;printk2                k_gain  
;printk2                k_low  
;printk2                k_bit  

a_prc           =       (a_prc / k_gain)  

;SAMPLE RATE MOD  

k_amp                   =       (k_adc3_raw * .512)  
k_rate                  =       (k_adc4_raw * .0049)  
i_wv_frm                =       3       ;unipolar square  
k_mod                   lfo     k_amp, k_rate, i_wv_frm  

;printk2                k_amp  
;printk2                k_rate  

;SAMPLE RATE REDUX  

k_sr_mult       =               .0154  
k_sr_amt        =               (((k_adc2_raw + k_mod) * k_sr_mult) + 1)  
a_prc           fold            a_prc, k_sr_amt  

;printk2                k_sr_amt  

;BYPASS GATE AND ATTENUATION  

k_thresh        =       30  
k_loknee        =       48  
k_hiknee        =       60  
k_ratio         =       1  
k_att           =       .001  
k_rel           =       .1  
i_look          =       .05  

if (k_gpio66_raw = 0) then  
a_out   =       a_in  
else  
a_out   =       a_prc  
endif  

out (a_out * .1)  
endin  

  
  
;       inst    start   duration  
;i      1               1               864000  
f0      864000  
e  

 

Alias

 'Alias' was a spectral audio analyzer which output MIDI data. It was music technology project I worked on for a couple of years at Berklee, and a year after. The aim of the project was to control synthesizers with electric instruments with an exceptional degree of accuracy. My controller used the BeagleBone development platform, Debian Linux, Csound, and a modified USB-MIDI interface.

be sure to run as 
csound alias_3_11_16.csd --sched -d -odac 

 
 
-+rtaudio=alsa -odac:hw:0,0 -iadc:hw:0,0 -+rtmidi=alsa -M hw:1 -Q hw:1 -b16 -B5$ 

 
 

sr      =       44100 
ksmps   =       2 
nchnls  =       2 
0dbfs   =       1 

;initialize global i-rate variables, adjust for different instruments... 
gi_fftsize      init    1536    ;fft size. 
gi_overlap      init    768     ;overlap. must be around gi_fftsize/4 
gi_winsize      init    1536    ;window size. must be at least ifftsize 
gi_wtype        init    0       ;window type. 

;initialize global k-rate variables 
gk_chn                  init    1       ;midi chnl 
gk_dn_cc                init    1       ;downbow pressure 
gk_up_cc                init    2       ;upbow pressure 
gk_dir_cc               init    3       ;direction 

;indicate when ready 
isys system_i 1, {{echo 30 > /sys/class/gpio/export}} 
;input and clocking 
alwayson 1 
instr 1 

gk_clock        metro 90 
ga_L, ga_R      ins 

endin 

;spectral analysis 
alwayson 2 
instr 2 

read: 

k_file  readk "/sys/bus/iio/devices/iio:device0/in_voltage0_raw", 7, .5 
rireturn 

if (gk_clock == 1) then 
reinit read 
endif 

k_thresh scale (k_file/4096), .1, .001 

fsig            pvsanal   ga_R, gi_fftsize, gi_overlap, gi_winsize, gi_wtype 
k_fr, k_amp     pvspitch   fsig, k_thresh 

k_oct           limit octcps(k_fr), 0, 20       ;ZERO REPRESENTS SILENCE 
k_num   =       int (((k_oct) - 3) * 12 + 0.5)  ;convert to note number 

k_trnote1       changed k_num           ;note number changes AND silence 
;consider adding additional trigger for silences 

if (k_oct <= 0) then            ;if there are not any notes active 
k_amp           =       0 
endif 

;       pitch bend (figure out how you did this  sometime) 
k_bnd   =       (((pchoct (k_oct) + 0.005) * 100) % 1) 

;       midi out 
midion2 gk_chn, k_num, (k_amp * 127), k_trnote1         ;pitch and velocity 
outkpb gk_chn, k_bnd, -.4, 1.4  ;set synth pb to 1 step up and down 
outkat gk_chn, k_amp, 0, 1 

endin 

;amplitude analysis 
alwayson 3 
instr 3 

k_max           max_k ga_L, gk_clock, 2           ;get maximum of original sign$ 
k_min           max_k ga_L, gk_clock, 3           ;get minimum of original sign$ 
k_amin          =       abs (k_min)               ;get absolute value of minimum 

k_up            =       (k_max > k_amin ? (k_max) : 0) 
k_dn            =       (k_max > k_amin ? 0 : (k_amin)) 

outkc gk_chn, gk_up_cc, k_up, 0, 1 
outkc gk_chn, gk_dn_cc, k_dn, 0, 1 
outkc gk_chn, gk_dir_cc, (k_up * 127), 0, 1 

endin