God with us

하나님은 우리와 함께하십니다.

8. 자작곡 4마디 작업예제와 MuseScore

언제 쓰나: 앞에서 배운 뼈대, divisions, 음표, <lyric>, <harmony>를 한 파일에 모아 실제로 동작하는 4마디 찬양 후렴 악보를 만든다. 아래 XML을 그대로 저장해 MuseScore에서 열어 보면 바로 악보·코드·한글 가사·재생까지 확인할 수 있다.

1. 4마디 찬양 후렴 구성 한눈에 보기

키: G Major (fifths=1) 박자: 4/4 (divisions=4) 템포: ♩ = 76
1마디 G B4(4) D5(4) G4(2) A4(2) B4(4) 주 님 을 찬 양
2마디 D/F# A4(8) F#4(4) A4(4) 해 온 맘
3마디 Em7 · C G4(4) E4(4) G4(4) C5(4) 다 해 노 래
4마디 D · G A4(6) B4(2) G4(8) 해___ 영 원 히

2. 완성 MusicXML 원본 (chorus-4bars.musicxml)

chorus-4bars.musicxmlMusicXML 4.0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC
  "-//Recordare//DTD MusicXML 4.0 Partwise//EN"
  "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
  <work><work-title>후렴 4마디 예제</work-title></work>
  <identification>
    <creator type="composer">나쥬니</creator>
  </identification>
  <part-list>
    <score-part id="P1"><part-name>Vocal</part-name></score-part>
  </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>4</divisions>
        <key><fifths>1</fifths><mode>major</mode></key>
        <time><beats>4</beats><beat-type>4</beat-type></time>
        <clef><sign>G</sign><line>2</line></clef>
      </attributes>
      <direction placement="above">
        <direction-type>
          <metronome><beat-unit>quarter</beat-unit><per-minute>76</per-minute></metronome>
        </direction-type>
        <sound tempo="76"/>
      </direction>
      <harmony>
        <root><root-step>G</root-step></root>
        <kind text="">major</kind>
      </harmony>
      <note>
        <pitch><step>B</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>주</text></lyric>
      </note>
      <note>
        <pitch><step>D</step><octave>5</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>님</text></lyric>
      </note>
      <note>
        <pitch><step>G</step><octave>4</octave></pitch>
        <duration>2</duration><type>eighth</type>
        <lyric number="1"><syllabic>single</syllabic><text>을</text></lyric>
      </note>
      <note>
        <pitch><step>A</step><octave>4</octave></pitch>
        <duration>2</duration><type>eighth</type>
        <lyric number="1"><syllabic>single</syllabic><text>찬</text></lyric>
      </note>
      <note>
        <pitch><step>B</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>양</text></lyric>
      </note>
    </measure>

    <measure number="2">
      <harmony>
        <root><root-step>D</root-step></root>
        <kind text="">major</kind>
        <bass><bass-step>F</bass-step><bass-alter>1</bass-alter></bass>
      </harmony>
      <note>
        <pitch><step>A</step><octave>4</octave></pitch>
        <duration>8</duration><type>half</type>
        <lyric number="1"><syllabic>single</syllabic><text>해</text></lyric>
      </note>
      <note>
        <pitch><step>F</step><alter>1</alter><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>온</text></lyric>
      </note>
      <note>
        <pitch><step>A</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>맘</text></lyric>
      </note>
    </measure>

    <measure number="3">
      <harmony>
        <root><root-step>E</root-step></root>
        <kind text="m7">minor-seventh</kind>
      </harmony>
      <note>
        <pitch><step>G</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>다</text></lyric>
      </note>
      <note>
        <pitch><step>E</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>해</text></lyric>
      </note>
      <harmony>
        <root><root-step>C</root-step></root>
        <kind text="">major</kind>
      </harmony>
      <note>
        <pitch><step>G</step><octave>4</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>노</text></lyric>
      </note>
      <note>
        <pitch><step>C</step><octave>5</octave></pitch>
        <duration>4</duration><type>quarter</type>
        <lyric number="1"><syllabic>single</syllabic><text>래</text></lyric>
      </note>
    </measure>

    <measure number="4">
      <harmony>
        <root><root-step>D</root-step></root>
        <kind text="">major</kind>
      </harmony>
      <note>
        <pitch><step>A</step><octave>4</octave></pitch>
        <duration>6</duration><type>quarter</type><dot/>
        <notations><slur type="start" number="1"/></notations>
        <lyric number="1"><syllabic>single</syllabic><text>해</text><extend type="start"/></lyric>
      </note>
      <note>
        <pitch><step>B</step><octave>4</octave></pitch>
        <duration>2</duration><type>eighth</type>
        <notations><slur type="stop" number="1"/></notations>
        <lyric number="1"><extend type="stop"/></lyric>
      </note>
      <harmony>
        <root><root-step>G</root-step></root>
        <kind text="">major</kind>
      </harmony>
      <note>
        <pitch><step>G</step><octave>4</octave></pitch>
        <duration>8</duration><type>half</type>
        <lyric number="1"><syllabic>single</syllabic><text>주</text></lyric>
      </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
      </barline>
    </measure>
  </part>
</score-partwise>

3. MuseScore 확인과 Python 반복 편집

  1. MuseScore에서 열기: chorus-4bars.musicxml을 MuseScore로 열면 오선보·코드 기호·한글 가사가 한 번에 렌더된다. 도구 → 조옮김으로 F장조나 A장조로 바꿔 보면 멜로디와 코드가 함께 이조된다.
  2. PDF·MP3 내보내기: 검수가 끝나면 MuseScore의 파일 → 내보내기로 인쇄용 PDF와 확인용 MP3를 한 번에 뽑을 수 있다.
  3. 반복 수정 자동화: 여러 곡의 템포나 작곡가 표기, 가사 오타를 일괄 정리할 때는 Python 표준 라이브러리 xml.etree.ElementTree로 .musicxml을 직접 읽고 고칠 수 있다.
update_tempo.py — 템포 일괄 변경 예시Python
import xml.etree.ElementTree as ET

tree = ET.parse("chorus-4bars.musicxml")
root = tree.getroot()

for pm in root.findall(".//metronome/per-minute"):
    pm.text = "72"
for sound in root.findall(".//sound[@tempo]"):
    sound.set("tempo", "72")

tree.write("chorus-4bars-72.musicxml", encoding="utf-8", xml_declaration=True)

최종 확인일: 2026-11-28