Atari.Org
Click Here
HomeNewsServicesForumsSupport

Talk Atari

Atari.Org Forums


16/32-Bit

8-Bits

Classics

Emulation

Jaguar

Lynx

Classic Consoles Forum 8-Bits Forum 16/32 Forum
Emulation Forum Jaguar Forum Lynx Forum
 
 Subject: 0
Author: 0 (0)
Date:   -0

Hi Jan, this is what I promise.
Excuse me for bad tabulations. I will e-mail you the original archive I made this weekend. This stand here because it could help someone else...
_________________________________________

Jully 2001
Autor : Frederic Dussin (LaTeX), France.

Please feel free to correct my bad english and my mistakes if there are
any.

Here what I remember from what I have read many years ago in "STMAG" (a
french magazine) and in "Le livre du developpeur" Tome 1 and Tome 2 from
Micro Application editions about STE sound.

Let me first make some theories.

The STE sound system differ from the ST sound system (still available on
STE) on the fact that STE could directly use 8 bits signed stereo samples.
The STE sound system also include a tone control and a volume control for
each channel that are different from the main volume control.

So each sample has a scope between -128 and +127. If you want to use 8 bits
unsigned samples (comming from STReplay for example) you will have to
convert them before using them. Otherwhise the sound will saturate (scope is
from +0 to +255). The convertion is easy to do. You just have to switch the
most significant bit to its other binary value regardless of what is its
actual value. I skiped here the mathematics demonstration, but it does work!

A stereo sample differ from a mono sample on the way channel (left and
right) are coded. If you extract the two first bytes of a stereo sample,
the first one stand for the left channel and the second one stand for right
channel. So if you have two mono samples you want to play simultaneously
one on the right channel, the other on the left channel, you will have to
alternativly mix the bytes of the two samples before sending the result to
the STE system.

If you want to play a signed 8bits uncompressed stereo Microsoft Wave format
sample, you will have no problem exepted the sample rate and the fact you
have to remove the header of the Wave format. Look for the string "data" in
such a sample file and play whatever there is after the "data" string until
the end of file is reached.

The STE sound system provide 4 fixed sample rates :
50066Hz
25033Hz
12517Hz
6258Hz
You will have to choose which is the most appropriate frequency to restitute
your sample depending on the record sample rate. If you play a 44000Hz
recorded sample on a 50066Hz frequency, the play will be quicker and
sharper than the original.
One way to prevent that is to oversample ("re-sample" ?) the original
record to get the exactly apropriate sample rate. I won't explain here the
way to do it. You will certainly find such programs on Internet or at least
you will find the mathmatic way to do it.
I am not sure at all but may be an other way to solve that problem would be
certainly to feed the STE digital to analogic convertor device with bytes at
our own rate, fixed with a timer, regardless of the frequency that is set
and play the convertor buffer loop at highest frequency. I don't knwow if
somebody will catch what I am trying to explain but if it is the case just
have a try...


That all for theories. Let's be more pragmatic now !

I've never got a Falcon neither a TT machine. I've never coded for them and
I DO NOT KNOW anything on their sound system. So the only waranty I could
give you is that the following will work on STE machines (520, 1040 and
Mega). On other machines things could differ (soundchip address???).

Atari never included functions in their operating system (TOS 1.4 or
TOS 2.06) to drive the STE sound system. That's a pity ! So anyone who wants
to use it is forced to break GEM compatibility for his program and directly
send data to chipset's buffer address. Keep that in minds all the time.

Let me give you a fast overview of which chipsets are involved in STE sound
system :
First there is the digital to analogic convertors (one for the left channel
and one for the right channel).
Then the sound signal comes to the analogic filters.
Then it is send to the LMC1992 to control tone and volumes.
Then you have got the cinch plugs to drive the stereo sound into an external
amplifier.

The STE sound is Direct to Memory Access (DMA). That means it no needs
microprocessor action to be.

Let me now describe the addresses you will have to deal with to play DMA STE
sound :

Every of them is WORD defined (short int type in C language) even if all
the bits are not used.

DMA sound control buffer is (read/write)
$FF8900 ____ ____ ____ __xx
xx = 00 -> no DMA sound
01 -> play DMA sound once
11 -> play DMA sound loop

DMA sound start sample address buffer is (read/write)
$FF8902 ____ ____ 00xx xxxx (high)
$FF8904 ____ ____ xxxx xxxx (medium)
$FF8906 ____ ____ xxxx xxx0 (low)

When sound record sample is loaded in memory you have to specify there the
start address of the record sample to be play. Rememer also that the sample
lenght have to be even whatever the play mode is (mono or stereo). Just
because the DMA soundchip read only words and not bytes.

DMA sound stop sample address buffer is (read/write)
$FF890E ____ ____ 00xx xxxx (high)
$FF8910 ____ ____ xxxx xxxx (medium)
$FF8912 ____ ____ xxxx xxx0 (low)

Same for the end of sample address.

DMA sound sample address counter buffer is (read only)
$FF8908 ____ ____ 00xx xxxx (high)
$FF890A ____ ____ xxxx xxxx (medium)
$FF890C ____ ____ xxxx xxx0 (low)

When DMA sound is playing this buffer shows the actual byte or word read.

DMA sound play mode buffer is (read/write)
$FF8920 0000 0000 m000 00rr
m = 0 -> monophonic play mode
1 -> stereophonic play mode
rr = 00 -> 6258Hz
01 -> 12517Hz
10 -> 25033Hz
11 -> 50066Hz

Then you have the microwire interface that lead the LMC1992.
Two addresses are used :
$FF8922 xxxx xxxx xxxx xxxx data register
$FF8924 xxxx xxxx xxxx xxxx mask register

The microwire is an interface to lead several devices. Each device has a
unique ID that is used in the head of the data register to be selected. Then
follows the main data to be sent to the appropriate device. The main data
include the specific device control data and the real data.
The ID format is two bits long (up to four devices so but if I remember
correctly only the LMC1992 is used with microwire in uncustom STE).
The control data for the LMC1992 is three bits long.
The real data length depends on which control is accessed but is up to six
bits long.
So we have got 2+3+6 bits = 11 bits out of 16 bits that are used in the
microwire data register. The mask register will determinate which are the
eleven bits to use. For example :

data register ____ _101 0001 1111
mask register 0000 0111 1111 1111

is strictly equivalent to

data register 10__ _100 0111 11__
mask register 1100 0111 1111 1100

and so on...

The ID of the LMC1992 is 10 (binary ID) in STE machines.

Before describing ALL the control data available with a LMC1992, let me
explain what this chipset was designed to.

The LMC1992 was a chipset designed to control tone and volume of car sound
devices. So it controls treebles, bass, main volume, front left volume,
front right volume, rear left volume and rear right volume. It also selects
a stereo input channel out of four (like your HiFi device : tape input,
radio input, CD input, phonograph input).

Atari STE machines never use rear output pins of the chipset and leave one
input channel free. But you could customize your own machine to get full
use of your LMC1992.
Rear and front sound are the same. It is not a four independent channels
chipset but only a stereo one (two independent channels).

I did customize my Mega STE connecting the free input channel (making so an
external sound input) and the two unused output pins to additionnal cinch
plugs through resistors and filtering condensators. Every thing is working
great. That is why I wrote that I am going to describe ALL the control data
available with the LMC1992 (and not only those used by original machines).

LMC1992 input selection
control real data
000 ____00 -> -12dB attenuation (meanings no input, silent mode)
____01 -> STE DMA soundchip mixed with Yamaha soundchip
____10 -> STE DMA soundchip only
____11 -> not used in original STE / external input if customized

LMC1992 bass control
control real data
001 __xxxx -> value between 0000 (-12dB attenuation) and 1100 (+12dB
accentuation). 0dB is 0110 value.
dB stand for deciBell and the step is 2dB by binary
value.

LMC1992 treebles control
control real data
010 __xxxx -> value between 0000 (-12dB attenuation) and 1100 (+12dB
accentuation). 0dB is 0110 value. (2dB more or less by
step)

LMC1992 main volume control
control real data
011 xxxxxx -> value between 000000 (-80dB attenuation, silent) and
101000 (-0dB attenuation). (2dB more or less by step)

LMC1992 front right volume control
control real data
100 _xxxxx -> value between 00000 (-40dB attenuation) and
10100 (-0dB attenuation). (2dB more or less by step)

LMC1992 front left volume control
control real data
101 _xxxxx -> value between 00000 (-40dB attenuation) and
10100 (-0dB attenuation). (2dB more or less by step)

LMC1992 rear right volume control (not used in uncustumized STE)
control real data
110 _xxxxx -> value between 00000 (-40dB attenuation) and
10100 (-0dB attenuation). (2dB more or less by step)

LMC1992 rear left volume control (not used in uncustomized STE)
control real data
111 _xxxxx -> value between 00000 (-40dB attenuation) and
10100 (-0dB attenuation). (2dB more or less by step)

So microwire is a kind of serial communication but how to know the delay we
have to respect before sending a new instruction ?
Well it's said that the mask register is supposed to change while data are
transfered. So when the mask get back to its initial value, that means the
data (ID + control + real data) have been fully sent.


Now you are supposed to be able to play a sample with the STE DMA sound.
But it is true for one single sample record. If you want to chain several
sample records problems begin.

In fact sample start address and sample stop address are temporized buffer.
That means they are read by the STE sound system only at the begining of a
new play. So to play two sample records, one after the other, the first
start and stop addresses have to be loaded and the play have to be a loop
play mode. As soon as the play mode is set, you could load new start and
stop adresses into the appropriated buffers. They will be used by the STE
soundchip next loop.
So to chain more than two sample records you have to check when the play
reachs the end of each sample record to load not the next one but the next
after the next one. Effectively, the next one should have its address
already loaded in the buffers and has already started to be played because
of the loop mode...

The "end of sample reached" signal is sent by STE DMA soundchip in two
different ways. One is by a tick sent to timer A of the MFP68901. This timer
should be configure in event clock mode.
The second way is by checking the monochrome monitor detection of the MFP.
That seems realy odd but it is true. The STE soundchip send the "end of
sample" tick also throught the monochrome monitor detection MFP68901 input.
The two signals are combined with an exclusif or gate before the MFP input.
Actif edge register of the MFP have to be set to wait a low to high change
if a colour monitor is plugged or a high to low change if a monochrome
monitor is plugged. To know which kind of monitor is plugged, the MFP input
could be cheked before playing any sound. If the input bit is set to 1 that
means a colour monitor is plugged, otherwise it is a monochrome one.

My problem is that I never coded the MFP68901. So I don't have any exemples
to illustrate the ways to play several sample records chained. Sorry !
Maybe one day I will go further than playing one sample and make some try.
But I did have no time to do so and I still have no time nowadays...

May this help you in STE DMA sound coding !
Have fun !

LaTeX.

 Topics Author  Date
  STE sound coding (for Jan Tomas) new LaTeX 07-23-2001 13:01 
   .H file :STE sound coding (for Jan Tomas) new LaTeX 07-23-2001 13:02 
    .C file :STE sound coding (for Jan Tomas) new LaTeX 07-23-2001 13:03 
     RE: .C file :STE sound coding (for Jan Tomas) new Jan Thomas 07-23-2001 14:39 

 Reply To This Message
 Your Name:
 Your Email:
 Subject:
 Human verification:   What's this?
               _    __     _ _     
 _ __  ___ _ _| |_ / _|___| (_)___ 
| '_ \/ _ \ '_|  _|  _/ _ \ | / _ \
| .__/\___/_|  \__|_| \___/_|_\___/
|_|                                
    



Copyright © 1997-2024 Atari.Org 
Atari is registered trademark of Infogrames