On 01 Dec 94 22:15:17 +0000, Johnathan Taylor said:
> > Perhaps you mean the "ldh,a:rrca:rrca:rrca:rrca:xorh:andl:xorh" that
> > you have to do in order to set the volume on both channels. It's not that
> > much actually, and not every program has to do it. Apart from that I can't
> > see any difference.
> Well you should compress the 16 or 8 bits into 4bits not just chop of the
> lsb's
It depends on what the sample is. I was referring to samples that have
already been compressed and stored as 2 4-bit samples per byte. In that
case there's not much overhead when playing 4-bit samples compared to
playing 8-bit samples.
> and of course talking the sound chip
> into emulating a DAC *MUST* require more z80 processing time than a single
> OUT
> to a latch, though I could be wrong as I've yet to see how it's done yet;-)
You are wrong. A single OUT is all it takes. As it's not a very well-kept
secret I might as well explain...
The sound chip has two channels which look a bit like this (the other four
don't have an envelope generator):
+----------+ [1] +----------+ +--------+
| tone |__/___>___| envelope |__>__| volume |_____> (to output)
| generator| | | generator| | control|
+----------+ /[2] +----------+ +--------+
^ | |
+----------+ | ^ ^
| noise |____+_... | |
| generator| [3] [4]
+----------+
[1] Tone enable switch (bit 2 or 5 of register 20)
[2] Noise enable switch (bit 2 or 5 of register 21)
[3] Envelope enable and type (register 24 or 25)
[4] Volume level (register 2 or 5; bits 0-3 left channel, bits 4-7 right).
By a freak of nature, if you turn the tone and noise both off, you can get
the envelope generator to produce a constant high voltage level (did they
design this in or was it an accident?). Therefore, by altering the volume
register you can output any voltage level you like. It only takes one OUT
instruction to do this.
> >> I've yet to uudecode imc's sample player and disasemble it
> > Don't you dare... ;-)
> GRIN, I will eventually, I presume you will want me to keep my opinions to
> myself when I finally get around to it;-)
Weeelll... :-)
If it gets released somewhere (such as on FRED) it will become public
knowledge to a certain extent, so you can do more or less anything after
that (except sell a verbatim copy of the code and claim you wrote it, and
similar things that I'm sure you would never dream of...)
However, I dare say there's nothing terribly new in it...
[about WAV]
> > Does it have advantages over any other kind? Is it compressed? I often
> None that I know of except it's better than RAW sample files, no compression
> either...
Why is it better than RAW if it isn't compressed? Is it just an envelope
containing raw data? As you can see, I know nothing about any format except
for .au files.
> The only reason to write these various sample players is to play existing
> samples on the sam, I presume you chose sun .au samples because you have
> access to a large quantity of that particular type...
Correct (but it's also because I have the docs on that format, seeing as I'm
sitting in front of a Sun workstation).
imc