Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Dr T'S T-Basic

Software for the Atari ST

Article from Music Technology, May 1990

Until now writing MIDI software has been the preserve of a few dedicated individuals, but T-Basic offers to make MIDI programming accessible to the masses. Ian Waugh gets online.


While writing your own programs might seem a daunting task, there's no doubt that creating MIDI software to suit your own needs would be cheap and convenient. T-Basic is a MIDI programming language that may bring MIDI programming within your reach.


IT'S A FACT, isn't it - whichever music software program you buy, there'll be just one function missing which you'd really like to have. It may be velocity or tempo scaling, it may be a selective note offset routine, a channel splitter to put data in each MIDI channel onto separate tracks, or it may be something as simple as a clock to tell you how long a piece runs for.

You're probably way ahead of me - putting the first paragraph and the item under review together you reckon I'm going to suggest you write your own routines. Well, that's one solution, but of course it's not as simple as that. For one thing, you'd require some programming skills and for another, you'd want to interface with your existing music program.

If that sounds pretty serious I won't lull you into a false sense of security by pretending it isn't. But if you haven't already turned the page, and if you have some programming skills and a sense of adventure, then you could find the rest of this review very interesting indeed. And if you have turned the page turn back immediately because there are still benefits to be gained from the program even if you are not a programmer. But let's start at the beginning.

MIND YOUR LANGUAGE



MOST COMMERCIAL MUSIC programs are probably written in a language called C, with the odd one or two being written in machine code (Virtuoso, for example). Some are even written in BASIC with the driver routines in assembler (or not) but this still involves a lot of work - and hard work at that.

A few variations of BASIC designed for music production have appeared over the years (notably Altech System's MIDI BASIC for the Mac) and I believe there's a musical version of LISP available for the IBM PC. I must also mention AMPLE (Advance Music Programming Language and Environment) which runs on the BBC micro with the Hybrid Music System. The system can interface with MIDI equipment and has a number of easy-to-use front-end editors for music entry and the AMPLE language permits an extraordinary degree of control over the music (if you're into music programming it's well worth exploring).

But unless you've studied programming or are a computer whizz kid, BASIC - Beginners All-purpose Symbolic Instruction Code - is probably the easiest computer language to learn. T-Basic (review version 1.0) combines the (relative) simplicity of BASIC with the power of a dedicated sequencer and Dr T's KCS (Keyboard Controlled Sequencer) in particular. KCS Level II supports Dr T's MPE (Multi Program Environment) which allows up to eight other program modules to be loaded into KCS, extending its capabilities to combine sequencing with scoring, algorithmic composition and so on.

While T-Basic can be used to produce stand-alone programs it is probably far more useful when run from within the MPE. Hooks are provided to allow T-Basic programs to store any sequences they generate in KCS, and to allow access to and modification of sequences already in KCS. This is very convenient indeed as it allows you to concentrate on the manipulation or creation of data which can then be accessed, edited and played using all the functions of the sequencer.

INTERPRETATION



T-BASIC IS AN interpreted language, which means that each instruction is executed as the program comes to it. High level languages like BASIC are generally interpreted languages and programs are (relatively) easy to write and develop. The trade-off is a lack of speed. However, in T-Basic each line is compiled into object code so in execution programs run much faster.

In format it is modelled on ST BASIC although the programmers call it an extension of REAL BASIC. The programming environment will be familiar to anyone who has dabbled with any form of BASIC.

When the language has loaded you are left with a command window and Desk, File, Edit and Run menus - yes, like the new generation of Dr T's programs this is GEM-based. The menus are mainly there for convenience as their functions can be duplicated by function key presses and/or T-Basic keywords.

Programs and instructions are entered at the command line prompt in the command window. Programs are given line numbers although they can be saved without any. When they are loaded, the interpreter automatically assigns a number to each line making it easy to merge programs.

A single line can be up to 510 characters in length (I just hope I'm not asked to debug it) and the language supports GOTO and GOSUB commands, although if you use subroutines you should really use labels - far more structured, anyway.

Variables can be up to 32 characters long (don't you dare) and T-Basic makes no distinction between upper and lower case. There are three variable types - integer, single precision floating point (also known as real numbers) and string variables.



"Despite the fact that T-Basic is probably the most numerate and difficult program to use yet released by Dr T's, I found the total package quite accessible."


Like most BASICS you can define your own functions which will return a value from supplied parameters and you can create procedures that accept and return multiple arguments using local variables.

As well as standard BASIC language functions, T-Basic has five special two-dimensional arrays for dealing with the KCS and manipulating sequence data within it. They correspond to the five elements in a KCS event: TIME, TYPE, PITCH, VEL and DUR. If you're feeling brave you can PEEK and POKE areas of the ST's memory although if you're operating in the MPE, T-Basic restricts the locations you can access to prevent interference with KCS.

DOWN TO BASICS



THE MANUAL GETS you started by explaining how to load and run some of the demo programs supplied. These include a MIDI data analyser which translates MIDI events such as key presses, program changes and so on, into English (very useful for troubleshooting) and a program called T-Keys which uses the mouse to create simple music sequences (it's actually a simplified version of KEYS!, a budget priced, step-time music entry program which itself was written in BASIC).

The next chapter runs through a few quick and dirty programming functions (its words, not mine) from within the MPE. The quick and dirty method wasn't quite as quick as I had hoped and, in fact, KCS Level II (v1.7) decided to crash a few times, especially when I tried to access the Edit function from the menu just to prove how dirty this method was (although KCS is not under review here). After donning my kid gloves, however, I managed to get things running but not without the sneaking suspicion that the manual/instructions and demo programs didn't quite tie up.

The first program, a mere four lines in length, took a sequence and transposed all notes in it with a velocity greater than 64 up an octave. Here it is so you can get a flavour of the language:

10 for i = 1 to lastevent(1)
20 ifthen type(1,i) < 127 and type(1,i) > 64
30 pitch(1.i) = pitch(1,i)+12
40 endif: next

I won't attempt to dissect it but even if you're not a programmer, I'm sure you'll recognise the instruction to raise the pitch an octave. The "1"s in brackets refer to the events in sequence 1 and the type array (previously mentioned) is looking for note events.

Three other "starter" programs (five or six lines long) perform selective transpositions, add accents (increase the velocity level) selectively and randomise the pitch and duration of a list of notes.

Next you are invited to load and run some of the more complex programs. The first produces an output similar to the sample and hold effects common on analogue synthesisers. The second generates various "curves" (sine, triangle, ramp, exponential) which can be applied to different types of event such as pitchbend, volume and even notes. Whacky.

PROGRAMMING



THE PROGRAMMING ENVIRONMENT is quite friendly and better, in my opinion, than that offered by ST BASIC.

In edit mode you can scroll backwards and forwards through the program with the cursor keys and edit the program lines using insert or replace mode. You can move around the program quickly using the cursor keys with Shift and Control, and the function keys take you quickly to the start and end of the program.

When a program is running, a Debug menu becomes available. This houses Break, Trace and Single step options (Trace and Single Step can also be selected from the Run menu). Trace displays the current line number as it is executed, and Single Step pauses after each statement and shows the line on screen. These are excellent debugging tools.

T-Basic has a full complement of commands for creating graphics, including keywords for drawing boxes, for manipulating the ST's colour palette and for switching screens. It also has several functions for creating some of the simpler elements of the GEM interface. For example, ALERT and DIALOG let you create your own alert and dialogue boxes, and menu bars are also supported. In addition, T-Basic provides access to other levels of GEM through AES, VDI, BIOS and XBIOS keywords although the manual (sensibly, in my opinion) directs would-be users to dedicated books on the use of GEM.



"If you want your sequencer to do something but lack programming expertise, it shouldn't take an experienced BASIC programmer long to write a T-Basic application."


The error handling allows either automatic error handling or error handling under program control.

PROGS & LIBRARIES



SEVERAL T-BASIC PROGRAMS are supplied and to give you an idea of some of the things they can do, here are details of a few:

SYSEXDMP can capture up to 32767 bytes of SysEx data and store it in KCS from where it can be saved as a SEQ file.

PBPLOT and VOLPLOT plot a pitchbend or volume curve on the screen from data within KCS. Not terribly useful, perhaps, but interesting, fun and possibly educational.

CH0RD1 creates simple chord progressions based on some "rules' of harmonic progression. It asks you to play an eight-note scale from which it produces the chord sequence which can be saved into KCS.

BUILDSET and KCSLIVE are tools for performing automated disk loads and playback within KCS, primarily for live performance (got your STacy yet?).

LISTING and FILELIST list the contents of a sequence much like KCS' edit screen but this list can be modified to filter out events you don't want to see.

TRACKER is a partially finished program with two working functions. One puts each MIDI channel on a separate track and the other calculates the duration in minutes, seconds and hundredths of a second of any measure and step in the piece.

GOGOIZE makes all 16th notes one step later for "that hip gogo sound". Painful in explanation, perhaps, but practical in concept.

You can create a default program which will load and execute automatically when you load T-Basic.

The demo disk also includes several library routines written in T-Basic which can be used in your own programs. These include a variety of sequence manipulation functions such as creating events and reading and storing certain KCS variables. There are procedures and subroutines used to play sequences and create tailored random number distributions and other items of use to those interested in computer-assisted composition.

There are routines to help with file handling, additional maths functions not found in T-Basic (heavy), several GEM-aid utilities and routines for working with the MIDI interface.



"If the thought of writing your own music routines gets the adrenalin pumping through your veins and the saliva dribbling down your chin then this is for you."


There are also several demos which just show off the BASIC. Some show how easy it is to produce alert and dialogue boxes and menu options. One produces a psychedelic pop-art moving screen display (an amazing graphics demo written in just one line) another draws a rotating 3D cube (showing T-Basic's high speed). Another plays a Bach Invention using the ST's sound chip. There are some games, too including a fast version of John Conway's game of Life and a breakout game.

MANUAL



WHEREAS A GOOD manual is a help when learning to use new software, when you're trying to use a new language it's essential. The T-Basic manual was written by Dr T's favourite author, Jim Johnson (I haven't quite forgiven him yet for Finger's Invisible Arithmetic Icons) and I confess to being pleasantly surprised.

The manual does not profess to be a BASIC primer (it would be unrealistic for it to attempt this) but it explains the main functions and operations quite well. Jargon is kept to a minimum (although when discussing a computer language there is inevitably a surfeit of jargon anyway) and the introductory tutorials are generally quite helpful if a little short.

The majority of the manual is given over to a reference guide of T-Basic keywords which are organised by category (editing, environment, operators, program flow, functions and so on) rather than alphabetically, although there is a keyword reference index, too (there are well over 200 keywords).

The appendix contains information about the data structures used by KCS along with the formats of SEQ, TRK, SNG and ALL sequencer files to enable you to access this data, although if you use the library routines for adding events to sequences you won't normally need to deal with this information.

The manual also contains a list of reference books and it's interesting to note that while the authors recommend the Abacus books on ST BASIC and ST Internals they make a special point of not recommending the Abacus book on MIDI programming (just shows publishers can't get it right every time).

VERDICT



ALTHOUGH DR T'S NEW generation of programs use GEM (which, in my opinion, makes them a considerable improvement over earlier non-GEM programs), they still, to a degree, have a numeric bent. While this inherently gives them a great deal of power and flexibility (a line of numbers is worth a thousand icons) it does so at the expense of accessibility. In the main I believe Dr T's programs appeal more to the computer musician and the music hacker than the musician who just happens to use a computer. (Comments directed to Communique welcome.)

Despite the fact that T-Basic is probably the most numerate and difficult program to use yet released by Dr T's, I found the total package quite accessible. It goes without saying that to make the fullest use of it will require not only a knowledge of BASIC but also of MIDI and its codes, conventions and idiosyncrasies.

But it's not essential to be a programmer as the programs themselves are quite easy to load, run and use. This could give rise to a whole new sub-market of designer routines. If you want your sequencer to do something but lack the programming expertise, it shouldn't take an experienced BASIC programmer long to write a T-Basic application. The authors express the hope that American bulletin boards will soon be filled with T-Basic routines, and if that happens it won't be long before they find their way to our shores.

There's no doubt that in expert hands T-Basic is capable of an enormous number of applications (I'm almost tempted to say, "limited only by your imagination") but the practicalities of programming will mean that only the most dedicated will ever get around to writing that pseudo-random bass line generator and auto-brass funk fill routine that you reckon should be de facto standard on all sequencers. If musicians had to write their own programs before recording a bit of music there'd be a darn sight less of them.

Finally, although T-Basic can be used as a standalone language, its integration into KCS' MPE is superb and I'd hesitate to suggest you use T-Basic without it. However, that's a decision which individual users can make. If the thought of writing your own music routines gets the adrenalin pumping through your veins and the saliva dribbling down your chin then this is for you.

Music hackers will have a great time with T-Basic. Anyone interested in computer-assisted composition - algorithmic, aleatoric and so on - and with some programming skills will be able to create composition routines of their own. The programs listed above will give you some idea of the range of applications to which the language can be put.

It will be interesting indeed to see what T-Basic programs surface in the months to come.

Price £129.00 including VAT

(Contact Details)



Previous Article in this issue

Clocking In

Next article in this issue

International Rescue


Publisher: Music Technology - Music Maker Publications (UK), Future Publishing.

The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Music Technology - May 1990

Gear in this article:

Software: Misc > Dr. T > T-Basic


Gear Tags:

Atari ST Platform

Review by Ian Waugh

Previous article in this issue:

> Clocking In

Next article in this issue:

> International Rescue


Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for December 2024
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £0.00

All donations and support are gratefully appreciated - thank you.


Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!
muzines_logo_02

Small Print

Terms of usePrivacy