-
Notifications
You must be signed in to change notification settings - Fork 1
Handle Long Melismas + Add Musicologist Button #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
69127b0
1cef67b
8426e31
0cbdaf4
c659f75
86e1008
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <a href="https://github.com/ECHOES-from-the-Past/PAM/blob/main/public/Test_PDF.pdf" target=_blank>For Musicologists</a> | ||
|
|
||
| <style lang="postcss"> | ||
| /* Default button styles */ | ||
| a { | ||
| @apply border-0 rounded-lg text-white py-2 px-4 font-medium bg-pink-600; | ||
| @apply cursor-pointer transition ease-in-out duration-300; | ||
|
|
||
| @apply hover:bg-pink-400; | ||
| @apply active:bg-pink-500; | ||
| @apply disabled:bg-gray-400 disabled:cursor-not-allowed; | ||
| } | ||
| </style> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| } from "@utility/components"; | ||
| import { Chart } from "chart.js/auto"; | ||
| import { onMount } from "svelte"; | ||
| import { draw, generate } from "patternomaly"; | ||
| /** | ||
| * @typedef {Object} Props | ||
|
|
@@ -28,8 +29,10 @@ | |
| const COLORS = { | ||
| normalBg: "#10b98180", | ||
| normalBorder: "#047857aa", | ||
| rhombusBg: "#67e8f980", | ||
| rhombusBorder: "#06b6d4aa", | ||
| rhombusBg: "#3c74f9aa", | ||
| rhombusBorder: "#1310f9aa", | ||
| ncBg: "#9270f6aa", | ||
| ncBorder: "#9253f2aa" | ||
|
Comment on lines
+32
to
+35
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are different hexcodes from the first screenshot you sent. Do you have a screenshot for the Personally, the rhombus color is a bit harsh compared to the regular note color - it was pastel green and cyan when I implemented it. It's perfectly fine as you implemented it, just my personal preference :))) |
||
| }; | ||
| /** | ||
|
|
@@ -86,7 +89,7 @@ | |
| { | ||
| label: "Rhombus", | ||
| data: sortedKeys.map((key) => rhombus[key]), | ||
| backgroundColor: new Array(sortedKeys.length).fill(COLORS.rhombusBg), | ||
| backgroundColor: new Array(sortedKeys.length).fill(draw('diamond', COLORS.rhombusBg)), | ||
| borderColor: new Array(sortedKeys.length).fill(COLORS.rhombusBorder), | ||
| borderWidth: 1, | ||
| }, | ||
|
|
@@ -153,7 +156,9 @@ | |
| */ | ||
| function getChantDataOldHispanic(chantSyls) { | ||
| const labels = []; | ||
| const data = []; | ||
| const ncData = []; | ||
| const ncData20 = []; | ||
| let has20Plus = false; | ||
| for (let i = 0; i < chantSyls.length; i++) { | ||
| const curSyl = chantSyls[i]; | ||
|
|
@@ -164,26 +169,73 @@ | |
| const position = prevSyl.syllableWord.position; | ||
| if (position === "t" || position === "s") { | ||
| labels.push(" "); | ||
| data.push(0); | ||
| ncData.push(0); | ||
| ncData20.push(0); | ||
| } | ||
| } | ||
| const ncLen = curSyl.neumeComponents.length; | ||
| labels.push(curSyl.syllableWord.text); | ||
| data.push(curSyl.neumeComponents.length); | ||
| if (ncLen >= 20){ | ||
| has20Plus = true; | ||
| ncData20.push(ncLen); | ||
| ncData.push(0); | ||
| } | ||
| else{ | ||
| ncData.push(ncLen); | ||
| ncData20.push(0); | ||
| } | ||
| } | ||
| return { | ||
| labels, | ||
| datasets: [ | ||
| { | ||
| label: "Number of notes", | ||
| data, | ||
| backgroundColor: new Array(labels.length).fill(COLORS.normalBg), | ||
| borderColor: new Array(labels.length).fill(COLORS.normalBorder), | ||
| borderWidth: 1, | ||
| }, | ||
| ], | ||
| }; | ||
| if (has20Plus){ | ||
| return { | ||
| labels, | ||
| datasets: [ | ||
| { | ||
| label: "Number of NCs", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is "NCs" understandable for musicologists? i.e., do they also call it "neume component", or just "neume" or "note"? |
||
| data: ncData, | ||
| backgroundColor: new Array(ncData.length).fill(COLORS.normalBg), | ||
| borderColor: new Array(ncData.length).fill(COLORS.normalBorder), | ||
| borderWidth: 1, | ||
| }, | ||
| { | ||
| label: "Number of NCs (20+)", | ||
| data: ncData20, | ||
| backgroundColor: new Array(ncData20.length).fill(draw('plus', COLORS.ncBg)), | ||
| borderColor: new Array(ncData20.length).fill(COLORS.ncBorder), | ||
| borderWidth: 1, | ||
| }, | ||
| ], | ||
| }; | ||
| } | ||
| else{ | ||
| return { | ||
| labels, | ||
| datasets: [ | ||
| { | ||
| label: "Number of NCs", | ||
| data: ncData, | ||
| backgroundColor: new Array(ncData.length).fill(COLORS.normalBg), | ||
| borderColor: new Array(ncData.length).fill(COLORS.normalBorder), | ||
| borderWidth: 1, | ||
| } | ||
| ] | ||
| }; | ||
| } | ||
| } | ||
| function getMaxNCs(chantSyls){ | ||
| let max = -1; | ||
| for (let i = 0; i < chantSyls.length; i++) { | ||
| const curSyl = chantSyls[i]; | ||
| const ncLen = curSyl.neumeComponents.length; | ||
| if (ncLen > max){ | ||
| max = ncLen; | ||
| } | ||
| } | ||
| if (max >= 20) | ||
| return 20; | ||
| return max; | ||
| } | ||
| onMount(() => { | ||
|
|
@@ -193,13 +245,11 @@ | |
| if (isOldHispanic) { | ||
| chantData = getChantDataOldHispanic(chant.syllables); | ||
| let maxNcs = getMaxNCs(chant.syllables); | ||
| config = { | ||
| titleText: "Number of Neume Components Across Chant", | ||
| xText: "Text", | ||
| yText: "Number of Neume Components", | ||
| xTick: 12, | ||
| chartLegend: false, | ||
| }; | ||
| } else { | ||
| const notes = getNeumeComponentList(chant.syllables); | ||
|
|
@@ -212,13 +262,6 @@ | |
| titleText: "Frequency of the notes across the chant ambitus", | ||
| xText: "Ambitus", | ||
| yText: "Frequency", | ||
| xTick: 14, | ||
| chartLegend: { | ||
| labels: { | ||
| display: true, | ||
| font: { size: 14 }, | ||
| }, | ||
| }, | ||
| }; | ||
| } | ||
|
|
@@ -234,7 +277,7 @@ | |
| } | ||
| // Create the chart | ||
| new Chart(chart, { | ||
| const chartSettings = { | ||
| type: "bar", | ||
| data: chantData, | ||
| options: { | ||
|
|
@@ -250,14 +293,16 @@ | |
| }, | ||
| padding: 14, | ||
| }, | ||
| legend: config.chartLegend ? { | ||
| ...config.chartLegend, | ||
| legend: { | ||
| labels: { | ||
| ...config.chartLegend.labels, | ||
| font: { size: 15, weight: "bold" }, | ||
| display: true, | ||
| font: { | ||
| size: 15, | ||
| weight: "bold" | ||
| }, | ||
| padding: 8, | ||
| }, | ||
| } : config.chartLegend, | ||
| } | ||
| }, | ||
| scales: { | ||
| x: { | ||
|
|
@@ -290,6 +335,13 @@ | |
| padding: 2, | ||
| }, | ||
| ticks: { | ||
| //Chart cuts off at max of 20, so use 20+ for clarity when there's more than 20 NCs | ||
| callback: function(val, index) { | ||
| if (val == 20 && chant.notationType == "old_hispanic"){ | ||
| return "20+" | ||
| } | ||
|
Comment on lines
+339
to
+342
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come the cutoff is 20 but the condition is |
||
| return val; | ||
| }, | ||
| font: { | ||
| size: 13, | ||
| }, | ||
|
|
@@ -302,8 +354,13 @@ | |
| margin: 0, | ||
| }, | ||
| }, | ||
| }); | ||
| }; | ||
| if (chant.notationType == "old_hispanic" && (getMaxNCs(chant.syllables) >= 20)){ | ||
| chartSettings.options.scales.y.max = 20; | ||
| } | ||
| new Chart(chart, chartSettings); | ||
| }); | ||
| </script> | ||
|
|
||
| <div | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,13 +68,22 @@ | |
| } | ||
| } else if (info == "MEI File") { // Links to the GitHub MEI files | ||
| p.innerHTML = `<b>${info}</b>: `; | ||
| const rootGABCtoMEI = | ||
| "https://github.com/ECHOES-from-the-Past/GABCtoMEI/blob/main/"; | ||
| const rootPamMeiDatabase = | ||
| "https://github.com/ECHOES-from-the-Past/PAM-MEI-Database/blob/main/"; | ||
| let fileName = chant.fileName; | ||
| let a = document.createElement("a"); | ||
| a.href = rootGABCtoMEI + fileName; | ||
| let chantLink; | ||
| if (chant.notationType == "square"){ | ||
| chantLink = "Square_MEIs/"; | ||
| } | ||
| else if (chant.notationType == "aquitanian"){ | ||
| chantLink = "Aquitanian_MEIs/"; | ||
| } | ||
| else if (chant.notationType == "old_hispanic"){ | ||
| chantLink = "Old_Hispanic_MEIs/"; | ||
| } | ||
| a.href = rootPamMeiDatabase + chantLink + fileName; | ||
|
Comment on lines
+71
to
+86
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can add a new field "meiUrl" to the Chant object to have it parsed in It would also contain the file path, since Feel free to make a new issue for this! |
||
| a.target = "_blank"; | ||
| a.innerText = `${fileName.split("/").pop()} (GitHub)`; // showing the file name only | ||
| p.appendChild(a); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing, this might not work because the PDF is not part of the path, but for the actual website, it will be at
https://echoes-from-the-past.github.io/PAM/Test_PDF.pdfAnd you can remove the Download component.
If you still want it to be pink, you can make a
$prop()for Tailwind classes and set the green ones to be the default so it doesn't break the project, and pink can be added as an option.