|
ANY-maze Help > I/O devices supported by ANY-maze > Other I/O devices supported by ANY-maze > Using soundcards as I/O audio devices > Soundcard speakers Soundcard speakers
IntroductionEach soundcard used in ANY-maze allows independent control of its left and right channel as speaker ports. Each speaker port can play essentially any sound at a software-controlled volume.
Types of sounds that can be playedSoundcards can play any sound that ANY-maze can generate, provided they fall within the frequency range of the soundcard. There are essentially three options: White noiseANY-maze can play white noise which can be useful for masking other sounds in the lab - for example the noises created by other equipment, noises in the room next-door, etc. TonesANY-maze can generate tones of any frequency, and soundcards can play those from 50Hz up to 22050Hz. This maximum frequency is determined by the sample rate of the soundcard; ANY-maze will play audio through soundcards at a sample rate of 44100Hz (the sample rate used by CDs and most audio files), so the maximum frequency it can generate is half of this sample rate. Tones can either be specified as a particular frequency or they can be specified as a musical note using Scientific pitch notation. ANY-maze can play all notes from C2 to B7. Sound filesANY-maze can play most sound files that can be played in Windows Media Player - this includes Wave (.wav) files, MP3 files and Windows media audio (.wma) files, although not MIDI files. (Note that the .wma format supports digital rights management - DRM - and ANY-maze cannot play DRM protected files.) If you want to play a file that's currently on a CD then you will need to 'rip' the CD first and then play the resulting sound file. Although ANY-maze cannot process MIDI files, there are cheap, commercial programs that can convert MIDI files to WAV format, which ANY-maze can play. In fact, converted MIDI files tend to provide the best sound quality, as you can specify that the WAV file should be generated as a mono, 16-bit, 44100Hz file - there's more about this below.
Note that if the sound file isn't already in 44100Hz, 16-bit format, then ANY-maze will need to convert the sound file before it can play it. This may take some time to do - especially if it's a long sound file. This only needs to be done once, however - the converted audio file is stored in a Sounds subfolder of the ANY-maze program folder, and the converted file will then be used next time the sound is played.
Obviously you won't want this conversion process to take place during a test - since the sound file may actually start playing a second or two after you wanted it to start! To avoid this, you can make sure the conversion process has already happened by using the I/O page to play the sound file for the first time. Sound qualitySoundcards use 16-bit 44100Hz audio, so the quality of the sounds they can produce should be quite reasonable - that's the same sound format used by CDs. However, the quality of the sounds generated will be entirely dependent on the quality of the soundcard itself, and the speakers that you use. If you find that the quality of the sounds isn't quite good enough, there are things you can do to improve it: TonesWhen choosing tones to be played, check the frequency response of your speaker - you can't expect a tone to sound good if it's at the limits of the speaker's ability to play it. Some small, low cost speakers only have a good frequency response between about 1000Hz and 5000Hz, so outside this range (and most especially at frequencies below 500Hz) tones will sound very ragged or may not be audible at all. At frequencies above about 20kHz, the sound quality will deteriorate (although this is at the upper limit of most human hearing anyway). This is because the highest theoretical frequency that a soundcard can produce when running at 44100Hz is 22050Hz, but in fact the closer the DAC (digital to analogue converter) in the soundcard gets to the sample rate, the poorer the audio quality. Nevertheless, there is still a good range of frequencies which will play well on most speakers (bear in mind that humans can discern a difference of 1Hz in a tone). Sound filesMost sound files are recorded at 44100Hz, and they're generally 16-bit as well. If a sound file isn't this format, ANY-maze will need to convert it in order to play it. Sound files can be converted from 44100Hz, 22050Hz or 11025Hz and 8 or 16-bits. Multi-channel sound files are converted to single-channel files so they can be played from a single speaker - when this happens, the audio in both channels is mixed to form a single channel 'mono' signal. Sometimes, the resampling process tends to introduce noise, which manifests as hiss, or sometimes crackle. There's nothing you can do about this, although if you use low quality speakers the hiss will tend to sound much worse. The best quality sound is usually achieved either by playing a .wav file that was recorded at 44100Hz (and ideally at 16-bit resolution), or by converting a MIDI file to this format. MIDI filesUnlike other formats such as wave files or MP3, MIDI files don't hold a digital representation of the sound of some music, rather they hold a series of notes that should be played to create the music - so they're a kind of electronic musical score. When a MIDI file is played, your computer synthesizes the notes in the 'score' and these are what you hear - this is why MIDI files played on computers usually sound a bit 'electronic'. However, there are two big advantages to MIDI as far as ANY-maze playing sounds through soundcards is concerned: First it's quite easy to find free MIDI authoring software on the internet. This means that you can create your own 'music' which can be very useful if you'd like to create something more sophisticated than the simple tones that ANY-maze can produce. For example, you could create a chord, something ANY-maze couldn't otherwise play. Second, by using a MIDI to wave file converter (which you have to do as ANY-maze can't natively play MIDI files) you can specify that the wave file should be generated as a mono, 16-bit, 44100Hz file, thus the sounds will be synthesised for this format avoiding the need to resample the resulting file and thus reducing the noise (hiss) that resampling tends to introduce. Latency of sound generationThe way Windows generates audio on a soundcard involves filling 'buffers' with the sound to play, and then asking Windows to play them. When a buffer has been played, it needs refilling before Windows plays it again. This process obviously means that there is a very short delay between switching on a sound, and the sound actually playing (due to the time it takes to fill the buffers). This delay is usually negligible, and you probably won't notice it - ANY-maze tries to keep the buffers as small as possible to minimise this delay. In addition, starting (or changing) a sound can cause a tiny 'pop' or 'click' when the audio starts playing. ANY-maze tries to reduce this by ramping up the volume of the sound, rather than starting it immediately at full volume. This means that there's a very short period of time as the audio 'smoothly' starts, which increases the delay. As I said, this probably isn't something that you'll even really notice, but it makes the starting and stopping of audio much smoother. Something else that might affect the latency of starting a sound is when playing a sound file. If the sound file isn't already in the 44100Hz, 16-bit format used by ANY-maze, then it will be converted - which may take a short time (a second or so) to do. This only needs to be done once, however - the converted audio file is stored in a Sounds subfolder of the ANY-maze program folder, and the converted file will then be used next time the sound is played. Obviously you won't want this conversion process to take place during a test - so to avoid this, you can make sure the conversion process has already happened by using the I/O page to play the sound file for the first time. If you need the minimum latency possible, you can adjust the settings of each individual soundcard to minimise latency rather than minimising pops in the audio. To do this, you'll need to change the soundcard configuration - see the Soundcard configuration topic for further details. See also:
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T1286 |