sander-wood commited on
Commit
9f63654
·
1 Parent(s): 381a078

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -12
README.md CHANGED
@@ -18,23 +18,24 @@ In [CLaMP: Contrastive Language-Music Pre-training for Cross-Modal Symbolic Musi
18
 
19
  WikiMT is a unique resource to support the evaluation of semantic search and music classification. However, it is important to acknowledge that the dataset was curated from publicly available sources, and there may be limitations concerning the accuracy and completeness of the genre and description information. Further research is needed to explore the potential biases and limitations of the dataset and to develop strategies to address them.
20
 
21
- ## How to Obtain ABC Notation Music Scores
22
 
23
- To access ABC notation music scores from the WikiMT dataset, follow these steps:
24
 
25
- 1. **Download WikiMT Metadata:** Get the metadata file for WikiMT [here](https://huggingface.co/datasets/sander-wood/wikimusictext/resolve/main/wikimusictext.jsonl). This file has important dataset information.
26
 
27
- 2. **Get the `xml2abc.py` Script:** Download the `xml2abc.py` script from [this link](https://wim.vree.org/svgParse/xml2abc.html) and save it in your local directory.
 
 
 
28
 
29
- 3. **Find Wikifonia MusicXML Data Link:** Locate a download link for the Wikifonia dataset in MusicXML format (with .mxl extension). You can search the internet or Wikifonia-related websites for it.
 
 
30
 
31
- 4. **Run the Provided Code:** After acquiring the WikiMT metadata, the `xml2abc.py` script, and the Wikifonia MusicXML data link, execute the provided Python code below. It'll prompt you for the Wikifonia data URL, like this:
32
 
33
- ```python
34
- Enter the Wikifonia URL: [Paste your URL here]
35
- ```
36
-
37
- Paste your URL pointing to the Wikifonia.zip file and press Enter. The code will take care of downloading, processing, and extracting the music content, making it ready for your research or applications.
38
 
39
  ```python
40
  import subprocess
@@ -81,7 +82,7 @@ def filter(lines):
81
  def load_music(filename):
82
  # Convert the file to ABC notation
83
  p = subprocess.Popen(
84
- f'cmd /u /c python xml2abc.py -m 2 -c 6 -x "{filename}"',
85
  stdout=subprocess.PIPE,
86
  stderr=subprocess.PIPE,
87
  shell=True
@@ -120,6 +121,24 @@ def download_and_extract(url):
120
  else:
121
  print("Failed to download the file. HTTP response code:", response.status_code)
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  # Download the Wikifonia dataset
124
  wikifonia_url = input("Enter the Wikifonia URL: ")
125
  download_and_extract(wikifonia_url)
 
18
 
19
  WikiMT is a unique resource to support the evaluation of semantic search and music classification. However, it is important to acknowledge that the dataset was curated from publicly available sources, and there may be limitations concerning the accuracy and completeness of the genre and description information. Further research is needed to explore the potential biases and limitations of the dataset and to develop strategies to address them.
20
 
21
+ ## How to Access Music Score Metadata for ABC Notation
22
 
23
+ To access metadata related to ABC notation music scores from the WikiMT dataset, follow these steps:
24
 
25
+ 1. **Locate the Wikifonia MusicXML Data Link:** Start by visiting the discussion thread on the forum to find the download link for the Wikifonia dataset in MusicXML format (with a .mxl extension). You can find the discussion here: [Download for Wikifonia all 6,675 Lead Sheets](http://www.synthzone.com/forum/ubbthreads.php/topics/384909/Download_for_Wikifonia_all_6,6).
26
 
27
+ 2. **Run the Provided Code:** Once you have found the Wikifonia MusicXML data link, execute the provided Python code below. This code will handle the following tasks:
28
+ - Automatically download the "wikimusictext.jsonl" dataset, which contains metadata associated with music scores.
29
+ - Automatically download the "xml2abc.py" conversion script, with special thanks to the author, Willem (Wim).
30
+ - Prompt you for the Wikifonia data URL, as follows:
31
 
32
+ ```python
33
+ Enter the Wikifonia URL: [Paste your URL here]
34
+ ```
35
 
36
+ Paste the URL pointing to the Wikifonia.zip file and press Enter.
37
 
38
+ The below code will take care of downloading, processing, and extracting the music score metadata, making it ready for your research or applications.
 
 
 
 
39
 
40
  ```python
41
  import subprocess
 
82
  def load_music(filename):
83
  # Convert the file to ABC notation
84
  p = subprocess.Popen(
85
+ f'cmd /u /c python xml2abc_145/xml2abc.py -m 2 -c 6 -x "{filename}"',
86
  stdout=subprocess.PIPE,
87
  stderr=subprocess.PIPE,
88
  shell=True
 
121
  else:
122
  print("Failed to download the file. HTTP response code:", response.status_code)
123
 
124
+ # URL of the JSONL file
125
+ wikimt_url = "https://huggingface.co/datasets/sander-wood/wikimusictext/resolve/main/wikimusictext.jsonl"
126
+
127
+ # Local filename to save the downloaded file
128
+ local_filename = "wikimusictext.jsonl"
129
+
130
+ # Download the file and save it locally
131
+ response = requests.get(wikimt_url)
132
+ if response.status_code == 200:
133
+ with open(local_filename, 'wb') as file:
134
+ file.write(response.content)
135
+ print(f"Downloaded '{local_filename}' successfully.")
136
+ else:
137
+ print(f"Failed to download. Status code: {response.status_code}")
138
+
139
+ # Download the xml2abc.py script (special thanks to Wim Vree for creating this script)
140
+ download_and_extract("https://wim.vree.org/svgParse/xml2abc.py-145.zip")
141
+
142
  # Download the Wikifonia dataset
143
  wikifonia_url = input("Enter the Wikifonia URL: ")
144
  download_and_extract(wikifonia_url)