DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: Dirk_Hendrik on July 21, 2005, 06:37:58 AM

Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 21, 2005, 06:37:58 AM
A few months ago I ran into the schematic for an Analog Harmonizer on Mark Hammer's page : http://ampage.org/hammer/files/AnalogHarmonizer.ZIP

As Mr. Hammer states already it looks at least like a serious draw. As the idea of doing pitch changes using BBD's has been offered here multiplle times I decides to give the design a test to find out the pro's and cons of the idea.

First, in short, the principle of the design;
The input signal is sampled by 2 BBD's connected with their inputs in parallel. However the clock used for these 2 BBD's will change periodically from "normal" to double speed. When one is clocked normally the other one is at double. By changing the clock to double speed samples taken at normal rate will be played at double speed and therefore sound an octave higher. When all samples are played the clock will go back to the normal speed and the other BBD will be clocked at double speed.
The problem is that if, let's say 10milliseconds of recorded samples are played at double rate they'll be all played in 5 milliseconds. Since the desire is to have a continuous pitch changed note the trick in the design is that while the samples are played a double rate this stream of samples is clocked into a third BBD at the same speed. At the moment all original samples were played the first samples arrive at the output of the 3rd BBD and are played back.

Which comes back in hardware looking like this:

Controlpanel and clockgeneration.
(http://www.exaudio.nl/harmonizer/harmtop.gif)

The BBD's filtering and multiplexing
(http://www.exaudio.nl/harmonizer/harmboard.gif)

So,

Having built that, does it work?
Well, the first thing I did was converting the original design from MN3007 to MN3207 BBD's from a cost perspective. Those output resistors should also  go to ground....(fool)....easily fixed.
The design provides proper bias trimming for the BBD's so distortion was trimmed out easy as well.  With the "noise cancel" trimmers the DC levels in can be trimmed to be all equal for the output signals of the 3 BBD's. Important since the rate at which the output signals are switched to be audio out is in the audible range. Noise level can be trimmed but a LF noise remains available.

Which left me with a couple of questions.
The octave down circuitry seemed to work but the "up" did not and was a constantly shifting mix between octave and input frequency. Scoping showed that the output signal of the 3rd delayline came too late. At the moment one of the 2 input delaylines was capable of presenting it's octave up signal to the output the 3rd delayline offered it's output signal as well which means it was 1024 clockcycles late. Based on the clock pesented form the master clock it should be in time..... except for error 1: A MN3201 BBD driver divides the clock rate by 2.

So, on the master clock circuit all clock signals were changes to have an extra division by 2, extremely degrading sampling rate but ok for testing purposes and yes.... the circuit worked.....

....let alone for a still annoying LF hum from the BBD's outputs beiing switched (at some 40 Hz rate).  This more or less was related to what I consider error number 2.  It's assumed that the output level for all 3 BBD's is exactly the same. This was not the case:
(http://www.exaudio.nl/harmonizer/amplitude.jpg)
C1: Input, C3: Output
It's clear the amplitude changes periodically between 2 levels

By changing the output resistors of the BBD's (the 56K ones) to a trimmer the levels could be adjusted making the whole quiet.

So, does it work now?
Yes and no. The whole setup sounds great for some notes but out of tune and frequencydistorted for most. At first I did not understand how something that is not input frequency dependent and has a pretty stable clock can sound out of tune when played back at double speed.
First a picture of a good sounding note. It can be seen that C3 (output) is a proper octave of C1 (Input).
(http://www.exaudio.nl/harmonizer/good.jpg)

Testing this was easy. Conect the generator and listen to the output signal.  The example above sounded "good". By adjusting the frequency on the generator a bad or out of tune note could be found which looked like this:
(http://www.exaudio.nl/harmonizer/overlayed.jpg)

What happens is that the periods of the input sine don't fit the sampled length. When a the sample is replayed it starts at the wrong position causing a) a glitch and b) frequency shifts which give the out tune effect.
I've placed 2 zoom channels on the C3 signal which show that at the glitch point the sine wave would continue perfectly if it wasn't broken off and replayed.

So,
Wrapping up, Is a BBD based pitch shifter/harmonizer possible?
In my opinion, no. There's no way in which to avoid glitches in the signal or the out of tune effect. Apart from that it requires a lot of controlpoints to get the thing kind of silent.
Title: BBD based harmonizer. Results, measurements and comments.
Post by: puretube on July 21, 2005, 06:45:24 AM
WOW!
Title: Re: BBD based harmonizer. Results, measurements and comments
Post by: Andi on July 21, 2005, 07:40:14 AM
First off, great build - that's a complex looking bit of kit.

Quote from: Dirk_HendrikThere's no way in which to avoid glitches in the signal or the out of tune effect.

I'm wondering if that'd be a selling point to some people though - plenty of lovers of "nasty" sounding boxes out there.
Title: BBD based harmonizer. Results, measurements and comments.
Post by: StephenGiles on July 21, 2005, 08:07:36 AM
Absolutely fascinating, thanks for all that. About 25 years ago, ETI were dumb enough to pay me (not very much) for a rough design of a BBD Harmoniser in their Tech Tips section!
Stephen
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Mark Hammer on July 21, 2005, 09:44:10 AM
I echo Ton's "WOW" and am absolutely, unreservedly, and completely humbled by your diligence here.  I'm just glad you're on our side.  Um, you ARE on our side, right? :shock:

If you haven't done so, read the review of the A/DA Harmonizer pedal that was published in DEVICE 26 years ago ( http://hammer.ampage.org  around page 10 or 11)
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 21, 2005, 10:26:55 AM
Thanks for all the compliments :oops:
@ Mark,
Thanks for putting my thoughts in this direction by posting this obscure Japanese schematic. The corrections you made are correct.


@ more scopedumps, just for the fun:
Turning the frequency down to the point that 1 period takes longer than the BBD can store:
(http://www.exaudio.nl/harmonizer/lowfreq.jpg)

And a measurement taken on the output of BBD "A" (refer to the schematic). The response of the signal on the clock changes is very visible.
(http://www.exaudio.nl/harmonizer/bbd_out.jpg)
Title: BBD based harmonizer. Results, measurements and comments.
Post by: sir_modulus on July 21, 2005, 10:38:36 AM
That's utterly amazing! You've sure done a lot of work for us! (I could barely even read the schemo  :oops: )

Cheers,

Nish
Title: BBD based harmonizer. Results, measurements and comments.
Post by: mojotron on July 21, 2005, 11:38:23 AM
Quote from: Mark HammerI echo Ton's "WOW" and am absolutely, unreservedly, and completely humbled by your diligence here.  I'm just glad you're on our side.  Um, you ARE on our side, right? :shock:

If you haven't done so, read the review of the A/DA Harmonizer pedal that was published in DEVICE 26 years ago ( http://hammer.ampage.org  around page 10 or 11)

Dirk - dude! That is cool!

I really like the integration of the pots and connectors onto the board too -excellent work in every detail. Thanks for sharing this - I'll have some questions in time, for now I just wanted to express how inspiring this is - Thanks!!!

Mark - I'm absolutely, unreservedly, and completely humbled by your site every time I visit - what a gold mine!! Thanks!!!
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Vsat on July 21, 2005, 12:08:09 PM
Dirk,
Thanks for posting the analysis and photos! Built a simple harmonizer  once using a 12 MHz 8031 microcontroller plus 2716 + DAC08 + ADC0804 . It was also very glitchy due to samples not butting together properly. If the processor was faster could have tried a crossfade function to minimize the glitch, or to determine the period of the input signal and adjust the sample window duration to  match. The processor was running as fast as it could though, to add these functions would have required additional processors.  Microcontrollers/DSP much faster nowadays, could make a good project for someone who is interested in this topic. There are dozens of recent patents on this topic from companies such as IVL Technologies for glitch-free and intelligent pitch shifters.

BTW one possibility for a clean analog pitch shifter is to use a vocoder - patch each analysis channel to the corresponding synthesis channel one octave up, to get an octave-up pitch shift etc.
Cheers, Mike
Title: BBD based harmonizer. Results, measurements and comments.
Post by: puretube on July 21, 2005, 12:09:12 PM
for decades, there have been numerous attempts to get rid of "glitching"...

(until the "Event*ders" succeeded, obviously)

[edit]: oops - just missed that Vsat post  :lol:
Title: BBD based harmonizer. Results, measurements and comments.
Post by: analogmike on July 21, 2005, 12:32:19 PM
HI,

I think the early MXR rack mount units used BBDs for pitch shifting. Not very good though! MXT pitch transposer I think.

the MXR pitch shift doubler uses BBDs for sure but it's just a chorus unit.
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 21, 2005, 01:00:01 PM
Quote from: VsatDirk,
Thanks for posting the analysis and photos! Built a simple harmonizer  once using a 12 MHz 8031 microcontroller plus 2716 + DAC08 + ADC0804 . It was also very glitchy due to samples not butting together properly. If the processor was faster could have tried a crossfade function to minimize the glitch, or to determine the period of the input signal and adjust the sample window duration to  match. The processor was running as fast as it could though, to add these functions would have required additional processors.  Microcontrollers/DSP much faster nowadays, could make a good project for someone who is interested in this topic. There are dozens of recent patents on this topic from companies such as IVL Technologies for glitch-free and intelligent pitch shifters.

BTW one possibility for a clean analog pitch shifter is to use a vocoder - patch each analysis channel to the corresponding synthesis channel one octave up, to get an octave-up pitch shift etc.
Cheers, Mike

Thanks Mike.
With last weekends experience on this project I am trying to gather courage and going this way. The last decent 8031 programming I did is some 5 years back. The thing I wanted to do different from your example (but thanks for letting me know you had encouraging results) was using a Dallas DZ87C520 of which I have some 30 laying in the drawer. These run at 33 Mhz and have an internal division of 4 instead of 12. I think this should give me the overhead to be able to detect 0 crossings. The next step is not to work with fixed framelengts (like the case in this topic where a frame is a fixed 1024 clocks long... the lenghth of the BBD line). The idea is to  determine how many samples can be stored in a max lenth RAM buffer and getting "out" (changeover to a next buffer) before the buffer is full. Basically this means a circular buffer with a start, an end and a read and a write pointer. This way it should be possible to "glue" the higher rate playback samples together only at 0 crossings. Unfortunately only crossing 0 and detecting that is not enough. The slope of the signal at such a point can be either going up or down. That means that another routine should determine this slope and only stop sampling when the slope of the signal equals that of the slope at the start.

Apart from that I'm also working my way through Eventide patent no 4.464.784 (use //www.pat2pdf.com for easy reading to see if I'm able to implement their correlation method.

Just checked my notes... the initial date I started working on this is november 2004... gimme some time.

@ all,
Thanks for all the inputs. I've got some more reading to do.
Title: BBD based harmonizer. Results, measurements and comments.
Post by: DiyFreaque on July 21, 2005, 01:03:37 PM
Absolutely stunning work!

Thanks for publishing it here,
Scott
Title: BBD based harmonizer. Results, measurements and comments.
Post by: puretube on July 21, 2005, 01:16:52 PM
http://www.pat2pdf.org/patents/pat4464784.pdf
does this link work for you guys directly?

anyways, I prefer: http://www.pat2pdf.org/ (faster),
or the real thing:
http://ep.espacenet.com/search97cgi/s97_cgi.exe?Action=FormGen&Template=ep/en/advanced.hts

btw: there have been analogue solution attempts...

...and still are  :wink:
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Vsat on July 21, 2005, 01:46:34 PM
Dirk,
I was using a 256-byte circular buffer with separate R/W pointers. Had up to three read pointers going at once so could turn a single note into a chord. A different version had a single shifted output but with an additional 32 Kbytes of RAM so could do the upshifted/downshifted repeats trick (like on the intro to Steve Miller "Fly Like an Eagle"). Worked, but the glitching was very objectionable. Tried a simple crossfade for 32 samples centered at the splice point, but it slowed down the processing so much there was no net benefit. Perhaps analog crossfade with two VCA's, and analog zero-crossing detection would help keep things fast, without very much additional circuitry.

Using the Dallas chips would be a big improvement. Also have some of the 33 MHz '420 microcontrollers here.  The more horsepower you have available, the better. A DSP evaluation board like the ones from Analog Devices have just about everything you need already on board.

Yamaha <might> have had  an early BBD-based shifter IIRC. It said in the ad that the technique they were using replaced the glitches with a gentle vibrato. Perhaps the error was being spread throughout the sample "frame" instead of localizing it at the splice point.
Regards, Mike
Title: BBD based harmonizer. Results, measurements and comments.
Post by: puretube on July 21, 2005, 02:06:32 PM
US 3846827;
US 3949174;
...
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 21, 2005, 02:06:35 PM
Quote from: VsatHad up to three read pointers going at once so could turn a single note into a chord. A different version had a single shifted output but with an additional 32 Kbytes of RAM so could do the upshifted/downshifted repeats trick


:shock:  :shock:
Hadn't thought of those........
Wow! That's possible as well!!!
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 21, 2005, 02:09:15 PM
Quote from: puretubeUS 3846827;
US 3949174;
...

Thanks puretube.
More stuff to read.
Title: Re: BBD based harmonizer. Results, measurements and comments
Post by: aankrom on July 21, 2005, 06:34:05 PM
Quote from: Dirk_HendrikA few months ago I ran into the schematic for an Analog Harmonizer on Mark Hammer's page : http://ampage.org/hammer/files/AnalogHarmonizer.ZIP


I ran into this schematic as well - and I did pretty much the same thing!
Except I used Radio Shack breadboards because I didn't even know if it would work. I had just gotten to the testing phase and asked anyone on the synth-diy list if they'd messed about with this and got steered here.

Very cool work (To parrot the other boids...)

This gives me things to try right away. Most helpful.

I thought about mounting all of the tweaking controls on the front. Maybe even go as far as using turns counting 10-turn pots. Well maybe not that far...

I thought about doing this using R5106's instead of the MN3007's that I used but I only have 2 of those...
Title: Re: BBD based harmonizer. Results, measurements and comments
Post by: gez on July 22, 2005, 07:45:03 AM
Quote from: Dirk_HendrikThe octave down circuitry seemed to work

How well did it work?
Title: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on July 22, 2005, 02:01:41 PM
Pretty well but out of tune for many notes. Same problem, samples which weren't stiched together at the right moment.
Title: BBD based harmonizer. Results, measurements and comments.
Post by: puretube on August 04, 2005, 08:39:20 AM
it might be of help synchronizing the resp. BBD-clocks
and the analog-switching
with the master-clock generator via some and-gates,
to get the edges of f/2, f/4, f/1024, and f/2048 simultaneously...

balancing the BBD-outputs can improve s/n ratio...
Title: Re: BBD based harmonizer. Results, measurements and comments.
Post by: A.S.P. on November 22, 2005, 03:02:44 PM
tried those proposals?
(bumped for the recent "clean octave" thread)
Title: Re: BBD based harmonizer. Results, measurements and comments.
Post by: GFR on November 23, 2005, 05:17:05 AM
Quote from: StephenGiles on July 21, 2005, 08:07:36 AM
Absolutely fascinating, thanks for all that. About 25 years ago, ETI were dumb enough to pay me (not very much) for a rough design of a BBD Harmoniser in their Tech Tips section!
Stephen

I have this issue of ETI. :)
Title: analogue pitch-shifting & reverse, 81 years ago...
Post by: A.S.P. on November 23, 2005, 04:47:54 PM
[OT], but related:
http://www.pat2pdf.org/patents/pat1671143.pdf (http://www.pat2pdf.org/patents/pat1671143.pdf)

UP/DWN/REV

:icon_eek:
Title: Re: BBD based harmonizer. Results, measurements and comments.
Post by: Dirk_Hendrik on November 24, 2005, 12:54:11 PM
Quote from: A.S.P. on November 22, 2005, 03:02:44 PM
tried those proposals?
(bumped for the recent "clean octave" thread)

Which is a thread that pushed me to the verge of leaving this forum for what it is.  ::)

As for the question, No.
Over the last few months a lot of my time was spend on work (one's got to make a living), finishing up other projects among which:
http://www.dirk-hendrik.com/images/wobclone.jpg (http://www.dirk-hendrik.com/images/wobclone.jpg),

,doing some other "custom jobs" for fellow players, working on some other projects as well as doing a lot of repairs and mods.

That doesn't mean that the whole thing has left my mind. What I need to have is some free weekend to set up a decent digital hardware platform (as mentioned earlier in this thread) and start to work on code, most likely ging from a one to one copy (does the AD-DA stuff work properly, through delay (setting up a decent circular buffer for the samples) to harmonizing again. Right now most likely my starting point will be working on 0-detection with semi intelligent guesstimate how many input cycles my buffer can store before getting to the end of that buffer. This means the buffer will have a max length but the actual length will constantly change and depend on the input frequency. Another thing which needs to be taken in consideration is the slope of the input wave. Is it going down or up when going though 0. This to avoid that two positive(or negative) sides of the wave can be "glued" together.

When reading older patents I realize this is partially re-inventing the harmonizer wheel. However, since the material can be quite complex this is (at least for me) the easiest way of understanding the problems involved in harmonizing.