For AHI version 4.20. Document version 4.21 (1999-03-28).
Copyright (C) 1994-1999 Martin Blom
The latest release of AHI can always be found at http://www.lysator.liu.se/~lcs/ahi.html.
The Amiga has always had excellent sound capabilities. In 1986, they
were awesome. Today, well@enddots{} Perhaps not awesome, but still very
good. The OS interface, audio.device
has however never been as good
as it could have been. It is tied hard to the underlying hardware, and
doesn't work very well for music. This has led to a situation where most
audio programs only use audio.device
to allocate the audio resource,
and then poke around in the hardware registers--making it next to
impossible to replace the Paula chip (1).
There have been attempts to write an audio.device
clone that uses a
sound card instead of Paula, but so far nobody has succeeded. It is
definitely possible, but the question is if it is worth the trouble--too
many of the programs bang the hardware.
Entering AHI (2). AHI is a new audio subsystem, designed to be flexible, hardware independent, expandable and future safe. It is designed with real-time applications in mind. It is designed to play modules (3) and sound effects as efficient as possible, taking advantage of modern DSP-based sound cards.
Yet AHI allows applications that don't need full control over the audio hardware to share the resource, so that many different programs can play and record sound at the same time, without conflicts.
As a user you will hopefully not see much of AHI, other than the audio mode requesters. They works almost exactly like screen mode requesters.
AHI was never supposed to be the standard for hardware independent audio. It was meant as a temporary solution until Amiga Technologies delivered an official standard. However, the situation looks worse and worse for every day that passes by, and this may be all you will ever get.
Copyright (C) 1994-1999 Martin Blom
AHI is available as freeware. That is, it may be freely distributed in unmodified form with no changes what so ever, but you may not charge more than a nominal fee covering distribution costs. However, donations are welcome (see section Donations).
If you use this software in a commercial or shareware software product, please consider giving the author (see section The Author)---and preferably each one of the contributors (see section Contributors) too--an original or registered version of your work. Should you want to distribute the AHI software with your own product, there is really nothing to consider, is it?
If you wish to distribute this software with a hardware product, contact the author (see section The Author). Distribution of AHI with hardware products is not free.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--AHI is available for personal use without any charges. I strongly believe in free software, and I use free high-quality software tools daily. But I live, like all of us, in a real world. As a student, my income doesn't even suffice for the rent, and much less food, course literature and entertainments. Therefore I ask, if you like this software, please consider showing your gratitude by making a small donation (see section The Author for my address).
Martin
AddAudioModes
is used to build and remove a list of audio modes that
AHI can understand. The definitions of the audio modes are stored in
`DEVS:Audiomodes' (see section The Mode Descriptors). Normally you don't
have to run this program, since ahi.device
automatically reads all
mode descriptors when it is used for the first time. It can, however, be
useful in installation scripts.
The `FILES' option specifies with descriptor(s) to be added to the
current mode list.
The `QUIET' option, if specified, will suppress error and output
messages.
The `REFRESH' option, if specified, will scan `DEVS:Audiomodes'
and add all descriptors found there to the current mode list.
The `REMOVE' option, if specified, will flush the current audio mode
list from memory.
The `DBLSCAN' option does not have anything to do with the audio mode
list. If specified, it will open and then immediately close a native,
double-scan screen. On some systems using a graphic card, this will enable
>28 kHz sample frequencies with the native audio. You need an appropriate
monitor driver in `DEVS:Monitors' to make it work.
AHI
without any arguments or with the `EDIT' argument opens the
AHI preferences editor. The `FROM' argument lets you specify a
file to open. This must be a file that was previously saved with the
`Save As...' menu item of the AHI preferences editor. For
example, if you have saved a special configuration of the AHI
preferences editor to a file in the `Presets' drawer, you can use the
`FROM' argument to open that file. If the `USE' switch is also
given, the editor will not be opened, but the settings in the `FROM'
file will be used. If the `SAVE' switch is given, the editor will not
open, but the settings in the `FROM' file will be saved. The
`PUBSCREEN' option allows you to specify a public screen on which the
program will open its window.
Example:
AHI Prefs/Presets/AHI.Delfina USEloads and uses the specifications saved in the `AHI.Delfina' file. If the system is rebooted, the last saved specifications will be loaded.
Note that the preferences program requires either bgui.library
version 41 (4) or
MUI version 3.8 (5)
The `Project' menu options let you save the editor settings to a specific file and open previously saved files.
The `Edit' menu options allow you to restore previously used settings or the default settings. The options are:
The `Settings' menu contains the `Create Icons?' item that allows you to save project icons representing your editor settings in the same drawer as your files. For example, if you save the specifications to the `SYS:Prefs/Presets/AHI.pre' file, the icon for the file appears in the `Presets' window. Double-click on the icon to activate the file's settings.
The `Help' menu's items let you view the on-line "AHI User's Guide" using AmigaGuide.
The preferences program's GUI is divided in two pages:
On this page you select which audio mode to use. You can select audio mode for both low-level programs (`Music unit') and other programs (`Unit n') that don't require low-level audio access such as the AUDIO: device (see section AHI-Handler), sample players etc. You can also select the sample mixing (and recording) frequency to use and how many channels you wish use (6). Furthermore, you can set three hardware properties of your sound hardware, namely the output volume, monitor volume and input gain. Finally, you can select which input and output connectors you wish to use.
The `Music unit' is the defaults for low-level programs. Such programs often have an audio mode requester that lets you chose an audio mode. If you chose `Default audio mode' from this requester, these settings will be used. Note that the number of channels is not selectable here, it's up to the application program to decide how many channels to use.
This page contains some options that should not be used if you don't understand them.
The AHI-Handler
is an I/O mechanism that is used to play and record
sounds. The AHI-Handler
is normally mounted as AUDIO:
at
startup time, or later by double-clicking on its icon or by giving the
following command in a Shell window: mount AUDIO: RET.
The DOSDriver entry is:
Handler = L:AHI-Handler Stacksize = 4096 Priority = 5 GlobVec = -1
When the device is mounted, you can read from the device to record and write to it to play. Options can be given like this:
"AUDIO:PRIORITY=1 VOLUME=50"
All slashes (`/') in the name will be translated to spaces. Thus, if you use slashes instead of spaces, you don't have to use quotes around the name:
AUDIO:PRIORITY/1/VOLUME/50
The full template for reading is:
B=BITS/K/N,C=CHANNELS/K/N,F=FREQUENCY/K/N,T=TYPE/K,L=LENGTH/K/N, S=SECONDS/K/N,BUF=BUFFER/K/N,UNIT/K/N
The full template for writing is:
B=BITS/K/N,C=CHANNELS/K/N,F=FREQUENCY/K/N,T=TYPE/K,V=VOLUME/K/N, P=POSITION/K/N,PRI=PRIORITY/K/N,L=LENGTH/K/N,S=SECONDS/K/N, BUF=BUFFER/K/N,UNIT/K/N
`BITS' can be one of 8, 16 or 32. `CHANNELS' can be either 1 for
mono or 2 for stereo. The `FREQUENCY' is in Hertz, `TYPE' is one
of `SIGNED', `AIFF' or `AIFC'. `VOLUME' ranges from 0
(silence) to 100 (full volume), and `POSITION' ranges from -100
(far left) via 0 (center) to 100 (far right). The `PRIORITY' can be
from -128 to 127 (unstoppable). `LENGTH' is how many bytes you
wish to read or write, and `SECONDS' is the same, but in seconds
instead of bytes. The `BUFFER' size is specified in bytes. Note that
two buffers are always used, which means that the memory usage will be two
times BUFFER. `UNIT' selects which ahi.device
unit to use.
The default options for reading are `BITS=8' `CHANNELS=1' `FREQUENCY=8000' `TYPE=SIGNED' `LENGTH=very-very-much' `BUFFER=32768' `UNIT=0'.
The default options for reading are `BITS=8' `CHANNELS=1' `FREQUENCY=8000' `TYPE=<none>' `VOLUME=100' `POSITION=0' `PRIORITY=0' `LENGTH=very-very-much' `BUFFER=32768 UNIT=0'.
If `TYPE' is not specified, the default behaviour is to identify the data stream as IFF-AIFF or IFF-AIFC. If so, the default values of `BITS', `CHANNELS', `FREQUENCY' and `LENGTH' will taken from the file. You can still override them if you wish. If the stream could not be identified, the data format is assumed to be `SIGNED'.
Both when reading and writing the sample rate will be converted on the fly to what the underlying hardware is configured to. Normally this is not a big problem when writing, but the quality when reading leaves quite a lot to wish for, since no low-pass filters are used.
Example 1:
copy Louise.AIFF AUDIO:
plays the file `Louise.AIFF'.
Example 2:
copy AUDIO:SECONDS/10/TYPE/AIFC/B/16/F/44100/C/2 sample.AIFC
records 10 seconds of audio and stores it in the file `sample.AIFC' as uncompressed IFF-AIFC, 16 bit stereo at 44.1 kHz.
AHI uses a set of hardware drivers for each sound card. This means that it's easy to add support for new sound cards as they appear. At the time of writing, the following sound cards are supported:
The hardware drivers themself are located in the `DEVS:AHI' drawer, and are named as `<name>.audio'. They are actually libraries, in spite of being located under the `DEVS:' assign, and will be flushed out from memory when not in use and the system needs more RAM. Many of the drivers require additional files; see below. These extra files are not delivered with AHI.
concierto.audio
concierto.library
.
delfina.audio
delfina.library
version 4 or greater (7).
maestropro.audio
maestix.library
version 40.10 or greater (8). For
more information about this driver as well as the most recent version of
maestix.library
, please visit the author's WWW page (9).
melody.audio
melodympeg.device
version 1.40 or greater (10).
paula.audio
SetEnv AHIpaulaFilterFreq 16000 Copy ENV:AHIpaulaFilterFreq ENVARC:The variable `AHIpaulaSampleLimit' is also checked. This variable controls how the driver should handle mixing frequencies greater than 28 kHz, which is the limit of the hardware when using 15 kHz screen modes (PAL, NTSC, Euro36). If the current screen mode is a VGA (31 kHz) mode, the driver allows frequencies up to 48 kHz. Normally, the driver checks the current screen mode, and decides if the higher mixing frequencies should be available or not. By setting this variable, you can control that decision. If set to `0', the frequency will always be limited to 28 kHz and if set to `1', there will never be any limit. Example:
SetEnv AHIpaulaSampleLimit 1 Copy ENV:AHIpaulaSampleLimit ENVARC:This will disable any screen mode checking, and will always allow up to 48 kHz in the mode requesters.
Delete ENV:AHIpaulaSampleLimit Delete ENVARC:AHIpaulaSampleLimitThis will turn on the screen mode checking again. Please note that this 31 kHz screen mode is not neccessary the screen mode you're seeing on your monitor. If you're using a graphic card, you must force the Amiga video signal to 31 kHz. CyberGraphX users might want to try this command (see section AddAudioModes for more information):
AddAudioModes DBLSCANPicasso 96 users just need to set the `Picasso96/AmigaVideo' variable to `31kHz':
SetEnv Picasso96/AmigaVideo 31kHzBecause of incorrect hardware documentation, there is great confusion about which hardware channels are sent to the left speaker, and which are sent to the right.
paula.audio
uses the correct order (right, left, left,
right) but many other programs don't. The `AHIpaulaSwapChannels'
variable was added to let the user decide if the correct or incorrect
behaviour should be used. In not present or set to `0', the correct
behaviour is used. If set to `1', the left and right channels will be
swapped.
By setting the `AHIpaulaFakeMixFreq' variable to `1', you can make
paula.audio
not report the actual mixing frequency used, but rather
exactly the frequency that the program asked for. The default, `0',
will report the nearest possible mixing frequency that the Paula sound chip
can use.
Why would anyone want this, you may ask. Well, by setting the variable
to `1', you will make paula.audio
behave exactly like
filesave.audio
, which can be important if you are making music that
you will later render and put on a CD, for example. Be warned, however, that
setting this variable to `1' can make the sound produced sound a little
false (but not when rendered, of course)!
Finally, the variable `AHIpaulaBufferLength' controls the minimum
playback buffer size to use. Because of the limited Chip RAM
bandwidth, a MC68060 CPU might run into trouble when using the
default minimum buffer size (0). By setting this variable to `1024',
for example, you will reduce the number of interrupts caused and increase
the number of samples transferred each time to at least 1024 samples. But
take care! Setting this variable too high will cause long periods with
multitasking disabled.
toccata.audio
toccata.library
version 12 or greater (11).
This driver also reads the environment variables `AHItoccataNoTask'
and `AHItoccataIrqSize'. If `AHItoccataNoTask' is set to
`1', all mixing will be done in a Software Interrupt which means
the sound output will not suffer when multitasking is turned off. The back
side is that it requires a faster CPU. Much faster. Only use this option
as a last resort. Example:
SetEnv AHItoccataNoTask 1 Copy ENV:AHItoccataNoTask ENVARC:`AHItoccataIrqSize' specifies the number of bytes transferred to the card each interrupt and defaults to `512'. It must be one of `32', `64', `128', `256' or `512'. If you encounter problems with serial port hardware, you might want to set this variable to a lower value than the default. Please note that this driver is used for both the DraCo Motion and the Toccata.
wavetools.audio
dad_audio.device
.
The files in `DEVS:AudioModes' describes the available audio modes that you can chose from in the audio mode requester. All files located in this drawer will be scanned the first time AHI is used, and added to the internal mode database.
The following modes are available for most drivers:
The author can be reached at the following addresses:
Martin Blom was born 1974 in a town in Sweden called Jönköping. He had a happy childhood, lots of good friends, and a great family. He did his homework and went to church every Sunday.
But then, one cold, dark Christmas Eve in the year of our Lord 1986, everything went wrong. This was the day when it entered his life. At once, there were fights among the brothers. They all wanted to use it. Martin started to avoid playing with kids that didn't share his passion for it. The school work suffered. Other interests suffered. It was the Commodore 64 home computer, and it would forever change his life.
Today, more than ten years after the tragedy, things are worse than ever. He is studying Computer Science and Engineering at Linköping Institute of Technology, surrounded every day by other computer nerds.
Martin has spent loads of money on computers over the years: Amiga 500, Amiga 4000/040, Commodore 128D, Commodore 64 (in order of appearance), modem, monitors, disks, mice etc. Interesting enough, no sound card. He did, however, build a sound card of his own for the Commodore 64, and he likes to mention that now and then (you see, this was one of the few hardware projects that actually worked!). 4 channels, 8 bit samples. He even wrote a module player for the good old 64. And it had quadrascopes.
Some people actually seem to believe that Martin is a good programmer. They couldn't be more wrong. He is lazy, has no patience, he is a slow thinker and he doesn't like anything he has to do.
Martin used to say
And guess what? He tried demos. He tried utilities. He tried intros. He wrote a door for /X. And he traded warez.
What do you do if you don't have the patience to write applications, if you only write moderate demos, are tired of utilities, hate BBS doors, are totally fed up with playing games and have decided to get legal and stop pirating software? Simple. Try a new concept!
Take a deep breath. Close your eyes. Think of one thing your computer lacks. Think of one of the things that makes your favorite toy feel outdated. Think of something that nobody has (successfully) tried before. Then write the software, and release it as Freeware.
In Martins case, that something was hardware independent audio.
Come on, admit it! It's brilliant. It doesn't matter if you are a good programmer. It doesn't matter if it takes 3 years to get to a half-finished product. It doesn't matter if you give it the most unimaginative name in the world--you can even use a TLA (12). Nobody is going to say your software sucks, because nobody can say he has done better himself. Nobody is going to complain if you're slow on releasing bug fixes and updates, because the software is free. And nobody is going to be angry with you if you stop developing the software--because it sucked in the first place, remember?
This concept won't make you rich, but are rich people really happier?
The author wish to give special thanks to the following persons (in alphabetical order):
And of course, the actual catalog translators: Samuel Aguilera, Andrija Antonijevic Rúben Alvim, Stéphane Barbaray, Frederico Borges, Piergiorgio Ghezzo, Roger Hågensen, Bernardo Innocenti, Ljubomir Jankovic, Petteri Kallio, Sini¹a Loliæ, Eivind Olsen, Marcin Orîowski, Thomas Petersen, Pauli Porkka, Vit Sindlar, Martin Sprenger, Sönke Tesch, Vörös Viktor, Michel Vissers, Ondrej Zima, me, myself and I@enddots{}
The following people has contributed to the AHI project with code:
Many thanks!
Jump to: 1 - 6 - a - c - d - e - f - h - i - j - l - m - n - o - p - r - s - t - v - w
Paula is one of the custom chips, and she is responsible for the sound (and more). Unfortunately, this chip has not been updated since the very first Amiga was released.
The name AHI was chosen because the functions in the system had to have a prefix, and the author couldn't come up with anything better than Audio Hardware Interface, something that he has regretted ever since. The suggested pronunciation is "atchii", as in "God bless!".
Originally designed in 1986 by Karsten Obarski, modules have become a de facto standard for game and demo music. The original format has been improved many times, and many new music formats have--more or less--been derived from it, including the popular S3M and XM formats.
BGUI is Copyright © 1996-1997 Ian J. Einman
MUI is Copyright © 1992-1997 Stefan Stuntz
The more channels you select, the more sounds can you play at the same time. However, due to the nature of sound mixing, the volume will decrease as well. If you try to play more sounds at the same time than there are channels, the least important sounds will be muted until the other sounds have finished playing.
The latest version of the Delfina software can be found at Petsoff Limited Partnership's WWW page: http://www.sci.fi/~petsoff.
maestix.library
is available from AmiNet, for example
ftp://ftp.germany.aminet.org/pub/aminet/util/libs/Maestix.lha.
Richard Körber's WWW page: http://www.is-koeln.de/einwohner/shred.
melodympeg.device
and the latest version of this driver can be found
at the Kato Development Group's WWW page:
http://home.pages.de/~kato.
toccata.library
is available from AmiNet, for example
ftp://ftp.germany.aminet.org/pub/aminet/util/libs/toclib12.lha.
Three Letter Acronym
This document was generated on 12 September 1999 using the texi2html translator version 1.52.