<?php
	include 'modsfordanhead.php';
?>
		<h1>Modifications to two Digitech Whammy(s)</h1>
		<hr/>
		<p><img src="whammy/pictures/dw_fullpanel.jpg" alt="" width="100%" /></p>
		<div>
			The modifications done to these units are as follows:<br/>
			<ul>
				<li>Direct program select buttons</li>
				<li>Pedal replaced with a slider</li>
				<li>CV control of pitch-shift amount</li>
				<li>Expression pedal control of pitch-shift amount</li>
				<li>Selectable quantization of pitch-shift amount in steps of 1/2 notes</li>
				<li>Slider START and STOP values for min/max travel</li>
			</ul>
			Possible future extensions:<br/>
			<ul>
				<li>Lots and lots of optimization and fine tuning</li>
				<li>Replace most of the circuitry</li>
				<li>Quantization per-mode</li>
				<li>MIDI IN (with pitch-shift controlled by MIDI notes)</li>
				<li>Bunch of analog event-generators (LFOs, ADSRs etc.)</li>
				<li>USB</li>
			</ul>
		</div>
		
		<h2>Preface</h2>
		<div>
			<img class="right" src="whammy/pictures/dw_orgpcb.jpg" width="33%" />
			The way that the original whammy works is quite simple; it's got a LED/LDR sensor for the 'whamming'-amount
			and it's got a digital rotary encoder for switching inbetween programs. Furthermore it's got some MIDI 
			control including choosing mode with a MIDI Program Select Command and - here's where it gets retarded - 
			a MIDI CC # for whamming amount! Now that they didn't bother to make the whamming controllable by Key ON 
			events could be for several reasons; the fact that they wanted it out on the market quicker, that they
			thought a 'cheap' pedal shouldn't have that kind of capability, or the fact that their pitch-shifting
			algorithm seemingly isn't linear (very strange, more on this later)! Either way you've got two basic
			parameters, whether you use MIDI or not; Whammy Mode and Whammy Amount.
		</div>

		<h2>The circuitry</h2>
		<div>
			<img class="right" src="whammy/pictures/dw_newpcb.jpg" alt="" height="250px" />
			The circuitry is based around a Microchip PIC, a couple of logic chips and a few opamps. The initial idea
			was quite simple, but perhaps not the smartest (i was an idiot). For the program select
			function I didn't even consider the MIDI implementation but instead decided to hack into the rotary 
			encoders circuitry to fake turns on the dial. So to go to a certain program, i've gotta know exactly
			at which program i'm at currently, and the only way of doing that was to at all times monitor the LEDs 
			indicating the selected program. To control the whamming amount i decided to disconnect the LED in the 
			LED / LDR contraption from it's constant connection to +V and instead make it voltage-controlled. I realized that this
			would be a little bit tricky because LEDs are non-linear, but in the beginning i didn't know that it was
			possible to control the whamming amount with MIDI, and when i did realize that i still thought that 7 bytes
			of control probably wouldn't sound very in tune.
			<br/><br/>
			<img class="right" src="whammy/pictures/dw_newpcb_bot.jpg" alt="" height="250px" />
			The scanning of the LEDs to know which program is currently selected never worked properly, and due to this
			the 'faking encoder turns'-approach was out the door as i couldn't be 100% i'd hit the right program.
			As for the voltage-control of the LED in the LED / LDR contraption it turned out that the voltage-range
			necessary was really narrow and really picky, and it also seemed like it'd probably change with each
			whammy meaning that each unit would have to be fine-tuned in-house before shipping. This seemed
			like a PITA so in the end a good friend reminded me of the MIDI implementation and i arrived at actually 
			doing both these things via MIDI, the mode selection buttons sends MIDI. 
			Since i had already built the scanning circuitry for the program LEDs and it worked well enough i kept it;
			the microchip PIC scans the output lines of where the original 
			LEDs were connected and outputs it's own data to the shift-registers that connects the LEDs. Now not only 
			is this a waste of chips, MCU-power, wire and solder, but it also works pretty badly - the LEDs flickers and
			the circuitry sometimes even twitches inbetween showing different programs as active. All this due to the
			fact that i didn't have time to bugtest and because at the time, it didn't really matter - in fact the 
			flickering, Dan said, would help him find the right keys while on a dark stage :) Anyway all isn't lost
			here because if the code was rid of bugs one could actually make use of the fact that the MCU knows which
			program that is selected; selectively changing quantization table (more on this later). It should also be
			said that some of these problems stems from the fact that the Whammys PSU isn't completely happy driving
			my extra circuitry and in the beginning i was unknowingly fighting a really whacky rotary encoder that
			was doing things 'its own way'.
			<br/><br/>
			Alright, so here's the gist of it; the LEDs are controlled by two 74hc595 shift-registers. The program
			select buttons are arranged in a matrix-style (with one exception), they share the same datalines as
			the incoming LED data from the whammy so both of them have a 74LS245 buffer ('cause i've got load of them)
			with a CS controlled by the PIC. All the whamming amount data is summed through a couple of opamps
			and are sampled with the PICs internal AD. The MIDI output, a few of the LEDs and two of the buttons share
			some common data lines and are enabled through 4066 switches. The bypass LED indicator is ANDED together
			similarly to how the original whammy LEDs were enabled, using two transistors. 
			<br/><br/>
			Now the AD sampling of the whammy amount isn't perfect - it's jittery - probably due to the fact that
			i used VDD as a sampling reference and for some dumb reason didn't put in extra bypass caps. I 'solved' 
			that through oversampling. The circuit is also not 100% V/Oct, i didn't really bother since it turned out that
			the CC that has to be given to the whammy to do 1/2 notes isn't linear. It's also not logarithmic. Or 
			exponential. It's just weird. So to use the circuit with an external CV keyboard you'll have to turn on 
			the quantizer either way, so it really doesn't matter that much. I had to tailor the quantization table
			by ear to get the notes sort of in the right tuning, it sounds ok and it does work with the one V/Oct 
			keyboard i tried it with. I did however realize that there are a bunch of CV keyboards that don't 
			necessarily have their lowest key on 0V, normally this doesn't matter since you've got more then one
			octave to play around with but for the Whammy's one octave it does, so when connecting a CV keyboard
			one can tailor the lowest key to give exactly no octaving.
		</div>
		
		<h2>What i would do differently</h2>
		<div>
			Well there's a bunch of stuff here; first of all i would completely remove the LED scanning stuff and
			just connect my LEDs the same way as the original whammy, i would then connect the rotary encoder to the
			PIC instead of directly to the whammy so i could monitor the program changes. This of course means also
			saving the last state before power off in the PICs EEPROM so that i could reset it into a known last state
			and still keep track. I would also either use an external AD +Vref reference or in fact just go with an 
			external AD, furthermore i would make a MIDI IN on the PIC so that i could use external MIDI messaging and
			the modified program-selectors at the same time. I would probably also make use of the PICs USB 
			capabilities.
		</div>
<!--		
		<h2>Workings</h2>
		<div>
			The program select methode that was finally settled on was (of course) sending a MIDI Program Select 
			message from the 
		</div>
		-->

<?php
	include $myroot . 'footer.html';
?>