Q&A- Other Audio Questions

QA1 Delta time processing.
QA2 Default priority of voices.
QA3 RSP processing time per sound.
QA4 About alAudioFrame().
QA5 About Max Voice.
QA6 Release time priority.
QA7 Finding the number of momentarily simultaneous sounds.
QA8 The no free updates error.
QA9 About alInit.
QA10 The data alignment gets messed up when I'm using vibrato.
QA11 attackTime raises the gain from 0 to attackVolume all at once.
QA12 I can only get echo and other effects to work in mono.
QA13 Using tremolo and vibrato processing - Method 1.
QA14 Using tremolo and vibrato processing - Method 2.
QA15 Is there a way to cancel an effect?
QA16 When I set maxVVoices or maxPVoices, there are tones that won't play.
QA17 What are the contents of ".sbk" and "midicomp" and how do I create them?
QA18 Where is the viper directory?
QA19 Is monaural mode necessary?
QA20 How did you realize headphone mode?
QA21 How do you change the DSP audio effect settings?

Q1 In order to initialize a sequence by means of a program change so that a specific sample is used, do I have to embed it at the head of the file without any delta time?

A1 I don't think you have to embed it. I don't think that that kind of control is provided on the player side. Considering the real time nature of the game sounds, it is best to make the time lag as small as possible between the start of the sequence and its playback. If the smoothness of the processing time is a crucial problem, inserting a delta time would be a possibility, but initialization processing generally doesn't become a problem with the delay present in most MIDI instruments.


Q2 What is the default value when the priority of a voice hasn't been set?

A2 It is "5".

This is set by AL_DEFAULT_PRIORITY(5). See libaudio.h.


Q3 What percent of the RCP's capacity is used per each sound with the N64.

A3 I can't accurately answer this question without knowing the actual sound. However, it is possible to measure this if your company has a target sound. The processing time for an entire sound (Y) can be obtained using the following approximation formula, wherein x is the number of sounds and b is the processing time required for the effect and/or initialization.

Y = a X + b

In the above formula, a is the processing time per one sound. The percentage of the total processing time by the RCP can then be obtained by dividing this figure by the overall RCP processing time.

Now, if you want to know the specific RCP performance for various sounds using the above formula, I think it would be better to measure the time it takes to process the target sounds.

As a general scale, it is said that about 1% of RSP processing is used for one sound at a playback rate of 44.1 kHz.


Q4 Even when no sound is being produced (when neither a sequence nor a sound is being played back,) alAudioFrame() will still generate around 350~380 commands. What are these doing? Does this happen because something would happen to mess up the application if they weren't performed?

A4 I can't get a clear picture of this since I don't know what argument you are using with alAudioFrame(), but alAudioFrame() will always generate commands. These are generally essential commands.


Q5 When there is one MIDI data, and MaxVoice is set to 1, there are times when nothing will be played back. I have to set MaxVoice to 2 to get the data to be played back. Is this a bug? Is there some other way to do this?



A5 This is not a bug. A single Voice is not released until its envelope completes the release stage. The envelope enters the release stage after it receives a "note OFF" signal. If the time difference from "note OFF" to "note ON" is shorter than the length of the release stage, then a second sound will not be played.

This kind of problem can be avoided by shortening the release time in the envelope or by lengthening the time between "note OFF" and "note ON".


Q6 What is the priority of release times?

A6 The release sound has the lowest priority, i.e., priority 0 (zero).


Q7 What would be a good way to calculate the number of sounds being simultaneously played at any moment?

A7 Using the oscillator is the quickest way to find the accurate number of sounds simultaneously being played at any moment. You can check the number of active voices at each moment by increasing the count by 1 when you come to an init, and decreasing the count by 1 when you come to a stop.


Q8 When I set the tremolo or vibrato, I get the "Synthesizer:no free updates" error.

A8 This is the synthesizer driver telling you that there is not enough buffer (UpdateBuffer) available to store the parameter changes from the player generated in one round of processing.

Since the number of pitch and/or volume overwrites per frame increases when the tremolo or vibrato cycle is very fine, there won't be enough of this buffer. To avoid this error, increase the value of maxUpdates specified in the configuration of the synthesizer driver to a commensurate value (so that the error doesn't occur).

If tempo changes have no effect even if maxUpdates is increased, it is possible that processing is being dropped. Maybe your vibrato cycle is too short.


Q9 With regard to alInit how exactly do I stop RSP processing and discard task lists?

A9 There are no instructions from SGI as to stopping (inhibiting) the RSP or discarding tasks. However, I imagine that a simple method would be to create an "enable/disable audio task start-up flag" in the main program to turn the RSP ON and OFF. The timing for turning the flag ON again would change depending on whether initialization was before or after alAudioFrame.

I suggest that you check the following 3 points with respect to this matter.

  1. Can you see what kinds of changes occur on the second call-back of dmaNew processing or a global work which is being used?

  2. Is the sequencer being released before the driver is closed?

  3. Does processing proceed well even when it is set up so that the oscillator is not used at all?


Q10 The data alignment gets messed up when I'm using vibrato.

A10 This problem doesn't lie in you using vibrato, it lies with the alignment of the data structure. When the game was compiled, did yeild_data_ptr, dram_stack, output_buff, or output_buf_size get moved to an area that doesn't have 16-byte alignment? Try putting these structures back in their original segments, or try allotting them from the audio heap (alHeap).


Q11 attackTime raises the gain from 0 to attackVolume all at once

A11 It appears that the envelope becomes irregular when the tremolo is specified within a bank. Since there is no problem when the tremolo delay is a relatively large value (e.g., 100), this probably can be corrected by revising the tremolo call-back routine (update0sc in Payseq.c, etc.).


Q12 I can only get the echo and other effects to work in mono. Could it be that the PAN information is not being received?

A12 That's correct. The only thing you can do to avoid this is to create your own original sequencer driver.


Q13 How do I use tremolo and vibrato processing? Could I get some samples that use "init0sc", "update0sc", and "stop0sc"?

A13 A typical way of using this process is written in playseq.c. Since this is configured as a call-back routine, such as the waveform DMA routine from ROM, by simply registering this in the sequence player (the 3 lines from line 967 in playseq.c: seqc.xxx0sc=&xxx0sc), the player will subsequently call it.


Q14 I've read that "by simply registering this in the sequence player, the player will subsequently call it," but can this be controlled with the sequence data? How should I set

oscType, oscDepth, oscDelay

and others that are similar?

A14 These can be used according to program changes if they are set in the bank file (if vibType, vibRate, vibDepth, VebDelay are written in each Instrument). They cannot be directly controlled by the sequence. The only way to manipulate the parameters in a sequence is to access the player itself.


Q15 Is there a way to cancel an effect?

A15 Use "alCSPSetChIFXMix" to set the effect send to 0 (zero).


Q16 When I set maxVVoices or maxPVoices, there are tones that won't play.

A16 This is probably due to a long release time. The synthesizer driver will continue to hold the voice during the release time, even though the waveform is completed, for instance. In addition, the release time is constant, regardless of the volume during release. Thus, voice resources are consumed, even though you can't actually hear the release sound. Consequently, low-priority sounds will be canceled by voice-overlays.


Q17 What are the contents of ".sbk" and "midicomp", and how do I create them?

A17 ".sbk" files are collections of ".seq" files (songs) created by the sbc command.

sbc [-o output_file] seqfile0 seqfile1 seqfile2

An ".sbk" file can be created with the following command from data that have been compressed by "midicomp". See the sample (/user/src/PR/playseq/) for how to use the data.

midicomp (standard MIDI(.MID)> <output name.cmf>

See the N64 Function Reference Manual, "Tools," for details.


Q18 Where is the "viper" directory referred to in the Programming Manual?

A18 This directory is not supported by the current version.


Q19 Does N64 software require some setting in the game menu etc. to switch between stereo mode and monaural mode, like other machines do?

Do you use a library to switch modes?

A19 No, there is no special requirement. There should be no problem with just stereo mode.

However, if you pan all the way to the left or right, and are playing on a monaural TV with a stereo cable, then there will be times when you hear no sound, either to the left or to the right, depending on which pin (L or R) is plugged into the Television.

There is no mode-switching library prepared. You can handle this problem by centering the pan of both channels.


Q20 Nintendo titles have a headphone mode. How do you do that? How is listening different?

A20 Sorry, that's a trade secret.

Nintendo has a proprietary driver that makes sounds very clean-sounding with headphones.


Q21 What's the best way to change the DSP effect settings once the audio has been initialized?

Do you need to forcibly overwrite the parameters?

A21 If you're using the "standard library," if you want to change the audio effects after initialization you need to reinitialize.

If you want to change the effects without reinitializing, you'll have to modify the library.

The library source is public, so go ahead and check the contents.

The free function n_alSynFreeFX()is available for effects, but we don't plan to include that in future releases.

The latest version of N64 Sound Tools supports effect switching.