ADC Home > Reference Library > Technical Notes > Legacy Documents > Audio >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Sound Manager 3.0 SndPlayFromDisk support
Will the
Sound Manager 3.0 supports
The System 7.1 interface has a play-from-disk How to play Macintosh sounds in a continuous sequenceDate Written: 11/15/90 Last reviewed: 3/18/92
When I open a Macintosh sound channel under System 6.0.5, I can use
The problem is documented in the Sound Manager chapter of Inside
Macintosh Volume VI. If you have a
If you want to play multiple sounds one after another, you may be able to do it
by using the
The way to tell if your
You can avoid having to dispose of the channel after each play if you make sure
that each
Sound Manager versus Sound DriverDate Written: 11/6/90 Last reviewed: 3/18/92
We generate sounds using the Four-Tone Synthesizer (
The Sound Driver is no longer supported, as of System 6.0.7. The Four-Tone
Synthesizer in the Sound Manager released with 6.0.7 does not work correctly
for non-Apple Sound Chip (ASC) machines (Macintosh Plus, Macintosh SE,
Macintosh Classic, and Macintosh LC). This has been fixed in System 7. If you
need to use the Four-Tone Synthesizer for non-ASC machines running 6.0.7, you
could try the Sound Driver with 6.0.7 on the chance it'll work for your
purpose. Use the Sound Driver for non-ASC machines running System 6.0.5 and
earlier. Note that there ARE problems when mixing the use of the Sound Driver
and the Sound Manager. Also note that Specifying a Macintosh Sound Manager frequencyDate Written: 11/20/90 Last reviewed: 3/18/92
Why don't the Macintosh System 6.0.5 Sound Manager's We are currently unsure if the second method for specifying a frequency will ever be supported. The problem is that there is no clean way to do the byte sharing which was suggested in Inside Macintosh. If we come up with some way to support this and still have a reasonable range of frequencies which can be played, then we will do it. Which Macintosh systems support internal speaker stereo mixingDate Written: 1/2/91 Last reviewed: 3/18/92 Why do I get only the left channel of a stereo sound out of my Macintosh IIcx? The only Macintosh models that combine the two stereo channels into one for playback out of the internal speaker are the Macintosh SE/30 and the IIsi. All others use just the left channel. If you would like to check for the machine's ability to do mixing, you can use Gestalt. This is documented in Inside Macintosh Volume VI, page 22-70. Bit 1 of the Gestalt selector for sound will tell you whether the machine has stereo mixing on the internal speaker. Macintosh code and instructions for generating dial tonesDate Written: 1/17/91 Last reviewed: 3/18/92 My program lets a user dial the phone if a modem is connected to the user's Macintosh. How can I add the option of dialing without using the modem, just like HyperCard does? Is generating dial tones a standard function of the Sound Manager?
So, ya wanna do dial tones just like HyperCard? Well, that's not so hard (as
long as you are patient enough to read through all the Sound Manager documents
and beat your head against the wall for half an hour, like I did). The
technique is simple: lift the
Start by using ResEdit to copy How to use the dial procedure:
To call the dial procedure simply pass it a string and it will do the rest. All
digits A thru D, # and * play the proper tone for the touch tone key; any other
characters generate a 1/2 second delay. Each tone is sounded for about 1/4
second. The interface to it is simply: And now for the fabulous source code:
Macintosh sndRecord filter proc structureDate Written: 8/30/91 Last reviewed: 3/18/92
What is the structure of a filter proc for
The filter procs used by SndPlayDoubleBuffer doesn't work on Macintosh Plus or ClassicDate Written: 8/30/91 Last reviewed: 3/18/92
The call
You can fake your own double-buffering routine, replacing
Alternatively, you can use the SndDoImmediate versus SndDoCommandsDate Written: 9/16/91 Last reviewed: 3/18/92 We want to allow the user to change the sound volume while a lengthy (many seconds or minutes) sound is playing.
If the sound that is playing belongs to your application, then you should be
doing a SndStartFilePlay 20,000-byte minimum buffer sizeDate Written: 10/8/91 Last reviewed: 3/18/92
What's the minimum buffer size for
Currently Playing 16-bit sound data from a Macintosh diskDate Written: 10/22/91 Last reviewed: 3/18/92
What's the preferred method for playing sound from disk: with a doubleback
routine and
The Sound Manager is not designed at this time to handle 16-bit sound data. You
will need to convert the 16-bit data before giving it to the Sound Manager. The
best method for playing from disk will be to make a doubleback routine and use
SndStartFilePlay: no NIL sound channel for asynchronous playsDate Written: 12/19/91 Last reviewed: 3/18/92
What's wrong here?
You need to pass Where to get Macintosh sound compression specsDate Written: 2/28/92 Last reviewed: 2/28/92 Where can I get technical specifications for Macintosh 4:1 sound compression? The 4:1 and 8:1 sound compression techniques are part of Farallon's software, not part of Apple's system software. You must contact Farallon for technical specifications. You can contact Farallon at:
Farallon The 3:1 and 6:1 sound compression techniques are Apple's. Technical specification for both are in the MACE Specifications, available through APDA (part number M0241LL/A). You can contact APDA at:
APDA AppleLink: APDA Playing a sound from a Macintosh interruptDate Written: 4/7/92 Last reviewed: 4/7/92 I queue a deferred task (which is already loaded and locked--the VBL doesn't move memory) to play a sound when my vertical retrace task checks for a particular condition and this condition is met. The VBL is installed at INIT time, the deferred task is preloaded, and the sound is preloaded and locked. This works fine once the system has completed its startup, but if the VBL detects the condition before startup has completed, such as at INIT time, the Macintosh will freeze. Does the Deferred Task Manager need to be initialized somehow? Is there any Deferred Task Manager documentation besides what's in Inside Macintosh Volume V? There's no additional information available on the Deferred Task Manager. Inside Macintosh Volume V covers it completely (however briefly). The Deferred Task Manager does very little; it's designed primarily to allow your interrupt routine to have interrupts re-enabled before processing information. Why is this important? Well, system services like AppleTalk require that interrupts not be disabled for much more than 1/1000th of a second usually. This means if you are doing something large during your interrupt routine (when all interrupts may be turned off), you could delay the AppleTalk interrupt so long that data gets lost. The Deferred Task Manager simply allows you to schedule a routine to get run at interrupt time, but while interrupts are enabled. This deferred task has to abide by two fundamental rules: (1) it must be interruptable--that is, you should not have to do anything such as timing-critical hardware access that can get screwed up with interrupts on, and (2) it must adhere to all the same tool/OS rules that an interrupt routine must follow. This means you cannot call any routine that may move memory; if you do, you can damage the current heap zone. If you image the flow of control for an interrupt/deferred task it looks something like this:
There's no way to start the Deferred Task Manager; it's always running. The Sound Manager also is always running. The reason why this is particularly bad at init time for you is that when making the mistake of allocating memory at interrupt time, you can get away with it safely if the heap you're using (system heap) is not the application's current heap zone. At init time, the system heap is the current heap zone for the most part until an app gets launched. At init time your chances of harming the system by moving memory at interrupt time increases dramatically.
Inside Macintosh Volume VI documents both Your best bet if you want a sound to play from an interrupt is to use the Notification Manager (Chapter 24 of Inside Macintosh Volume VI) The Notification Manager is primarily designed so background applications and interrupt tasks (like VBLs) can get the user's attention with a flashing icon, sound, dialog or any combination of the above. And you can simply pass it any sound handle you might want to use. The Notification Manager will simply delay your sound request until the system can play it back and not hurt anything. Correct value of Macintosh initNoInterpDate Written: 5/28/91 Last reviewed: 3/18/92 Is there an error in Inside Macintosh Volume VI where it claims that both initNoInterp and initChan0 have the same value of $0004? You're right, they're the same. According to the guy who is doing time attempting to straighten out the Sound Manager, "initChan0 is ONLY used by the waveTableSynth, initNoInterp is ONLY used by the sampledSynth." I'm always grateful for meaningful constant names, aren't you?! Determining Macintosh Sound Manager versionDate Written: 8/30/91 Last reviewed: 3/18/92
The call Using the Sound Manager to produce desired frequenciesDate Written: 3/16/92 Last reviewed: 3/18/92 To generate arbitrary frequencies using sampled sounds, start with the original sample rate and know what frequency was sampled. For example, to play a pitch of 440 Hz sampled at 11 kHz as a 460 Hz pitch, use the ratio of 460/440 as a fixed point number and multiply this ratio by the original sample rate of 11 kHz. Put this product into the sound header's sample rate and use it with a bufferCmd to play your sound back at 460 Hz. Consider overflows in your equations. Fixed point numbers have an upper range of 65K, otherwise they become negative numbers. Therefore, some sample rates and pitches cannot be created. You will not be able to take a 22 kHz sampled sound and play it back three octaves higher. You could use the Standard Apple Numeric Environment (SANE) to calculate the number with more precision, but would need to be careful with overflow. Also, you cannot use SANE at interrupt level. Inside Macintosh Volume VI, which documents the Sound Manager, defines supported frequency values as 0-127. Arbitrary frequencies are not supported. The freqCmd is exactly the same as the freqDurationCmd but does not have an associated duration. The Sound Manager has no way of determining the original frequency of the sound. A baseNote of 56 may be a pitch of 440 Hz, but if the original pitch wasn't in equal temperament (a pitch represented by notes of a piano) it's impossible to represent this in the Sound Header. Additionally, to support other frequencies a new sound command is needed. The freqCmd is documented as having its high byte used for amplitude, leaving three bytes to represent a frequency, but it should be a Fixed type number. This need was not realized, though, until after the MPW interface was frozen and an agreement had been made with developers not to change the API. The Sound Header was changed when the original Macintosh Audio Compression and Expansion (MACE) package was released. This was done in 1989. The MPW Sound interfaces have been incorrect since then. The former field "baseNote" which was a word (with the high byte always being ignored) is now two fields. This change causes no problems for existing applications, but applications being compiled against the System 7 interfaces may need to be changed. How can I play more than one Macintosh sample at a time?Date Written: 5/3/89 Last reviewed: 3/18/92 How can I play more than one Macintosh sample at a time?
Unfortunately, the Sound Manager prior to System 6.0.7 can play only one sample
at a time. A basic limitation of the Sound Manager was that it only allows a
single channel open with the sampled sound Why Macintosh system crashes when StartSound is launched twiceDate Written: 5/3/89 Last reviewed: 3/18/92
My Macintosh application calls
A bug in the
Note that the Sound Driver is no longer supported. You should be using the
Sound Manager to play sounds, and not the older driver calls such as
X-Ref: Macintosh Technical Note "How to Produce Continuous Sound without Clicking" Changing the pitch of a sample in Macintosh Sound ManagerDate Written: 5/3/89 Last reviewed: 3/18/92 How do I specify different pitches for the sampled sound synthesizer of the Macintosh Sound Manager?
You should be using the X-Ref: Macintosh Technical Note "How to Produce Continuous Sound without Clicking" Specifying different frequencies for the Macintosh Note SynthDate Written: 45/3/89 Last reviewed: 3/18/92 How do I specify different frequencies for the Macintosh Note Synth?
The Note Synth sample code on page 484 of Inside Macintosh Volume V is
incorrect. You should follow the
X-Ref: Macintosh Technical Note "How to Produce Continuous Sound without Clicking" How to minimize clicking sound when using Mac Sound ManagerDate Written: 5/3/89 Last reviewed: 3/18/92 When I use the Sound Manager with MultiFinder, I hear clicks before and after my sound plays. How can I stop the clicks? The clicking is a hardware problem. The speaker clicks whenever the sound is turned on or off. There's nothing you can do about this. The Macintosh Tech Note "How To Produce Continuous Sound Without Clicking" explains a technique that minimizes the clicking.
Because the sound hardware can't be shared among processes, if your program is
using the Sound Driver and another process attempts to use the Sound Manager,
it's likely to crash the Mac. This includes
In systems without an Apple Sound Chip (the Macintosh Plus and SE), the Sound
Manager will either skip or repeat bytes, based on the sample and playback
rates. If you use a buffer size that is a multiple of 370 bytes and the
X-Ref: Macintosh Technical Note "How to Produce Continuous Sound without Clicking" Macintosh Sound Manager changes in System 6.0.4Date Written: 5/14/90 Last reviewed: 3/18/92 What changes have been made to the Macintosh Sound Manager? System 6.0.3 Sound Manager changes: none System 6.0.4 Sound Manager changes:
cmd = param1 = snd handle state bits, result of param2 = handle to
This happens when you supply a sound channel to
The SetupAIFFHeader bugDate Written: 4/1/92 Last reviewed: 5/21/92
I may have found a bug in the
You are absolutely correct. The Sound Manager routine How to get MACE algorithmsDate Written: 11/9/90 Last reviewed: 3/18/92
What are the Macintosh Audio Compression & Expansion (MACE) algorithms that
will allow me to translate the compressed digitized audio from my device into
compressed The MACE algorithms are proprietary, but they are licensable. Contact Apple's Software Licensing department for more information. You can reach them at (408) 996-1010 or at AppleLink SW.LICENSE. Macintosh System 6.0.5/MACE problem fixed for 6.0.7Date Written: 2/8/91 Last reviewed: 3/18/92 After playing a MACE-compressed sound several times under System 6.0.5, my Macintosh SE eventually hangs. The same code works fine under System 6.0.4 and System 6.0.7. Do you have any clues as to what is causing this? MACE was shipped originally as a strange hack to System 6.0.4. It was not revised for System 6.0.5 and as a result, it has never worked under 6.0.5. In System 6.0.7, MACE became part of the Sound Manager, so it should work fine on all systems from 6.0.7 on. Unfortunately, it is not going to ever work under 6.0.5. MACE-compressed sound -201 errorDate Written: 12/20/91 Last reviewed: 3/18/92 We get a -201 (not enough sound hardware available) when we try to get our backlit Macintosh Portable (not PowerBook) to play MACE-compressed sounds. What are we doing wrong?
You're probably either (1) incorrectly opening the sound channel or (2) trying
to open too many sound channels or (3) being honest and using the
The MPW C sound.h header file fixDate Written: 11/21/89 Last reviewed: 12/17/90 I'm having trouble compiling & linking with the sound routines and MPW C 2.0.2. The "sound.h" header file shipped with MPW C 2.0.2 was incorrect. The correct header file is available on AppleLink in the Developer Services Bulletin Board, and is also shipped with MPW 3.0. Downloadables
|
|