Nintendo GameCube Microphone

From gc-linux

Jump to: navigation, search
The Nintendo GameCube Microphone (DOL-022).

The Nintendo GameCube Microphone (DOL-022) is a rather exotic accessory for the Nintendo GameCube. It can be used as a microphone in games like Mario Party 6, Mario Party 7, Karaoke Revolution Party and Odama.

Contrary to what one might think, the microphone connects to a memory card slot instead of a controller port. The reason for this design decission is probably that Nintendo wanted to keep the possibility of creating games enabled for four controllers and a microphone.

The microphone has a colored button that can be pushed to activate the microphone on some games.

No microphones were harmed/disassembled during the writing of this article.


Contents

Interfacing with the Microphone

As previously commented, the microphone connects to a memcard slot. That means that it is indeed an EXI device sitting in EXI channel 0 for Slot A or EXI channel 1 for Slot B.


EXI ID

The microphone answers to an "exi_get_id()" request with 0x0a000000.

select exi channel {0,1}, device 0, frequency 4
write 0x0000 (2 bytes)
read exi id (4 bytes)
deselect exi channel {0,1}


Commands

The microphone at least seems to support the following commands.

Command 0x40 (Get Status)

The command 0x40 retrieves the status of the microphone.

select exi channel {0,1}, device 0, frequency 4
write 0x40 (1 byte)
read status (2 bytes)
deselect exi channel {0,1}

These are the bit definitions for the 2 byte status word (bit 0 is lsb):

bit(s) description
15 e 1:mic sampling, 0:mic not sampling
14-13 p period length 00:32, 01:64, 10:128
12-11 r sample rate 00:11025, 01:22050, 10:44100
10 unknown // related to 0x00, 0x0f values
9  ? 1:overflow
8 b 1:button pressed
7-4 unknown // related to events?
3-0 unknown

Command 0x80 X Y (Control)

The command 0x80 X Y can be used to control how the microphone operates, for example, by defining the period size and/or sample rate, or by enabling it.

The bit definitions for the 2 bytes X Y are the same as for the status bytes of command 0x40. Note that some of the bits are read-only and can't be set or cleared using command 0x80.

select exi channel {0,1}, device 0, frequency 4
write 0x80 X Y (3 bytes)
deselect exi channel {0,1}

For example, to make the microphone start sampling use command 0x80 X=0x80 Y=0x00.

Command 0x20 (Read Samples)

The command 0x20 can be used to retrieve a number of samples from the microphone given the currently enabled period size (refer to the status word from command 0x40).

select exi channel {0,1}, device 0, frequency 4
write 0x20 (1 byte)
read data (n bytes)
deselect exi channel {0,1}

The data read are PCM samples in signed 16-bit format.

On Linux, you can play a raw dump of samples from the microphone with the following command for 11025Hz:

$ play -c 1 -f s -r 11025 -s w -t raw dump_of_samples.bin

Command 0xff

This is probably not a command, but anyway... The command 0xff seems to be used to get in sync with the microphone or to wake it up.

Normally, it is issued before any other command, or to recover from errors.

select exi channel {0,1}, device 0, frequency 4
write 0xff (1 byte)
deselect exi channel {0,1}


Operation

Init

  • Make sure that the reported EXI ID is 0x0a000000.
  • Then, issue command 0xff.

Configure sample rate

  • Read status word using command 0x40.
  • Set sample rate into bits 12-11 of status word (see r in status word bit definitions).
  • Issue command 0x80 passing the resulting status word.

Configure period size (in bytes)

  • Read status word using command 0x40.
  • Set period size into bits 14-13 of status word (see p in status word bit definitions).
  • Issue command 0x80 passing the resulting status word.

Enable sampling

  • Read status word using command 0x40.
  • Set bit 15 of status word.
  • Issue command 0x80 passing the resulting status word.

Read samples

After enabling sampling, the microphone will issue EXI interrupts when period-bytes of samples are available for retrieval. The currently enabled period size n can be determined from the status word.

wait for EXI int on exi channel {0,1}
ack EXI int

select exi channel {0,1}, device 0, frequency 4
write 0x40 (1 byte)
read 2 bytes (status)
deselect exi channel {0,1}

if bit15 of status word is set
 select exi channel {0,1}, device 0, frequency 4
 write 0x20 (1 byte)
 read n bytes (n/2 16-bit signed samples)
 deselect exi channel {0,1}

Check button

  • Read status word using command 0x40.
  • Check if bit8 is 1
Personal tools