Rt


Contents


Introduction



rt is a Linux port of an SGI port of an application originally developed under NeXTStep. It essentially allows the user to play up to 240 different soundfiles, at up to 12 at a time as if they were notes, from a note list, with continuous control over amplitude, pitch, input and output skip, pan, and direction. On newer computers the limitations are evaporating. Included with this distribution are versions of rt which will do 12, 16, 18, 20 and 24 (stereo) tracks. (The versions greater than 12 tracks still only have controls for 12 tracks on the first and second pages, but more tracks can be controlled from the Track Map Page.)

The current limitations are:

-NeXT/Sun and wave files are supported for input and output, and aiff files are supported for input.

The data is organized in terms of sounds and tracks. A track can only play one sound at a time (in two channels). A segment of a sound played on a given track at a given time will be referred to as a note.

With this program you can

1) Mix arbitrary parts of soundfiles of different sampling rates and of different formats (mono and stereo)

2) Put envelopes on sound segments.

3) Continuously control gains of left and right channels independently.

4) Continuously control gains of tracks independently, and alter gains over periods of time.

5) Shift the pitch of a note up or down, continuously or instantaneously.

6) Selectively listen to given tracks and/or given sounds.

7) Save and restore the state of a given mix in an ascii data file

8) Write a mix to disk, or to the DACs and the digital i/o port.


Basic Components


1) Soundfile window
Containing the names, attributes, and user-specified gains for up to 240 soundfiles.

2) Playnote Window
Containing playnote commands, telling the driver which segments of which soundfiles to load, when and how.

3) Information Window
Containing reports from the sound driver. Check this for error messages

4) Tracks Window
Containing gain controls for each channel of each of the 12 tracks and the 2 output tracks as well as reports on peak amplitudes and toggle switches for each track.

5) Various Buttons
To load/reload data, play, stop, pause, and start over.

6) Information Fields
To specify the number of tracks, the starting and ending time, the elapsed time, the timescale.

7) Track Map Window
Contains a visual layout of soundfile segments on tracks, and a marching timeline while playing mixes

8) Safety Backup
After every 25 characters are altered or entered in the playnote window, a complete backup of the current rt script will be saved in the /tmp directory. It will be called <filename>.bk if you opened a script called <filename., and untitledxxxx.rt.bk, where xxxx is some arbitrary number, if you a creating a new unnamed script.


Soundfile Window



The path names of the relevant soundfiles are listed in the Soundfiles window. The number of the soundfile, listed immediately to its left, is important and is used by playnote() to reference that soundfile. Soundfiles can be loaded by using the Open Input Soundfile command in the Soundfiles menu, or by entering the name in the form above the window, and hitting return, or hitting the load soundfile button. To load a soundfile at a specific location in the soundfiles window, preposition the cursor on that line. If you want to load a placeholder at some point, use the name 'null'.

Soundfiles can be played directly from the soundfile window by simply double clicking on the name of the soundfile. A second click anywhere in the window will stop the play.

Soundfiles can be turned off and on either during or before a mix is played by clicking once on the soundfile line in the on_off window

The gain column is editable. You can change a gain by selecting and typing over, or inserting, or, you can place the cursor in the gain and move the slider above the gain column to change that gain. These gains control the amplitude of that soundfile, and are multiplied by the gain factor on the playnote card, the track gain for a given playnote and the output gain. To fine-tune a gain you can use the arrow keys while the gain slider is selected.
The gain change will take place during a play with delay subject to buffer size -- see lookahead buffers -- ssif you change it with the slider. Otherwise it will only take effect on the next play.


Playnote Window



In the playnote window you put the actual data for accessing the soundfiles. Each playnote() command is usefully thought of as a note. It instructs the sound driver to play part or all of a soundfile at a given time, on a given track, with certain properties. You can copy and paste text into the playnote window. The arguments can be placed in any order. Both the playnote window and the large playnote window use Emacs key binding. This is set in the resource file.

Each playnote() command must appear on a separate line in the playnote window. It needn't begin in the first column.

The only arguments for a playnote window are the track and the sound numbers (track, and snd). All other arguments have default values if omitted.

Each note as specified by a playnote() command has the following properties, specified with these names:

skip= : amount of time to skip into that soundfile before beginning to read it. Default is skip=0.

at = : time in the output mix to start playing that segment of the soundfile. Default, at = 0.

track= : the track number that soundfile will occupy. Note that only one sound can be played on a track at a given time. There is no default, the track number must be specified. If two playnotes occupy the same track at the same time, or overlap for a period of time, the one that was entered second will destroy the overlapping contents of the first one. Note that this is important if you are using the reload playnotes button. If there is no track specified the next available track will be allocated. This can lead to confusion when notes are inserted, etc., since the track will be one greater, (mod the number of tracks) than the previous playnote. It is a good idea when using this feature to specify the track for the first playnote. This is useful when using a bunch of playnotes which have successively later starting times. Otherwise care must be taken that segments do not overlap on the same track. See the trackrange() command.

snd= : the actual number of the soundfile, as referenced by its position in the soundfile window. There is no default, the snd number must be specified.

dur= : amount of time to play that segment. The Default is to the end of the soundfile. When the transp= argument is invoked, a positive dur value will indicate the amount of time to read the input file, so that for downward transpositions the actual duration will end up being longer, and for upward transpositions, shorter. If the argument is a negative value it represents the absolute amount of time to play that note, regardless of the transposition (e.g. it represents the output rather than input time.)

end= : the time on the input file to stop playing. i.e. end = skip + dur. It can be specified instead of dur. The Default is the end of the soundfile. If transp is in effect and the argument is positive it represents the end on the input (as with the dur argument), and if negative it represents the end time on output, relative to the starting time of the note.

transp=: this is a single valued gliss function. e.g. transp = -2 is equivalent to gliss(0,-2,1,-2). It will simply transpose the whole passage down by 2 semitones.

mtransp=: instead of indicating transposition by semitones, this indicates it by multiplying the frequency by the specified constant. e.g. mtransp=2. will raise the pitch one octave, mtransp=.5 will lower it an octave etc.

amp(time,amp,time,amp etc): an envelope for the note which will control the amplitude as it plays. The times are normally relative to the length of that note (unless you use a stickpoint, see below) so any arbitrary timescale can be used. There is no maximum gain and fractional values can be used. Default: all amps set to 1. Note that you just specify numbers within the parentheses. e.g. amp(0,0, 1,.5, 2,0) will create an envelope which goes from 0 at the beginning of the note, to .5 in the middle, to 0 at the end.

gliss(time,interval,time,interval etc): this will cause the apparent sampling rate of the sound to change over time. Note, however, that simple interpolation is used so spectral artifacts will be created. Default: no gliss. (Note that transposition up will increase the data transfer rates. ) The interval arguments are given in semitones (with fractional parts allowed) up or down. For example, gliss(0,1,1,2,2,-1.5) will cause the note to start one semitone higher than the input file, go up to two semitones higher in the middle of the note and end 1.5 semitones lower.

mgliss(time, freq.mult, time, freq.mult, etc):, as with mtransp, the transposition arguments here are expressed as multipliers of the frequency, rather than in semitons.

If you have both a gliss() and transp= argument, then they will be added. All pitch values in the gliss() curve will have the transp= value added to them.

ampl(time,amp,time,amp, etc): a separate amplitude control for the left channel. Default: set to 1. Syntax and time scaling are the same as for the amp() command.

ampr(): is similarly a separate control for the right channel. Default, set to 1.

STICKPOINT: This feature allows any of the above commands which have a string of time/value arguments to use absolute time rather than relative time, for the beginning and end of the notes. The stickpoint is a | sign. You specify it in the middle of a set of arguments to "spread" or "shrink" the middle of the note, while leaving the times around the stickpoint fixed.

amp(0,.2,2,.5, | , 9 1, 10, 0) for example, means that this note will have a rise from .2 to .5 over the first 2 seconds, and have a decay from 1 to 0 over the last 1 second of the note, (assuming its duration is at least 3 seconds), and between these two times the amplitude will go from .5 to 1. If, for example the note is 20 seconds long, this is equivalent to saying amp(0,.2,2,.5,19,1,20,0).

If there were not a stickpoint in the above example and the note were 20 seconds long, it would equivalent to saying amp(0,.2,4,.5,18,1,20,0). Here you can see that the times are warped relative to the actual duration of the note. There can be only one stickpoint in an argument set, but there can be any number of argument pairs around it.

gain=: the signal is multiplied by the product of this gain (default = 1) and the gain specified for that track in the tracks window. It is up to you to make sure that the product of any sample and the gains does not exceed +/- 32767. (You'll know if it does.)

pan= : Normally a mono input file will be split evenly between the two stereo output channels. A stereo input file will be mapped channel by channel. If you specify the pan argument this is equivalent to multiplying the gain of the left channel by the pan value and on the right channel by 1.0 - the pan value. It is equivalent to using ampl() and ampr(). In other words, for a mono signal pan=.1 is equivalent to shifting the signal so that it appears to be about 10% of the way between the left and right channels. If you are using the pan feature the amplitude of the signal will be boosted to accomodate the loss in power a signal has when it is shared between two speakers. . The formula used is 1./sqrt(pan*pan + (1-pan)*(1-pan)).

rev: This word by itself, (or reverse) will cause the segment to be played backwards. (Thanks to Pete Yadlowsky for this hack.) In this case skip will indicate the amount of time to skip backwards from the end of the note. (NOTE the rev function is broken in this version, don't use, yet.)

playnote(snd=1,track=1,skip=2.5,at=3.5,amp(0,0,1,1,2,0),dur=4)

will cause snd 1 to be played on track 1, starting at 2.5 seconds into the sound, starting at time 3.5 in the mix, for 4 seconds with an envelope going from 0 to 1 and back down.

playnote(track=1,snd=1,transp=-2.5)

will simply play all of snd 1 on track 1 down 2.5 semitones.

Thecommands in the playnote window are initially loaded by hitting the load everything, or reload playnotes buttons in the control window. If some of the text in the playnote window is selected, only that segment will be loaded. You can subsequently select a subset of the playnote() commands in the playnote window to be added to the mix, or altered within the mix by simply selecting them with the cursor and hitting the reoad playnotes button. This will save a bit of time since it sometimes takes a few seconds to load in a bunch of files and playnote commands. Note that if a subsequently loaded playnote command occupies the same time portion of a track as a previous one, then the first one will be eliminated.


Some Special Features



last=: This is a substitute for the at= command. It will remember the ending time of the last playnote() and begin this playnote at that time plus the value set by last=. So, for example, if you specify last=0, the current note will begin exactly where the previous one left off (to within the current timescale), or last=-1, will set the current note to begin 1 second before the previous note ends. This is quite useful if you are doing splicing. You can create a butt-end splice and then bevel and overlap without having to do any arithmetic.

overlap=: This is the same as the last= command except that it worries about the beginning of the previous playnote() rather than the end. So overlap=0 will start the current playnote() at the same time as the beginning of the previous playnote().

When either of these arguments is used the actual computed at value will appear in the output window. I recommend pasting this into your playnote, replacing the last or overlap definitions, to avoid too much confusion. Things can get messy, particularly in connection with the offset= command (see below).

Additional commands which can appear in the Playnote window

These arguments are specified on separate lines, not within a playnote() argument list, and will effect all playnote() commands which follow.

offset=x

This will result in the value x being added to the at= value of any playnote() which follows this statement. This is a convenient way to alter the starting time of contiguous groups of playnotes.

addoffset=x

This will result in the value x being added to the currently loaded offset value. This is a convenient way to increment or decrement currently defined offset values. It will only effect playnotes which follow it. If you are using this feature it is highly recommended that the first line in the window be offset=0, so that everytime you reload playnotes the cumulative addoffset will be the same.

trackgain(starttrack,endtrack, time1,amp1, time2,amp2... timen,ampn)

This will put a global amplitude curve on all notes occupying the tracks between and including starttrack and endtrack. Here the times are absolute. For these tracks, any referenced times before time1 will be assigned amp1, and after timen, will be assigned ampn. The default amplitude for all tracks is 1. For this feature it is best to use amplitudes greater than 0 and less than or equal to 1. This will keep you out of trouble with respect to amplitude overflow since these values will be multiplied by the gain set on individual tracks in the track window, the gain for each sound, and the amplitude settings for each playnote. There can only be one trackgain() call for any track or subset of tracks. (I'm working on a better system.) Note: you do not use names in this call, just numbers.

trackrange(starting track, ending track)
Use this feature to allocated clumps of playnotes to specific groups of tracks when you are not specifying the track number in playnotes, but rather using the automatic feature. This will improve the track placement hygiene.

tempo=x

This statement will cause all times subsequently referred to by playnote() at= statements to be multiplied by a factor. If x is less than 15 it is a simple multiplier. If greater than 15 the factor is formed by 60/x, so standard tempo speeds can be used.

comments

any text on any line which is preceded by // will be ignored by the driver. e.g.

//this is a comment

playnote(track=1,snd=1)//this is another comment, but the playnote is taken seriously




 

Playnote Window -- Large View




 
 




The third window is simply a larger version of the playnote window on the main page. The purpose of this is to allow you to look at larger groups of playnotes without having to scroll around. In addition, if you like smaller, or larger fonts, you can change these by editing the resource file. The name of this widget is 'playnote_bigtext'. When you toggle back and forth between this and the main window, each is updated.


Information Window



This window displays reports and error messages. The playing process uses an sproc() call to create a child to play the sound. The process id of this child is listed in the window. In case something gets munged and you can't kill the child from the interface, you can always kill it from a shell with the kill command, using the displayed number. (This normally should not happen). This window will also report syntax errors from the playnotes, although these can sometimes by cryptic.


Tracks Window



It is not necessary to use this window, but it can provide some extra gain control. It is opened by clicking on the tab at the bottom of the main window. You can also turn tracks off and on by clicking on the track number atop each set of sliders. The changes you make only go into effect a few seconds after you make the change, due to the large size of the intermediate sound buffers used to do the mix.

The track window is quite useful for balancing sounds, and for preparing very complicated mixes which might exceed the throughput capacity of the machine. You can turn selected tracks off and on, balance them against each other etc.

The individual tracks gains are multiplied by the gains of the playnotes in that track to effect the input amplitude.

The output track controls can be used to control the gain of the overall mix.

If you save an rt script it will save the current state of the input and output tracks, and the off/on state of the individual tracks.

Tracks can also be turned off and on from the main window by using the buttons immediately below the information window.

The left mouse button will drag the slider of the channel of the track it clicks on, and the middle mouse button will drag both sliders simultaneously for that track, at the value of the track it selects.

Gains can be shown in decibels by clicking on the db box in the lower left hand corner.


An Experimental track feature



If you click on the little blue box below the DB box, you can control tracks independently from the keyboard. Keys 1 through 0, - and =, will increase tracks 1-12 respectively, and keys q,w,--> ] (just below) will decrease the tracks. Keys g and b will increase and decrease the output gain, respectively. In order to move several tracks simultaneously, you have to repeatedly click on their keys. Holding down one key will repeat that track but lock out the other keys. I don't know how to sove this, and need an X-pert to show me how. When I can solve this problem and also figure out how to make the response more immediate the next step will be to record track motions. If you click elsewhere in the window you will have to click the blue box again in order to reactivate this feature. s


Track Map Window



Display in the Track Map Window


Once playnotes have been loaded with the load everything button, or with the reload playnotes button, this window will display a timeline layout of the tracks and soundfile segments on each track. Below each soundfile are three numbers indicating starting time, duration, and soundfile number for that segment. While playing, a timeline will march along, and the time will be displayed in the lower left hand text field. If you click the left mouse button anywhere in the window, the next play will begin at the time you clicked and the starting time will be displayed in the right of the two text fields. (You can also simply type a number in that window to force a starting time.) Sometimes you will have to wiggle the mouse to get the timeline and the listings to start up. Remember that if you are skipping into a mix, there may be a pause before it starts to play. If you click the left mouse button while a sound is playing it will stop playing. While playing if you click the right mouse button anywhere in the window, the mix will start to play at this point. If it is already playing it will stop and start again at the point at which you clicked. This enables you to jump around a mix. Again, there may be some slight delay, depending on your timescale, and the size of the timeskip.

On the lower right hand side of the window there is an autoscroll switch. Toggling this on will cause the window to jump to a location in which the moving cursor is always visible.

The zoom in and zoom out buttons will give you differently scaled displays. The default is zoom in. When you are zoomed out the smallest visible duration may be about 1/4 inch wide. In the zoom out case the time and duration of each note will not be displayed.  Holding down the <shift> key while using these buttons will zoom you in and out by 50% (rather than 10%).

If you have a comment after a playnote: e.g.
playnote(track=1,snd=2,at=23,skip=23)//big noise
or
playnote(track=1,snd=2,at=23,skip=23)big noise
this comment will appear above the rectangle representing the track. If there is no comment, the soundfile name will appear, stripped of its full path. Sometimes, depending on the length of your comments, track spacing and filenames, the text of one playnote may run on over the text of another. There are also cases when the end of one playnote will overlap the beginning of another. These should be obvious. (I'm going to leave it this way for a while until we get more experience with this feature.)s

The font for the text in the track map window can be set in the resource file by adjusting the track_map_font parameter, listed towards the top of the file. To get a complete list of available fonts use xlsfonts. If you comment out that line in the resource file (the comment character is !), the font will be iris10.

The shape of the symbols in the track map window reflects the amplitude modifications you have made in the playnotes with the amp() command.

The color or the symbols reflects the gain as stated in the gain= command. Bright tan is light and dark brown is soft, with various shades in between reflecting gains in between. This color scale can be modified by editing the resource file and changing the values for redlow and redhi, bluelow and bluehi, and greenlow and greenhi.

Editing existing playnotes in the Track Map Window


Attributes of a playnote can be changed from this window. If you click the middle mouse button on any playnote bar, the playnote script for that note will appear in the textfield below and the soundfile name and number in the lower field to the right. You can then edit it. Do not hit <return> after editing the field -- doing this will insert a new playnote in the list with the current values. When you press the reload playnotesor reload everything button the changes will take effect. If you want to make a bunch of changes in several playnotes you can enter the changes into memory by just editing them all, then hitting either of the two reload buttons to make all the changes at once.

You can then play the playnote or the soundfile alone, with the play buttons to the left of each field. In the case of the playnote, what is happening is that you are playing the mix with all the other tracks turned off, and skip and end set to that playnote's time. Note that if you have a small timescale, and a lot of tracks and sound, there may be a delay before it starts to play. (Skips are much faster with larger timescales.). The only way to stop either of these plays is with the stop button, or command-L. If you hold down the shift key while clicking on the play button, the note will start to play at the time specified in the skip field, rather than at the beginning of the note. This way you can play selected portions of a playnote as well.

There are several causes of potential confusion when using this page. First, the reload playnotes button may not erase old playnotes from memory, but they may not appear on the map. If, for example, you change tracks, the playnote may still live on the old track as well but will not appear on the map (unless it previously overlapped the end of an earlier playnote, in which case it will not sound). The only way to make sure that your map is accurate is to hit the reload everything button. This is probably not necessary, however, if you are just changing amplitude characteristics, or making the starting time a bit earlier.

If, on the main page, you loaded the playnotes after having made a selection in the playnote window, what you will see is the result of that selection. Changes in any playnotes will, of course, be copied back to the playnote script, whether or not a selection is in effect.

Another potential source of confusion is in the case where you want to simply reload one playnote in the main window by selecting that playnote and hitting reload playnotes. In this case only that playnote will appear in the track map, although all the other playnotes selected previously will still sound. (This should be fixable, but my brain hurts right now.)

This window makes it very easy to fine tune characteristics of a mix. You can turn tracks off and on with the buttons to the left of each track, and start at any time in the mix simply by clicking the left mouse button at that time, and then make changes in the playnotes and try again.  When a track is turned off, all displayed playnotes for that track will appear partially greyed-out as a reminder.

While in the Track Map Window, if you ask to edit a soundfile (Alt-e, or Edit Input File, from the Soundfile menu) you will get the soundfile which is currently listed in the soundfile textfield on the lower right of the window.

Visual editing in the trackmap window

Adding new playnotes from the Track Map Window


You can add new playnotes to the mix simply by typing them in the field, hitting <return>, and, after all the playnotes you want to add have been entered, hitting reload playnotes, or reload everything. The default program state assumes that what you are entering in this field is a new playnote, unless you have clicked the middle mouse button on an existing playnote bar. This sets the state to modify. The state will be reset to the default add when you hit reload playnotes or reload everything.

A potential source of confusion exists when you have used the offset and/or the addoffset feature in the playnote window. Remember that when you enter new playnotes the starting time will be incremented to whatever the cumulative offset is at that point for the mix, and the displayed playnotes will reflect this.
 

Visual editing of playnotes in the track map window.


Playnotes can be moved around with the mouse or the arrow keys. To move a playnote with the mouse, hold down the <shift> key and click on the playnote you want to move with the left mouse button. Note that the text and end-bars for this note are now displayed in red.  This indicates that this is the playnote selected for editing.  Now drag the playnote with the mouse. You will see a white version of the soundfile move with the mouse. You can change both its start time and track number this way.  When you release the mouse button, the original image of the soundfile will disappear and the new one will assume its color. You can move around any number of soundfiles before hitting the reload playnotes or load everything button to put the changes into effect. If you move soundfiles to the left, later in time, you should use the load everything button. As you move the soundfile you will see the values for at= and track= change in the playnote window below.

You can also move playnote by using the arrow keys, which will move them up or down one track at a time or back and forth in time, in .1 second increments. This feature merely requires that you have shift-clicked on the playnote on the playnote you wish to move with the left mouse button.   When you are done, left-click anywhere in the window to redraw the playnote in its new location.  Again, you have to reload playnotes or load everything after you are done.

The duration of playnotes can also be adjusted with the mouse.  To do this, hold down the <shift> key and click on the playnote with the right mouse button.  Dragging to the right and left will adjust the duration of the playnote.  As you do this, the value for dur= changes in the playnote window below.  Note that you cannot drag between tracks using this command.  As always, you have to reload playnotes after you are done (load everything would never be needed for this operation).

The gain of playnotes may be adjusted up and down with the keypad '+' and '-' keys.  To do this, select a playnote using <shift>-leftmouse.  The '+' key will increase the gain by 1 dB;  if the <shift> key is down as well, the gain will increase by 3 dB.  The '-' key will reduce the gain in the same fashion.  As you do this, you will see the values for gain= change in the playnote window below.  Note that the relative colors of the various playnotes will also change to reflect the new gain relationships.
 

Controlling track playback from the track map window.


Tracks can be turned on and off from the track map window by first clicking with the left mouse button in the window to gain focus, and then using a combination of the middle mouse button and the letter z to turn tracks off, and the middle mouse button and the letter x to turn tracks on. You can drag the mouse up and down to select groups of tracks. When a track is turned off, the line under that track will turn white, and all playnotes on that track will appear partially grayed-out. You can turn all tracks off with Alt+u and turn all tracks on with Alt+t.


Various Buttons



1) Load Everything. Mashing this button does the following: it opens and stats all the soundfiles listed, it reads in the playnotes, it reads the timescale, the number of tracks, and the state of the individual input and output tracks. It also allocates memory. When it is yellow it indicates that no relevant information is in memory, that memory is not allocated, and that nothing will happen. Since rt uses a lot of virtual memory, miniaturizing the app in this unloaded state makes it possible to have a very large number of these apps running simultaneously. (See the note on virtual swap space).

2) Kill everything. Mashing this guy will simply kill the current driver and stop everything that is going on. It resets the app to a zero state, and releases virtual memory. It is useful to hit this when things get confusing or out of hand.

3) Reload Playnotes. This button assumes that the driver is already running, and it will simply read in either the entire contents of the Playnote Window, or a selection you have made with the mouse. This is useful if you want to add a note or alter a note. You have to be careful about allocation here, however, since a track can only play one note at a time you may wipe out something that was already there. (This is often what you want to do.) When things get too complicated it is usually best just to restart the driver.

4) Play. This will play the currently loaded mix, using the times given in the play from, play to forms. The button is inactive unless the 'load everything' button has been hit.

5) Stop. This will stop the currently playing mix, but will not kill the driver. Sometimes it takes a moment or two to kill the playing process.  This button is inactive unless a mix playback is in progress (or is paused).

6) Pause. This will pause the currently playing mix. Currently it may take a few seconds to pause.  This button is inactive unless a mix playback is in progress.


Information Fields



1) Timescale. This describes the quantization of the mix. The driver works by quantizing time into ticks of this length. At each tick it stores information about who is playing where, what, how loud, etc. Each tick thus contains a complete record of the state of the mix for that moment. The data in the Playnote window is used to set this information up. The default timescale is 1/100 of a second. This means that sounds, amplitude alterations, etc, can alter states with this granularity. In other words, if you want a note to enter at time 1.005 and your timescale is .01, your sound will enter at time 1.00. The sounds will play to whatever duration you specify, regardless of the timescale, and transitions over that time will be smooth, no matter what the timescale is. The maximum timescale for a 44.1k mix is about .8 seconds. The limitation is caused by the size of the buffers being sent to the DACs. .01 is a good timescale for most purposes. Larger timescales will result in somewhat more efficient mixes since there is less reshuffling of the disk and data. (Changes in amplitude and frequency are done on a sample-by-sample basis, however, regardless of the timescale, so larger timescales should not normally result in clicks.). There are certain conditions, however, in which a smaller timescale may result in better performance. In particular, if a great many files are being mixed, a smaller timescale seems to allow disk overhead to be distributed more evenly over a period of time. With a large timescale, at each grain, a lot of disking has to be done and this might cause interruptions. There are currently a maximum of 200,000 ticks allocated, so with a timescale of .01 you are limited to a play of 200.000 * .01 = 2000 seconds. Increasing the timescale increases the amount of time available. It is often worth experimenting with the timescale. If you have a mix which only contains a few large files, a larger timescale will be more efficient. Skips into a file are much quicker with a larger timescale. 

2) Tracks. This is the maximum number of tracks you will be using. The default is 8 but up to 12 tracks can be used. If you are using less than 12 (the absolute maximum) you may want to specify fewer to gain slightly greater efficiency, but I don't think that this normally would make much difference. See the manual page on the Tracks Window .

3&4) Play from.., play to. Very often you will only want to hear selected portions of a mix. You may enter the starting and ending times in these two forms. You don't need to reload or restart the mix to do this, just change the times and hit play. If you put a very high number in the play to form, it will just play to the end of the mix.

5) Timer. Displays the current time of the mix in 1/10 second increments. If you skip in the timer will skip in as well. If you turn soundfiles off while playing, however, the timer if there are periods of time in which no soundfile is active, since this time will not be updated . The timer also appears in the trackwindow .

6) Peak Amplitude. Displays the current peak amplitude of the buffers just before they are sent to the DACs. The fields below the peaks show the maximum so far, and can be reset by the reset button.


Order of Operations.


If you make any changes in the names, conditions, or numbers of soundfiles, or the timescale or maximum number of tracks, you will have to restart the driver (kill everything, load everything). Most other changes, such as altering the times of a mix in the control window, some changes in the playnote window, turning soundfiles off and on in the soundfile window, making any changes in the tracks window, can be done without restarting the driver.


rt scripts

The entire state of a mix can be saved to a simple ascii file with file type .rt. This is done from the File menu, and if it is a new mix, you will be prompted for a filename. Similarly, you can restore a mix by first opening rt with the rt script specified in the command line, or by opening rt and then loading in the script from the files menu.


Saving mixes


When you finally want to save a mix, before hitting the play button go to the Soundfile menu and select the Write NeXT soundfile or the Write WAVE soundfile option. It will prompt you for a soundfile name.  Now hit the play button.  What will be written to disk is exactly what you would have heard had you hit the play button alone.  As the mix proceeds, you will be updated on its progress via a dialog panel, and you have the option of interrupting the mix at any point.  The nux-to-disk option resets after each play command, so you will have to repeat the above steps to rewrite the mix to disk.

It's up to you to make sure you have enough disk space. (hint: learned the hard way--if you fill up your disk don't try to save your rt script, it will just write an empty file.)


Editing Soundfiles and Playnotes


To edit a soundfile place the cursor anwhere in the name of that soundfile, in the soundfile window, and go to the edit input soundfile selection in the Soundfile menu. The sound editor program specified by the Rt*soundEditor resource will be invoked on the soundfile, if the program is installed on your machine.  Otherwise you will be alerted that it can't find it.  Under Linux, the current default is Douglas Scott's "mxv" program.

You can also edit a playnote, as modified by its parameters. To do this you need to select a playnote in the Track Map Window with the middle mouse button. The playnote will then appear in the form at the bottom left of the Track Map Window. Then, Alt-K will write that playnote's sound in /tmp, and the sound editor program will open that file. When you are done you will be prompted to see whether or not you want to save the soundfiles in /tmp. Note that any changes made to the playnote soundfile with the soundeditor will have no effect on the resulting mix.


Altering Soundfile Formats


Rt will now read wave, aiff and NeXT/Sun soundfiles The last column in the soundfile window displays the format after the file has been loaded. "w" for wave, "a" for aiff, and "n" for NeXT/Sun. In the Soundfiles menu there are options to alter the headers. To select a file for alteration place the cursor anywhere in the name of that soundfile, and call up the menu selection. You will not be allowed to write an aiff header if it would destroy any sound data. . (This will only happen in the case in which an aiff header is requested for a NeXT soundfile where the header is the minimum size, 28 bytes). The new file format will be shown next time the soundfiles are loaded with the "load everything" button.



Memory Use


Rt works by dividing time into ticks, as specified in the timescale window. Each tick contains information about what is going on at that track, at that time. For each track there are 200000 ticks allocated for each of 10 parameters. Normally only a small number of these locations are used, but when the memory is allocated the operating system checks to see if that much virtual memory is available. So, for 12 tracks, you would have to have 12*10*4(sizeof(int))*200000 = 96 megabytes of virtual memory. In the (unlikely) event that you had all 12 tracks going for all 200000 ticks and were setting all parameters all the time you *might* start to use up your swapfile. (I've never seen this happen, but it's possible). The following are recommendations regarding use: First, when the 'load everything' button is in its yellow state, no virtual memory is allocated. This means that you can have lots of different rt jobs running at the same time, as long as the sum of the requested virtual memory doesn't exceed what you have available. Second, use only as many tracks as you need, and specify the limit in the tracks window. This way less virtual memory will be requested. Finally, if you are going to 'minimize' an rt job, be sure to 'kill everything' before you do. This way it will take up only a few meg of available memory.


Performance

On a 200 mhz INDY, running 5.3, reading from a Seagate Barracuda drive, the program seems to be able to play 12 44k stereo files at one time with a timescale of .02. The larger the timescale, the fewer function calls there are. Reading files over NFS is generally going to be much slower.

Look ahead buffers. There are two internal buffers which are used. One is in the driver, and the other is in the DACs. The driver buffer is fixed at 64k, but the size of the DAC buffers can be adjusted to be between one and six 32k buffers by using the slider on the track window. The effect of decreasing the number of these buffers is that changes made by moving the sliders for the individual tracks and the output tracks will take effect more quickly, as will the stop and pause buttons. The negative effect is that there may be glitches since the DACs may run out of data. For complicated mixes it is best to use a larger number of buffers. You don't need to restart the driver to reset the buffers, but they will not take effect during a play.


A quick tutorial

You have three soundfiles you want to work with. Let's call them talk, whistle and knock.

1) Enter them, in this order, in the soundfiles window.

talk is a long soundfile and you want to use selected parts of it. whistle is the sound of someone whistling which you want to intersperse here and there, and knock is a simple annoying knocking sound.

2) you might have the following list in the playnote window

playnote(snd=1,track=1,amp(0,1,4,1,5,0), end=10) //give me 10 seconds of talk fading out at the end

playnote(snd=2,track=2,amp(0,0,1,1,2,0), skip=2,end=5,transp=-1,at=5)

// give me times 2 through 5 of the whistle, down 1 semitone starting at time5

playnote(snd=3,track=3,at=3,pan=.1)

playnote(snd=3,track=4,at=3.2,pan=.6)

playnote(snd=3,track=3,at=3.4)// several knocks, assuming that the knock is less than .4 seconds long

3) then hit, load everything, play and listen. You notice that the balance and envelopes are all wrong so you open up the tracks window and adjust the gains individually, listening to the sounds individually.

4) You decide that the transposition level for the whistling is all wrong so you change the transp=-1 to transp=-2. Then select this line and hit the reload playnotes button. Hit play and listen again

5) You then decide that the whistling comes in too soon, so you adjust its at=5 to say at=6, select, load and play. Now you notice however, that the note still starts at time 5 and then starts again at time 6. In otherwords you haven't wiped out the first reference to it. The only thing to do now is to restart the driver by hittile the load everything button..

6) You want to listen to the section from time 3 on now, so you type 3 in the play from form in the control window.

7) You decide it is good enough for your recording company so you write the mix to disk and go to bed happy. 


Sgi-Style Help


Many of the windows and buttons have SGI-style help panels. To activate them put the cursor over the window and click the F1 key. This is probably most useful for the playnote window, where the panel will show the complete syntax for playnote commands.


Bugs

1) As of this writing (1/5/97) I think that the rev function is broken.

2) If you turn soundfiles off during a play, and there are moments when no soundfiles are active, the timer will not be updated properly. (This may be a feature)

3) To turn a soundfile back on you have to move the cursor to a different position in the word 'off'. (Due to the inadequacy of X callbacks).

4) Often you will see artifacts left over in the track map window after moving playnotes, panning, etc.  Just hit reload playnotes and these will all go away.



Customizing


If you know what you are doing you can change fonts, colors etc, by editing the Rt resource file. If you don't like my color schemes, learn how to use cedit and you can then specify any of 256^3 colors. If you want to use your own resource file you should set the XUSERFILESEARCHPATH environmental variable to %S%N and copy the Rt resource file to your current directory. 


Acknowledgements

Thanks to David Jaffe for important additions to the NeXT port, which will also make it into this port, eventually. Peter Velikonja did the major work in de-NeXTifying the sound driver so that it would work without the SoundKit. To Doug Scott for simplifying the use of the SGI Audio Library for me. Thanks to Bill Schottstaedt for helping to grok aiff files. And, most of all to Kent Dickey, whose class project in Cos/Mus 325, the driver for this app, has helped out so many people since that time. (I should have given you an A+)

Paul Lansky 1/5/97

Revised by Douglas Scott 06/2002