Hammond organ / roto2

Status
Not open for further replies.
My first post here so forgive my youthful exuberance. Many thanks to Paul and all the contributors to Teensy and the terrific hardware and software you have created. I am especially pleased with the audio library. I am so impressed that you made meaningful real-time audio processing as easy as pie. My first teensy project was to download and install Peter Teichman's terrific roto2, a basic Hammond organ simulator. https://github.com/pteichman/roto2

I didn't see anyone mention it in this forum so I wanted to bring it to your attention. It features some very nice features and would serve nicely as the foundation for a polyphonic midi instrument.
  • Midi USB, Regular Midi is easy to add
  • 8 way polyphony. More is possible
  • Wavetable synthesis: write any waveform once and play it at any pitch
  • Vibrato audio block. Sounds great.
  • Nice serial debug stuff.
Again, thanks to all.

Dave Erickson
www.djerickson.com
 
Hi Dave,

Is this a complete simulation? Does the teensy do the audio processing as well as the midi processing, all on one board?

Brian.
 
Hi Dave,

Is this a complete simulation? Does the teensy do the audio processing as well as the midi processing, all on one board?

Brian.

Hi Brian,
Yes it does all the audio processing as well as midi interfacing on Teensy 3.2 + audio codec board. The 9 drawbar settings are midi commands. If you can follow Arduino C and C++ code you can get a good education in MIDI and audio processing by following thru Peter's program. The whole thing is about 15 pages of code.
Dave
 
Thank you Dave. I got my first Teensy today, the Teensy LC. I will be for the midification of a 13 note pedalboard. Afther this in the new year, I have HUGE plans for TEENSY. I am extremelly surprised at the small footprint of this little board - in fact, I am in awe.

I am looking forward to a long relationship with Teensies.

Regards,

Brian.
 
Thank you Paul. I hope my future midi projects will only use Teensy LC. I also do plan to step up to Teensy 3.6 when I am more confident.

This is a whole new world to me.
 
Oh hi! I'm the author of roto2 and just happened by this thread. Thanks for the kind words. Dave.

It's the continuation of some work I did for Hammond simulation on AVR Arduino. I moved on to other things before I figured out how to approach the simulation efficiently enough for that platform, and by the time I wanted to work on it again the Teensy was available with great built-in support for audio. (thanks Paul!)

Here's the status as of a year ago, and development has been inactive since then: https://www.instagram.com/p/-o5tDEsn1C/

For me it's a platform for playing with audio synthesis and a way to get a few more Hammond noises into the world. roto2 currently contains a wavetable oscillator with Hammond style drawbar control and a simulation of the Chorus/Vibrato scanner that I haven't evaluated for accuracy at all.
 
Hi Pteichman,

I've listned to your simulator, and have to say it sounds breathtaking, congratulations.

Some time I would like to build such a little box. I have a complete set of original drawbars, from my dead Hammond E100 console (9 upper, 9 lower, and 2 pedal drawbars), that I hope to somehow connect to the Teensy and hope they can come alive again. It would be wonderful.

Brian.
 
Last edited:
Hi Peter,

You are welcome, and I mean it. I love the hammond sound, and to me this is the 'simplest solution so far. Currently I am using a vstI in order to get to my most loved organ sound. I would really love to do this as well soon. I would like to do this very much, and it would be exceptional if I could control it with my set of original Hammond drawbars that I have. It would be the cherry on the cake. Not having to use a PC for this would be phenominal. I am prepared to go so far as to try 4 Teensies for this, each with it's own audio board, so that I have the most flexible system.

Regards,

Brian.
 
Hi Pteichman:
I came across this thread after having programmed my own Hammond tonewheel simulator. Looking at your code, it is much more elegant than mine. I had only gotten my first T3.2 and audio adapter board a few weeks when I wrote my version. I thought about loading all of the harmonics into 1 waveform like you do, but figured you couldn't change the drawbars while playing if I did it that way (without some glitch in the note generation). So, I used 56 individual sine synth blocks - 8 note polyphony x 7 drawbar harmonics (I left out the highest 2 harmonics so I would only need two X4 mixers per note polyphony.) Your way is more efficient, but I wasn't proficient enough in writing the underlying routines to tie in with Pauls Audio library, at that time.
I am a bit curious about the method you use for loading the waveform table. You decided on a longer wavetable- 768 samples, but you are loading it from the audio libraries 256 sample sine table. So, I am wondering if it would work better if you looked up the values from a 768 sample table that you generated yourself. I guess that I am not getting any more accurate results than your program, as I am mixing together up to 7 different sine waves but they are all based upon the 256 sample sine table in the audio library as well.
I also like your vibrato/chorus routine (again, I found it a bit late for me). I had tried the audio library chorus block but it didn't work at all when I tried it at the time. Neither did the audio lib. flanger block, which I was more interested in at the time. I found a (small) problem in the flanger and got it working. The audio lib chorus was a different matter- it wasn't going to work at all the way it was written. So, I modified the flanger routine to work as a vibrato/chorus, as the two algorithms are similar. It orig. used a sine wave modulation, but after seeing yours, I switched to a triangle wave, which works just as well. However, their routine used an offset between the pointer writing into the delay line, and the modulated pointer reading out of the delay line. There was a small error in that routine, which caused a faint clicking in the output signal, at the vibrato rate. After I corrected that error, it works perfectly now for vibrato or chorus (depending upon the adding in of the orig signal, or not). But, I don't see any such offset in your code. So, I wondered if you got a (very) faint distortion in your signal, at the vibrato rate?
Both of our simulators must sound about the same, and I've scoped the output signals and seen good, clean sine waves. But, I must admit that the Native Instruments B4 VST plug-in that I have on my computer does sound somewhat "richer", especially on the lower notes. I am thinking that the "Real" B3 tonewheels produced something other than a pure sine wave, explaining this. I know for sure that the lowest octave wheels on a B3 are not pure sine waves.
My program adheres to the "note foldover" in the upper octaves/harmonics that the B3 exhibited, due to there being only 93 tonewheels. I didn't check if your program does this as well.
Nice to see another Hammond / electronics fan doing similar work. Thanks for posting your project!
 
Hi SweetBB;
If you read my recent post, you'll see I have written code something like pteichman.
Some years back I refurbished a hammond tonewheel organ- got right into the guts of everything. From what I recall, the drawbar assemblies have a terminal at the back for each stop, and terminals on the side for each of the 9 or so busbars inside that the drawbars connect to. There is a low value resistor chain connected to these 9 (or so) busbars, that basically takes the keyboard signal from the drawbars and divides that signal down in amplitude, depending upon the drawbar setting. But, I don't recall if this resistor chain is inside the drawbar assy or external. If you removed this resistor chain, then the whole drawbar assy could be read out like a 9 X 9 matrix keyboard- something quite easy for the Teensy, but you might want to go with a T35 or T3.6 with many more I/O ports. Another way would be to leave the resistors in place, feed the resistor chain with 3.3 Volts (for example), and then monitor each of the drawbars for the voltage on them, using the multiplexed ADCs in the Teensy. But, I think the values of the resistors in that chain are very low, maybe in the < 10 ohm range (can't remember for sure after 15 years or so) . You'd have to see how much current the chain drew, before expecting to connect it up to the Teensy's 3.3V output pin. Of course, if the resistors are on the outside of the assy, they could be replaced by something like 1K resistors, which wouldwork fine.
Good luck with your project, if you decide to proceed.
 
Hi Bmillier, it's nice to hear from a kindred spirit!

Your questions are helping me to remember and re-justify some of the longer term design decisions in this thing, so thanks. Apologies if some of this is review for you, but it's helping me to get it down.

You're right about audio glitches occurring if the drawbars are connected directly to the wavetable. At the end of the audio chain in roto2, I have a low pass filter to smooth those out. It works well enough: I've rhythmically sequenced drawbar changes over MIDI and it sounds great.

Longer term, I'd like to crossfade between old and new wavetables whenever drawbars are adjusted (essentially double buffering). The LPF isn't a great long term option because I'd eventually like to simulate the grit of the Leslie preamp before that stage and that will have some higher harmonic content.

The 768 sample wavetable could certainly be squished down to 256. The reason I ended up with 768 was to make the mental math a little easier: it meant I could think about the fundamental harmonic being played back at a rate of 1:1 compared to the underlying sine table.

Maybe this is already clear to you (it sounds like it is), but building a wavetable 3x the length of the fundamental was a big step forward in performance for me. This length allows all of the partial harmonics to complete an integer number of cycles, so the wavetable loops perfectly.

My previous attempt (on Arduino) was to run all the oscillators in parallel and mix them in real-time, an almost direct physical model of the Hammond tonewheel assembly.

I only managed to run and mix about 30 oscillators on the Arduino. Five years after setting it aside, I woke up with the wavetable idea, and by then the more powerful Teensy was available and much more convenient for audio work.

It means giving up on some accuracy: the tonewheels don't have the fixed phase relationship they have on the Hammond, and I can't emulate those that are slightly off pitch because of gearing, but I think it makes Hammond simulation within the realm of possibility on an Arduino, and it allows tradeoffs around polyphony that can free up more cycles.

Native 32 bit support, the far faster clock speed, and the excellent supported audio board will all keep me on Teensy though.

The library chorus block is more of a multi-voice unison effect, so you're right that it doesn't sound like a Hammond's.

I got the triangle wave for the chorus/vibrato scanner from this page: http://electricdruid.net/technical-aspects-of-the-hammond-organ/

As for the offset you're looking for in the delay line, it's essentially built in: half the time, the vibrato line is leading the unmodified signal, and half the time it's lagging. I'm using a signed triangle wave. If it were unsigned, I'd have to read the unmodified signal from halfway between the triangle's extremes (with an offset).

I've put little effort so far into accuracy, so I'm not surprised if B4 sounds richer on the low end. I have access to a Nord Electro, and planned to compare spectrograms with that once I get around to it. You're certainly right about the lowest tonewheels having a non-sine wave. It will be interesting to see if others in the low end are also a little different. I've played around a little with square waves for 1-12 as discussed here: http://www.dairiki.org/HammondWiki/ComplexToneWheels

This code doesn't emulate foldback yet, though I did that on the Arduino version. My plan is to support it with two more wavetables that eliminate the high harmonics and boost the existing ones instead.

Here's a great page that details the resistor wire assembly you mention in your next comment: http://keyboardpartner.de/hammond/techinfo.htm

You have me excited to pick this project back up! My next move is a first pass at Leslie speaker simulation, and then I'd like to improve general audio quality and accuracy.

Cheers,
Peter
 
Hi Peter: I guess you fill up the wavetable so quickly that the glitch is small enough to be filtered out. I certainly agree 100% with the larger 768 wavetable. What I was wondering was if it would be even better if it was filled using lookups from a sine table that was itself 768 samples, and not the default audio library one of 256.
I worked with AVR MCUs for about 15 years, and knew them "down to the metal". But, even being able to do assembly language coding, I knew they weren't fast enough to do what these teensys do.
I agree with you on the fixed phase relationship of Hammond- I guess you could never achieve that in software. Each of the 3 layshafts running the tonewheels had a spring clutch though, and there is a bit of randomness associated with slippage from this. Also, there was a bit of signal leakage between adjacent tonewheels (like in a piano) that gave a variation in the sound.
Yes- the library "chorus" block is described as a multi-voice unison. Actually though, the library code implements "n" taps on a delay line, but there is no modulation of those taps. There needs to be some modulation for it to work- ideally a random modulation, but a sine/triangle will work. When you listen to the lib. chorus, you can hear the sound is a bit different, but not chorus. And, if I recall correctly, I couldn't see anything happening on my 'scope, apart from a difference in the shape of the sine wave.
Re the offset. I still have a problem understanding this. Upon entry to the routine, you are filling a small part the delay line with 128 new samples. The whole delay line- as a circular buffer, will have a continuous representation of the input waveform, EXCEPT at the "write incoming sample to delay line" pointer location, where a discontinuity will exist. In my routine (which was "lifted" from the flanger routine) , the sine(or triangle) modulated pointer has a fixed offset from the latter pointer, added to it. So, whether you are adding or subtracting (using the triangle), you still are offsetting this pointer away from the "write incoming sample to delay line pointer" by a fixed amount (I use 1/8 of the delay line length). If not, you are reading in samples (for processing in the rest of the routine), from an area in which this discontinuity lies. This shows up as a faint click at the vibrato rate in my routine if I do not incorporate this offset. I must say I haven't studied your code carefully enough to see how your code gets around this issue.
I just did an analysis of the waveforms generated by the Native Instruments B4 VST plug-in. My Moto multichannel digital mixer has built in 'scope and FFT routines, which I must admit I never needed or used much til now.
It turns out that the B4 waveforms are NOT pure sinewaves anywhere across the keyboard! I used the 16' stop only, and looked at each note. Here are a few examples: (I only put in the dB labels for the 1st line)
Lowest C (folded over from C1) Fund +3dB 2H -12dB 3H -30 dB
D (" ) Fund +2 1.5H -36 2H -12 3H -36

E Fund +2 1 1/3H -36 1 2/3H -36 2H -12

F# 2/3H -36 Fund +1 1 1/3H -36 2H -16

C1 Fund +8 1 1/2H -33 2H -5 3H -24
D#1 2/3H -36 Fund +8 1 1/3H -30 1 2/3 -32 2H -6 3H -38
G#1 2/3H -36 F +12 1 1/3H -33 1 2/3H -36 2H -8 4H -36 16H -36

This is just a small sample, but the waveform harmonics vary all the way up the keyboard. and nowhere, among the 16' notes, are they even close to a pure sine wave. Some of the notes I measured have 5 or more subharmonic "spurs". This explains why the B4 sounds a lot richer than my simulation program! Native Instruments is a big, professional German company and I am assuming that their engineering/programming team must have sampled each tone wheel, and the VST must be mixing the individual tonewheel waveforms for each stop on any given note.
So, it seems that to do this "right", one would need to pre-generate 91 "accurate" wave tables, pick the proper one(s) for a given note, and mix them together at ratios dictated by the settings of the drawbars. Even with your longer 768 16-bit tables, there would be enough SRAM in the new Teensy 3.6 to hold them all. And its MCU, overclocked at 240 MHz, could handle the processing easily, I expect. But, it would be a big programming job.
The foldback issue was easy to handle the way I do things, but would be harder to do in your method.
Thanks for the link- lots of good info there. I thought that the 9 drawbar busses terminated in a low value resistor chain, acting like a rough potentiometer But, I see it is a multi-tap transformer instead. So, my advice to Sweetbb is a bit off, but the methods I proposed are still correct, assuming the transformer is stripped off.
Re: Leslie- That is the holy grail of organ effects;). I have thought a LOT about this myself. Basically, I figured that you would need 1 teensy for the hammond organ sound generation itself. That output, as an I2S signal, could go into the I2S port of a second teensy, for the Leslie effect. For the Leslie, you need at least vibrato for the horn Doppler shift, a variable bandpass filter to simulate the accentuation of the high frequencies as the horn faces you. For the drum, I think that you only need vibrato, and maybe some amplitude modulation (tremolo).Plus, you need to have a filter to implement the cross-over network ahead of the speakers.
For a digital guitar amp/effects box project I built, I've done all of these things to implement various effects, directly from the audio library (except for vibrato for which we both have our own routines). But, for a Leslie they must all be synched, and I haven't had to do that yet. That is where your enhanced programming skills re the audio library, would come in handy.
You mentioned "grit", from using the drive control on the Hammond to overdrive the Leslie preamp. Overdrive is an effect that would have been nice on my digital guitar amp project, but I hadn't made the effort to come up with an algorithm that could do it nicely. But, I did use the auto gain control function in the SGTL5000 codec's DAP, on the Audio adapter, to get soft compression, but its not quite the same.
I chose to get two Teensy3.5s from Paul's Kickstarter campaign, because of the 5V tolerance of the 3.5s. But now I wish I had picked the 2X faster T3.6s !
It is really great to discuss this topic with you- I admire your C programming skills ( and Paul is a real pro!). My career was as a hardware guy with some MCU programming. I used Visual Basic on PC and Bascom/AVR Basic for all of my AVR MCU projects til a year ago. Then, I switched to Arduino, to take advantage of its huge user base/driver libraries. So, I've switched to "C", but not as skilled as you on it yet! Plus, the ARM chips are really complicated. I like reading datasheets, but 2000+ pages is a lot!
Best regards.
 
I had some more progress with the Hammond Organ roto2. I bought a nice M-Audio Oxygen 49, 4 octave Keyboard. It has 9 slide pots that can be used as drawbars. I set up their midi channels in roto2, and they work fine.

The downside of the Oxygen and many other keyboards is that they are Midi USB, but do not have a 5-pin MIDI connector, just USB. So for now I use MIDI-OX as a bridge between the USB Midi keyboard and the USB Midi Teensy running Roto2.

But it's all good and having 9 slide pots as drawbars is cool. The Oxygen keyboard even has a 'drawbar' mode where the Midi value of the slide pots increases as you pull them towards you. Otherwise the sliders value increases as you push them. Not bad for a $125 keyboard.
 
Hello all

First post on here.
I have been doing something related using the Propb3 http://bolltone.de/Projekte/PropB3/PropB3_US.html

It's been WIP for a while due to one thing or another. Propb3 works great, don't know how the features/sound compare to this, which is awesome btw.

I'm using a Nektar lx61 keyboard, arduino uno, USB host shield, 16 x 2 LCD, EEPROM and blinky lights.
The keyboard is USB MIDI, so the Project converts that to DIN MIDI, it also accepts DIN and USB MIDI.

Over 200 presets are stored on EEPROM, push buttons control Leslie speed and other parameters. Drawbars are controlled by sliders on the keyboard and shown on the LCD.

Will post a video asap.

Hats off to the folks able to write stuff like this. But can i request something? There are plenty of Hammond emulators, what is really missing is a Vox Continental emulator. That would be super awesome. Anyone up for this?

Regards

Sparx266
 
Hats off to the folks able to write stuff like this. But can i request something? There are plenty of Hammond emulators, what is really missing is a Vox Continental emulator. That would be super awesome. Anyone up for this?

Regards

Sparx266

Sparx: Not sure if it's a quite a Vox, but the "Transistor Orgel" part of the PropString build at the same site sounds pretty funky.

http://bolltone.de/Projekte/PropString/PropStringUS.html

Pity no source code that I can find. You'd be able to drop it right into your existing hardware (minus the FV-1 effects chip) with some mods.

Back to Arduino / Teensy: You might want to follow this project: http://sandsoftwaresound.net/arduino/60s-combo-organ-midivox/ The easy thing would be to keep it arduino or Teensy 2.0 because of all the TIMER foo. This project would have more potential if adapted to Teensy 3.X because of the built-in DAC/more memory/faster processor (more polyphony), but you'd still be on the hook for a MIDI opto circuit if USB MIDI was not your thing.

Let us know what you come up with, esp if it involves source code.
 
Circuit Cellar magazine November & December 2017 issues includes an article for a Hammond Organ simulator based on the Teensy 3.5 controller.
http://circuitcellar.com/
This is an excellent project for building a small organ and sounds very nice as it includes a Leslie simulation as well. The project uses the excellent Audio library from PJRC along with some additional audio modules from Brian Millier (available on the Circuit Cellar site). I have adopted the source code for an M-Audio Oxygen49 midi keyboard, so that it will use the keyboard for extended percussion control etc. and also avoids using hardware switches. Please refer to the source code attached for further information.
 

Attachments

  • Hammond.ino
    23.6 KB · Views: 245
Status
Not open for further replies.
Back
Top