You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,46 +9,142 @@ A **work-in-progress** implementation of the [musicXML](https://www.musicxml.com
9
9
10
10
The goal of this project is to allow Swift users to read, manipulate, and write musicXML files in a richly-typed manner on any platform supported by Swift.
11
11
12
-
## Roadmap
12
+
## Hello, world!
13
+
14
+
Let's construct the "Hello, world!" score example from the [musicXML documentation](https://www.musicxml.com/tutorial/hello-world/). This musical composition consists of one measure that contains a whole note on middle C, based in 4/4 time.
15
+
16
+
### Graphical Representation
17
+
18
+
When rendered graphically, this score example should look something like this:
The upcoming pre-release versions will be focused on completing different tasks.
66
+
### Constructing the "Hello, world!" example using the `MusicXML` library
15
67
16
-
### 0.3.0
68
+
Let's build up this musical example from the ground up, using the `MusicXML` library.
17
69
18
-
Pre-release version **0.3.0**will be defined by completing the implementation of the **encoding** of **abstract musical content**. The LilyPond Test Suite tests will be transformed into round-trip tests to ensure that the plumbing is clean.
70
+
First, we will create our whole note:
19
71
20
-
### 0.4.0
72
+
```Swift
73
+
let note =Note(
74
+
pitch: Pitch(step: .c, octave: 4),
75
+
duration: 4,
76
+
type: .whole
77
+
)
78
+
```
21
79
22
-
Pre-release version **0.4.0** will be defined by refining the public interfaces exposed by the `MusicXML` package. Up until this point, pubic initializers may be somewhat clumsy.
80
+
Let's establish our `Key`, `Time`, and `Clef`:
23
81
24
-
## Getting Started
82
+
```Swift
83
+
let key =Key(fifths: 0)
84
+
let time =Time(4,4)
85
+
let clef =Clef(sign: .g, line: 2)
86
+
```
25
87
26
-
### Requirements
88
+
We can bundle these attributes up:
27
89
28
-
Use the [Swift Package Manager](https://swift.org/package-manager/) to include the `MusicXML` module into your project.
90
+
```Swift
91
+
let attributes =Attributes(
92
+
divisions: 1,
93
+
keys: [key],
94
+
times: [time],
95
+
clefs: [clef]
96
+
)
97
+
```
29
98
30
-
### Usage
99
+
Now, we have all the information we need to put together our single measure. In this case, we are traversing the score in a partwise fashion, so we will create a `Partwise.Measure`. Otherwise, we would create a `Timewise.Measure`.
31
100
32
-
If you want to use the `MusicXML` module in your own project, add the `MusicXML` package to the `dependencies` section of your `Package.swift` file:
101
+
```Swift
102
+
let measure = Partwise.Measure(
103
+
number: "1",
104
+
musicData: [
105
+
.attributes(attributes),
106
+
.note(note)
107
+
]
108
+
)
109
+
```
110
+
111
+
We have all of the musical information under control, so let's do some administrative work to declare who is playing this music. We will start by creating a single part. Again, as we are traversing the score in a partwise fashion, we will create a `Partwise.Part`, rather than a `Timewise.Part`. We can keep track of this part by its identifier, `"P1"`.
If you decode the musicXML representation of our "Hello, world!" composition, you will get a value equivalent to the one you have built by hand above.
157
+
158
+
### 🚧 Work-in-progress: Encoding a `MusicXML.Score` into musicXML
159
+
160
+
[Pre-release version 0.3.0](https://github.com/dn-m/MusicXML/milestone/1) will see the completion of the encoding from a `MusicXML.Score` into the musicXML format.
161
+
162
+
163
+
## Getting Started
164
+
165
+
### Requirements
166
+
167
+
Use the [Swift Package Manager](https://swift.org/package-manager/) to include the `MusicXML` module into your project.
168
+
169
+
### Usage
170
+
171
+
If you want to use the `MusicXML` module in your own project, add the `MusicXML` package to the `dependencies` section of your `Package.swift` file:
To contribute to the `MusicXML` package, clone the `git` repository:
@@ -83,6 +208,19 @@ If you use the Xcode IDE, use the Swift Package Manager to generate an `.xcodepr
83
208
swift package generate-xcodeproj
84
209
```
85
210
211
+
### Development Roadmap
212
+
213
+
The upcoming pre-release versions will be focused on completing different tasks.
214
+
215
+
### 0.3.0
216
+
217
+
Pre-release version **0.3.0** will be defined by completing the implementation of the **encoding** of **abstract musical content**. The LilyPond Test Suite tests will be transformed into round-trip tests to ensure that the plumbing is clean.
218
+
219
+
### 0.4.0
220
+
221
+
Pre-release version **0.4.0** will be defined by refining the public interfaces exposed by the `MusicXML` package. Up until this point, pubic initializers may be somewhat clumsy.
222
+
223
+
86
224
## More Resources
87
225
88
226
See the [MusicXML XSD Schema Reference](http://usermanuals.musicxml.com/MusicXML/MusicXML.htm#MusicXMLReference.htm%3FTocPath%3DMusicXML%2520Reference%7C_____0) for more information about how musicXML is structured.
0 commit comments