Skip to content

Commit

Permalink
scraping chords post
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Jan 14, 2025
1 parent 9ac718e commit c9dbd17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<body>
<h2>🌱 garten.salat.dev</h2>
<ul>
<li>
041:
<a href="ireal/reader.html">scraping chords</a>
</li>
<li>
040:
<a href="meta/youre-doing-computing-wrong.html"
Expand Down Expand Up @@ -60,7 +64,7 @@ <h2>🌱 garten.salat.dev</h2>
<li>023: <a href="audio-dsp/worklets2.html">audio worklets II</a></li>
<li>022: <a href="audio-dsp/worklets.html">audio worklets</a></li>
<li>021: <a href="audio-dsp/buffers.html">audio buffers</a></li>
<li>021: <a href="hydra/how3.html">how hydra works III</a></li>
<li>020: <a href="hydra/how3.html">how hydra works III</a></li>
<li>019: <a href="hydra/how2.html">how hydra works II</a></li>
<li>
018: <a href="kabelsalat/graph-compilation.html">a graph compiler</a>
Expand Down
10 changes: 7 additions & 3 deletions ireal/reader.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>🌱 chord scraping</title>
<title>🌱 scraping chords</title>
<style>
body {
background-color: #222;
Expand Down Expand Up @@ -187,6 +187,7 @@ <h2>🌱 chord scraping</h2>
}
}
});
// TBD: replace + chords with aug (mini doesn't allow +)
let mini = "<\n";
for (let i in bars) {
const bar = bars[i];
Expand Down Expand Up @@ -318,6 +319,7 @@ <h2>🌱 chord scraping</h2>
comments = [];
var i;
text = text.trim();
// console.log("text", text);
// text = text.trimRight();
while (text) {
var found = false;
Expand All @@ -328,8 +330,9 @@ <h2>🌱 chord scraping</h2>
found = true;
if (match.length <= 2) {
const replacement = match[0];
var repl = replacements[replacement];
arr = arr.concat(repl ? repl : [replacement]);
var repl = replacements[replacement] || [replacement];
// console.log("match", match, replacement, repl);
arr = arr.concat(repl);
text = text.substr(replacement.length);
} else {
// a chord
Expand All @@ -352,6 +355,7 @@ <h2>🌱 chord scraping</h2>

for (i = 0; i < arr.length; i++) {
var token = arr[i];
// console.log('token', token);
if (token instanceof Array) {
obj.chord = parseChord(token);
token = " ";
Expand Down

0 comments on commit c9dbd17

Please sign in to comment.