Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 1.21 KB

NotationParser.md

File metadata and controls

78 lines (54 loc) · 1.21 KB

NotationParser

A tool to convert digital musical notation to pwm rate and duration. You can use this tool to make the buzzer play nice music.

TODO

  • Rate control
    • Pitch
    • Semitone
    • Octave
    • Pause
    • Key Signature
    • Pre-raised
  • Time control
    • BPM
    • Time Signature
    • Note
    • Mordent
    • Tie

Sample code

parser = NotationParser()

parser.setKeySignature('C')
parser.setPreRaised(0)
parser.setBPM(120)
parser.setTimeSignature(4)

print(parser.parseNotation('+3..'))

Use

Init

parser = NotationParser()

Set key signature

Set key signature like 1=C.

parser.setKeySignature('C')

Set pre-raised scale

The frequency division capability of the PWM pins of some chips is limited. In order to make the played music still conform to the law, the octave can be raised or lowered uniformly.

parser.setPreRaised(0)

Set BPM

parser.setBPM(120)

Set time signature

Set time signature like 4/4.

parser.setTimeSignature(4)

Get pwm rate and duration

parser.parseNotation('+3..')