diff --git a/libs/music/piano.ts b/libs/music/piano.ts new file mode 100644 index 00000000..d1e48af8 --- /dev/null +++ b/libs/music/piano.ts @@ -0,0 +1,16 @@ +namespace music { + /** + * Get the frequency of a note. + * @param name the note name, eg: Note.C + */ + //% weight=1 help=music/note-frequency + //% blockId=device_note block="%note" + //% shim=TD_ID color="#FFFFFF" colorSecondary="#FFFFFF" + //% note.fieldEditor="note" note.defl="262" + //% note.fieldOptions.editorColour="#FF1493" note.fieldOptions.decompileLiterals=true + //% useEnumVal=1 + //% weight=10 blockGap=8 + export function noteFrequency(name: Note): number { + return name; + } +} \ No newline at end of file diff --git a/libs/music/pxt.json b/libs/music/pxt.json index d2c29bae..cd6d46f0 100644 --- a/libs/music/pxt.json +++ b/libs/music/pxt.json @@ -8,6 +8,7 @@ "shims.d.ts", "melodies.ts", "music.ts", + "piano.ts", "sounds.jres", "sounds.ts", "ns.ts"