Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapping a button to the microphone key binding #210

Closed
twipley opened this issue Dec 2, 2016 · 18 comments
Closed

mapping a button to the microphone key binding #210

twipley opened this issue Dec 2, 2016 · 18 comments

Comments

@twipley
Copy link

twipley commented Dec 2, 2016

Hello. I have great respect for the work here, although I have found one core feature to be missing.

It is the microphone support (for Nestopia UE through Retroarch, at least).

The request is not the support for external microphone as such, but rather button mapping to a simulated microphone.

Upon tapping the button, microphone usage is mimicked and after a few presses, the sought in-game effect arrives.

(I am coming from https://libretro.com/forums/showthread.php?t=3050 Thread: [Famicom] Nestopia UE Microphone button binding).

Hoping to hear back from you,
and that our interests converge!

Sincerely yours,
twipley

@rdanbrook
Copy link
Member

Sorry for the late response. This does not seem to be currently in the core, unless you can point out the API calls... I can't seem to find them anywhere though. I'll leave this open in case I ever get the desire to implement it in the core.

@twipley
Copy link
Author

twipley commented Jan 3, 2017

thanks for the reply.

I remember that standalone Nestopia features such a microphone button.

Does this answer the question? Or, am I missing something? If it works in standalone Nestopia, does it mean it is written in the Nestopia core?

@rdanbrook
Copy link
Member

I will revisit the win32 code and see exactly what it is doing there...

@wyatt8740
Copy link
Contributor

@rdanbrook did you find anything? I'm now playing through FDS Zelda as well :|

@rdanbrook
Copy link
Member

I could never figure out how it's being done in win32, or if it even works at all.

@wyatt8740
Copy link
Contributor

It works in win32. I had to spam player 2's microphone button, but that killed off the pol's voice enemies.
Need a save file?

@rdanbrook
Copy link
Member

Actually what would be more helpful is helping me track down the piece of code that injects this into the emulator, so I know what input device is being used and how. I took a look before but could not find anything that led me to the answer.

@rzumer
Copy link

rzumer commented Sep 21, 2017

I assume you have seen this already, but in case this is what you were looking for, the input is defined in NstApiInput.hpp. In NstInpPad.cpp it is treated like another button. When polled, if the button is pressed, it is as if the microphone detects noise at the maximal intensity, and it remains at that intensity for the duration of the frame, after which it is reset to 0 if the button was released. The feature was introduced in version 1.24 according to the changelog, but the GitHub repository does not have releases tagged that far back.

@rdanbrook
Copy link
Member

@rzumer thanks for pointing that out, I did not see that previously...

I will try to add something to libretro and standalone soon.

@rdanbrook
Copy link
Member

Ok, I have figured out how it works, and replicated the behaviour in the win32 port in standalone. Currently I have hardcoded it to the spacebar, until I figure out how I want to add this binding to the config. I also need to think about the best way to add it to libretro. Ideally it would be nice to actually process input from a real microphone, but that is not something that even exists in the win32 port, and I need more microphone games to test with. Currently I have only tested with Zelda no Densetsu. Basically, you have to keep tapping the space bar quickly to kill Pols Voice. I don't particularly like this, because I'd rather just press it once, but I need to study how the game actually processes mic input to understand.

@rzumer
Copy link

rzumer commented Sep 22, 2017

From what I can tell, the standard Famicom microphone detects binary input, so a threshold could be used to binarize real microphone input without changing the existing functionality. Ideally, this threshold should be user-adjustable and/or incorporate background noise reduction.

Emulating karaoke peripherals might be interesting after this.

@rdanbrook
Copy link
Member

OK, I added it to the libretro port using the L3 button by default. That means clicking your joystick, if you have one... of course it is remappable though.

@rzumer
Copy link

rzumer commented Sep 22, 2017

Should a new issue be created for potential microphone input support?

@rdanbrook
Copy link
Member

Not at this point, because it's going to require more work and I'm about to leave my country for sabbatical, and will not be able to work on things until I'm settled down. I may do it if I get a few weeks with regular internet access and have nothing else going on.

@rzumer
Copy link

rzumer commented Sep 14, 2018

@rdanbrook Going back to this issue, are you open to creating a new one for complete microphone support now? Even if you do not have time to implement it any time soon, it will be easier for someone to come in and take a look at it if it is visible in the list of open issues.

It looks like microphone input (via a Famicom controller clone) will be implemented in Nintendo's emulator for the Switch, so perhaps it can be used as a reference.

I also tested triggering the key bound to the microphone via processed microphone input last year (see https://github.com/rzumer/mic2key), and the results from my own tests (with an adequate threshold value) were far more consistent than the direct button method.

@rdanbrook
Copy link
Member

I don't have a microphone, so I can't even begin to work on this. I am open to it, but it needs to be done without imposing more dependencies on the codebase just for one very obscure feature that works in only a few games.

@rzumer
Copy link

rzumer commented Sep 15, 2018

SDL seems to be able to process audio input. Would you prefer creating a new issue in this repository or in the libretro fork?

@rdanbrook
Copy link
Member

Ideally all issues should be in here, the main repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants