Date: Thu, 19 MAR 92 15:12 N From: USER%PISA.INFN.IT@ICINECA.CINECA.IT Subject: SoundTracker ( lots of (A)'s ) Dea Netters in the last days i have seen a lot of curiosity around the Mac SoundTracker. The questions were (i) how can many minutes of sound be compressed in a few tens of kilobytes and then expanded in real-time ? (ii) how can i write a song like those we see at info-mac and at ab20.larc.nasa.gov ? (iii) why do some songs fail to work on the mac ? I haVE answers for the three questions. (i) indeed nothing is compressed in the MOD files. there is a collection of usually very short ( most are 3-8 k ) sampled instruments, and tradition is that they play an F (Fa for italian and french people), the one at more or less 698 Hz, when 8000 samples are sent to the speaker every second. Then you have a short, compact ( not compressed ) description of the song. That is every note is specified by its instrument ( which can be, of course, anything, including obscenities like those we are accustomed to hear in obnoxious tetris when we have DISINFECTED it ... by the way ... GOD BLESS JOHN NORSTAD .. but i digress ). I wrote, every note is specified by its instrument, its duration, its pitch and some additional effect ( portato, glissato, arpeggio) etc. etc. . Indeed SoundTracker does something different. At regular andclose intervals of time it reads a command from a queue, and these commands may be : ((i)) silent the track ((ii)) start playing a sound with specified pitch and instrument from a track, and with particular effect if any ((iii)) add an effect to a track which is playing. ((iv)) go on retrieving further commands from another queue of those ( like a GO TO , spaghetti music i'd say ) there are more 'queues' of commands, every queue contains exactly 64 commands for each of the four tracks, and when one is exausted another queue is played. On the Amiga everything is easy to do: just redirect those commands to the four Digital/Analog converters built in in hardware and hear the sounds forming a full-fledged orchestral score or a cluster of meaningless sounds depending on the ability and the musical skill of the composer. This redirection is done by the CPU ( a mere 68000 is even too much ) during interrupt time, and requires almost no CPU load. On the Mac you don't have DMA that feeds automatically the D/A converter, but the CPU itself has to read the data from the samples, resample them by reading the same sample more times or stepping some samples, or even doing some complicated sort of linear interpolation, THIS must be done for each of the four 'virtual tracks', and the final four so obtained buffers must then be added and the sum feeds the small buffer inside the Apple SOund Chip. Gosh ! I think i have gone too technical. Anyway Apple helps us : it provides an efficient double-buffering mechanism to do this, and it is described clearly in IM volume VI. If you want to see another application of it download Storm and StormSound Kit to have sources. All that work that has to be done by the poor CPU is so hard that on a mere LC (16Mhz 68020) you spend 25% cpu time to hav NON anti-aliased 22Khz sound. But You'll enjoy it greatly. Sources for Play routines on the Amiga should be available on the main Amiga BBS services, for those more interested in technical details and yet didn't want to kill me for what i've written. (iI) at the moment the Only way to have a module is to write it on an Amiga, as far as I Know. I have some Modules i Have written home, if You are curious and you hate Your ears i'll upload them to sumex-aim. (iii) there is more than one soundtracker for the Amiga, and not all of them are compatible. MED for example i believe is one of those which are incompatible with ST and NT (NoiseTracker, and enhanced version of SoundTracker, but there are subtle incompatibilities which don't cause crashes but some strange noises may occur) This isn't all, folks, eventhe sound representation is different on the two hardwares. Ranges of samples on the Amiga are -128...127 while on the Mac the range is 0...255. That is that to convert a sound from Amiga to Mac you just have to add $80( or 0x80 or 128, who prefers) to every byte of the Amiga Raw Data and Reduce the value modulo 256. Bingo, That's all I know, folks, i hope your curiosity is satisfied. Roberto Avanzi Mocenigo Dept. of Pure and Applied Mathematics University of Padova. ( 2nd year student ) author of Bob's Eyes Pro member of the Tron 3.0 team ( early alpha stage) email cossip@vaxsns.infn.it or danieli@hp800.bio.unipd.it home Via Luigi Balzan 12 45100 Rovigo Italy. this stuff may find its place in the tech directory , other than in the digests.