Tiny MML
Posted feedbacks - C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | using System;
using System.Runtime.InteropServices;
using System.Threading;
class Program
{
[DllImport("kernel32.dll")]
extern static bool Beep(uint f, uint d);
static void Main()
{
Play("cdefedcrefgagfercrcrcrcrcdefedcr");
}
static void Play(string s)
{
uint[] dt = {440, 494, 262, 294, 330, 349, 392};
foreach (char c in s)
{
if (c == 'r') Thread.Sleep(500);
else Beep(dt[c - 'a'], 500);
}
}
}
|

にしお
#3387()
Rating0/0=0.00
入力はcがド、dがレ、eがミ、fがファ、gがソ、aがラ、bがシ、rが休符とします。この8文字以外の文字は入力に含まれていないと仮定して構いません。おのおのの音符・休符は八分音符・八分休符とします。
オクターブや音の長さの変更、同時発音などの機能は不要です。
サンプル入力(カエルの歌)
[ reply ]