DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: deadlyshart on February 23, 2017, 02:38:18 PM

Title: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: deadlyshart on February 23, 2017, 02:38:18 PM
Hey guys, I recently heard EHX's synth pedals that turn a guitar sound into classic organ/synth sounds, and I love it. Here's the key9, for example: http://www.ehx.com/products/key9

So I'm pretty positive it's a digital circuit, right? Taking a look at the guts shot, I'm not seeing a lot of discrete components: http://www.harmonycentral.com/images/uploads/ehx-b9-organ-machine-gutshot-7425eb5b.jpg

and that makes sense to me. Is the following, my naive guess of how it works, correct? my understanding is that, because they want to create a new *timbre* for a given note you're playing, the electronics has to figure out the fundamental input frequency (because the guitar has its own timbre of overtones/etc), and then just reconstruct the note from there with the correct timbre?

So my real question is, has anyone does this type of stuff on a DIY level, and how doable is it? I would loooove to make one of these and be able to mess around with the sounds by programming it. I briefly looked into doing it with an Arduino and found a little, but it seems like it's hard to do.

Is this within the realm of possibilities?

thanks!
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: vigilante397 on February 23, 2017, 02:41:21 PM
Very much digital, and not very doable in a DIY way. They are very cool pedals, I owned a B9 for a little while and it was awesome. And while you can get similar with DIY stuff (I run a fuzz into an octave up+octave down for an organ-ish sound live) if that's exactly the sound you want I'm afriad you're just going to have to buy one. But I can promise they are well worth the price 8)
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: deadlyshart on February 23, 2017, 03:09:06 PM
Hmm, okay... do you know any more about how they work? I'm curious.

I might just buy one, I have the cash. I just want to know if I can make them, because it's really satisfying.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on February 23, 2017, 03:16:30 PM
QuoteVery much digital, and not very doable in a DIY way

Quote from: pruttelherrie on January 18, 2017, 04:55:35 PM
... how would a kind of guitar-synth be implemented? A whole bunch of filters + gates/triggers or by FFT? With FFT one will introduce latency because of the frame/window size, but with high samplerates (96kHz?) and small framesizes (1k?) that might be ok-ish.

I ask because daydreaming about things to use your board for might be to do a kind of EHX B-9/C-9/etc. workalike. In this case FFT might actually be ok, if you start a 'click' sample right away on the attack of the notes but only start the correct pitched sample after analysis.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: Steve Newton on February 23, 2017, 03:20:55 PM
When the B9 first came out I started to read an article about it and the technology behind it and some other EHX pedals like the Superego.

I was in a hurry and didn't read it all and I thought I'd bookmarked it for later. I've never been able to find it again.

But basically what I did read suggested that it's not pitch extraction and processing that but is a 'granular' based system. Finite slices of time processed and blended. So if at any instant you are playing say, a root, flat third, fifth, flat seventh stack of notes, the contents of that slice of time get processed. The unit doesn't have to figure out that you are playing E, G, B and D or whatever.

Fiendishly mathematical, and probably beyond us DIYers even if we can get the chips to run the code.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on February 23, 2017, 03:45:35 PM
Anyone know how this stuff works?  I can provide FFT, time-domain filter, and energy/RMS detection code but I'm not sure they come together.  Nor do I know how instrument synthesis works.

It seems that using FFT or filter banks could be used to detect energy at various frequencies that either correspond with notes (E, G, B whatever you consider those to be as far as specific frequency) or who's relative frequency spacing (root, third, fifth) can be determined.

So maybe two steps here?  Determine 'notes' or whatever we're calling them and translate that to a stream of codes that represent these notes/bins temporally and then push those to a synthesis system that operations in parallel - both operating in real time.  Hmmm, it even seems that this intermediate stream of 'codes' could be MIDI allowing Guitar-->MIDI, MIDI-->Synthesis, and Guitar-->Synthesis.

Anyway I've not read about any of this but I can provide digital/DSP frequency and time domain foundations for other work.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: Digital Larry on February 23, 2017, 03:53:49 PM
See "Phase Vocoder".

https://ccrma.stanford.edu/~jos/parshl/Phase_Vocoder.html

https://guitarextended.wordpress.com/2012/04/04/polyphonic-synth-using-phase-vocoder-in-pure-data/

I ran the Pure Data Phase Vocoder on my PC using the Focusrite interface for guitar input.  Incomplete but kinda interesting! 
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on February 23, 2017, 04:16:13 PM
Quotehttps://ccrma.stanford.edu/~jos/parshl/Phase_Vocoder.html

... mentions the use of STFT which is ...

https://en.wikipedia.org/wiki/Short-time_Fourier_transform
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: Digital Larry on February 23, 2017, 08:46:32 PM
Here's a little more light reading on the topic (cough)...

https://ccrma.stanford.edu/~jos/sasp/
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: potul on February 24, 2017, 08:28:03 AM
Answering the OP: There is currently no DIY project that can achieve this. I've explored  multiple DIY-friendly ways to achieve similar things with different results:

-Raspberry pi + puredata: You can get very close, but when you go polyphonic, things get funky. Rpi is a great platform, but it's tricky to make it work "headless" without display, keyboard and so on. At the end, it's a small PC, it suffers from the same issues (hanging from time to time, you need to close it correctly, etc...)

-PIC for fundamental detection (guitar to MIDI) + some sort of MIDI synth (it can be DIY as well). There is a GUITAR2MIDI project here in the forum that works reasonably well for MONOPHONIC playing, using zero-crossing detection algorithms. No chords, and no bendings.

-I started a project with dsPIC using FFT  and autocorrelation in order to improve guitar to MIDI fundamental detection, but I never finished it.

-There are some software based solutions (like MIDI guitar 2.0) that seem to work pretty well. You need a PC though. And it's not really DIY.

After playing with all these for some years, I ended up buying an EHX C9, and I don't regret it.
This doesn't mean I stopped investigating this area... that's the fun of DIY. But when I want to really play guitar with organ sounds, I use the C9.

Mat
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on February 24, 2017, 10:50:47 AM
Good feedback/info and based on that is seems that hardware was the limiting factor?  When folks say something can't be done and haven't tried that really fires me up.  So it's encouraging to see that you actually looked into it and gave it a shot - you would probably have some good insights into implementation.

For me a PC is a no go (not portable and more latency than I want putting the latency and psychoacoustic arguments aside).  rPI wasn't meant for this stuff although there's projects that get the latency way down.  But how much real-time audio DSP is it capable of and what about appropriate guitar-level analog interfaces?  The dsPIC for audio DSP work?  Forget that.

My FlexFX board offers 2000 MIP's (up to 4000 MIP's depending on instruction mix using dual-issue pipelines), hardware threading with 300+ MBit transfers between them, three 500 MHz single-cycle 32x32=64 multiply accumulated units, low latency USB and ultra-low latency I2S/PCM/TDM.  This is serious hardware.  So as far as a HW feasibility study I'll start from there and I suspect that there's enough compute to at least do guitar to MIDI via windowed STFT or wavelets or whatever.

Looking at pictures of the B9/C9 PCB I see an AKM CODEC and TQFP64 IC which must be the MCU/DSP.  Anyone know what DSP this is?  From the looks of it (being a relatively small package) this does't look exotic in any way.

Interesting post on the B9: http://www.vguitarforums.com/smf/index.php?topic=11574.0

I wouldn't suggest putting off buying a C9 nor would I suggest giving up on trying it yourself if you're into that.  Do both.  After all one review states "Given the low cost and ease of use, the C9 is a seriously impressive device." and I believe that 100% ... and it works right now.  Hmm but if you're driven by DIY ...

The FlexFX digital and analog boards take care of circuitry, USB audio, I2S, MIDI, sample data flow, DSP libraries, etc. leaving you (us) with just the application specific DSP to figure out and implement.  There's lots of smart folks here and out there - I'm sure if we collaborate we could figure this out.

I'd like to look into implementing the windowing, the sliding STFT (or Wavelets although they seem to reduce to almost the same thing for this app?), and energy detection to MIDI conversion when I have time so that I know what the MIP's load on this board will be.  Starting with the math is pretty hardcore - anyone have source code for various aspects of this?  That might speed things up.

BTW the FlexFX board prototype run has been quoted - three boards for almost $3K!  A big investment but I *have* to prove that the HW design is correct and that the boards are manufacturable.  I'd like to get these boards mass produced to bring cost down to $100 to $125 per board (PCB, assembly, BOM/parts) but it's going to take some interest from the community to make that leap (perhaps via KickStarter).  If anyone's really serious about developing code for this board for apps such as guitar effects, high-channel count instrument interfaces and mixers, cab sims, instrument synthesizers, guitar-->MIDI, etc. and making that code publicly available on a FlexFX code sharing site then I'd consider getting you a board at low cost (maybe free).
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: slacker on February 24, 2017, 01:09:49 PM
Quote from: markseel on February 24, 2017, 10:50:47 AM
TQFP64 IC which must be the MCU/DSP.  Anyone know what DSP this is? 

It's an Analog Devices part, other EHX pedals use Blackfin DSPs, I had a quick look on the AD website and I couldn't see anything obvious in TQFP though.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: slacker on February 24, 2017, 01:29:58 PM
If deadlyshart hasn't already been scared off you can do "simple" organ sounds using pitch shifting to add extra harmonics, octaves up, down, fifths or whatever, add compression to get rid of the distinctive guitar attack and add sustain, chuck in some modulation to taste and you can get organish noises.
Something like the Earthquaker Devices Organizer, which is almost certainly Spin FV-1 based, is DIYable using either an FV-1 or a suitable MCU and an external codec/ADC-DAC combo. You could just about do it using though hole parts if you used a DSPic.

Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on February 24, 2017, 02:28:27 PM
QuoteIt's an Analog Devices part, other EHX pedals use Blackfin DSPs, I had a quick look on the AD website and I couldn't see anything obvious in TQFP though.

I see that their POG uses an ADI Blacken so maybe so maybe I looked at the wrong part?
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: slacker on February 24, 2017, 03:54:48 PM
I had another look and found a thread on "the other" forum about the EHX Pitchfork that had a photo with very similar looking parts to the ones in deadlyshart's photo. The part number was BF592KCPZ which is available in a 64 pin QFP package http://www.analog.com/media/en/technical-documentation/data-sheets/ADSP-BF592.pdf (http://www.analog.com/media/en/technical-documentation/data-sheets/ADSP-BF592.pdf) I must have missed it when I looked on the AD website earlier. It would make sense for them to use the same parts in multiple pedals so it could be it.

Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: Ruptor on February 25, 2017, 05:41:15 PM
As already mentioned the sliding DFT is required to do this kind of job and if you do a Web search of "Sliding DFT" there is lots of stuff about it. It comes in to its own when the number of frequencies to deal with is low and since a guitar only has 6 fundamental frequencies Sliding DFT is the perfect match. I found this article that at a quick glance looks useful.
http://www.convict.lu/Jeunes/ultimate_stuff/RFT.pdf
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: deadlyshart on February 26, 2017, 08:14:19 PM
Hi guys, I haven't been scared off! Just quickly mostly out of my depth here, but still interested.

A brief googling of the ADSP-BF592 says that it's only about $10, so price itself doesn't seem crazy, unless it needs some sort of crazy programmer. It is also definitely SMT or even finer, so that would be tricky.

I know the basic idea of FFT/DFT stuff, having done a little bit of it (but in software, not with hardware). So from what Ruptor said:

QuoteAs already mentioned the sliding DFT is required to do this kind of job and if you do a Web search of "Sliding DFT" there is lots of stuff about it. It comes in to its own when the number of frequencies to deal with is low and since a guitar only has 6 fundamental frequencies Sliding DFT is the perfect match. I found this article that at a quick glance looks useful.

am I right in thinking that this may be what I was originally guessing? That it does FFT magic to figure out the actual notes (i.e., fundamental freqs) being played, then "reconstructs" those notes with the timbre you want? That's what I understood from "only has 6 fundamental freqs", anyway.

(I wonder/can speculate what happens if you play a chord with an octave in it -- how will it know that the higher one is an actual distinct note rather than just an overtone of the lower one? I'm guessing that it has some sort of amplitude threshold, and the octave note would have roughly the same amplitude as the lower note, whereas overtones drop off in amplitude really quickly.)

also, I'm sure it can't actually do stuff this complicated, but it appears that someone *has* gotten DSP stuff to work on an arduino! http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-realtime-audio-processing/
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: samhay on February 27, 2017, 04:59:48 AM
>If deadlyshart hasn't already been scared off you can do "simple" organ sounds using pitch shifting to add extra harmonics, octaves up, down, fifths or whatever, add compression to get rid of the distinctive guitar attack and add sustain, chuck in some modulation to taste and you can get organish noises.

This is very do-able with a dsPIC. I have a mini POG-a-like going on the breadboard, which makes use of the 2 DACS on the 33FJ64GP802 to output separate octaves up and down from a single ring buffer. It would cost little extra parts to add regeneration and/or variable ringbuffer length for psuedo-reverb, and I think it would sound pretty similar to the 'Organizer' at this point.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: potul on February 27, 2017, 10:24:43 AM
Quote from: markseel on February 24, 2017, 10:50:47 AM
Good feedback/info and based on that is seems that hardware was the limiting factor?  When folks say something can't be done and haven't tried that really fires me up.  So it's encouraging to see that you actually looked into it and gave it a shot - you would probably have some good insights into implementation.

In my case, hardware was one of the limiting factors, but not the only one. Designing the software/algorithms is not a piece of cake. I suppose that with your XMOS architecture we should have enough power to do it.
I have not seen any explanation on what the EHX pedals are doing in terms of algorithm, in fact in one of the linked forums, Bill says "If I talk about its workings Mike Matthews would have me in cement shoes at the bottom of the Atlantic!".   ;D  ;D. But from the EHX description, they seem to say they are not using any picth detection + synthesis, but rather manipulating somehow the guitar audio signal to get the right result. Whether this manipulation is done on the frequency or time domain is another story... This would explain the really low latency and the polyphonic characteristics.
What puzzles me is that they have been able to "copy" the sound characteristics of so many keyboard instruments (Hammond, piano, mellotron, etc...)

Implementing an organ similar to what can be achieved using a POG is doable. At the end it's just a combination of known algorithms. Using a phase vocoder you can create multiple pitch-shifted signals, that can be combined into a organish should. If you add some envelope manipulation to change the attack-decay and some modulation, you are in the ballpark.

But if you pretend to go further and recreate let's say a grand piano, or cello, ... it would require some more creativity.

Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: slacker on February 27, 2017, 01:34:28 PM
Quote from: deadlyshart on February 26, 2017, 08:14:19 PM
A brief googling of the ADSP-BF592 says that it's only about $10, so price itself doesn't seem crazy, unless it needs some sort of crazy programmer.

I haven't done much research but it looks like the development software is about $1000 for a single user license, and a programmer is about $150. I've got no idea if there's cheaper or free alternatives.

Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: Ruptor on February 28, 2017, 11:19:38 AM
Quote from: deadlyshart on February 26, 2017, 08:14:19 PMam I right in thinking that this may be what I was originally guessing? That it does FFT magic to figure out the actual notes (i.e., fundamental freqs) being played, then "reconstructs" those notes with the timbre you want? That's what I understood from "only has 6 fundamental freqs", anyway.
Yes it is a good question since a guitar can generate three fundamental notes an octave apart in a chord but midi guitar adapters seem to manage it and once you have the fundamentals it is easy to feed them through any effect or make them any instrument you want.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: deadlyshart on February 28, 2017, 02:26:28 PM
Quote from: slacker on February 27, 2017, 01:34:28 PM
Quote from: deadlyshart on February 26, 2017, 08:14:19 PM
A brief googling of the ADSP-BF592 says that it's only about $10, so price itself doesn't seem crazy, unless it needs some sort of crazy programmer.

I haven't done much research but it looks like the development software is about $1000 for a single user license, and a programmer is about $150. I've got no idea if there's cheaper or free alternatives.

ahhh, hahah, I didn't think of that... I wonder if there are open source options. Maybe I'll look into this someday, that mythical future time when I have some free time...
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: markseel on March 01, 2017, 11:47:58 AM
Quote from: markseel on February 16, 2017, 07:45:08 PM
The FlexFX digital board layout is complete and ready for a prototype production run!

(http://i1064.photobucket.com/albums/u361/markseel/flexfx_layers%20small.png)

I'm planning on these boards costing something like $125?  It has plenty of DSP power but it only has the digital/DSP/USB - a separate analog board has to be connected via I2S and I2C.  The SDK and development tools are free.  The JTAG interface (if you want to override the provided SDK framework and write your own XMOS apps from scratch) is $20 from Digikey.
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: deadlyshart on March 16, 2017, 11:30:38 PM
So, brief update:

I caved and bought one! I bought the Key9 because after watching the various sample videos EHX made, it seemed like the one that had both the sounds I thought were coolest, and I could actually use in my music.

It's a ton of fun! I'll say a few things I've noticed already though, that I find very interesting...

For some of the presets, they won't play chords at all! It will essentially start freaking out, or alternating between notes of the chord you're playing. At least one of the presets, you can't even play two notes at once! And for the "steel drums" one (which sounds awesome regardless), if you even play single notes too quickly in succession, it seems to cut some out. Additionally, there seems to be a bit of noticeable latency sometimes. The manual mentions some tips for using it successfully, and uses the word "tracking"... this really makes me think that it's doing something like what I originally guessed, where it is figuring out what the fundamental you're playing is, and builds it from there.

Overall very fun though!
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: potul on March 17, 2017, 01:05:42 PM
Interesting... I have the C9, and this one is fully polyphonic in any setting...
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: vigilante397 on March 19, 2017, 12:25:00 AM
I had the B9 for a while and it said it doesn't track chords very well, but it actually does :P
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: anotherjim on March 19, 2017, 08:11:37 AM
Probably the various kinds of these use slightly different systems. Hammond B9 was first & probably the easiest for EHX, basically it's a POG.

The most common Hammond sound is with drawbar values 888000000. That's 3 tones per note 16',51/3rd' and 8'.
16' and 8' are simply an octave apart, but 51/3rd' is a 5th interval in the musical scale (not the 5th harmonic). This harmonic is the pitch coupled from the 5th interval above the played key.  The error between the 5th interval compared to the true harmonic gives that characteristic sound. The organ tuning is the Hammond approximation of equal tempered tuning.

The 5th is slightly out of tune as a harmonic, but the higher "odd" drawbars are even more out (17th and 19th) so allow a metallic/bell effect. Other types of organ used similar method of creating the sound, although sometimes simple on-off switches for the footages instead of drawbars.

So if a POG is or can be set to create shifted pitch intervals equal to the organs scale, it's pretty close to getting the heart of it.
So I think that's the first step if you want to try it yourself.

EHX have denied there is any kind of tracking re-synthesis going on in the B9. I for one am inclined to believe it.

Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: llemtt on April 11, 2017, 03:49:24 AM
https://aaltodoc.aalto.fi/handle/123456789/20158 (https://aaltodoc.aalto.fi/handle/123456789/20158)

My .02 is that at heart of ehxs is a "vocoder like" fft/filterbank processing where no "frequency analysis/detection" is performed (peak picking for instance shouldn't be counted as such...).

have fun
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: llemtt on April 19, 2017, 05:35:43 AM
Other bits:

"spectral morphing" is a keyword

chapter 11.3.5 of "Udo Zolzer - DAFX: Digital Audio Effects" shortly explains the algorithm

cheers
Title: Re: How hard would it be to make something like EHX's key9/b9/mel9 etc?
Post by: pgiorgio61 on September 27, 2020, 11:27:26 AM
Wow... you guys know a lot about stomp boxes!
I'm an old fashioned engineer with some idiosyncrasies on digital world!
Anyway I have made some modifications on my B9 that maybe you'll like!
https://www.instructables.com/id/B9/
Please: be sympathetic with my basic knowledge and poor musical skills!

(https://i.postimg.cc/p5vLMn7G/378-C53-E7-B865-4524-B813-E2322-E1-A5-B46.jpg) (https://postimg.cc/p5vLMn7G)

(https://i.postimg.cc/R3j0GYTz/5771-A3-D6-217-C-43-D5-9-EEA-8-B2-D803-D8-EBF.jpg) (https://postimg.cc/R3j0GYTz)

(https://i.postimg.cc/wtmzxcCq/0-D678-ABC-1599-4-C14-9750-2-AEA3-C8924-F6.jpg) (https://postimg.cc/wtmzxcCq)

(https://i.postimg.cc/CRtYV66r/C47-B8156-2-DF3-484-F-8-B16-BCE5-CC90-B7-A3.jpg) (https://postimg.cc/CRtYV66r)