コード例 #1
0
    private IEnumerator Blink(int note, int color)
    {
        if (blinkMap.ContainsKey(note))
        {
            blinkMap[note] = true;
        }
        else
        {
            blinkMap.Add(note, true);
        }
        bool   flag = true;
        Colors defaultColor;

        while (flag)
        {
            MidiOut.SendNoteOn(MidiChannel.Ch1, note, color / 127f);
            yield return(new WaitForSeconds(0.5f));

            //		defaultColor = map[note];
            if (!map.TryGetValue(note, out defaultColor))
            {
                map.Add(note, Colors.OFF);
            }
            MidiOut.SendNoteOn(MidiChannel.Ch1, note, ((int)defaultColor) / 127f);
            yield return(new WaitForSeconds(0.2f));

            flag = blinkMap[note];
        }
    }
コード例 #2
0
    IEnumerator _OutputNote(float value)
    {
        MidiOut.SendNoteOn(midiChannel, note, Mathf.Clamp01(value));
        yield return(new WaitForSeconds(noteDurationSec));

        MidiOut.SendNoteOff(midiChannel, note);
    }
コード例 #3
0
 public void Reset()
 {
     foreach (int i in notes)
     {
         MidiOut.SendNoteOn(MidiChannel.Ch1, i, 12 / 127f);
     }
 }
コード例 #4
0
//	public MusicalChairs mc;
//	public Arena arena;
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                notes.Add((i * 16) + j);
                MidiOut.SendNoteOn(MidiChannel.Ch1, (i * 16) + j, 12 / 127f);
            }
        }
//		StartCoroutine(mc.StartSequence());
    }
コード例 #5
0
    IEnumerator Start()
    {
        MidiBridge.instance.Warmup();

        if (delay > 0.0f)
        {
            yield return(new WaitForSeconds(delay));
        }

        while (true)
        {
            MidiOut.SendNoteOn(channel, noteNumber, velocity);
            scale = 2.0f;
            yield return(new WaitForSeconds(length));

            MidiOut.SendNoteOff(channel, noteNumber);
            yield return(new WaitForSeconds(interval - length));
        }
    }
コード例 #6
0
        public virtual void NoteOn(int noteNum, int velocity = 127)
        {
            switch (outputMode)
            {
            case OutputMode.OSC:

                MidiCommand com = MidiCommandHelper.NoteOnCommand(midiChannelOut, noteNum, velocity);
                OscOutput(com);

                break;


            case OutputMode.MIDI:

                MidiOut.SendNoteOn((MidiChannel)midiChannelOut, noteNum, velocity / 127.0f);
                break;

            default:
                break;
            }
        }
コード例 #7
0
    IEnumerator Song()
    {
        while (true)
        {
            MidiOut.SendNoteOn(MidiChannel.Ch1, 45, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOn(MidiChannel.Ch1, 57, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(MidiChannel.Ch1, 45);
            MidiOut.SendNoteOff(MidiChannel.Ch1, 57);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 59, velocity);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 71, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(MidiChannel.Ch1, 59);
            MidiOut.SendNoteOff(MidiChannel.Ch1, 71);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 64, velocity);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 76, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(MidiChannel.Ch1, 59);
            MidiOut.SendNoteOff(MidiChannel.Ch1, 71);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 76, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOn(MidiChannel.Ch1, 76, velocity);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 76, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(MidiChannel.Ch1, 71);
            MidiOut.SendNoteOn(MidiChannel.Ch1, 76, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(MidiChannel.Ch1, 71);
        }
    }
コード例 #8
0
 public void Light(int note, Colors color)
 {
     map[note] = color;
     MidiOut.SendNoteOn(MidiChannel.Ch1, note, ((int)color) / 127f);
 }
コード例 #9
0
    IEnumerator Song()
    {
        while (true)
        {
            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 65, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 65);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 75, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 75);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 62, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 62);
            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 45, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 52);

            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.475f));

            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.575f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.75f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);

            MidiOut.SendNoteOn(channel, 44, velocity);
            // MidiOut.SendNoteOn(channel, 45, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 44);
            // MidiOut.SendNoteOff (channel, 45);
            MidiOut.SendNoteOn(channel, 47, velocity);
            //  MidiOut.SendNoteOn(channel, 53, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 47);
            //  MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOn(channel, 51, velocity);
            // MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 51);
            //  MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 47, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 47);
            MidiOut.SendNoteOn(channel, 56, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 56);
            MidiOut.SendNoteOn(channel, 47, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 47);
            MidiOut.SendNoteOn(channel, 51, velocity);
            yield return(new WaitForSeconds(0.45f));

            MidiOut.SendNoteOff(channel, 51);
            MidiOut.SendNoteOn(channel, 47, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 47);
            MidiOut.SendNoteOn(channel, 44, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 44);

            MidiOut.SendNoteOn(channel, 47, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 47);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 51, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 51);
            MidiOut.SendNoteOn(channel, 47, velocity);
            yield return(new WaitForSeconds(0.475f));

            MidiOut.SendNoteOff(channel, 47);
            MidiOut.SendNoteOn(channel, 56, velocity);
            yield return(new WaitForSeconds(0.575f));

            MidiOut.SendNoteOff(channel, 56);
            MidiOut.SendNoteOn(channel, 47, velocity);
            yield return(new WaitForSeconds(0.75f));

            MidiOut.SendNoteOff(channel, 47);

            MidiOut.SendNoteOn(channel, 51, velocity);
            // MidiOut.SendNoteOn(channel, 45, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 51);
            // MidiOut.SendNoteOff (channel, 45);
            MidiOut.SendNoteOn(channel, 47, velocity);
            //  MidiOut.SendNoteOn(channel, 53, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 47);
            //  MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 65, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            // MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.45f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 55);
            MidiOut.SendNoteOff(channel, 32);
            //  MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 53, velocity);
            yield return(new WaitForSeconds(0.45f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 52);

            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 65, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 65);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 53, velocity);
            yield return(new WaitForSeconds(0.475f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.575f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.75f));

            MidiOut.SendNoteOff(channel, 60);

            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 65, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 65);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 75, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOff(channel, 75);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 62, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 62);
            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 52, velocity);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.55f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 45, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.35f));

            MidiOut.SendNoteOff(channel, 52);

            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.275f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.275f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 60, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 60);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.475f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 53, velocity);
            MidiOut.SendNoteOn(channel, 32, velocity);
            yield return(new WaitForSeconds(0.65f));

            MidiOut.SendNoteOff(channel, 53);
            MidiOut.SendNoteOff(channel, 32);
        }
    }
コード例 #10
0
    IEnumerator Song()
    {
        while (true)
        {
            MidiOut.SendNoteOn(channel, 45, velocity);
            MidiOut.SendNoteOn(channel, 57, velocity);
            yield return(new WaitForSeconds(0.25f));

            //MidiOut.SendNoteOff (channel, 45);
            //MidiOut.SendNoteOff (channel, 57);
            MidiOut.SendNoteOn(channel, 59, velocity);
            MidiOut.SendNoteOn(channel, 71, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 59);
            MidiOut.SendNoteOff(channel, 71);
            MidiOut.SendNoteOn(channel, 64, velocity);
            MidiOut.SendNoteOn(channel, 76, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 64);
            MidiOut.SendNoteOff(channel, 76);
            MidiOut.SendNoteOn(channel, 48, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 48);
            MidiOut.SendNoteOn(channel, 59, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 59);
            MidiOut.SendNoteOn(channel, 64, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 64);
            MidiOut.SendNoteOn(channel, 45, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 45);
            MidiOut.SendNoteOn(channel, 59, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 59);
            MidiOut.SendNoteOn(channel, 64, velocity);
            yield return(new WaitForSeconds(0.25f));

            MidiOut.SendNoteOff(channel, 64);

            MidiOut.SendNoteOn(channel, 40, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 40);
            MidiOut.SendNoteOn(channel, 64, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 64);
            MidiOut.SendNoteOn(channel, 52, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 52);
            MidiOut.SendNoteOn(channel, 55, velocity);
            yield return(new WaitForSeconds(0.375f));

            MidiOut.SendNoteOff(channel, 55);
            MidiOut.SendNoteOn(channel, 59, velocity);
            yield return(new WaitForSeconds(0.75f));

            MidiOut.SendNoteOff(channel, 50);
        }
    }