Ernie The Electronic Organist


Published on

My presentation on a hardware hack project which has been undertaken by my Dad, Geoff King.
Done for BarCampBlackpool initially, and also presented at BarCampLondon7.

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ernie The Electronic Organist

  1. 1. E R N I E T H E E L E C T R O N O R G A N I S T I C Or - How to make a BBC Micro play a pipe organ
  2. 2. ERNIE the Electronic Organist BarCamp London Presentation by Caz Mockett
  3. 3. ERNIE the Electronic Organist – About The Project Engineer <ul><li>I am presenting a hardware hack project which has been undertaken by my Dad, Geoff King </li></ul><ul><li>He is a closet geek/engineer/tinkerer with many years’ experience under his belt </li></ul><ul><li>He spent most of his career before retirement in the Physics Department of the University of Essex </li></ul><ul><li>He taught the students how to interface lab experiments with KIMs, then BBCs, and later PCs </li></ul><ul><li>When the BBC Model B arrived, he had an idea to use one to play the organ in his local church, where he has been organist since the mid-1960’s </li></ul>
  4. 4. <ul><li>But in the early 1980’s they were expensive state-of-the-art machines – as you may have seen recently on the excellent BBC4 series Electric Dreams! </li></ul><ul><li>So the idea was put on hold for a while. But you know a geek. An idea never really goes away... </li></ul><ul><li>Some 20 years later, with his retirement looming, he was able to “acquire” several Beebs, by then regarded as redundant and heading for the scrap heap </li></ul><ul><li>The idea was dusted down, and Ernie the Electronic Organist was born </li></ul>ERNIE the Electronic Organist – About The Project Engineer
  5. 5. <ul><li>The church organ is a modest affair of 6 speaking stops on a single 54-note manual keyboard , with a single stop on an independent 30-note pedal organ </li></ul>ERNIE the Electronic Organist – The Organ
  6. 6. <ul><li>As small organs go, the instrument is unusual in having electro-pneumatic action </li></ul><ul><li>This is in contrast to the traditional system of rods and levers, known as trackers , linking the keyboard to the pallet valves which supply air to the pipes </li></ul><ul><li>Switches beneath the keys supply current to a series of solenoids which operate small valves controlling the air supply to the pneumatic motors attached to the pallet valves </li></ul>ERNIE the Electronic Organist – The Organ
  7. 7. <ul><li>Here is a part of the wind chest showing the solenoids in action whilst the organ is played: </li></ul><ul><li> </li></ul>ERNIE the Electronic Organist – Hardware In Action
  8. 8. <ul><li>An unregulated PSU provides up to 10 amps of current at a nominal 14 volts DC to power the action </li></ul><ul><li>One side of each magnet is connected to the 0 volt rail, with the keyboard switches on the +14 volt side </li></ul><ul><li>The aim of the project is to simulate a series of computer-controlled switches in parallel with the keyboard switches </li></ul>ERNIE the Electronic Organist – The Organ Electro-Pneumatic Action
  9. 9. ERNIE the Electronic Organist – The Switching Circuit in Parallel <ul><li>The analogue switching circuit for each note looks like this </li></ul>
  10. 10. ERNIE the Electronic Organist – The Switching Circuit in Parallel <ul><li>A 1-bit data latch stores the state of each note, ON or OFF </li></ul>
  11. 11. <ul><li>The LEDs were originally provided to facilitate trouble-shooting at the development stage, but now provide entertainment for interested spectators! </li></ul>ERNIE the Electronic Organist – The Manual Switching Circuit Hardware
  12. 12. <ul><li>It will be noted that the components are grouped to correspond to the layout of keys on the keyboard </li></ul>ERNIE the Electronic Organist – The Pedal Organ Switching Circuit
  13. 13. <ul><li>Here is a short video showing the switching boards whilst the organ plays a familiar tune … </li></ul>ERNIE the Electronic Organist – A Quick Demontration!
  14. 14. <ul><li>The diagram of a sample latching circuit is shown below - there are 4 latches per chip, but there are only two clock lines, each one clocking two latches </li></ul>ERNIE the Electronic Organist – Addressing The Latches <ul><li>So each latching operation requires two bits distributed via a network of 74LS04 inverting buffers to provide the necessary fan-out </li></ul>
  15. 15. <ul><li>A single 1-0-1 clock pulse is then routed to one latch pair only, using a 2-to-4 74LS139 decoder and a series of 1-to-16 74L154 demux chips , as shown -> </li></ul>ERNIE the Electronic Organist – Addressing The Latches <ul><li>This arrangement requires 5 address bits as well as the two data bits and one clock bit </li></ul>
  16. 16. <ul><li>Each of the 32 5-bit addresses points to a pair of latches, so giving access to a maximum of 64 individual latches </li></ul>ERNIE the Electronic Organist – Addressing The Latches <ul><li>There are only 54 notes on the manual organ, but some of the spare latches are used for auxiliary functions , including the operation of the master switching transistors in the 14V supply to upper and lower halves of the analogue switching board </li></ul>
  17. 17. <ul><li>This is the address routing circuit board </li></ul>ERNIE the Electronic Organist – Opto-Isolators, Decoders and Buffers
  18. 18. <ul><li>This is the latch circuit </li></ul><ul><li>Much of the above hardware is duplicated to provide independent operation of the 30-note pedal organ , but this needs only one additional address line to distinguish between the two sections </li></ul><ul><li>Thus: Note address bits PB0-4 Manual/Pedal select PB5 Data output bits PB6-7 </li></ul>ERNIE the Electronic Organist – Latch & Buffer Circuit Board
  19. 19. <ul><li>Operation of the above hardware is controlled by a machine code program running on the BBC Micro </li></ul><ul><li>A user interface in BBC BASIC , normally running in MODE 6, controls the display, selection and loading of items from the music menu </li></ul><ul><li>Prior to the transfer of control to the machine code there is provision for setting a number of playing parameters , whose values are passed via the Resident Integer Variables </li></ul>ERNIE the Electronic Organist – Machine Control
  20. 20. <ul><li>The system can play music in up to 8-part harmony , equivalent to 8 separate parts or voices in a choir, and keeps track of the current status of each part </li></ul><ul><li>The numerical data for each piece of music are arranged in groups to represent events at successive points in time </li></ul><ul><li>Each event usually involves changing the note being played by any one or more of the parts, including muting any of the parts </li></ul><ul><li>Following are some examples of three typical events </li></ul>ERNIE the Electronic Organist – Data Format
  21. 21. ERNIE the Electronic Organist – Data Format <ul><li>Starting at address 193 is the Data Group for a chord, duration 21 time units </li></ul><ul><li>The Control Byte at 194 has value 180 = &B4, which has 4 bits set (7, 5, 4, 2) </li></ul><ul><li>The voices corresponding to bits (6, 3, 1, 0) will remain unchanged, whatever their previous states </li></ul><ul><li>Address 199 holds value 131=&83 which represents a mute of all voices, duration 3 time units </li></ul><ul><li>Address 200, 201 hold the sequence 00, 08 which represents the bar line at the start of bar 8 </li></ul>Data Group starting at Address 193 199 200 Duration 21 03 00 Control Byte &B4 (180) &83 (131) 08 Notes S X A T Y B P Q bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 A3 (34) -- F#3 (31) C3 (25) -- D2 (15) -- -- Significance Voice 4-note chord Mute Bar No. 8
  22. 22. <ul><li>The data group for each event begins with a Duration Parameter , D, a 6-bit number in the range 1 to 63 which defines the length of time that the note or chord in question is to be sustained </li></ul><ul><li>The default value of D is 24 units for a crotchet, 12 for a quaver, etc., although these values are arbitrary – but the inclusion of a factor of 3 facilitates the rendering of triplet rhythms when required </li></ul><ul><li>Next comes an 8-bit Control Byte which acts as a mask defining which part or parts are to be changed </li></ul><ul><li>This is followed by a list of N numbers, each in the range 0 to 54, representing the notes to be played </li></ul>ERNIE the Electronic Organist – Data Format
  23. 23. <ul><li>N is the number of set bits in the mask and the sequence of note-numbers defines to which parts they are allocated </li></ul><ul><li>The note value zero indicates that the relevant voice is to be silenced </li></ul><ul><li>A Duration Parameter in the range (1 to 63) + &40 indicates that the previous chord is to be maintained unchanged for a further period of time ( a tie ) </li></ul><ul><li>A parameter in the range (1 to 63) + &80 heralds a mute , a period in which all parts are to be silenced </li></ul>ERNIE the Electronic Organist – Data Format
  24. 24. <ul><li>A Duration Parameter of zero represents an Escape Code which is followed by at least one further byte </li></ul><ul><li>If this next byte is a number in the range 0 to 240 (&F0) it indicates a bar number in the music - this is ignored by the playing program but is an invaluable aid to editing the data </li></ul><ul><li>Values from &F1 to &FF invoke various special functions and may be followed by additional bytes </li></ul><ul><li>These functions include setting the Tempo Parameters , marking the beginning and end of repeated passages, implementing octave- and pedal-coupling facilities and marking the end of the piece </li></ul>ERNIE the Electronic Organist – Data Format
  25. 25. <ul><li>In the early days, the data lists were compiled and entered into memory manually , which was extremely tedious even for short and simple melodies </li></ul><ul><li>Around the same time, Dad was writing a PC-based program originally designed merely to print music in a legible form, and it occurred that it might be possible to combine these two problems </li></ul><ul><li>Now, generation of the data begins with a Project in Visual Basic running on a PC under Windows 98 </li></ul><ul><li>Please stop laughing , there are good reasons for using this ancient machine! </li></ul>ERNIE the Electronic Organist – Generating The Data
  26. 26. <ul><li>The programme initially displays a pair of blank staves, plus, in the case of organ music, an additional stave to show the pedal part </li></ul>ERNIE the Electronic Organist – Generating The Data
  27. 27. <ul><li>Notes are inserted by a series of mouse-clicks to build up a single line of music </li></ul>ERNIE the Electronic Organist – Generating The Data <ul><li>The information displayed is stored in memory merely as the note-values and their co-ordinates on the staves, and each line of music can be saved as a .DAT file </li></ul><ul><li>No bit- image files are involved </li></ul><ul><li>It is important to note that all the notes in a given chord must be vertically aligned at the same X-co-ordinate else they will not be rendered as a single event when played </li></ul>
  28. 28. <ul><li>The N lines of music required for a given work can be printed out for future reference </li></ul>ERNIE the Electronic Organist – Generating The Data <ul><li>The filename for each line of music is constructed from the file-stem, Bday in the example shown </li></ul><ul><li>Plus the bar number at the start of that line, thus Bday1.DAT and Bday5.DAT </li></ul>
  29. 29. <ul><li>The treble clef (normally played by the right hand) contains the S oprano part (tails up) </li></ul><ul><li>A lto (tails down) and an extra intermediate part ( X , with no tails) </li></ul>ERNIE the Electronic Organist – About The Voices <ul><li>Similarly the next stave down ( bass clef , normally played by the left hand) supports T enor (tails up) </li></ul><ul><li>B ass (tails down) and an additional part ( Y , no tails) </li></ul><ul><li>The lower bass clef, where used, is played by the pedals and can contain two parts, tails up ( P ) and down ( Q ) </li></ul><ul><li>When the music has been compiled the order of parts as shown in the Control Byte is from most to significant bit to least: S, X, A, T, Y, B, P, Q </li></ul>
  30. 30. <ul><li>Visual Basic and Windows can now be closed and a compilation program loaded in GWBASIC under MS-DOS </li></ul><ul><li>Details of the file-stem ( Bday ), bar numbers ( 1, 5 ) and Folder ( Happy ) are entered, together with an estimate of the required metronome value in crotchet beats per minute </li></ul><ul><li>The compiler then reads each if the .DAT files in turn and processes them into the format required by the BBC program </li></ul><ul><li>The complete data list is saved as a .BIN file, e.g. 8HBDAY1.BIN , indicating 8 parts (and 7+ext file name) </li></ul>ERNIE the Electronic Organist – Compiling The Data
  31. 31. <ul><li>Control is now passed to a second program in GWBASIC </li></ul>ERNIE the Electronic Organist – Generating The Data <ul><li>This enables the data to be edited and any errors and omissions corrected </li></ul><ul><li>In this 8-part PC editor two lines of data , comprising 32 columns or events , can be displayed </li></ul><ul><li>Note that a line of displayed data does not as a rule correspond to a line of the printed music </li></ul>
  32. 32. <ul><li>Various features of the data are indicated by their colours: green (decimal) numerals indicate memory addresses at which the data for each event begins </li></ul>ERNIE the Electronic Organist – Generating The Data <ul><li>Red (decimal) numerals are the Duration Parameters </li></ul><ul><li>Pale blue (hexadecimal) numbers are the Control Bytes, and the white characters define the note letters and the octaves in which they are situated </li></ul><ul><li>The usual range of organ music is from two octaves below middle C (C1-B1, and C2-B2) to two and a half or three octaves above (C3-B3, C4-B4, and C5-F5 in this case) </li></ul>
  33. 33. <ul><li>Phrasing in organ music is achieved solely by small adjustments to the duration of selected chords and by short gaps inserted between them </li></ul>ERNIE the Electronic Organist – Editing The Data <ul><li>Pressing any key at this stage of the display causes the lower line of 16 columns to be erased and replaced by cues and space for input statements to make any changes </li></ul><ul><li>The data as initially compiled will often sound rather bland and boring but can be made to sound more realistic by careful editing at this stage </li></ul><ul><li>In particular it is the custom to increase the length of the first note in each bar by one unit , a process carried out automatic- ally by the compiler </li></ul>
  34. 34. <ul><li>A further GWBASIC program is then invoked to transfer the file over a parallel cable to a BBC where it is received and saved by another program </li></ul>ERNIE the Electronic Organist – Transferring The Data <ul><li>After the data has been edited it is wise to save it to a different filename, e.g. 8HBDAY2.BIN </li></ul><ul><li>There is also a BBC data editing program but due to memory space constraints it is very limited in scope compared to the PC version & can display only 10 cols or events at a time </li></ul><ul><li>The data, now on a BBC floppy disc , can be taken to the church to be tested on the organ </li></ul><ul><li>If necessary, final adjustments can be made there using the BBC editor </li></ul>
  35. 35. <ul><li>In typical geek fashion, the project was originally undertaken to test an idea and see if it could be done </li></ul><ul><li>After a few teething troubles were ironed out it has proved extremely versatile and reliable and appears to be capable of playing almost any organ music that can be rendered on a single-manual instrument </li></ul><ul><li>It just requires sufficient time and patience in setting up and editing the data </li></ul>ERNIE the Electronic Organist – So Why Bother?
  36. 36. <ul><li>It now plays most of the voluntaries in the weekly service and has even been used for an evening’s organ recital, raising money for charity </li></ul><ul><li>With the aid of a computer-literate assistant, it has occasionally been used to accompany the hymn singing when no organist has been available </li></ul><ul><li>However, setting up the files for 5 hymns is no trivial task since each verse may need to be differently edited for correct phrasing due to different words </li></ul>ERNIE the Electronic Organist – What He Can Do
  37. 37. <ul><li>And now for a short recital … </li></ul>ERNIE the Electronic Organist – Ernie Performs!
  38. 38. <ul><li>I have often wondered if, instead of spending so much time designing hardware, software and inputting data to the system, Dad had spent the time practicing the organ tunes in the first place, he would be able to play them himself! </li></ul><ul><li>But that would not have been half the fun ;-) </li></ul><ul><li>So, any questions ? </li></ul>ERNIE the Electronic Organist – Final Thoughts