Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"postcss": "^8.5.6",
"svelte": "^5.41.2",
"tailwindcss": "^3.4.18",
"vite": "^6.4.1"
"vite": "^6.4.1",
"patternomaly": "^1.3.2"
},
"private": true,
"scripts": {
Expand Down
Binary file added public/Test_PDF.pdf
Binary file not shown.
13 changes: 13 additions & 0 deletions src/components/Download.svelte
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>
2 changes: 2 additions & 0 deletions src/components/NavBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { env } from "@utility/utils";
import Button from "./Button.svelte";
import ExternalLink from "./ExternalLink.svelte";
import Download from "./Download.svelte";
let clientVersion = $state();
export function setVersion(version) {
Expand All @@ -26,6 +27,7 @@
<ExternalLink href="https://github.com/ECHOES-from-the-Past/PAM">
<Button>Source Code</Button>
</ExternalLink>
<Download>For Musicologists</Download>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Download>For Musicologists</Download>
<ExternalLink href="./Test_PDF.pdf">
<Button> Guide for Musicologists </Button>
</ExternalLink>

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.pdf

And 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.


<p id="client-version" class="text-base text-emerald-900 ml-auto">
Version: {clientVersion}
Expand Down
127 changes: 92 additions & 35 deletions src/search/AnalysisChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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 ncBg and ncBorder? I couldn't test that one.

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 :)))

};
/**
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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];
Expand All @@ -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",
Copy link
Member

Choose a reason for hiding this comment

The 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(() => {
Expand All @@ -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);
Expand All @@ -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 },
},
},
};
}
Expand All @@ -234,7 +277,7 @@
}
// Create the chart
new Chart(chart, {
const chartSettings = {
type: "bar",
data: chantData,
options: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come the cutoff is 20 but the condition is val == 20? Shouldn't it be val >= 20?

return val;
},
font: {
size: 13,
},
Expand All @@ -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
Expand Down
17 changes: 13 additions & 4 deletions src/search/ChantDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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 database.mjs, in case there's a database change again, we don't have to manually change the URL there.

It would also contain the file path, since chant.filename is a strip down string of the full path 😆

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);
Expand Down