Beispiel #1
0
    private static onkai FreqToOnkai(float freq, kensu ken)
    {
        var   k = (int)ken;
        float bs;

        bs = baseOn * Mathf.Pow(2, (int)(k - 4));
        if (bs > freq)
        {
            Debug.LogError(k + "謎" + ":" + freq);
        }
        int intVal = 0;

        //Debug.Log("鍵数:"+k+" base音:"+bs+" 周波数:"+freq);
        while (true)
        {
            bs *= R;
            if (bs > freq)
            {
                break;
            }
            intVal++;

            if (intVal > 16)
            {
                Debug.LogError("音階をオーバーしています。");
                break;
            }
        }
        return(IntToOnkai(intVal));
    }
Beispiel #2
0
    private static string GetString(kensu kens, onkai onka)
    {
        string ke = "ken" + (int)kens;
        string on;

        switch ((int)onka)
        {
        case 0:
            on = "a";
            break;

        case 1:
            on = "bf";
            break;

        case 2:
            on = "b";
            break;

        case 3:
            on = "c";
            break;

        case 4:
            on = "df";
            break;

        case 5:
            on = "d";
            break;

        case 6:
            on = "ef";
            break;

        case 7:
            on = "e";
            break;

        case 8:
            on = "f";
            break;

        case 9:
            on = "gf";
            break;

        case 10:
            on = "g";
            break;

        case 11:
            on = "af";
            break;

        default:
            on = "";
            Debug.LogError("音階が当てはまらねえぜ");
            break;
        }
        return(ke + on);
    }