SGI Audio Tools: Difference between revisions

m
Starting to make slow progress through implementing an instrument bank.
m (Danielface moved page Libultra/sgi-audio-tools to SGI Audio Tools: The name was bad!)
m (Starting to make slow progress through implementing an instrument bank.)
Line 23:
 
The n64decomp project has decompiled <code>tabledesign</code> and <code>adpcm</code> [https://github.com/n64decomp/sdk-tools here]. It's possible to build those two particular programs yourself and run them in the environment of your choice, which might make your life a little easier!
 
A good warm-up for this article might be to compile and run the <code>nu3</code> NuSystem sample, as it's more or less a "hello world" that plays the sort of audio files we're looking to generate. Keep note of the Makefile including the audio library and the spec file adding the <code>sbk</code>, <code>ctl</code>, and <code>tbl</code> files to the ROM. If you're able to compile/run <code>nu3</code>, even in an emulator, you'll be in a good place to test/debug/iterate an issues that pop up in your program.
 
== Authoring a Song with the SGI Audio Tools ==
Line 40 ⟶ 42:
<br ><code>midicomp some_midi_converted.mid some_midi_compressed.cmf</code>
 
You'll now have various `<code>cmf`</code> files for each of your songs.
 
==== Compiling Your MIDI File(s) ====
Line 56 ⟶ 58:
[http://sox.sourceforge.net SoX] bills itself as ''the Swiss Army knife of sound processing programs''. Its uses include (but aren't limited to) converting audio between formats, providing effects, and even recording. Given that SoX is an open-source tool, it's well worth including into any game developer's setup.
 
The <code>tabledesign</code> and <code>vadpcm_enc</code> tools require audio samples to be in AIFF or AIFC. If the samples you're using are in a different format, such as WAV, you can use SoX to batch-convert your samples. It's also a good idea to resample each effect to the same sample rate, such as 32000Hz. If you're generating your instrument bank file via a script, you can assumehardcode the sample rate inwhich yourwill codelet toyou savespend less time coding/debugging.
 
If we want to convert an arbitrary WAV file to AIFF with a sample rate of 32000 and in mono we can enter:
Line 71 ⟶ 73:
<br /><code>tabledesign song_sample.aiff > song_sample.table</code>
 
It's worth noting that by default <code>tabledesign</code> will print to <code>STDOUT</code>. The <code>></code> operator for writing to a file should work both on Mac/Linux/BSD/etc.Unix-like and Windows here.
 
==== Compressing each sample ====
Once we've created aour code book(s), we'll want to convert our AIFF samples to Nintendo's compressed AIFC formats. To do that, we'll be using <code>vadpcm_enc</code>.
 
On each of your samples, run the following:
Line 81 ⟶ 83:
The following <code>.aifc</code> file(s) will be compiled in to make a sound bank.
 
=== Authoring the Instrument Bank File ===
==== Before we Begin ====
This is likely the most tricky and confusing parts of the SGI Audio Tools, so be sure to take a break if you're finding yourself frustrated. Take comfort in that what you're feeling is pretty normal, and that others have been in the same spot.
 
Section 18.1.12 of the ''Nintendo 64 Programming Manual'' is a pretty comfortable overview of what each section of an instrument bank file does. It's not "correct" in certain areas though, and copy/pasting the shown examples won't always work with <code>ic</code>. A particular example is that the manual says to reference each instrument in your bank section with <code>program</code> when in fact you'll need to use <code>instrument</code> instead.
 
If you're looking for a reference of a working instrument bank, it's best to check the example banks at <code>ultra/usr/src/pr/assets/banks/</code> included with the SDK. They'll run through <code>ic</code> fine and help clarify things for you.
 
==== The Instrument Bank File ====
 
==== Compiling the Instrument Bank ====
 
 
=== CreatingFinishing the Instrument Bankup ===
Once we've completed the steps above, we should now have the following:
* A <code>sbk</code> that consists of our converted/compressed MIDI sequences
* <code>ctl</code> and <code>tbl</code> files for our samples
 
We'll be including the above files into our ROM's spec file, then requesting the audio library to load and play them.
 
== Playing a song with NuSystem ==
84

edits