Famicom microphone question

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
SusiKette
Posts: 110
Joined: Fri Mar 16, 2018 1:52 pm
Location: Finland

Famicom microphone question

Post by SusiKette » Sat Apr 18, 2020 2:03 pm

The wiki states that "This hard-wired second controller also contains a microphone, which gives an immediate 1-bit report at $4016 D2 whenever it is read.", but what does this status bit actually represent? Can the $4016 register be read literally any time or does it have to be strobed to update the status bit like normal buttons?

Also, what emulators support a proper microphone input? FCEUX seems to have a check box that enables the microphone, but doesn't have other settings, like selecting input device or it's volume, like most programs that utilize the microphone.

lidnariq
Posts: 9508
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom microphone question

Post by lidnariq » Sat Apr 18, 2020 2:28 pm

SusiKette wrote:
Sat Apr 18, 2020 2:03 pm
The wiki states that "This hard-wired second controller also contains a microphone, which gives an immediate 1-bit report at $4016 D2 whenever it is read.", but what does this status bit actually represent?
Whether the instant readout from the microphone is above or below some threshold.
Can the $4016 register be read literally any time or does it have to be strobed to update the status bit like normal buttons?
Yes, it can literally be read at any time, there is no strobe.

Ccovell wrote a minimal "oscilloscope" program, and rainwarrior wrote a minimal "logging" view: viewtopic.php?t=18314
Also, what emulators support a proper microphone input? FCEUX seems to have a check box that enables the microphone, but doesn't have other settings, like selecting input device or it's volume, like most programs that utilize the microphone.
Almost no games actually use the microphone for audio input, but instead treat it as a boolean "yes, noise; or no, too quiet" kind of thing - a button is often mapped to the input instead. With only one bit of ADC it's difficult to do much more.

User avatar
rainwarrior
Posts: 7824
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famicom microphone question

Post by rainwarrior » Sat Apr 18, 2020 4:27 pm

When noise is being made it flips erratically between 1 and 0. When no noise is being made, it's a steady 0.

Polling it once per frame is generally what games do with it. Like lidnariq said, most emulators just treat it as an on/off button rather than try to use an actual hardware microphone interface, which is sufficient for the relevant games, so far as I know.

I suppose you could record some sort of 1 bit waveform if you polled it constantly, but I dunno if anyone would want to. I would imagine that the signal is basically half-wave rectified, with the negative half clamping to 0. It'd probably still be recognizable as its source if you played it back to the user?

calima
Posts: 1159
Joined: Tue Oct 06, 2015 10:16 am

Re: Famicom microphone question

Post by calima » Sun Apr 19, 2020 12:51 am

So that's a no to the "can I talk online with my buddies on a Famicom mic" question in the NES online cart thread :P

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom microphone question

Post by Pokun » Sun Apr 19, 2020 3:50 am

$4016 D2 can only register microphone activity as an 1-bit report, but the sound from the microphone is also mixed with the APU output audio so that the sound comes out of the TV speaker. You could have hardware in the cartridge that processes the audio via the audio pin, and this way you could do stuff with the mic input audio (no game does this as Rainwarrior said). The APU can not play at the same time or this sound will also be processed though. If you want sound from the game, you would need an audio chip in the cartridge as well, that makes audio separately.

SusiKette wrote:
Sat Apr 18, 2020 2:03 pm
Also, what emulators support a proper microphone input? FCEUX seems to have a check box that enables the microphone, but doesn't have other settings, like selecting input device or it's volume, like most programs that utilize the microphone.
Nestopia maps $4016 D2 to "M" on the host keyboard by default. Strangely the emulator has a "Mic" input for each of its 4 controllers, but a real Famicom only has one microphone ($4016 D2), which is technically a separate input device from the controllers, so I've no idea what the other "Mic" inputs do.

FCEUX supports it with a checkbox that replaces controller II START with the $4016 D2 input (and also disables controller II SELECT). So you can't use START and SELECT on controller II and a microphone at the same time in FCEUX (similar to a real Famicom).

Mesen allows you to assign the $4016 D2 input to any host input you want like Nestopia. Unlike the other emulators, it sorts of vibrates the input pattern to simulate how blowing/shouting into the microphone on a real Famicom works, like how Rainwarrior explained. Other emulators just do "1111111..." when pressing the mic button and "0000000..." when not, while Mesen does like "01010101010101..." when pressing and "0000000..." when not pressing.

I'm not sure if Nintendulator supports the microphone, doesn't look like it.


I remember Bokosuka Wars has a cheat with a very strict microphone reading routine that makes it very hard or maybe impossible to do on a real Famicom. I imagine Mesen would have trouble with this title as well.

Fiskbit
Posts: 125
Joined: Sat Nov 18, 2017 9:15 pm

Re: Famicom microphone question

Post by Fiskbit » Sun Apr 19, 2020 6:40 am

This thread prompted me to put together a simple microphone test. This test records about 1.5 seconds of audio from the microphone to PRG-RAM and can then play it back. The audio is 1-bit and 43,653 Hz, which is as close as you can get to 44.1 kHz with constant cycles (41) per bit. It...sort of works, but I find that it's extremely hard to understand the recording.
Attachments
famicom_microphone_test.zip
(7.36 KiB) Downloaded 38 times

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom microphone question

Post by Pokun » Tue Apr 21, 2020 10:56 am

The Famicom finally got a real mic app!
I tried it, and it works as expected. Now if just emulators would start supporting the microphone fully, like Nintendo DS emulators do.

Fiskbit
Posts: 125
Joined: Sat Nov 18, 2017 9:15 pm

Re: Famicom microphone question

Post by Fiskbit » Tue Apr 21, 2020 11:09 am

I also posted a version with battery support here. There's a sample recording included. If you manage to get better quality out of this thing than I did, please do post a sav file.

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom microphone question

Post by Pokun » Fri Apr 24, 2020 2:00 am

Yes that's the version I tested on my Everdrive. I couldn't get better quality than you though. My sample has "holes" in it which I think is the aged microphone's fault. I've bought a new microphone, so I'm going to try and replace it sometime when I find time and energy. This will be a good app to test it with.

User avatar
rainwarrior
Posts: 7824
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famicom microphone question

Post by rainwarrior » Fri Apr 24, 2020 10:49 am

Pokun wrote:
Fri Apr 24, 2020 2:00 am
My sample has "holes" in it which I think is the aged microphone's fault.
Strong low frequency components might easily push it out of usable range for a short burst, especially breathing directly into the mic. I don't think age is really going to be the issue, so much as the construction of this particular microphone and especially it's maximally limited 1-bit range.

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom microphone question

Post by Pokun » Fri Apr 24, 2020 1:19 pm

Hmm so what could be the problem then? Why does it work so poorly in games?

User avatar
rainwarrior
Posts: 7824
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famicom microphone question

Post by rainwarrior » Fri Apr 24, 2020 5:50 pm

Pokun wrote:
Fri Apr 24, 2020 1:19 pm
Hmm so what could be the problem then? Why does it work so poorly in games?
It's such a crummy interface it should barely work at the best of times, IMO. It's kinda bizarre that it happened at all. Very unsurprising that it was dropped for the NES.

lidnariq
Posts: 9508
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Famicom microphone question

Post by lidnariq » Fri Apr 24, 2020 6:31 pm

Also, looking at enri's referse-engineered schematics, it's heavily filtered. On the player 2 controller, there's a 440 or 880 Hz highpass (2.2kΩ or 1.1kΩ - I'm not entirely clear how to model the electret itself; 0.33 µF), and in the Famicom itself there's a 160 Hz lowpass (10kΩ; 0.1µF).

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Famicom microphone question

Post by Pokun » Sat Apr 25, 2020 8:57 am

Still my microphone doesn't work with some games like Paluthena. Maybe it's just an extra tricky game to get working though.
I guess the trick in Bokosuka Wars has never worked on real hardware. It's just the developer that released the trick to gaming magazines or whatnot.

Great Hierophant
Posts: 768
Joined: Tue Nov 23, 2004 9:35 pm

Re: Famicom microphone question

Post by Great Hierophant » Sat Apr 25, 2020 10:10 am

Pokun wrote:
Sat Apr 25, 2020 8:57 am
Still my microphone doesn't work with some games like Paluthena. Maybe it's just an extra tricky game to get working though.
Are you sure you're doing it right? You must hold down the A button on controller 2 as you blow (hard) into the microphone to get the haggling to activate.

Post Reply