Open main menu

WiiBrew β

Asndlib

Template:Infobox homebrewapp

Sndlib is a sound library for the wii. It includes a software mixer capable of playing up to 16 voices at once, and one of the voices may be generated from a MOD file (using MODplay) or an OGG file (using libtremor). It also includes a "musical note" feature for dynamic song generation and some example applications that combine the various features.

Contents

Release Announcement

Translated from the [Release Announcement]

"As promised, I already have the Wii sound library and just one day before my birthday, so we could say I'm the gift XD

Features:

  • Works with 32000Hz and 48000Hz due to hardware
  • Handles 16 voices (configurable, though given the state of the mixing software, better be careful)
  • Implementation of voices in Mono or Stereo, 8 or 16 bits (signed), with independent volume adjustment for each channel
  • Pitch control (frequency) for voices from 1Hz to 144000Hz
  • Ability to add a playback delay to create reverb or echo effects, or chaining.
  • Dynamic pitch and volume adjustment (for special effects)
  • Three operation modes: simple, continuous double buffer, and musical notes
  • Various control functions, potential for callbacks, timers, etc.
  • Added support for MODs, OGG (with libtremor) and a library for song creation (see song_lib.h)

Simple mode

Run a voice program only once, allows you to adjust the format, frequency, delay, and volume of each channel. Ideal for sound effects.

Continuous double buffer mode

Schedule a voice similarly to simple mode, but add a callback function to be invoked when the voice can add new samples, using a special function.

Ideal for music players (eg Modplay, which I have already adapted to work with this, or libtremor to play Ogg).

Musical note mode

Uses a special function that allows you to specify a sample to be played in a loop, and then used by another function that lets you adjust the frequency, delay, attack, support, drop, and volume of the note.

Ideal for small musical performances, improvised music, etc.

song_lib relies on these functions for the execution of voices.

Examples

  • The first example runs a MOD in the background using voice 0 and mixes it with some sound effects played on the other voices.
  • The second example runs an OGG in the background using voice 0 and mixes it with some sound effects played on the other voices. If you include a file named "sample.ogg" in the root directory, it will alternate playing it and the original file.

Free mode: (Wiimote): Use A and B for mixing sound effect voices. Use - and + to change the playback speed for Ogg / Mod, and use 1 and 2 to activate the different background tracks. On the DPad, press Left / Right to move forward or backward within the Ogg (only works for the Ogg example).

Press Home or RESET to exit the application.

Indeed, the example also shows 900 rotating cubes in the background along with 900 sections of "land" and lighting composed of three "Spot" light sources to show that Rocky can still handle it! XD

Note: There shouldn't be any problem with porting these libraries to the GameCube: you'd only have to change the Makefiles to work for the GC, although snd.c (the core) is compiled for both versions. This can also be used on the PC, using the SDL port of Tremor, song_lib, and snd.c/snd.h.

Installation

Read the readme.txt for more info, but basically, if you have the CVS libraries just copy the contents of "libogc" to the devkitPro directory of the same name and compile. Or if you don't have the source, copy the contents of "libogc_patch" to the directory "libogc" and compile and patch libogc.a.

Finally, copy the examples, tremor, and song_lib to where you're compiling things."