Tuesday, 29 March 2011

MIDI Bass Pedals

The virtual organ project continues...

As I mentioned before, the key elements of the player interface for a virtual “Hammond-style” organ are...

• Keyboards
• Pedals
• Controls

The keyboards are cheap (and rather nasty) "off the shelf" items. I’ve demonstrated how to implement the controls (both simple Boolean controls and – most importantly – analog controls such as drawbars). Now it is time to confront the bass pedals.

Whilst a full-size RCO pedalboard would be nice (and remains on the wish-list for the future) a more practical 13-note pedal department will have to do for the moment. Whilst making one from scratch would be fun, there are only so many hours in the day and old organs (with perfectly serviceable pedals) are cheap.

I found such a cheap organ on eBay – won for the princely sum of a pound (pity about the diesel I burned in transporting it home).

Here is the “organ donor” – a Hammond 9422k, enjoying its last few moments in the “old keyboards’ home” next to my Fender Rhodes...


Unlike the other kind of organ donor scheme (in which – as I heard on the radio recently - the donor is left for five minutes after their heart stops – just in case), this donor was still viable. It worked. That is to say, whilst 95% of all the voices sounded dreadfully “70’s home organ” and were an insult to the name “Hammond”, I could use it to perform (at best) a parody of a Rive Gauche Cafe Accordionist. Accordingly, I admit to feeling a twinge of guilt when I broke it up for “transplant”.

I’ve saved the Leslie, the main speaker, the amplifier and the control electronics to select between them. I’ve saved the manuals (which feel so much better than my MIDI controller keyboards). I’ve salvaged several miles of hook-up wire and several dozen A733 PNP transistors. Most importantly, I salvaged a nice set of pedals (see here atop the old Workmate)...


Now – how to interface this array of switches...

I have some experience of arranging an intimate relationship between a PIC and a switch array (not least in the keypad for my multi-mode beacon). Here, I decided to use the same strategy – a group of four input lines with pull-down resistors, any of which can be pulled high by closing one of the pedal switches (you can see the 13 nice microswitches in the photo above). The switches would be addressed in groups of 4, requiring 4 “groups” to cover the 13 switches.

I created these addressable groups using a 3 – 8 line demultiplexer chip (to lower the burden on PIC I/O lines). This approach “future-proofs” the design, to allow expansion to a 2-octave (25 key) pedal board in the future.

I could have added to the program already running in the PIC16F873 which controls my drawbars – but I decided against this for several reasons...
Wiring complexity between pedals and the console
Saving code space, time and I/O pins on the PIC16F873
Availability of lots of 14 pin PICF676’s in the junk box
Production of a stand-alone solution for others to copy

Accordingly, here’s my design for a solution based on the PIC 16F676...


The pedals connect to the jumpers at bottom right of the schematic above like this...


OK – hardware is easy enough – now for the software...

The current “state” of the switches is read into two 8-bit registers “Pedals1” and “Pedals2”. This code segment shows scanning 8 keys into "Pedals1"...

These states are compared with the previous states, held in the registers imaginatively named “OldPedals1” and “OldPedals2”. Here’s the comparison for the first state register...

If there is a change between “Pedals1” and “OldPedals1” (signalled by one or more bits asserted in “DeltaP1”) the code above calls the subroutine “P1Change”...

Any asserted bit in “DeltaP1” results in a call to the relevant note subroutine – as, for example, the subroutine for the bottom C (which calls Ross Bencina's "sendmidi" subroutine via the macros "Noteon" and "Noteoff")...

Note that the settings of OldPedals are only changed after the relevant MIDI command has been sent – when OldPedals indicates that a note is “on”, it really is on – and vice-versa!

The code gives full 13-note polyphony (I’m not sure if that is a help or a hindrance!) and works perfectly. In a next version, I’ll use the extra three available switches to allow me to transpose up or down an octave – maybe.

All that remained was to cobble together an enclosure for the pedals. Here’s my “Work-in-Progress”, made out of the veneered plywood which formed the top of the old donor organ...


The system includes the (optical) swell pedal from the donor. I need to find some information on this device before I can build its interface (a question on The Organ Forum has yielded nothing but deafening silence so far). If you know anything about Hammond optical swell pedals, please contact me.

A third MIDI-USB interface arrived in the post this morning – so I’m up-and-running with two manuals, pedals, drawbars, percussion level, Leslie switch... We’re getting there!

...-.- de m0xpd

Thursday, 24 March 2011

Multi-Band LowPass

The multi-mode beacon (Blogs passim) is scheduled to make her public debut in a few weeks time at the NARSA Blackpool rally. Like any d├ębutante, she needs to look her best...

Amongst the many areas for development within the beacon, there is one gaping “incomplete” – the output lowpass filter. To date, I’ve been using the original ugly 30m lowpass seen in the photo below...


I had always planned to make a switchable output filter, after the style of the multi-band BandPass filter - indeed, I’d already provided a controlling output on the controller board and already written the code to switch bands. Now the time for the hardware finally had arrived...

Here’s the schematic – it borrows extensively from my BandPass system...


The board layout also exploits the work already done for the BandPass filter – all I had to do was change the central filter area. Here’s the resulting board, without any filter components fitted...


The filters used the design guide published by George Dobbs, g3rjv, which is derived from the work of Ed Wetherhold, w3nqn.

I made up the seventh-order filters specified for both 30 and 40m bands on the first two “channels” of the board...


The final channel is unpopulated (until such time as I decide which band to play with next), as with the BandPass unit. I may even go for a plug-in final filter, to keep my options open.

Here’s the new output filter in situ...


It works perfectly (now I’ve tracked down the accidental short on the output HI HI).

Any readers visiting the Blackpool Rally are encouraged to come and meet the beacon on the Warrington ARC stand (just inside the door, near the Bar – where else!)

...-.- de m0xpd


Sunday, 20 March 2011

Semi Lunacy


Visitors hoping to see the CW Filter project should click here


Well – the “virtual organ” project continues...

You might remember that I’m building some aspects of a physical interface for a “Hammond-style” tonewheel organ emulation (currently using the “Organzied Trio” VST plug-in). The first and most important part of the interface is undoubtedly the drawbars, but I’ve cracked that. Next on my list of “must-have” features is another iconic aspect of old Hammonds: the Leslie switch. Let me explain...

Hammond organs traditionally have been paired with “Leslie” loudspeakers within which sound is passed through rotating horns (or “baffles” for the lower frequency components). This system exploits Doppler shifts to generate interesting comb-filtering effects, the rate-of-change of which (corresponding to the speed of the rotating elements of the Leslie speaker) is controlled by a two (or three) position switch. In later organs, this switch was integrated within the console. However, perhaps as result of alleged antipathy between the Hammond and Leslie companies, early organs had an external switch fixed to the lower left side of the console, where the player conveniently could control it with her/his left hand.

That switch was mounted in a “half-moon” shaped case; the “semi lunacy” of our title is part of Hammond iconography (so much so there’s a crowd in the US trading as Halfmoon Electronics) and not another cheesy astronomical link to mark yesterday's lunar perigee.

Here’s one, mounted on a B3. Fortunately (for visibility) this one is white – more usually they were a sombre brown (the originals were made of Bakelite) or black.


I decided – in my lunacy – to make a half-moon enclosure for the switch I got from the good people at Warman Guitars (good prices, great service and a sense of humour).

I hacked a piece off some PVC 200mm soil pipe, glued on a “back” made of Perspex and roughed out a “top” from fibreglass PCB material (in which I cut the slot using a dental burr in my old horizontal milling machine).


Some more epoxy and fettling had the case finished...


The white “brackets” on the back are the "nylon" corner blocks that have replaced joinery skills in cheap modern furniture.

Here’s the whole shooting match installed on the temporary stand on which I'm assembling the "organ"...


All we need now is a lick of paint.

The switch grounds one of two PIC I/O lines which have pull-up resistors. The code reads these two I/O lines and sends MIDI commands to set the speed of the "Leslie" simulation accordingly. The switch currently selects between "Chorale" (slow; switch left) or "Tremolo" (fast; switch right). I've left the central position inactive (it should stop the Leslie rotors completely, but the Organized Trio software makes an irritating glitch when you de-select the Leslie simulation, so I've left it out).

Next step is the pedals – I’ve just won an old wrecker Hammond on eBay, from which I’ll rob out the pedal assembly and, perhaps, a few other bits. These will be converted to MIDI operation after even more coding for the PIC16F873.

Watch this space!

...-.- de m0xpd

Friday, 18 March 2011

A(nother) CW Filter

I have held this subject under a self-imposed “D-Notice” for the past few months as George, g3rjv, kindly agreed to publish it in our beloved SPRAT. Today, the Spring 2011 number hit my doormat, with my article on page 20, so I feel free to comment...

There have been any number of attempts to limit the output bandwidth of a CW receiver “correctly” (i.e. early in the signal chain) or as an “afterthought” (i.e. in the audio path). This idea belongs to the latter category. It is a tunable bandpass filter, which I designed with the intention of providing independent control of tuning and bandwidth. The “novelty” of the design – if it has any – is associated with the application of a “gryrator”, which is used to emulate an inductor, and with the manner by which the bandwidth control is achieved.

The “virtual” inductor is resonated with a capacitor to produce a resonant system, tuned to the desired frequency. The bandwidth is established by driving the parallel “LC” network with controllable source impedance; high impedance drive gives a very narrow bandwidth and vice-versa. The SPRAT article gives more detail.

The original development version was the usual pig’s breakfast of tangled, blue spaghetti, as seen in the photo...


Despite the mess, I was sufficiently encouraged by the performance of the filter to write it up for the journal. Here’s the measured frequency response – bold lines show the response with R4 at extreme settings and dashed/dotted lines at manually selected intermediate settings of the R4 potentiometer.


It worked – but it was hardly suitable for everyday use, so I cooked up a more practical version...

Here’s the schematic (identical to that in SPRAT, except for the addition of a “bypass” switch, S1)

here’s a PCB layout ...


and here's the copper side (shown in negative to make it visible against the black background of this blog)...

(any reader foolish enough to reproduce this PCB can scale and invert using image handling software)

The twin-gang potentiometer was chosen from Maplin’s catalog (usual disclaimer) to ensure availability (part number JM84F ) – no doubt an equivalent part is available from “other fine retailers”!

Here’s the finished article...


The tuning control, R6, is reduced to a trimmer. Once set (to 600 Hz, in my case) it is left alone.

The unit sits on the shelf next to my Funster Plus 40m rig, the usability of which it greatly enhances.


One day, I’ll get round to building it into the Funster’s case (assuming it will fit)!

Now for the bad news...

I explained in the SPRAT article how the prototype system makes an ugly noise if you turn it on with the control in “narrowest bandwidth” setting (momentarily backing off R4 stops the oscillation, after which the unit can be used without further problem). When I made the PCB version (above) I noticed some more “issues”...
  • Don’t drop the power supply voltage to 9V – keep it at 12, or higher

  • Don’t overdrive the unit with incoming audio – too much signal will cause the unit to clip and distort (as the gyrator saturates)

  • One particular setting of R4 on the current PCB version (close to – but not at – the “widest bandwidth” setting) can also evoke a brief “buzz”/”fart” sound

Despite these practical challenges, the unit works very well in a QSO. So well that I’m not inclined to sort out the remaining bugs and issues – life is short and there are so many interesting things to do!

...-.- de m0xpd

Saturday, 12 March 2011

MIDI Organ Drawbars

Here's a pretty story about PIC interfacing. OK - so the context is music technology - but I think Hams and "Knack Victims" will find something of interest. Read on...

Regular readers will remember I was given a Digital Effects Processor as a Christmas present. I was amused to hear that one of my fellow members of WARC uses these processors in his shack! I think he uses something called a "microphone" as an input to his radios - 'nuff sed. Of course, I'm pretty fussy about audio quality, too - having gone to elaborate lengths to generate a nice sound!

The Processor has some old-school 5-pin DIN sockets on the back (reminiscent of those on my beloved old Quad 33 pre-amp), supporting something called MIDI; the "Musical Instrument Digital Interface".


Well, I've managed to get through half a century without MIDI (despite a lifelong interest and activity in music and electronics). However, prompted by those sockets on the back of my Christmas present, I decided it was high time I learned something about it.

A sniff around the web showed me it is easy to generate MIDI signals using a PIC. I cut my teeth with a program for the PIC 16F873, generating control signals for the Behringer processor - all pretty easy stuff.

MIDI's physical layer involves the 5-pin DIN connectors mentioned previously - so I added to my stable of PlugIn modules with a MIDI connector...


The socket was part of the bargain haul from g4vap's stand at the Red Rose Rally a few months back.

Having seen how easy MIDI is to generate, I started to think about a project that has been fermenting in the back of my mind for several years - an organ. Not the "Hauptwerk" PC-based emulations of pipe organs (though, no doubt, I'll end up running that too). Rather, a virtual "tonewheel" organ, emulating a Hammond - such as that played by several of my "heros"...


PC software emulating a Hammond was led by Native Instruments' "B4" software, a demo of which I downloaded a few years back. The "B4" software was impressive, but limited by the price tag for the code itself (far too rich for a cheapskate like me) and by the requirement for an expensive hardware interface for the player, including...
  • Keyboard(s)
  • Pedals
  • Controls
MIDI keyboards are cheap, but both pedals and controllers (especially organ-specific controllers) are VERY expensive. However, now I had cracked MIDI, I could consider homebrew controls and pedals...

The key to the control interface for a Hammond organ is the array of "Drawbars" (some of which are seen in the image above, sandwiched between Joey and Thijs).

For the non-musos, drawbars are gain controls for individual harmonic components of the sound produced by the organ. The Hammond Organ (at least, any one of the bigger models) provides 9 drawbars for each of the two manuals and a further 5 drawbars for the pedal department. That's 23 potentiometers - easy enough to handle in the original analog "mixing" context but a non-trivial interfacing problem in a digital emulation.

The PIC16F873, as used in the controller for my multi-mode beacon, has 5 channels of 10-bit Analog to Digital Conversion on-chip - but interface to 23 pots was going to need some kind of multiplexing scheme...

Obviously, trying to switch 23 individual analog voltages to one (or more) analog inputs would be a chore - so I decided that it would be simpler to switch the voltage applied to the "top" of each of the potentiometers sequentially, such that only one pot is "energized" at any instant. Diodes would block the inactive potentiometers, allowing a SINGLE ADC channel to read the selected drawbar. I could scan along all the controls and send a MIDI signal whenever a control setting is changed.

Here's a schematic of the idea, for the 9 drawbars of the upper manual ...

A four-bit "address bus" gives access to 15 individual controls (the last of the 16 states is used to generate an "off" condition) - enough for the upper manual drawbars plus some extra analog controls (swell pedal, etc) OR for the drawbars for the lower manual and the pedals. The "address bus" will be shared by these two units - selection between them is arranged by individual (active low) "latch enables".

Here's the code for reading the setting of a single Drawbar...

MIDI control values are 7-bit numbers (0:127) and I ignore changes in the bottom two bits when checking if a drawbar setting has changed.

The subroutine calls in the code segment above are all pretty trivial; "Latch_Upper" simply puts an (active low) pulse to the 74HC137s in the Upper Manual Drawbar unit, "Delay" "does what it says on the tin", "sendmidi" is Ross Bencina's routine and "ad_conv" drives the A->D conversion on the PIC's RA0 pin...

I've breadboarded the system with the only two slider potentiometers I had in the "junk box"...


It operates though a dirt-cheap MIDI - USB adapter, available for peanuts from many sellers on eBay...


(OK: the MIDI -> USB interface is difficult to get running until you find the right links on the 'net and pluck up the courage to make the necessary Registry Changes - but the price is right!).

The prototype works perfectly with the excellent Organized Trio VST plug-in (which is a free-ware version of VB3)...


All that remains is to buy 23 sliders - another "trip" to eBay is indicated!

...-.- de m0xpd


Update

I happened to swing by Maplins yesterday and couldn't resist buying up all their stock of sliders - which now adds up to the spectacular total of five! Here they are in a test lash-up with a couple of keyboards [they are mapped to the lowest five Upper (swell) manual drawbars]...


Even this level of controllability makes the organ emulator infinitely more usable and musical - great fun!