Ada Suitable for Television
Ada's real time features make it highly suited for computers and television. The TV time scale is one frame every 1/60 second fast enough to require a real time mindset, but slow enough for a PC or Macintosh. Ada's Calendar package and Delay statement allow easy and portable control of timing. Usually more than just video is running; operator input, audio, VCR control, etc., all complicate the system. Juggling all these without any tasking leads to complex, fragile designs. Using interrupts or OS tasking facilities (if any) is hard to debug and leads to non portable code. Ada tasks simplify the design and make them portable.
The Orson Project
One example of Ada programming in software for television production and post production are Orson, a video tape editor. Orson is designed as a low end program for the millions of people with a camcorder, lots of un indexed, un edited, and un watched "vacation videos," and a computer. If you have ever tried to edit by using the play/fast forward/rewind buttons on a VCR, you know there has to be a better way!
Using modern video compression chips and very fast multi gigabyte disks, it is possible to copy tapes to disk, edit them with the random access speed of a disk, and then copy the result back to video tape. Such hardware is still beyond the reach of most small video houses, not to mention consumers. Orson, however, uses cheap PC audio and video capture boards that cost only a few hundred dollars to capture telephone quality sound and small, monochrome pictures to a hard disk at rates averaging 20 megabytes/hour of tape.
Copying VCR to VCR
Once captured, the tape can be edited at disk speeds to produce an edit decision list, which is simply a list of the shots the user wants on the edited tape, in the order he wants them. Each shot has a short description and a starting and ending position on the original master tape. During editing, the CRT shows two TV sets, two remote control pads, and two pads of yellow ruled paper. The TV, remote control, and yellow pad on the left show the original master tape; the ones on the right show the resulting, edited tape. In addition to the play/fast and forward/rewind remote control buttons, there are buttons to move forward or back by a single frame, or to the next scene. The master tape controller also has buttons to specify and name shots and to copy a shot to the edited tape. The yellow pads scroll, jumping the small TV picture to the correct section of tape.
The small, monochrome pictures and telephone sound on disk are only used to let the editor make decisions. Given the final edit decision list, the computer shuttles the VCRs around to copy the desired sections of tape, VCR to VCR, thus maintaining maximum picture and sound quality. Professional systems incorporate a digital time code that tells the position of each video frame. Consumer camcorders lack this time code and amateur videos frequently have totally blank sections of tape, so simple frame counting will not work. A one time calibration step lets the computer determine the mechanical delays and timings of the VCRs. Other, proprietary techniques are also used. The different methods for controlling the VCR transports range from telling the user to push the buttons (having previously measured his response time) to hardware (of various levels of sophistication and reliability) to interface the computer to the camcorder or VCR.
Ada for Orson
Ada's encapsulation mechanisms handle the plethora of different hardware very nicely. Thus, Orson has a single package, package sound_play, that defines the interface to sound- playing hardware. There are multiple bodies corresponding to different supported hardware.
It took me two weeks to port the decision list editor to the Macintosh, including learning the Macintosh OS calls, the MPW editor, and the Meridian Macintosh Ada compiler (I use RR Ada on the PC). The program was already organized with a main loop to respond to operator inputs, so that matched directly to the Macintosh style. The low level graphics and sound needed to be totally changed but the package specifications stayed intact, and thus the higher level packages needed no changes. The Macintosh OS is defined in Pascal terms, so it maps at least tolerably well to Ada. The Meridian System'Tick is one second, but I wrote a package, package my_calendar, to get times accurate to 1/60 second from the OS. Meridian was kind enough to send a patch to allow Delay to execute with that granularity. RR on the PC uses the MSDOS clock which ticks every 1/18 of a second, but I replaced their Calendar body with one that reads the clock to a quarter millisecond and their Delay immediately became that accurate.
The PROMPT Project
PROMPT, a teleprompter like program that scrolls a script, is a small program originally written for KSAR the local Community Access Television station. Talent (a technical TV term meaning anybody in front of the camera) needs help remembering a script of any significant length. A teleprompter simply displays text in large enough letters to be read at a distance and scrolls it past at a comfortable speaking pace.
KSAR has a low budget and depends heavily on donated equipment. They had an IBM PC XT with a CGA display available. The CGA was originally designed to use a television set as a monitor, so it has an adequate NTSC video output signal. The program must:
- display large text and scroll it steadily on the TV,
- read the script file from disk and feed it to the scroller, and
- accept operator input to vary the speed, pause, insert comments, etc.
Ada for PROMPT
The Ada program designed to meet these needs uses three tasks, one for each of these jobs. With a little trickery controlling the CGA hardware, the program is able to scroll 12 twenty character lines of large, blocky letters that look just fine at talent teleprompter distance, at speeds up to faster than a person can intelligibly speak.
Thinking PROMPT might be useful to other community access stations, I uploaded it to the National Federation of Local Cable Programmers electronic bulletin board system (BBS) [since renamed the Association for Community Media or ACM] and the Compuserve Broadcast Professionals Forum. Since it was small, and nicely demonstrated the use of Ada tasking, I included the source code. I have had positive feedback from people using it across the US and around the world. I recently heard from an Australian who uses it on his laptop when storytelling in the local community center. I understand it has also been included on a CD ROM of shareware.
Based on a flyer by Tom Moran, Decision Aids.