Skip to content

Instantly share code, notes, and snippets.

View neurochems's full-sized avatar

Brendan Lehman neurochems

View GitHub Profile
@neurochems
neurochems / BrainScore.cs
Last active October 13, 2022 14:40
Example EEG Activation Score for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BrainScore : MonoBehaviour
{
private BrainStats stats;
[Range(-0.05f, 0.05f)]
public float score;
@neurochems
neurochems / BrainStats.cs
Last active October 13, 2022 14:39
Example EEG Runtime Statistics for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MathNet.Numerics.Statistics;
public class BrainStats : MonoBehaviour
{
private BrainData data;
[Header("Moving Band Power Stats - 10 seconds")]
@neurochems
neurochems / EffectObject.cs
Last active October 13, 2022 14:40
Example Set Transform Value for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using UnityEngine;
[ExecuteInEditMode]
public class EffectObject : MonoBehaviour
{
private Vector3 localScale;
[Tooltip("drag in FungiScore game object")]
public FungiScore fungiScore;
@neurochems
neurochems / EffectShader.cs
Last active October 13, 2022 14:39
Example Set Shader Value for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using UnityEngine;
[ExecuteInEditMode]
public class EffectShader : MonoBehaviour
{
public Material score;
[Tooltip("drag in FungiScore game object")]
public FungiScore fungiScore;
@neurochems
neurochems / FungiScore.cs
Last active October 13, 2022 14:39
Example MIDI Activation Score for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FungiScore : MonoBehaviour
{
private MIDIStats stats;
public float scoreRaw;
public float score;
@neurochems
neurochems / MIDIStats.cs
Last active October 13, 2022 14:48
Example MIDI Runtime Statistics for Biodata + Unity Workshop, nanotopia, Oct 12 2022
using UnityEngine;
using System.Collections;
using MathNet.Numerics.Statistics;
public class MIDIStats : MonoBehaviour
{
private RunningStatistics noteStats;
private MovingStatistics movingNoteStats, movingIntervalStats;
private MIDIData midi;
@neurochems
neurochems / BrainData.cs
Last active October 13, 2022 15:39
EEG Band Power Data Input for Biodata + Unity Workshop, nanotopia, Oct 5 2022. Requires OSCCore.
using System.Collections.Generic;
using UnityEngine;
using OscCore;
// [ExecuteInEditMode]
public class BrainData : MonoBehaviour
{
public const int NUM_CHANNELS = 4;
public const int NUM_BANDS = 5;
public enum EEGChannel
@neurochems
neurochems / MIDIData.cs
Last active September 25, 2022 19:45
MIDI Data Handling for Biodata + Unity Workshop, nanotopia, Oct 5, 2022. Requires Minis.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
// from Keijiro's NoteCallback.cs - This script shows how to define a callback to get notified
// on MIDI note-on/off events.
public class MIDIData : MonoBehaviour
{
@neurochems
neurochems / AnimateMuse.cs
Last active November 15, 2019 23:51
Introduction to Unity + Biosignals workshop given at InterAccess July 17 + 23 2019. Help from @netgrind.
/// ANimateMuse
/// A script to allow properties of a GameObject's components to be manipulated by the activation scores.
/// Change the component object to effect or add others
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimateMuse : MonoBehaviour
{