Tutorial
This section explains tools and microcode, and the way to play audio with NuSystem.
Two types of sound tools have been released for N64 at this time. One group includes ic, sbc, midicomp and other SGI tools. The other is N64 Sound Tools for the PC. The output data from these different tools is not compatible, and the libraries they use are also different.
There are also two types of new and old audio microcode (aspMain.o and n_aspMain.o), and there is a separate underlying library for each.
In NuSystem, these tools and microcode can be combined in four ways.
Depending on the combination, the following libraries and headers are needed.
SGItool/aspMain.o | nualsgi.h | libnualsgi.a | ||
SGItool/n_aspMain.o | nualsgi_n.h | libnualsgi_n.a | libn_audio.a | |
SoundTools/aspMain.o | nualstl.h | libnualstl.a | libmus.a | |
SoundTools/n_aspMain.o | nualstl_n.h | libnualstl_n.a | libn_audio_sc.a | libn_mus.a |
The original mus library is necessary for use with N64 Sound Tools.
The SGI version is compatible only with compact MIDI.
For information on the use of each tool, please refer to their separate manuals (N64 Audio Development Guide (SGI) or N64 Sound Tools User's Guide).
Samples that use the SGI tools and the N64SoundTools can be found in the nu3 and nu4 directories below the sample directory. (The nu1 sample is based on both.)
Processing either with "make" compiles them so they can use N_AUDIO(n_aspMain.o).
Below is the main routine of the nu3 sample with sound functions added.
void mainproc(void) { /* initialize graphic */ nuGfxInit(); /* initialize controller manager */ contPattern = nuContInit(); /* initialize audio */ nuAuInit(); /* register ROM audio data */ setAudioData(); : } /* set audio data */ void setAudioData(void) { /* register bank in sequence player */ nuAuSeqPlayerBankSet(_midibankSegmentRomStart, _midibankSegmentRomEnd - _midibankSegmentRomStart, _miditableSegmentRomStart); /* register MIDI sequence data in the sequence player */ nuAuSeqPlayerSeqSet(_seqSegmentRomStart); /* register bank in sound player */ nuAuSndPlayerBankSet(_sfxbankSegmentRomStart, _sfxbankSegmentRomEnd - _sfxbankSegmentRomStart, _sfxtableSegmentRomStart); }
Audio is initialized with a call to nuAuInit().
The NuSystem audio data set functions are called with setAudioData(). The arguments of these functions correspond to the contents of spec, so they can be defined as external references with segment.h.
Once the audio settings have been made, you can play back simply by setting the sequence number.
nuAuSeqPlayerSetNo(0,seq_no); nuAuSeqPlayerPlay(0);
To play back a sound effect, simply specify the number.
The default playback frequency is 32KHz, so when sampling data that has a 44KHz cycle, you need to quickly lower the pitch as shown below. (This is not normally done).
nuAuSndPlayerPlay(snd_no); nuAuSndPlayerSetPitch(44100.0/32000);
We will not give any special explanation of sample nu4. The host machine is installed in an environment that enables use of the data in the latest version of N64 Sound Tools (Version 3.x).
For more detailed information, please refer to the Nintendo 64 Sound Tools User's Guide (provided with N64 Sound Tools software) and the NuSystem functions manual.