Skip to content

Commit

Permalink
doc dixes
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Nov 18, 2024
1 parent d7e03c7 commit 305c641
Show file tree
Hide file tree
Showing 25 changed files with 26,505 additions and 51 deletions.
8 changes: 5 additions & 3 deletions Documentation/patch/Templates/1-score.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ hide:

In this template you have access to a patch that receives image files (from scores) and renders it side by side with your patch. The result will be something like this:

!!! tip "Click in the image to open the example in a new tab"

<p align="center">
<img src="../assets/score.png" width="80%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);">
<img src="../assets/score.png" width="80%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); cursor: pointer;" onclick="window.open('../templates/score', '_blank');">
</p>

<p align="center" markdown>
Expand All @@ -19,7 +21,7 @@ In this template you have access to a patch that receives image files (from scor

---

<h3 align="center">Score Files</h3>
## <h2 align="center">What should your patch include?</h2>


You make your patch and the score file can be set using the object `[s pd4web-score]`. I recomend to use svg files, but you can use any image file (.png, .jpeg).
Expand All @@ -30,7 +32,7 @@ You make your patch and the score file can be set using the object `[s pd4web-sc

---

<h3 align="center">Add infos in the website</h3>
## <h3 align="center">Extra options</h3>


After compile the patch, you will see that, inside the folder `WebPatch`, will have a file called `bula.md`. Inside this file, you can write some description about your piece. The file uses markdown to render, you can check the complet syntax in https://www.markdownguide.org/basic-syntax/. Below the example of main command:
Expand Down
15 changes: 6 additions & 9 deletions Documentation/patch/Templates/2-hands.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ The result will be something like this:
---

<p align="center">
<img src="../assets/ml5.png" width="50%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);">
<img src="../assets/ml5.png" width="50%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); cursor: pointer;" onclick="window.open('../templates/ml5', '_blank');">
</p>

<p align="center" markdown>
:octicons-download-16: [Download Patch example](../patches/template-2.pd)
</p>

<h2 align="center">How must be your patch</h2>
## <h2 align="center">What should your patch include?</h2>

You patch must have some receivers using the `L-` and `R-` preffixes to receive the data from the hands followed by the number of the position you want, following the image below:

Expand All @@ -38,13 +38,10 @@ For example, to receive the data from where is the `INDEX_FINGER_TIP` for the `L

From these receivers, you will get two numbers, `x` and `y`, inside a list. These numbers represent the position of your hand relative to your real-time video.

- The `x` value indicates the vertical position:
- Close to `0` means your hand is near the top of the image.
- Close to `1` means your hand is near the bottom of the image.

- The `y` value indicates the horizontal position:
- Close to `0` means your hand is near the left side of the image.
- Close to `1` means your hand is near the right side of the image.
<div class="grid cards" markdown>
- __X Position__: `0` is the top and `1` is the bottom.
- __Y Position__: `0` is the left and `1` is the right.
</div>

In summary, `[x, y]` defines the hand's position within a coordinate system where `(0,0)` is the top-left corner and `(1,1)` is the bottom-right corner of the image.

Expand Down
12 changes: 6 additions & 6 deletions Documentation/patch/Templates/3-choir.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ The result will be something like this:
---

<p align="center">
<img src="../assets/choir.jpeg" width="35%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);">
<img src="../assets/choir.jpeg" width="35%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); cursor: pointer;" onclick="window.open('https://charlesneimog.github.io/Pandemonio/', '_blank');">
</p>

<p align="center" markdown>
:octicons-download-16: [Download Patch example](../patches/template-3.pd)
</p>

<h2 align="center">How must be your patch</h2>
## <h2 align="center">What should your patch include?</h2>

In your patch, you have these options to set using **senders**:
In your patch, you have these options to set using **senders**, for example, `[s composer`], `[s title]`, `[s duration-bar]`, `[s piece-duration-bar]`, `[s poem-phrase]` and `[s pitch-syl]`:

- `composer`: The composer name;
- `title`: Title of the piece;
- `duration-bar`: A number between 0 and 100 for the bar line.
- `piece-duration-bar`: A number between 0 and 100 for the bar line.
- `duration-bar`: A number between 0 and 100 for the bar line (control the bar above the score);
- `piece-duration-bar`: A number between 0 and 100 for the bar line (control the bar below the phrase);
- `poem-phrase`: The complete phrase of the poem (or anything else), for example `minha frase`.
- `pitch-syl`: A list with the pitchname and the syllable, for example `C4 fra`.

In your patch, you have these options to set using **receivers**:
In your patch, you have these options to set using **receivers**, for example, `[r naipe]`:

- `naipe`. Receive the naipe choosen by the singer, 1 for Baixo, 2 for Tenor, 3 for Contralto and 4 for Soprano.

Expand Down
13 changes: 6 additions & 7 deletions Documentation/patch/Templates/4-p5js.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ hide:

# <h1 align="center">Template <code>4</code>: p5js and pd4web</h1>

!!! tip "Template designed for know how to program"
Learn how to program, I really recommend watch the [Coding Train](https://www.youtube.com/user/shiffman) channel. It is a great channel to learn how to program in a fun way. `CodeTrain + ChatGPT` = :heart:.

This template is for the combination of p5js and pd4web. It is a simple template that uses the p5js library to create a canvas and pd4web to create a patch that can be used to control the canvas (or vice-versa).
!!! tip "Template designed for those who know how to program"
Learn how to program, I really recommend watch the [Coding Train](https://www.youtube.com/user/shiffman) channel. It is a great channel to learn how to program in a fun way.

This template is for the combination of `p5js` and `pd4web`. It is a simple template that uses the `p5js` library to create a canvas and pd4web to create a patch that can be used to control the canvas (or vice-versa).

<p align="center">
<img src="../assets/p5js.png" width="80%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);" onclick="window.open('./../templates/p5js', '_blank')">
<img src="../assets/p5js.png" width="80%" style="cursor: pointer; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);" onclick="window.open('./../templates/p5js', '_blank');" >
</p>

<p align="center" markdown>
:octicons-download-16: [Download Patch Template](../patches/template-4.zip)
</p>

There is no much to say about this template, just download and have fun. If you have any question, please, let me know. If you have some questions about `p5js` or `pd4web` you can ask me too. I will be glad to help you.
There is no much to say about this template, it just use a personalized `index.html` and `sketch.js`, where you can code you `p5js` code.

See you in the example working in the <a href="./../templates/p5js">website</a>.
Just download and have fun. If you have any question, please, let me know. If you have some questions about `p5js` or `pd4web` you can ask me too. I will be glad to help you.
2 changes: 1 addition & 1 deletion Documentation/patch/Templates/5-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ hide:
Patch side by side with some text to explain the patch. The result will be something like this:

<p align="center">
<img src="../assets/tutorial.png" width="80%" style="border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);" onclick="window.open('./../templates/tutorial', '_blank')">
<img src="../assets/tutorial.png" width="80%" style="cursor: pointer; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);" onclick="window.open('./../templates/tutorial', '_blank');">
</p>

To make the description again we use a markdown file. The markdown is called `tutorial.md` and is located in the `WebPatch` folder. The content of the file should be edited after compilation of the patch.
Expand Down
66 changes: 66 additions & 0 deletions Documentation/patch/Templates/templates/ml5/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!doctype html>
<html lang="en">
<head>
<title>Pd4Web</title>
<meta charset="UTF-8" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.min.js"></script>
<script src="https://unpkg.com/ml5@1/dist/ml5.js"></script>
<script src="./pd4web.threads.js"></script>
<script src="./pd4web.js"></script>
<script src="./sketch.js"></script>
<style>
canvas {
border-radius: 30px;
}
</style>
</head>
<body>
<span class="pd4web-sound-switch" id="Pd4WebAudioSwitch"></span>
<div id="Pd4WebPatchDiv"class="Pd4WebPatchDiv">
<svg id="Pd4WebCanvas"></svg>
</div>
<hr>
<p id="message" style="text-align: center; font-size: 20px">
Click on the page to request access to the camera and microphone.
</p>
<div style="display: flex; justify-content: center; border-radius: 30px">
<div id="p5js" style="border-radius: 30px"></div>
</div>


<script>
// ╭─────────────────────────────────────╮
// │ Gui Bottoms Interface │
// ╰─────────────────────────────────────╯
var Pd4Web = null;

// add window click event to start video
document.addEventListener("click", async () => {
navigator.mediaDevices.getUserMedia({
video: true,
audio: true
});
if (Pd4Web) {
return;
}
Pd4WebModule().then((Pd4WebModulePromise) => {
Pd4Web = new Pd4WebModulePromise.Pd4Web();
const message = document.getElementById("message");
if (message) {
message.style.display = "none";
}
});
// remove event listener
document.removeEventListener("click", () => {});
});

document
.getElementById("Pd4WebAudioSwitch")
.addEventListener("click", async () => {
startVideo();
Pd4Web.init();
console.log("Pd4Web", Pd4Web);
});
</script>
</body>
</html>
60 changes: 60 additions & 0 deletions Documentation/patch/Templates/templates/ml5/index.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#N canvas 121 80 1282 686 10;
#X obj 3 3 tgl 45 0 s-tgl1 r-tgl1 empty 0 -8 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 153 2 tgl 45 0 s-tgl2 r-tgl2 empty 0 -8 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 153 90 tgl 45 0 s-tgl4 r-tgl4 empty 0 -8 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 3 90 tgl 45 0 s-tgl3 r-tgl3 empty 0 -8 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 208 4 r R-8;
#N canvas 266 303 622 364 tgl2 0;
#X obj 2 33 unpack f f;
#X obj 2 74 change;
#X obj 2 119 s r-tgl2;
#X obj 2 53 expr if ($f1 > 0.9 && $f2 < 0.2 \, 1 \, 0);
#X obj 2 4 inlet;
#X connect 0 0 3 0;
#X connect 0 1 3 1;
#X connect 1 0 2 0;
#X connect 3 0 1 0;
#X connect 4 0 0 0;
#X restore 257 94 pd tgl2;
#N canvas 266 303 622 364 tgl1 0;
#X obj 2 4 inlet;
#X obj 1 25 unpack f f;
#X obj 1 45 expr if ($f1 < 0.2 && $f2 < 0.2 \, 1 \, 0);
#X obj 1 111 s r-tgl1;
#X obj 1 66 change;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 2 0 4 0;
#X connect 4 0 3 0;
#X restore 209 94 pd tgl1;
#N canvas 266 303 622 364 tgl3 0;
#X obj 2 33 unpack f f;
#X obj 2 74 change;
#X obj 2 4 inlet;
#X obj 2 53 expr if ($f1 < 0.2 && $f2 > 0.8 \, 1 \, 0);
#X obj 2 119 s r-tgl3;
#X connect 0 0 3 0;
#X connect 0 1 3 1;
#X connect 1 0 4 0;
#X connect 2 0 0 0;
#X connect 3 0 1 0;
#X restore 306 94 pd tgl3;
#N canvas 266 303 622 364 tgl4 0;
#X obj 2 33 unpack f f;
#X obj 2 74 change;
#X obj 2 4 inlet;
#X obj 2 53 expr if ($f1 > 0.8 && $f2 > 0.8 \, 1 \, 0);
#X obj 2 119 s r-tgl4;
#X connect 0 0 3 0;
#X connect 0 1 3 1;
#X connect 1 0 4 0;
#X connect 2 0 0 0;
#X connect 3 0 1 0;
#X restore 355 94 pd tgl4;
#X text 38 57 Use your right hand!;
#X connect 4 0 5 0;
#X connect 4 0 6 0;
#X connect 4 0 7 0;
#X connect 4 0 8 0;
#X coords 0 -1 1 1 200 140 1 0 0;
Loading

0 comments on commit 305c641

Please sign in to comment.