The waveform synthesis program 'GEN.BAS', a detailed description. The prime purpose of 'GEN.BAS' is to take entered function description data for sine, pulse, triangle, random etc, have such data evaluated, placed into an array and permit the array to be written to waveform storage files. Since the array waveform data may be viewed on-screen and the waveform files may be recalled into the array, the program becomes a general-purpose medium for processing and evaluating the source and output material from the recording and replay program 'WORD'. The program is called by typing 'BASIC GEN'. This produces a front-panel that shows three categories of operations: 1. Preset waveform functions: (the available waveform types of sine, square, pulse, random, DC level, line functions or copy functions). 2. Array management: (the manner in which the calculated samples values are placed into the data array; added, multiplied or substituted fro example). 3. File management: (control of file storage or loading). Preset waveform functions. The program allows the following 'simple' waveform types to be constructed with or without an exponential attack or decay envelope. 'Complex' waveforms are constructed using combinations of these 'simple' types. 1. Sine: During data entry, the user may specify values for number of cycles, samples per cycle, peak value, cycle starting point, a bias value, and an attack or decay option. 2. Square / Pulse: This allows the user to specify 'flat-topped' waveforms such as pulse or square waves. The data entry is similar to that for 'sine'. 3. Random: A random waveform may be created to simulate a noise signal. It is shown during the section on array management how such a signal may be integrated with another. 4. DC Level: With or without an exponetial attack or decay, this allows subsequent processing of existing waveform array data or the creation of a simple 'DC level'. 5. Line function: Similar to the 'DC level', the line function permits various 'slope' type waveforms to be created such as triangle or sawtooth. 6. Copy: For faster creation of long waveform data, repetitive cycles may be replicated using this copy function rather than calculation. Entering data. All waveforms have a very similar entry format. The most complex is illustrated by 'Sine wave' which will be described. Others are a subset of these commands. Sine wave........S Pressing the 'S' key prompts for: Number of cycles: This the number of complete waveform function cycles required for this calculation run. The value can range from 0 to N and may be a decimal fraction for parts of a whole cycle. Number of samples per cycle: This is the number of samples that will comprise one complete waveform cycle. The waveform frequency during replay will be based on this together with the relay sample rate, eg 10 samples per cycle replayed at a 100 us sample rate will result in a waveform frequency of 1kHz. Beware of setting sample-per-cycle values of less than about 10 since this can create unwanted aliasing effects and increased harmonic content. Bias Level: This is a value of amplitude from -1 to +1 that will be added to the each calculated sample value and so provides a level shift or 'bias' function. If not required, enter '0'. Peak Level: This is a value from -1 to +1 that will be taken for the peak amplitude of the waveform function, ie the maximum function sample value during the cycle. It is usually from 0 to +1 but may be negative for special purposes. Use a value of +1 to utilise the full sample value. Phase angle at start: This specifies the starting point of the cycle in degrees. Allowed values are from 0 to N degrees. Enter zero if not required. Attack (1) Decay (-1) or level (0): This is an option to place an overall exponential attack or decay envelope around the generated function. Entering '1' will cause sample values to be scaled after calculation by an exponential factor commencing at zero and increasing to unity with a time constant entered as described next. Entering '-1' results in a decay from a unity scale factor to zero with a specified time constant. Entering '0' results in no attack or decay with each sample value directly as calculated. Envelope time constant in cycles: If an attack or decay was specified, this requests a value that will be taken as the time constant entered as cycles. The value entered should be less than one-fifth of the total cycles to be calculated if the samples values are to reach within 1% of the function values by the end of the calculation. (exponential gets to within 1% within 5 time constants). Envelope time constant in samples: Alternatively, if an attack or decay was specified, this requests a value that will be taken as the time constant in samples. The value entered should be less than one-fifth of the total samples to be calculated if the samples values are to reach within 1% of the function values by the end of the calculation. (exponential gets to within 1% within 5 time constants). Data application to array: The calculated integers from 0-255 that make up the required function will now be placed into the data array; however to greatly increase the power of the program, they can be mixed with data already present. This allows harmonic addition, and complex waveform synthesis. There are five options, overwrite, add, multiply, subtract and divide. Use overwrite normally, but the others for synthesising complex waveforms. Use plot / pointer to restore the array pointer before generating a new wavform that is to be combined with another. File operations. Use 'Write' to save the array that is created to a file with the extention '.WAV'. These can be read into WORD. Alternatively, files created using WORD can be loaded into the array using 'LOAD'. Unfortunately there is a limitation of about 5000 plot points under 'GEN' due to the memeory used, where WORD allows files up to about 56K bytes. Anybody got a compiler?.........