From: dempson@atlantis.actrix.gen.nz (David Empson) Newsgroups: comp.sys.apple2.programmer Subject: Re: Ensoniq help needed Date: 21 Apr 1996 16:41:32 +1200 Organization: Actrix - Internet Services Message-ID: <4lce9s$k6r@atlantis.atlantis.actrix.gen.nz> References: <4l0otn$bij@elna.ethz.ch> In article <4l0otn$bij@elna.ethz.ch>, Henrik 'Boris Grishenko' Gudat wrote: > > I have some problems with the Ensoniq. I have this very old book (GS > hardware ref I), and some bright mind has to enlighten me... I haven't seen the first edition for quite a while, but from the parts you have quoted, it sounds identical to the second edition. There is also some useful information in the Sound Manager chapter of Toolbox Reference Volume 3. > I want to know the precise frequency/pitch of a wave that is being > played. From my experience, the frequency low/high registers do not > represent frequencies in Herz but some internal measurement. The hardware ref gives the formula for calculating the "output frequency". The actual pitch of the output waveform will also depend on the waveform in memory. The "output frequency" is the actual frequency of the output, given a single cycle of a sine wave being placed in the table. According to the formula given in the hardware reference, the "output frequency" will be (SR / 2^(17+RES)) * FHL. Given 32 enabled oscillators, RES=0, FHL=512 (and a table size of 256), this results in an "output frequency" of 102.8. With the above settings, the DOC will play each location in the 256 byte table for a single output sample. The sample rate will be 894886/34 = 26320 Hz. Assuming the table contains a single cycle of a sine wave, it will take 256 samples to play the waveform once, and the output frequency of the waveform will be 26320 / 256 = 102.8 Hz. If you increased the resolution to 1 (A10 is LSB), the output frequency would be halved. If you doubled the frequency register value, the output frequency would be doubled. If the table size is increased, the resolution selects lower order accumulator bits. With a table size of 512 bytes, a single cycle of a sine wave, RES=0, FHL=256, you would get an output frequency of 51.4 Hz. It would be necesary to increase the frequency to 512 to get the original output frequency, which would also cause every second waveform sample to be skipped. > I'm no hero in acoustics, so I guess that I'm mixing up something. > The "output frequency" is merely the speed at which the oscillators' > waves are scanned. it does not affect the _pitch_ of the sound in any > way. Yes it does. If you vary the frequency registers, table size or resolution, you will affect the "output frequency" and also the pitch of the output. > (Otherwise, the pitch would depend on the number of active > oscillators which is rather silly.) It doesn't depend on the number of ACTIVE oscillators - inactive (halted) oscillators just output as quiet a signal as possible during their time slice. The "output frequency" and pitch will be affected by the number of ENABLED oscillators (controlled by the Oscillator Enable Register, $E1). All 32 oscillators should be enabled if the Sound Manager is active, because the last two are used internally. > 2. What the hell is the purpose of the address bus resolution bits > (part of the wavetable size register). I noticed that you can greatly > lower or raise sounds one octave by manipulating these bits, but the > chart 5-7 looks like a math exam to me (=garbage). At which setting > will every byte be used in playback? Is there a simple conversion > scheme for knowing how many bytes are interpolated or skipped? That table is the key to working out which DOC RAM addresses are fetched while playing back sounds. It must also be used in conjunction with Fig 5-8, which shows how everything ties together. I'll run through a simple example. Look at the first line in Fig 5-7: table size of 256, resolution of 111 (7). With this setting, all 8 bits of the pointer register are used (specifying which 256 byte page of DOC RAM is being used). The lower order 8 bits of the address are taken from bits 23 through 16 of the accumulator. Assume the accumulator is initially zero. The first sample will be therefore be taken from location 0 within the 256-byte page. Now, the frequency value is added to the 24-bit accumulator. It always gets added into the lower order 16 bits, with carry as required into the higher order bits. If the frequency register contains a value of 1, then it will take 65536 samples before the accumulated value changes at bit 16. All of these samples will play from the same location in DOC RAM. The next 65536 samples will play from the next location, etc. If the frequency register contains a value of 32768, then each DOC RAM location will be played twice. If the resolution bits were changed to 000, then a frequency register value of 512 (2^9) would result in a 1-to-1 playback, with each DOC RAM location being output once. A higher value in the frequency register would result in occasional DOC RAM locations being skipped (e.g. 1024 would result in every second location being played). As you move down the table in Fig 5-7 (larger sound tables), less bits from the pointer register and more (lower order) bits from the accumulator are used. With the last line (table size 32768, resolution sets LSB to A2), a frequency value of 4 (2^2) would produce a 1-1 playback. The main purpose of the resolution setting is to allow the frequency value to be independent of the table size. If the resolution is set in each case so that A9 is the least significant bit taken from the accumulator, then the frequency register will cause exactly the same addressing pattern (ignoring wrapping due to the table size), and a frequency of 512 will produce a 1-1 playback. In effect, the resolution combined with the table size specifies the number of right-shifts performed on the frequency value (the lower order bits are still accumulated, but do not affect the DOC RAM address until they carry). The number of right-shifts, or if you prefer, the least significant bit of the frequency that directly affects the address, is (9 - table_size + resolution), where table_size and resolution refer to the values placed in the fields of the wavetable size register. > 3. The Ensoniq got 32 oscillators but I've been unable the use them > individually. Instead, only each other oscillator does produce > something useful (whether its mate is silent or sync'ed). Is it > possible to play on all 30 oscillators simultanously? (I've tried it > but it sounded awfull.) You might be getting beating effects. Adjacent oscillators use consecutive 1.2 microsecond time slices in the output waveform. If they were being played on the same speaker, it might produce something inaudible, depending on the waveforms. Using stereo output with all oscillators in free-run mode and each pair of oscillators directed to opposite channels might work. > PS: is it Herz or Hertz? Aahhh..:) Hertz. -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand