コード例 #1
0
    IEnumerator _OutputNote(float value)
    {
        MidiOut.SendNoteOn(midiChannel, note, Mathf.Clamp01(value));
        yield return(new WaitForSeconds(noteDurationSec));

        MidiOut.SendNoteOff(midiChannel, note);
    }
コード例 #2
0
        public virtual void NoteOff(int noteNum)
        {
            switch (outputMode)
            {
            case OutputMode.OSC:
                MidiCommand com = MidiCommandHelper.NoteOffCommand(midiChannelOut, noteNum);
                OscOutput(com);
                break;


            case OutputMode.MIDI:
                MidiOut.SendNoteOff(MidiChannel.Ch1, noteNum);
                break;

            default:
                break;
            }
        }
コード例 #3
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));
        }
    }
コード例 #4
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);
        }
    }
コード例 #5
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);
        }
    }
コード例 #6
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);
        }
    }