Korg Poly800/EX800 Users group photo

Yahoo Groups archive

Korg Poly800/EX800 Users

Index last updated: 2026-03-30 17:34 UTC

Thread

A study of Ensoniq Voice Chip (ESQ-1)

A study of Ensoniq Voice Chip (ESQ-1)

2012-10-28 by bimmerfan222

I dug a little more into the Ensoniq chip found in ESQ-1's and Apple IIGS's.

Very cool chip!


Here's a link to Apple IIGS Docs.. specifically the Hardware Ref. Guide (Sound docs start at pg. 101)

http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20Hardware%20Reference%20Guide.pdf

and the Schematics.

http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20schematic.pdf

(Above file's root page)
http://www.classiccmp.org/cini/systems.htm



Seems simple enough at the core. It uses wavetables you program. Volume is also controlled via bit values.
They show using 64K of RAM, but I think it's expandable.
It has support for sampling as well.

32 independent osc.'s total.
Up to 8 independent channels via an ext. demux to split osc.'s out. So 8 independent voices in all is possible, or 4 stereo channels.. whatever you prefer to do, I guess.

I'm sure with the right coding, you can split the keyboard/voices up for multitimbral applications.


Nice chip, but it'll be about $50 USD to buy an old Apple IIGS to scavenge the Ensoniq chip out of.. or cheaper if you're lucky.
But nice thing is that IIGS's are for sale all the time on theBay.


Even if it's not a good candidate to add/re-voice a Poly800, the programming methods are nice to study.. like I found it interesting that they mention there are no actual OSC's.. the OSC's are actually independent registers altered by the data.

The Apple Docs are just about the only published docs avail. for this chip since Ensoniq closely guarded their technology/software. But I know there are plenty of Ensoniq support sites out there to get even more info and perhaps code from.


Cheers,
-Blaine

Re: [korgpolyex] A study of Ensoniq Voice Chip (ESQ-1)

2012-10-28 by Gordon JC Pearce

On 28/10/12 17:04, bimmerfan222 wrote:

>
> Nice chip, but it'll be about $50 USD to buy an old Apple IIGS to
> scavenge the Ensoniq chip out of.. or cheaper if you're lucky. But
> nice thing is that IIGS's are for sale all the time on theBay.

It's a bit of a shame to break up a running machine, to bodge the sound
chip into a crap 80s synth.

If you want to play around with a DOC chip, why not spend roughly twice
as much and buy an Ensoniq Mirage? You've got a DOC, a 6809 CPU that
will run any arbitrary code that you care to stick on a boot floppy, 16K
of OS RAM, 128K of sample RAM *and* eight proper Curtis filters to play
with. It's a well-documented platform with at least a partial
disassembly of the ROM and OS available.

Oh, and if you want to roll your own, it can run Forth:

http://gordonjcp.github.com/miragetools/

--
Gordon JC Pearce MM0YEQ

Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-28 by rga24us

The Ensoniq 5503 DOC chip is the son of the Commodore MOS 6581 SID chip. They were both designed by Bob Yannes. There's some documentation at:

http://www.buchty.net/ensoniq/5503.html

Both chips use 24 bit phase accumulating oscillators and 16 bit frequency registers. The 6581 SID chip has three of these oscillators and a state variable filter on chip, as well as a bunch of other stuff (envelope generators, VCAs, analogue switches). All waveforms are generated on chip using the phase accumulating oscillator bits, XOR gates and comparators, to produce sawtooth waves, triangle waves, pulse waves, ring modulation and oscillator sync.

Whereas the 5503 DOC provides a single phase accumulating oscillator, multiplexed up to 32 times. It uses a wavetable ROM or RAM for arbitrary waveforms, and has VCAs on chip, but no envelope generators or filters. It can do oscillator sync and a form of ring modulation (using the output of one oscillator to control the VCA of another oscillator), but all filtering and envelope generation is done off chip. The clue is in the name; whereas the 6581 is the Sound Interface Device, the 5503 is the Digital Oscillator Circuit/Chip.

Comparing the Poly 800 and the ESQ-1, the Poly 800 has simple waveforms, one or two oscillators per voice and a single filter for all four or eight voices. Whereas the ESQ-1 has a lot of different waveforms, three oscillators per voice and a filter for each voice (8 voices). But the single filter of the Poly 800 (Korg NJM-2069), to my ears, sounds a lot better than the filters of the CEM3379 chips in the ESQ-1.

The Mirage, ESQ-1 and SQ-80 provide you with good tools for exploring the DOC chip, especially the ESQ-1. I'd skip the Apple II and just get an ESQ-1. If you want a polyphonic synthesizer with sampled waveforms and an NJM-2069 filter per voice (8 voices), that's the Korg DSS-1 sampler.

--- In korgpolyex@yahoogroups.com, "bimmerfan222" <bperkins211@...> wrote:
>
> I dug a little more into the Ensoniq chip found in ESQ-1's and Apple IIGS's.
>
> Very cool chip!
>
>
> Here's a link to Apple IIGS Docs.. specifically the Hardware Ref. Guide (Sound docs start at pg. 101)
>
> http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20Hardware%20Reference%20Guide.pdf
>
> and the Schematics.
>
> http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20schematic.pdf
>
> (Above file's root page)
> http://www.classiccmp.org/cini/systems.htm
>
>
>
> Seems simple enough at the core. It uses wavetables you program. Volume is also controlled via bit values.
> They show using 64K of RAM, but I think it's expandable.
> It has support for sampling as well.
>
> 32 independent osc.'s total.
> Up to 8 independent channels via an ext. demux to split osc.'s out. So 8 independent voices in all is possible, or 4 stereo channels.. whatever you prefer to do, I guess.
>
> I'm sure with the right coding, you can split the keyboard/voices up for multitimbral applications.
>
>
> Nice chip, but it'll be about $50 USD to buy an old Apple IIGS to scavenge the Ensoniq chip out of.. or cheaper if you're lucky.
> But nice thing is that IIGS's are for sale all the time on theBay.
>
>
> Even if it's not a good candidate to add/re-voice a Poly800, the programming methods are nice to study.. like I found it interesting that they mention there are no actual OSC's.. the OSC's are actually independent registers altered by the data.
>
> The Apple Docs are just about the only published docs avail. for this chip since Ensoniq closely guarded their technology/software. But I know there are plenty of Ensoniq support sites out there to get even more info and perhaps code from.
>
>
> Cheers,
> -Blaine
>

Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-29 by bimmerfan222

Thanks for the info and your thoughts..

yea, you guys are probably right about just getting a full Ensoniq synth instead of trying to rebuild one from an Apples guts.

I found it an interesting readup though.. and that buchty site is definately the motherload of info on it.


I am curious though.. are the 16/32 bit PICs from Microchip using a similar form of osc method of sound generation?

The evidently use ports called "output compare/PWM"

Would the programming methods similar?

-Blaine

--- In korgpolyex@yahoogroups.com, "rga24us" <rga24@...> wrote:
>
> The Ensoniq 5503 DOC chip is the son of the Commodore MOS 6581 SID chip. They were both designed by Bob Yannes. There's some documentation at:
>
> http://www.buchty.net/ensoniq/5503.html
>
> Both chips use 24 bit phase accumulating oscillators and 16 bit frequency registers. The 6581 SID chip has three of these oscillators and a state variable filter on chip, as well as a bunch of other stuff (envelope generators, VCAs, analogue switches). All waveforms are generated on chip using the phase accumulating oscillator bits, XOR gates and comparators, to produce sawtooth waves, triangle waves, pulse waves, ring modulation and oscillator sync.
>
> Whereas the 5503 DOC provides a single phase accumulating oscillator, multiplexed up to 32 times. It uses a wavetable ROM or RAM for arbitrary waveforms, and has VCAs on chip, but no envelope generators or filters. It can do oscillator sync and a form of ring modulation (using the output of one oscillator to control the VCA of another oscillator), but all filtering and envelope generation is done off chip. The clue is in the name; whereas the 6581 is the Sound Interface Device, the 5503 is the Digital Oscillator Circuit/Chip.
>
> Comparing the Poly 800 and the ESQ-1, the Poly 800 has simple waveforms, one or two oscillators per voice and a single filter for all four or eight voices. Whereas the ESQ-1 has a lot of different waveforms, three oscillators per voice and a filter for each voice (8 voices). But the single filter of the Poly 800 (Korg NJM-2069), to my ears, sounds a lot better than the filters of the CEM3379 chips in the ESQ-1.
>
> The Mirage, ESQ-1 and SQ-80 provide you with good tools for exploring the DOC chip, especially the ESQ-1. I'd skip the Apple II and just get an ESQ-1. If you want a polyphonic synthesizer with sampled waveforms and an NJM-2069 filter per voice (8 voices), that's the Korg DSS-1 sampler.
>
> --- In korgpolyex@yahoogroups.com, "bimmerfan222" <bperkins211@> wrote:
> >
> > I dug a little more into the Ensoniq chip found in ESQ-1's and Apple IIGS's.
> >
> > Very cool chip!
> >
> >
> > Here's a link to Apple IIGS Docs.. specifically the Hardware Ref. Guide (Sound docs start at pg. 101)
> >
> > http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20Hardware%20Reference%20Guide.pdf
> >
> > and the Schematics.
> >
> > http://www.classiccmp.org/cini/pdf/Apple/Apple%20IIgs%20schematic.pdf
> >
> > (Above file's root page)
> > http://www.classiccmp.org/cini/systems.htm
> >
> >
> >
> > Seems simple enough at the core. It uses wavetables you program. Volume is also controlled via bit values.
> > They show using 64K of RAM, but I think it's expandable.
> > It has support for sampling as well.
> >
> > 32 independent osc.'s total.
> > Up to 8 independent channels via an ext. demux to split osc.'s out. So 8 independent voices in all is possible, or 4 stereo channels.. whatever you prefer to do, I guess.
> >
> > I'm sure with the right coding, you can split the keyboard/voices up for multitimbral applications.
> >
> >
> > Nice chip, but it'll be about $50 USD to buy an old Apple IIGS to scavenge the Ensoniq chip out of.. or cheaper if you're lucky.
> > But nice thing is that IIGS's are for sale all the time on theBay.
> >
> >
> > Even if it's not a good candidate to add/re-voice a Poly800, the programming methods are nice to study.. like I found it interesting that they mention there are no actual OSC's.. the OSC's are actually independent registers altered by the data.
> >
> > The Apple Docs are just about the only published docs avail. for this chip since Ensoniq closely guarded their technology/software. But I know there are plenty of Ensoniq support sites out there to get even more info and perhaps code from.
> >
> >
> > Cheers,
> > -Blaine
> >
>

Re: [korgpolyex] Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-29 by Gordon JC Pearce

On 29/10/12 15:11, bimmerfan222 wrote:
> Thanks for the info and your thoughts..
>
> yea, you guys are probably right about just getting a full Ensoniq
> synth instead of trying to rebuild one from an Apples guts.
>
> I found it an interesting readup though.. and that buchty site is
> definately the motherload of info on it.

Get a Mirage, learn Forth and 6809 assembler. I'll give you the rest.

> I am curious though.. are the 16/32 bit PICs from Microchip using a
> similar form of osc method of sound generation?
>
> The evidently use ports called "output compare/PWM"
>
> Would the programming methods similar?

Not in the least. PWM - pulse width modulation - is familiar to us from
synthesis as an effect. With microcontrollers it is used to do
something similar to a DAC. If you connect an LED to a PWM pin, with
PWM set to 50% the LED will be at half brightness, with it set to 25% it
will be at quarter brightness and so on. You pedantic bastards can all
shut the hell up about the linearity of light intensity.

If you do the PWM fast enough you can no longer hear the carrier (say if
it's at 32kHz) but if you filter that carrier off you get a varying DC
voltage from the pulse width. Now, the "output compare" stuff works
because you have a counter and you compare the value of that with your
desired PWM level. So, start with your output pin high and the counter
at zero, count until you reach 128 and the comparator matches, toggle
the pin low and keep counting until 255 (because we're using an 8-bit
counter for this example), and the counter wraps back to zero so reset
the pin back to high. And, here lies the clever bit.

When that overflow interrupt fires to say we've wrapped, the ISR
contains a routine that calculates the next value for the sample you
want to play. Let me demonstrate:

https://github.com/gordonjcp/gyoza/blob/master/acidmatic/acidmatic.pde

Line 242 is where the ISR starts. This is called every 31.25μs when the
32kHz timer interrupt fires. Line 245 to 248 set a flag roughly every
990μs which signals that we should run the envelope calculations.

line 251-252, phaccu is the phase accumulator. It is a 32-bit value
which has the timing word tword_m added to it for every sample. The
timing word is calculated from 2**32 (the size of the word) times the
desired frequency divided by sample rate) - I *think*, I can't quite
remember how I wrote that bit. Anyway you end up with the upper eight
bits of phaccu being a sawtooth wave at the desired output frequency,
which we get into an 8-bit value icnt by shifting right 24 times.

line 255 clips it into a squarewave at not quite full scale, to avoid
overdriving the next bit...

... which is line 260-262, a fastish integer implementation of a biquad
lowpass.

line 265 sets the output level by multiplying the filter output by gain
(from 0 to 127) and shifting it back down to 0-255, and finally...

line 266 loads the value into the output compare register, where it sets
the PWM switching point.

Whew. Did I mention this all happens in a shade over 31 microseconds?
I haven't got recordings of this exact code, but its predecessor sounded
like this:
http://www.gjcp.net/~gordonjcp/mp3s/arduinoacid.ogg
The drum samples were played by the same Arduino using a similar trick.

In that repository you'll see another sketch called fmtoy, which sounds
like this:
http://www.gjcp.net/~gordonjcp/mp3s/fmtoy.ogg

Simple 2-op FM synthesis implemented in a 16MHz AVR, with 8-bit sample
playback hence the gritty aliasing.

Right, now one of you clever little sods can take that code and work out
how to use it to make a replacement for the Poly800 oscillator chip.

--
Gordon JC Pearce MM0YEQ

Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-29 by bimmerfan222

Wow!

Thanks Gordon. This is the kinda nitty gritty I was looking for RE PICs and how to make voices with them.

I don't completely understand everything you explained, but it's the best description I've found yet.

-Blaine



--- In korgpolyex@yahoogroups.com, Gordon JC Pearce <gordon@...> wrote:
PWM - pulse width modulation - is familiar to us from
> synthesis as an effect. With microcontrollers it is used to do
> something similar to a DAC. If you connect an LED to a PWM pin, with
> PWM set to 50% the LED will be at half brightness, with it set to 25% it
> will be at quarter brightness and so on. You pedantic bastards can all
> shut the hell up about the linearity of light intensity.
>
> If you do the PWM fast enough you can no longer hear the carrier (say if
> it's at 32kHz) but if you filter that carrier off you get a varying DC
> voltage from the pulse width. Now, the "output compare" stuff works
> because you have a counter and you compare the value of that with your
> desired PWM level. So, start with your output pin high and the counter
> at zero, count until you reach 128 and the comparator matches, toggle
> the pin low and keep counting until 255 (because we're using an 8-bit
> counter for this example), and the counter wraps back to zero so reset
> the pin back to high. And, here lies the clever bit.
>
> When that overflow interrupt fires to say we've wrapped, the ISR
> contains a routine that calculates the next value for the sample you
> want to play. Let me demonstrate:
>
> https://github.com/gordonjcp/gyoza/blob/master/acidmatic/acidmatic.pde
>
> Line 242 is where the ISR starts. This is called every 31.25μs when the
> 32kHz timer interrupt fires. Line 245 to 248 set a flag roughly every
> 990μs which signals that we should run the envelope calculations.
>
> line 251-252, phaccu is the phase accumulator. It is a 32-bit value
> which has the timing word tword_m added to it for every sample. The
> timing word is calculated from 2**32 (the size of the word) times the
> desired frequency divided by sample rate) - I *think*, I can't quite
> remember how I wrote that bit. Anyway you end up with the upper eight
> bits of phaccu being a sawtooth wave at the desired output frequency,
> which we get into an 8-bit value icnt by shifting right 24 times.
>
> line 255 clips it into a squarewave at not quite full scale, to avoid
> overdriving the next bit...
>
> ... which is line 260-262, a fastish integer implementation of a biquad
> lowpass.
>
> line 265 sets the output level by multiplying the filter output by gain
> (from 0 to 127) and shifting it back down to 0-255, and finally...
>
> line 266 loads the value into the output compare register, where it sets
> the PWM switching point.
>
> Whew. Did I mention this all happens in a shade over 31 microseconds?
> I haven't got recordings of this exact code, but its predecessor sounded
> like this:
> http://www.gjcp.net/~gordonjcp/mp3s/arduinoacid.ogg
> The drum samples were played by the same Arduino using a similar trick.
>
> In that repository you'll see another sketch called fmtoy, which sounds
> like this:
> http://www.gjcp.net/~gordonjcp/mp3s/fmtoy.ogg
>
> Simple 2-op FM synthesis implemented in a 16MHz AVR, with 8-bit sample
> playback hence the gritty aliasing.
>
> Right, now one of you clever little sods can take that code and work out
> how to use it to make a replacement for the Poly800 oscillator chip.
>
> --
> Gordon JC Pearce MM0YEQ
>

Re: [korgpolyex] Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-29 by Gordon JC Pearce

On 29/10/12 20:07, bimmerfan222 wrote:
>
> Wow!
>
> Thanks Gordon. This is the kinda nitty gritty I was looking for RE PICs and how to make voices with them.

These are AVR 8-bit processors, rather than PIC. I won't use PIC
because the toolchain is extremely non-free, they're slow as shit and
they're ridiculously expensive. AVR is ridiculously expensive too, but
the toolchain is good old gcc and they are reasonably quick.

> I don't completely understand everything you explained, but it's the best description I've found yet.

If there's anything you want explained further, then please just ask.
It might provide the much-needed poke I need to do some more work on
that project.


--
Gordon JC Pearce MM0YEQ

Re: A study of Ensoniq Voice Chip (ESQ-1)

2012-10-30 by bimmerfan222

Alrighty Gordon, you offered to further explain.. so I'll pick your brain further on these algorithms...

You said in the prev. post,
==If you do the PWM fast enough you can no longer hear the carrier (say if it's at 32kHz) but if you filter that carrier off you get a varying DC
voltage from the pulse width.==

Wouldnt that be like an AC signal? Except it goes from ground to say.. +5v?
So i take it you dont get a useable raw audio signal out from the PWM pins.. you must filter out that 32khz signal, then what's left over is the audio??



==Now, the "output compare" stuff works because you have a counter and you compare the value of that with your
desired PWM level.==

So are we working with two registers here? One as a counter, the other the comparator that tracks the counter as it changes and matches it's value?

icnt1=0; is this the counter in your example code below?


==So, start with your output pin high and the counter
at zero, count until you reach 128 and the comparator matches, toggle
the pin low and keep counting until 255 (because we're using an 8-bit
counter for this example), and the counter wraps back to zero so reset
the pin back to high.==

So this is building a square waveform, right?



==here lies the clever bit.

When that overflow interrupt fires to say we've wrapped, the ISR
contains a routine that calculates the next value for the sample you
want to play. Let me demonstrate:

https://github.com/gordonjcp/gyoza/blob/master/acidmatic/acidmatic.pde

Line 242 is where the ISR starts. This is called every 31.25μs when the
32kHz timer interrupt fires. Line 245 to 248 set a flag roughly every
990μs which signals that we should run the envelope calculations.==


Ok.. so is "do_update=1;" the envelope mod? I was lost as to what this command was calling.




==line 251-252, phaccu is the phase accumulator. It is a 32-bit value
which has the timing word tword_m added to it for every sample. The
timing word is calculated from 2**32 (the size of the word) times the
desired frequency divided by sample rate) - I *think*, I can't quite
remember how I wrote that bit. Anyway you end up with the upper eight
bits of phaccu being a sawtooth wave at the desired output frequency,
which we get into an 8-bit value icnt by shifting right 24 times.==

aahh.. ermm.. yea. Is tword defined at line 177?
i_tf = ((i_f*12)>>8) + ((243*i_tf)>>8);
tword_m = 580*i_tf
Sorry for my ignorance.. just trying to follow.
The upper 8 bits is the shape of the waveform being repeated by freq.Value? Is this upper 8 bits at the top of a 32bit value? Is the word size variable?
Are you shifting right 24 times to filter a value out for icnt?



==line 260-262, a fastish integer implementation of a biquad
lowpass.==

Really? This is a virtual lowpass filter of sorts?



==line 265 sets the output level by multiplying the filter output by gain
(from 0 to 127) and shifting it back down to 0-255, and finally...==

so output level is a byte value using the combined values from filter output and gain?
So the cutoff range is 0-??. How are you shifting "back down" to 0-255?




==line 266 loads the value into the output compare register, where it sets
the PWM switching point.==

OCR2A = CLIP0(out) So OCR2A is the Output Compare Register A and the value is CLIP0?



Around line 25, you have a "pitchtable". Is this pre-calculated data to reference when getting a freq. value of a note?





Thanks again for taking time to explain this. It's very helpful.

-Blaine