Spaces:
Running
Running
Commit
•
0b06f90
1
Parent(s):
52f2d82
Update app.py
Browse files
app.py
CHANGED
@@ -23,30 +23,30 @@ description = """
|
|
23 |
<div>
|
24 |
|
25 |
<a style="display:inline-block" href='https://github.com/sander-wood/tunesformer'><img src='https://img.shields.io/github/stars/sander-wood/tunesformer?style=social' /></a>
|
26 |
-
<a style="display:inline-block" href="https://huggingface.co/datasets/sander-wood/
|
27 |
<a style="display:inline-block" href="https://arxiv.org/pdf/2301.02884.pdf"><img src="https://img.shields.io/badge/arXiv-2301.02884-b31b1b.svg"></a>
|
28 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/sander-wood/tunesformer?duplicate=true"><img style="margin-top:0;margin-bottom:0" src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-md-dark.svg" alt="Duplicate Space"></a>
|
29 |
</div>
|
30 |
|
31 |
## ℹ️ How to use this demo?
|
32 |
1. Enter the control codes to set the musical form of the generated music. For details, please refer to the below "Control Codes" section. (optional)
|
33 |
-
2. Enter the
|
34 |
-
2. You can set the parameters (i.e., number of tunes, maximum
|
35 |
3. Click "Submit" and wait for the result.
|
36 |
-
4. The generated ABC notation can be
|
37 |
|
38 |
## 📝 Control Codes
|
39 |
-
|
40 |
|
41 |
-
-
|
42 |
-
- `[SECS_NS]`: controls the number of sections in the entire melody. This can be used to create a sense of structure and coherence within the melody, as different sections can be used to create musical themes or motifs. It counts on several symbols that are commonly used in ABC notation and can be used to represent section boundaries: `[|`,`||`,`|]`,`|:`,`::`, and `:|`. The value of `NS` ranges from 1 to 8, where 1 means one section and 8 means eight sections.
|
43 |
-
- `[SIM_EDS]`: controls the similarity between the generated music and the prefix. The value of `EDS` is the edit distance similarity level between the current section and a previous section in the melody. The value of EDS ranges from 0 to 10, where 0 means no similarity and 10 means the same section.
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
50 |
|
51 |
## ❕Notice
|
52 |
- If the prefix is given, you must also provide the control codes.
|
|
|
23 |
<div>
|
24 |
|
25 |
<a style="display:inline-block" href='https://github.com/sander-wood/tunesformer'><img src='https://img.shields.io/github/stars/sander-wood/tunesformer?style=social' /></a>
|
26 |
+
<a style="display:inline-block" href="https://huggingface.co/datasets/sander-wood/irishman"><img src="https://img.shields.io/badge/huggingface-dataset-ffcc66.svg"></a>
|
27 |
<a style="display:inline-block" href="https://arxiv.org/pdf/2301.02884.pdf"><img src="https://img.shields.io/badge/arXiv-2301.02884-b31b1b.svg"></a>
|
28 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/sander-wood/tunesformer?duplicate=true"><img style="margin-top:0;margin-bottom:0" src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-md-dark.svg" alt="Duplicate Space"></a>
|
29 |
</div>
|
30 |
|
31 |
## ℹ️ How to use this demo?
|
32 |
1. Enter the control codes to set the musical form of the generated music. For details, please refer to the below "Control Codes" section. (optional)
|
33 |
+
2. Enter the prompt of the generated music. You can set the control codes to set the musical form, ABC header (i.e., note length, tempo, meter, and key) and the motif of the melody. (optional)
|
34 |
+
2. You can set the parameters (i.e., number of tunes, maximum patch, top-p, top-k, temperature, random seed and show control code) for the generation. (optional)
|
35 |
3. Click "Submit" and wait for the result.
|
36 |
+
4. The generated ABC notation can be played or edited using [EasyABC]([ABC Sheet Music Editor - EasyABC](https://easyabc.sourceforge.net/), you can also use this [Online ABC Player](https://abc.rectanglered.com/) to render the tune.
|
37 |
|
38 |
## 📝 Control Codes
|
39 |
+
Inspired by [CTRL](https://huggingface.co/ctrl), we incorporate control codes into TunesFormer to represent musical forms. These codes, positioned ahead of the ABC notation, enable users to specify the structures of the generated tunes. The following control codes are introduced:
|
40 |
|
41 |
+
- **S:number of sections**: determines the number of sections in the entire melody. It counts on several symbols that can be used to represent section boundaries: `[|`, `||`, `|]`, `|:`, `::`, and `:|`. In our dataset, the range is 1 to 8 (e.g., `S:1` for a single-section melody, and `S:8` for a melody with eight sections).
|
|
|
|
|
42 |
|
43 |
+
- **B:number of bars**: specifies the desired number of bars within a section. It counts on the bar symbol `|`. In our dataset, the range is 1 to 32 (e.g., `B:1` for a one-bar section, and `B:32` for a section with 32 bars).
|
44 |
|
45 |
+
- **E:edit distance similarity**: controls the similarity level between the current section $c$ and a previous section $p$ in the melody. It is based on the Levenshtein distance $lev(c,p)$ , quantifying the difference between sections for creating variations or contrasts. Mathematically, it can be expressed as:
|
46 |
+
```
|
47 |
+
eds(c,p) = 1 - lev(c,p) / max(|c|,|p|)
|
48 |
+
```
|
49 |
+
where $|c|$ and $|p|$ are the string lengths of the two sections. It is discretized into 11 levels, ranging from no match at all to an exact match (e.g., `E:0` for no similarity, and `E:10` for an exact match).
|
50 |
|
51 |
## ❕Notice
|
52 |
- If the prefix is given, you must also provide the control codes.
|