Comment detail

Tiny MML (Nested Flatten)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#light
open System
open System.Runtime.InteropServices
open System.Threading

[<DllImport("kernel32.dll")>]

let Beep (dwFreq:int) (dwDuration:int) :bool = failwith ""
let toNum = function
    | 'c' -> 262
    | 'd' -> 294
    | 'e' -> 330
    | 'f' -> 349
    | 'g' -> 392
    | 'a' -> 440
    | 'b' -> 494
    | _ -> 0

let play (s:string) =
    for c in s do
        if (toNum c) = 0 then Thread.Sleep( 500 )
        else Beep (toNum c) 500 |> (fun b -> ())
    done

do play "cdefedcrefgagfercrcrcrcrcdefedcr"

Index

Feed

Other

Link

Pathtraq

loading...