From ed1c187514f8b649eac6986c74b9df172b1aa9a4 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Tue, 21 Nov 2017 11:35:53 -0800 Subject: [PATCH 1/6] Initial work --- libs/music/piano.ts | 16 ++++++++++++++++ libs/music/pxt.json | 1 + 2 files changed, 17 insertions(+) create mode 100644 libs/music/piano.ts 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" From 2c89848fda4a3dcd2ab12fe9ec3620806b6fb658 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Tue, 21 Nov 2017 17:11:11 -0800 Subject: [PATCH 2/6] More --- libs/music/piano.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/music/piano.ts b/libs/music/piano.ts index d1e48af8..fc3b1e13 100644 --- a/libs/music/piano.ts +++ b/libs/music/piano.ts @@ -8,6 +8,7 @@ namespace music { //% shim=TD_ID color="#FFFFFF" colorSecondary="#FFFFFF" //% note.fieldEditor="note" note.defl="262" //% note.fieldOptions.editorColour="#FF1493" note.fieldOptions.decompileLiterals=true + //% note.fieldOptions.minNote=131 note.fieldOptions.maxNote=277 //% useEnumVal=1 //% weight=10 blockGap=8 export function noteFrequency(name: Note): number { From 85ca6b36987c443272f639c5a80f7f1f0344ba71 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Mon, 27 Nov 2017 14:12:04 -0800 Subject: [PATCH 3/6] Support for new data structure --- libs/music/piano.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/music/piano.ts b/libs/music/piano.ts index fc3b1e13..e20e80f2 100644 --- a/libs/music/piano.ts +++ b/libs/music/piano.ts @@ -8,7 +8,7 @@ namespace music { //% shim=TD_ID color="#FFFFFF" colorSecondary="#FFFFFF" //% note.fieldEditor="note" note.defl="262" //% note.fieldOptions.editorColour="#FF1493" note.fieldOptions.decompileLiterals=true - //% note.fieldOptions.minNote=131 note.fieldOptions.maxNote=277 + //% note.fieldOptions.minNote=40 note.fieldOptions.maxNote=51 //% useEnumVal=1 //% weight=10 blockGap=8 export function noteFrequency(name: Note): number { From 7e39cdde9db2651d82de91d11d62f71f52c96441 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Mon, 27 Nov 2017 17:21:32 -0800 Subject: [PATCH 4/6] Add a todo --- libs/music/piano.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/music/piano.ts b/libs/music/piano.ts index e20e80f2..daaeba7e 100644 --- a/libs/music/piano.ts +++ b/libs/music/piano.ts @@ -12,6 +12,7 @@ namespace music { //% useEnumVal=1 //% weight=10 blockGap=8 export function noteFrequency(name: Note): number { + //TODO fill in actual min/max note values return name; } } \ No newline at end of file From ef2807a84e7e05b9164949e193cdf25b23aa1b21 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Tue, 28 Nov 2017 16:04:25 -0800 Subject: [PATCH 5/6] Fill in real min and max --- libs/music/piano.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/music/piano.ts b/libs/music/piano.ts index daaeba7e..145f1319 100644 --- a/libs/music/piano.ts +++ b/libs/music/piano.ts @@ -8,7 +8,7 @@ namespace music { //% shim=TD_ID color="#FFFFFF" colorSecondary="#FFFFFF" //% note.fieldEditor="note" note.defl="262" //% note.fieldOptions.editorColour="#FF1493" note.fieldOptions.decompileLiterals=true - //% note.fieldOptions.minNote=40 note.fieldOptions.maxNote=51 + //% note.fieldOptions.minNote=52 note.fieldOptions.maxNote=75 //% useEnumVal=1 //% weight=10 blockGap=8 export function noteFrequency(name: Note): number { From b02891602506b5483c4e1c1f7d73d402c45a1449 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Tue, 28 Nov 2017 16:48:16 -0800 Subject: [PATCH 6/6] Increment pxt-core and pxt-common-packages dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 228b23d7..e53fd5bd 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,8 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-common-packages": "0.14.3", - "pxt-core": "2.3.28" + "pxt-common-packages": "0.14.5", + "pxt-core": "2.3.29" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis"