Short: A simple additive synthesizer Author: Kim Fastrup Larsen Uploader: kimflarsen hotmail com (Kim Fastrup Larsen) Type: mus/edit Version: 1.3 Architecture: m68k-amigaos New in version 1.3 - Prevent possible resource leaks by making sure requesters are ended before closing a project window Introduction Harmonics is a simple sound synthesizer program. Waveforms are created by adding sine waves of different frequencies and amplitudes. You are limited to working with 12 different fre- quencies: The base frequency (called the first harmonic), the base frequency × 2 (the second harmonic), the base frequency × 3 (the third harmonic), and so on, up to the base frequency × 12 (the twelfth harmonic). Full source code included. How to use Harmonics Harmonics are added to the waveform simply by adjusting the twelve sliders that determine the amplitude of each harmonic. Setting a slider to zero (far left) leaves that harmonic out of the waveform altogether. The resulting waveform is scaled to use the full amplitude range. You can test the waveform by playing tones with the keyboard. The top two rows will give about an octave and a half to play with, and the next two rows will let you play the next deeper octave plus a bit. There are five octaves in total, and you can choose which octaves are available on the keyboard using keys F1-F4. If you manage to get sounds "stuck" by doing things like changing octave while playing tones, you can kill all sound by hitting the space bar. Harmonics projects contain simply the setting of the twelve sliders and so are very small files. In order to use your sounds in other programs, you must use the "Export IFF" faci- lity of the program. This will save a 5-octave IFF 8SVX sound file that most Amiga music software will be able to load. As mentioned above, the program generates 5 octaves of wave- form data. However, you should observe the following limita- tions: Harmonics 5-8 may be inaudible or distorted in the highest octave, and harmonics 9-12 may be inaudible or distorted in the two highest octaves. Harmonics 1-4 will sound fine in all octaves. Therefore, if you wish to make use of all 5 octaves, you may want to limit yourself to harmonics 1-4, and likewise, if you wish to use all but the highest octave, you may only want to use harmonics 1-8. If you need only the lower 3 octaves, you will have no problems with any of the harmonics. About the code Version 1.1 of this program is a complete rewrite. The design goals remain the same, however. It was originally created as the sort of software you would have wanted for your Amiga 500/2000, and I deliberately limited myself to features available in Kickstart 1.2 as a design exercise. None of this has changed with the new version. One of the main goals of the rewrite was to have one and only one event loop handling everything including requesters. This was achieved using callbacks, which also facilitated separa- tion of user interface and project logic. Modularizing the code was another goal. Although it is not actually utilized, the code has been de- signed with a multi-project capability in mind, In order to introduce multi-project handling, you would in principle only need to make a few changes to the "tool" module, which han- dles the project logic, although in practice you would want to make some changes to the "ui" module as well to accomodate this. The "guitools" module contains routines that can lay out menus to look just like Gadtools, as well as functions to easily create and reuse a couple of different types of re- questers. This program allocates sound channels dynamically when they are actually needed to play sounds. The audio device features a way of letting multiple programs play sounds and music si- multaneously by stealing channels from each other and freeing them up as soon as possible, and this program demonstrates that - you can start up multiple instances and play in all of them at once. This is handled by the "audio" module, which is an abstraction layer on top of the audio device. There are more modules, e.g. the "piano" module that imple- ments the polyphonic keyboard, the "waveform" module that generates the 5 octaves of samples, and the "io" module which handles saving and loading. History 1.3 (Dec 14, 2018) - Prevent possible resource leaks by making sure requesters are ended before closing a project window 1.2 (Sep 6, 2018) - Minor fixes and tweaks 1.1 (Aug 28, 2018) - Polyphonic keyboard - Completely rewritten 1.0 (Sep 6, 2004) - Original release.