Kejiro 01 - Reaktion

作者: zitaoye | 来源:发表于2020-12-14 18:31 被阅读0次

https://github.com/keijiro/Reaktion
参考
https://zhuanlan.zhihu.com/p/40768210
参考教程
Reaktion Introductory Tutorial

声控动画套件Reaktion
音频信号的节拍检测——像图片里看到的一样,程序可以检测到外部声音的信号(麦克风输入),然后生成相应的动画响应,达到声音可视化的效果。

按照上方的教程
在驱动目标物上添加Reaktor,Constant Motion Gear,以及Constant Motion就够;
创建一个AudioManager,挂载Audio Injector以及Generic Audio Input;

经过测试可以用比较简单的方式获取来自Injector发出,并且Reaktor接受的声音:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Reaktion;

public class ColorGear : MonoBehaviour
{
    public ReaktorLink reaktor;
    SpriteRenderer spr;
    public Modifier color = Modifier.Linear(0, 1);
    
    void Awake()
    {
        spr = GetComponent<SpriteRenderer>();
        reaktor.Initialize(this);
    }

    // Update is called once per frame
    void Update()
    {
        if (color.enabled)
            spr.color = new Color(color.Evaluate(reaktor.Output), color.Evaluate(reaktor.Output), color.Evaluate(reaktor.Output));
    }
}

有一个先前的官方文档,但似乎已经很久没有更新了https://github.com/keijiro/Reaktion/tree/documentation

Unity Shader大神冯乐乐似乎有过一个博文提到了这个项目:【Unity3D】 Unity Chan项目分享

想要让Reaktion工作就需要有三个关键部分,音频注入器Injector、音频核心处理器Reaktor以及接收信号的装置Gear,Injector把音频信号传递给某个Reaktor,然后场景里所有的Gear会监听某个Reaktor的输出,它们之间的链接都是通过GenericLink类实现的。也就是我们需要两个links,一个link(InjectorLink类型)负责让每个Reaktor找到一个Injector,一个link(ReaktorLink类型)负责让每个Gear找到一个Reaktor。它们都有四种链接模式(在GenericLink.cs中被定义):Not Bound,即不绑定输入;Auto Bind,找到离该物体最近的那个输入器(先在自身身上找,不然再找父亲,不然再找儿子,不然再找全场景);Bind By Reference则可以让我们直接拖一个输入的引用;Bind By Name则会在场景里找名字为该字符串的特定输入。


在考虑可以做出一些打击的简单游戏。
不过这个插件的主要用途应该还是为了解决声音的接受以及对象视觉表现的连接

相关文章

网友评论

    本文标题:Kejiro 01 - Reaktion

    本文链接:https://www.haomeiwen.com/subject/irbvgktx.html