chuck@bnr-di.UUCP (Charles Shnider) (11/20/88)
I am thinking about building a sound sampler for my Mac+. Does anyone know if commercial samplers like MacRecorder clock the Mac serial port externally? Also, do the built-in Macintosh serial drivers handle speeds higher than 57.6Kbaud? From reading IM II, I can't figure out how to run them faster. I'd like to avoid writing my own driver if at all possible. Thanks in advance, Charles R. Shnider Bell-Northern Research Ottawa, Ontario Canada utgpu!bnr-vpa!bnr-di!chuck
billkatt@caen.engin.umich.edu (Steve Bollinger) (11/21/88)
In article <145@bnr-di.UUCP> chuck@bnr-di.UUCP (Charles Shnider) writes: >I am thinking about building a sound sampler for my Mac+. Does anyone >know if commercial samplers like MacRecorder clock the Mac serial >port externally? Also, do the built-in Macintosh serial drivers >handle speeds higher than 57.6Kbaud? From reading IM II, I can't >figure out how to run them faster. I'd like to avoid writing my own >driver if at all possible. Thanks in advance, I think the MacRecorder does clock the port externally. (22Khz*10 bits= 220,000 baud, much higher than 56000) Unfortunately, I can't figure out how to get the serial driver to handle externally clocked data, either. If you decide to make a sampler that works at 44Khz, tell me, I want one. +----------------------+----------------------------------------------------+ | Steve Bollinger | Internet: billkatt@caen.engin.umich.edu | | 4297 Sulgrave Dr. +------+---------------------------------------------+ | Swartz Creek, Mi. 48473 | "My employer doesn't take my opinion any | +-----------------------------+ more seriously than you do." | | "You remember the IIe, it +---------------------------------------------+ | was the machine Apple made before they decided people didn't need | | machines with big screens, color, or slots." | | - Harry Anderson (from NBC's Night Court) | +---------------------------------------------------------------------------+
zarko@Apple.COM (Zarko Draganic) (11/23/88)
In article <3fccf691.12e8e@scottie.engin.umich.edu>, billkatt@caen.engin.umich.edu (Steve Bollinger) writes: > I think the MacRecorder does clock the port externally. (22Khz*10 bits= > 220,000 baud, much higher than 56000) Unfortunately, I can't figure out > how to get the serial driver to handle externally clocked data, either. > If you decide to make a sampler that works at 44Khz, tell me, I want one. There are two factors which limit the transport speed of the ROM serial driver, namely clocking technique and SCC mode (polling vs. interrupt). The standard ROM Serial driver is for full-duplex, asynchronous data. It uses interrupt-per-character operation and Baud Rate Generator clocking. At speeds above 57.6kbps the SCC's internal baud rate generator cannot be used to clock the data since PCLK is fixed at 3.672MHz and x16 clocking is used. Hence the limit. Remember, the ROM serial driver is intended for RS-232/422 serial-this standard does not specify ext.clocks or high speeds. In theory, it is possible to have externally-clocked async data at speeds over 64kbps, but it becomes impractical to use an int-per-char driver such as the ROM serial driver since, in worst case (full FIFO) you'd need to process a char every 156usec or less, and the overhead associated with interrupt and dispatch becomes significant. If you wanted to try this, you could write code which opens the normal driver, then re-inits the SCC to use TRxCA clocked Async, but you'd find SCC overruns will occur at the high rates mentioned. Therefore, for high speed transport you must write a SCC driver. Use polling, not int-per-char. If you choose to use an external clock and x1 clocking, synchronous mode, you can easily achieve rates of (8bits*44kHz=) 352kbps. For digitization, you only need an input driver - half duplex is considerably easier to implement than full. Your program would not necessarily need to be in the format of a device driver, just an assembler routine which inits the SCC (Channel A only!) and then polls for data and puts it in a buffer. Be careful not to hit the SCC at <2.2usec intervals on a Mac plus. (use the VIA to poll it instead) You need the Z8530 Serial Communications Controler Technical Manual from Zilog to program the SCC properly. IM III-25 tells about talking to the SCC. It's actually quite straightforward. The SCC is a very versatile chip. You do not necessarily have to use the HSKi external clock (TRxCA/B pin on SCC). It depends on the data encoding scheme you want to use. If you chose FM1 or FM0 (biphase Mark/biphase Space), clock is recovered from data, else clock must be supplied by HSKi or the BRG. The nice thing about using an external clock or FM0 is that you can still use the BRG to cause interrupts for other purposes. I just took a quick look at MacRecorder on a 'scope. They're using a 352kHz (approx) external clock, and NRZ encoded Monosync, with a sync character ($7F, looks like) preceding each 8-bit data character. Hey, if they took out the frequent syncs or doubled CLK, you could sample at 44kHz! A quick disasm of their code also shows they're indeed polling the SCC RxCharAvail thru the VIA in a non-device driver routine. If you still don't want to write a SCC driver, just build a box to compress the PCM sound data to <=57.6kbaud async data. Then write Mac software to decompress and play it. Really it's alot easier to write a driver! zarko@apple.com applelink: ZARKO --------------------------- "Free food = Student Heaven" Disclaimer: These are opinions of me, not of apple. No guarantee of anything I say being correct.