[net.micro.amiga] Can't make Non-DMA audio out work.

keithd@cadovax.UUCP (Keith Doyle) (03/18/86)

.......

Been trying to get non-DMA audio output to work.  Why you ask, when
you've got this neat DMA which dosen't use any processor overhead?
Well, we're experimenting with an audio digitizer, and would like to
feed the digitized input to the output during digitization so you 
can monitor what is being captured.  Couple of problems though.

The manual says you can write directly to the DMA port and get things
to happen.  I tried this with no success.  And, I realized, since the
DMA output is WORD oriented, how would it know when to output the
second byte?  If it never did, that would be ok with me as long as
ONE of the bytes get output, but normally after the selected *period*
it would output the other byte.  If the DMA is off, I don't get a peep.
Someone suggested to turn the DMA on and try.  If the DMA is outputting
a sound, and I am writing to the DMA port, yes I can hear my sound 
interfering with the DMA sound.  So, I tried setting the period to max,
and I then only hear a periodic pip (every *period* I expect), no matter
how fast I might be writing directly to the data port.  So, I tried another
experiment.  I set the period to 1, setup a 1 word buffer, and instead of
writing to the port, I just stuff the buffer.  Well, this sort of works, but
sounds kind of like it's being ring modulated, especially at higher 
frequencies.  I finally found that if I set the period to be as close
to the actual desired output rate as possible, and by writing the data
to BOTH the 1 word buffer AND the DMA port, I get the best results so
far, but still have some distortion due to the fact that the timings are
not perfect.  Also someone suggested that some of the audio channels have
somewhat different characteristics than others, so try them all.  So far,
they all work (or don't work) alike as far as I can tell.

Some things I haven't tried yet:

1. Keep the DMA off, output the data, and kick the DMA on and off real
   quick.

2. Keep the DMA off, kick the DMA on, output the data and THEN kick the
   DMA off real quick.

3. ??? (I'm still thinking)

If anyone out there in net.land or Commodore Amiga have suggestions, they
would be appreciated.

Keith Doyle
#  {ucbvax,ihnp4,decvax}!trwrb!cadovax!keithd
#  cadovax!keithd@ucla-locus.arpa

sam@amiga.UUCP (Samuel C. Dicker) (03/20/86)

In article <1020@cadovax.UUCP> keithd@cadovax.UUCP (Keith Doyle) writes:
>Been trying to get non-DMA audio output to work...
I got this from Glenn Keller who designed Paula (the audio chip):

 Using nonDMA audio
    gjk  18-mar-86

If you want the input period to track the output period:
   Set the period to what you want with the dma off.
   Collect 4 bytes, collect the 1st 2 in a word.
   (clear the interrupt, output, collect 2 more, poll interrupt) loop

If you want the output period to track the input period:
   Set the period small (like 1 ) with dma off
   (collect a byte, duplicate into a word (two identical bytes),clear
    interrupt, send word); loop

Note: An update has been sent to the hardware manual people with
  exact details of the audio controller state machine for those
  who want even more detail.