Merge pull request #2772 from NovaDawn999/master

Ukulele Chords
pull/2783/head
Gordon Williams 2023-05-25 09:01:53 +01:00 committed by GitHub
commit aa3b38cd45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 158 additions and 0 deletions

1
apps/Uke/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New App!

11
apps/Uke/README.md Normal file
View File

@ -0,0 +1,11 @@
# Uke Chords
An app that simply describes finger placements on a Ukulele to form common chords.
## Usage
Use the button to scroll through the available chords.
## Creator
NovaDawn999

1
apps/Uke/app-icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwgtqiAXWiMRDKsBolBCqcQilEoQwTiMUoMkkJGUiQwUFwVCGCcUoVEkJ5SgJ2CAQMROyIsBoVDoIXQgMSiJ2EPB4uBdwMieCMBCoIZCDoJdQAAMSUYUBLqIXBIhxCBCAJdDIZwPBTgIAEFxrOCAAIuTCwVELoQuToIuRgIuDCoUiFxjNCFwq7BC5YWBFoZdDAQIXLCwpdEogXKLYgWBXYZ9BC5SKDCwQYCkIHBC5IuFFQIYBiQhCC5JdFCoIYBBIYXJIwlEFwUUBIYXOLgIYDA4ReJC4i4BI4RODOxj/CAQIyBFwSOMoIYCagQ4BCxQXEigrBiS7CLpRHGAIMiMwYXMQoYwCSogXKU4gwCC6gwCC6ApEUoIFDRxR4Fd4QXReAgcEC5hIFLyAwJFxwwIiIWODATbDCyIYCAAQWSACY"))

131
apps/Uke/app.js Normal file
View File

@ -0,0 +1,131 @@
const stringInterval = 30;
const stringLength = 131;
const fretHeight = 35;
const fingerOffset = 17;
const x = 44;
const y = 32;
//chords
const cc = [
"C",
"x",
"x",
"x",
"33"
];
const dd = [
"D",
"23",
"22",
"24",
"x"
];
const gg = [
"G",
"x",
"21",
"33",
"22",
];
const am = [
"Am",
"22",
"x",
"x",
"x"
];
const em = [
"Em",
"x",
"43",
"32",
"21"
];
const aa = [
"A",
"22",
"11",
"x",
"x"
];
const ff = [
"F",
"22",
"x",
"11",
"x"
];
var ee = [
"E",
"33",
"32",
"34",
"11"
];
var index = 0;
var chords = [];
function init() {
g.setFontAlign(0,0); // center font
g.setFont("6x8",2); // bitmap font, 8x magnified
chords.push(cc, dd, gg, am, em, aa, ff, ee);
}
function drawBase() {
for (let i = 0; i < 4; i++) {
g.drawLine(x + i * stringInterval, y, x + i * stringInterval, y + stringLength);
g.fillRect(x- 1, y + i * fretHeight - 1, x + stringInterval * 3 + 1, y + i * fretHeight + 1);
}
}
function drawChord(chord) {
g.drawString(chord[0], g.getWidth() * 0.5 + 2, 18);
for (let i = 0; i < chord.length; i++) {
if (i === 0 || chord[i][0] === "x") {
continue;
}
if (chord[i][0] === "0") {
g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y + fretHeight * chord[i][0], true);
g.drawCircle(x + (i - 1) * stringInterval -1, y + fretHeight * chord[i][0], 8);
}
else {
g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y -fingerOffset + fretHeight * chord[i][0], true);
g.drawCircle(x + (i - 1) * stringInterval -1, y -fingerOffset + fretHeight * chord[i][0], 8);
}
}
}
function buttonPress() {
setWatch(() => {
buttonPress();
}, BTN);
index++;
if (index >= chords.length) { index = 0; }
draw();
}
function draw() {
g.clear();
drawBase();
drawChord(chords[index]);
}
function main() {
init();
draw();
setWatch(() => {
buttonPress();
}, BTN);
}
main();

BIN
apps/Uke/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

14
apps/Uke/metadata.json Normal file
View File

@ -0,0 +1,14 @@
{ "id": "Uke",
"name": "Uke Chords",
"shortName":"Uke",
"version":"0.01",
"description": "Wrist mounted ukulele chords",
"icon": "app.png",
"tags": "uke, chords",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"Uke.app.js","url":"app.js"},
{"name":"Uke.img","url":"app-icon.js","evaluate":true}
]
}