简体   繁体   English

Unity3D:如何使用设备麦克风作为输入移动对象?

[英]Unity3D: How to move object using device microphone as input?

I'm trying to create a game that responds to certain voice pitch via device microphone. 我正在尝试通过设备麦克风创建一个响应某些语音音调的游戏。 But unity does not support something like this. 但团结并不支持这样的事情。 However, they can record your voice using device microphone . 但是,他们可以使用设备麦克风录制您的声音。

var aud = GetComponent.<AudioSource>();
aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100);

is it possible to use aud.pitch as input to move a rigidbody without it recording but just getting the input realtime, say 是不是可以使用aud.pitch作为输入来移动一个没有它的刚体,但只是让输入实时,比方说

ball.velocity.y = jumpHeight * aud.pitch; // move up

I believe that pitch is just a default value that you can modify to alter an audio source. 我相信音调只是一个默认值,你可以修改它来改变音频源。 I doubt it actually detects a pitch value every frame a sound is played. 我怀疑它实际上是在每一帧播放声音时检测到音高值。 You can however use .NET libraries such as Vocalyz 但是,您可以使用诸如Vocalyz之类的 .NET库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM