Skip to content

Commit a220d62

Browse files
committed
Updating MusicXML test
1 parent 8674c36 commit a220d62

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

test/musicxml/creating.jl

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using MusicXML
22

3+
@MX begin
4+
35
## Part List
46
### Piano
57
midiinstrument_piano = MidiInstrument(channel= 1, program =1, volume = 100, pan =0, id = "P1-I1")
@@ -24,20 +26,20 @@ attributes1_piano = Attributes(
2426
)
2527

2628
measure1_notes_piano = [
27-
NoteX(pitch = Pitch(step = "C", alter = 0, octave = 4), duration = 4),
28-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 4),
29-
NoteX(pitch = Pitch(step = "E", alter = 0, octave = 4), duration = 4),
30-
NoteX(pitch = Pitch(step = "F", alter = +1, octave = 4), duration = 4),
29+
Note(pitch = Pitch(step = "C", alter = 0, octave = 4), duration = 4),
30+
Note(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 4),
31+
Note(pitch = Pitch(step = "E", alter = 0, octave = 4), duration = 4),
32+
Note(pitch = Pitch(step = "F", alter = +1, octave = 4), duration = 4),
3133
]
3234

3335
measure2_notes_piano = [
34-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 5), duration = 1),
35-
NoteX(pitch = Pitch(step = "G", alter = +1, octave = 5), duration = 1),
36-
NoteX(pitch = Pitch(step = "B", alter = 0, octave = 5), duration = 1),
37-
NoteX(pitch = Pitch(step = "A", alter = +1, octave = 5), duration = 1),
38-
NoteX(rest = Rest(), duration = 4), # Rest
39-
NoteX(pitch = Pitch(step = "A", alter = 0, octave = 5), duration = 4),
40-
NoteX(pitch = Pitch(step = "B", alter = 0, octave = 5), duration = 4),
36+
Note(pitch = Pitch(step = "G", alter = 0, octave = 5), duration = 1),
37+
Note(pitch = Pitch(step = "G", alter = +1, octave = 5), duration = 1),
38+
Note(pitch = Pitch(step = "B", alter = 0, octave = 5), duration = 1),
39+
Note(pitch = Pitch(step = "A", alter = +1, octave = 5), duration = 1),
40+
Note(rest = Rest(), duration = 4), # Rest
41+
Note(pitch = Pitch(step = "A", alter = 0, octave = 5), duration = 4),
42+
Note(pitch = Pitch(step = "B", alter = 0, octave = 5), duration = 4),
4143
]
4244

4345
measures_piano = [
@@ -61,30 +63,30 @@ attributes1_guitar = Attributes(
6163

6264
measure1_notes_guitar = [
6365
# G Major chord for a bar
64-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 16, chord = Chord()),
65-
NoteX(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 16, chord = Chord()),
66-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 16, chord = Chord()),
67-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 16, chord = Chord()),
68-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 16, chord = Chord()),
69-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 16, chord = Chord()),
66+
Note(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 16, chord = Chord()),
67+
Note(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 16, chord = Chord()),
68+
Note(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 16, chord = Chord()),
69+
Note(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 16, chord = Chord()),
70+
Note(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 16, chord = Chord()),
71+
Note(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 16, chord = Chord()),
7072
]
7173

7274
measure2_notes_guitar = [
7375
# G Major chord for half a bar
74-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 8, chord = Chord()),
75-
NoteX(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 8, chord = Chord()),
76-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 8, chord = Chord()),
77-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 8, chord = Chord()),
78-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 8, chord = Chord()),
79-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 8, chord = Chord()),
76+
Note(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 8, chord = Chord()),
77+
Note(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 8, chord = Chord()),
78+
Note(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 8, chord = Chord()),
79+
Note(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 8, chord = Chord()),
80+
Note(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 8, chord = Chord()),
81+
Note(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 8, chord = Chord()),
8082

8183
# G Major chord for half a bar
82-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 8, chord = Chord()),
83-
NoteX(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 8, chord = Chord()),
84-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 8, chord = Chord()),
85-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 8, chord = Chord()),
86-
NoteX(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 8, chord = Chord()),
87-
NoteX(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 8, chord = Chord()),
84+
Note(pitch = Pitch(step = "G", alter = 0, octave = 2), duration = 8, chord = Chord()),
85+
Note(pitch = Pitch(step = "B", alter = 0, octave = 2), duration = 8, chord = Chord()),
86+
Note(pitch = Pitch(step = "D", alter = 0, octave = 3), duration = 8, chord = Chord()),
87+
Note(pitch = Pitch(step = "G", alter = 0, octave = 3), duration = 8, chord = Chord()),
88+
Note(pitch = Pitch(step = "D", alter = 0, octave = 4), duration = 8, chord = Chord()),
89+
Note(pitch = Pitch(step = "G", alter = 0, octave = 4), duration = 8, chord = Chord()),
8890
]
8991

9092
measures_guitar = [
@@ -101,5 +103,6 @@ partlist = partlist,
101103
parts = [part_piano, part_guitar],
102104
)
103105

106+
end # @MX
104107

105108
writemusicxml("myscore.musicxml", score)

test/musicxml/musicxml.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ cd(@__DIR__)
44

55
@testset "parsing example" begin
66
include("parsing.jl")
7-
@test scorepartwise isa ScorePartwise
8-
@test scoreparts isa Vector{ScorePart}
9-
@test parts isa Vector{Part}
7+
@test scorepartwise isa MX.ScorePartwise
8+
@test scoreparts isa Vector{MX.ScorePart}
9+
@test parts isa Vector{MX.Part}
1010
end
1111

1212
@testset "creating example" begin

0 commit comments

Comments
 (0)