Skip to content

Commit 7d5a45d

Browse files
committed
New tune for multiple voices
- also changed http to https - fixed link to abcmidi page
1 parent 75cc4a5 commit 7d5a45d

File tree

2 files changed

+65
-37
lines changed

2 files changed

+65
-37
lines changed

easy_abc.py

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22

3-
program_name = 'EasyABC 1.3.7.8 2020-10-10'
3+
program_name = 'EasyABC 1.3.7.9 2020-12-31'
44

55
# Copyright (C) 2011-2014 Nils Liberg (mail: kotorinl at yahoo.co.uk)
66
# Copyright (C) 2015-2020 Seymour Shlien (mail: [email protected]), Jan Wybren de Jong (jw_de_jong at yahoo dot com)
@@ -16,7 +16,7 @@
1616
# GNU Lesser General Public License for more details.
1717
#
1818
# You should have received a copy of the GNU Lesser General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2020
#
2121

2222
# V1.3.7.8
@@ -448,7 +448,7 @@ def upload_tune(tune, author):
448448
text = '(:music:)\n%s\n(:musicend:)\n' % tune.strip()
449449
if not browser:
450450
browser = mechanize.Browser()
451-
response = browser.open('http://www.folkwiki.se/Meta/Nyl%c3%a5t?n=Meta.Nyl%c3%a5t&base=Musik.Musik&action=newnumbered')
451+
response = browser.open('https://www.folkwiki.se/Meta/Nyl%c3%a5t?n=Meta.Nyl%c3%a5t&base=Musik.Musik&action=newnumbered')
452452
response = response.read()
453453
import pdb; pdb.set_trace()
454454
m = re.search(r"img src='(.*?action=captchaimage.*?)'", response)
@@ -543,7 +543,7 @@ def copy_bar_symbols_from_first_voice(abc):
543543
return abc
544544

545545
def process_MCM(abc):
546-
""" Processes sticky rhythm feature of mcmusiceditor http://www.mcmusiceditor.com/download/sticky-rhythm.pdf
546+
""" Processes sticky rhythm feature of mcmusiceditor https://www.mcmusiceditor.com/download/sticky-rhythm.pdf
547547
:param abc: abc possibly containing sticky rhythm
548548
:return: abc-compliant
549549
"""
@@ -1181,7 +1181,7 @@ def process_abc_for_midi(abc_code, header, cache_dir, settings, tempo_multiplier
11811181
per the instructions in the ABC Settings/abc2midi and voices. If the tune already contains these instructions, eg. %%MIDI program,
11821182
%%MIDI chordprog, etc. then the function avoids changing these assignments by suppressing the output of the additional commands.
11831183
Note that these assignments can also be embedded in the body of the tune using the instruction [I: MIDI = program 10] for
1184-
examples see http://ifdo.ca/~seymour/runabc/abcguide/abc2midi_guide.html and click link [I:MIDI=...].
1184+
examples see https://abcmidi.sourceforge.io/ and click link [I:MIDI=...].
11851185
'''
11861186
global execmessages
11871187
#print traceback.extract_stack(None, 5)
@@ -3690,7 +3690,7 @@ def __init__(self, parent, ID, app_dir, settings):
36903690
default_soundfont_path = os.environ.get('HOMEPATH', 'C:') + "\\SoundFonts\\FluidR3_GM.sf2"
36913691
else:
36923692
default_soundfont_path = '/usr/share/sounds/sf2/FluidR3_GM.sf2'
3693-
3693+
36943694
soundfont_path = settings.get('soundfont_path', default_soundfont_path)
36953695

36963696
if fluidsynth_available and soundfont_path and os.path.exists(soundfont_path):
@@ -3853,7 +3853,7 @@ def __init__(self, parent, ID, app_dir, settings):
38533853

38543854
# 1.3.6.3 [SS] 2015-05-04
38553855
self.statusbar.SetStatusText(_('This is the status bar. Check it occasionally.'))
3856-
execmessages = _('You are running {0} on {1}\nYou can get the latest version on http://sourceforge.net/projects/easyabc/\n'.format(program_name, wx.Platform))
3856+
execmessages = _('You are running {0} on {1}\nYou can get the latest version on https://sourceforge.net/projects/easyabc/\n'.format(program_name, wx.Platform))
38573857

38583858
def update_controls_using_settings(self):
38593859
# p09 Enable the play button if midiplayer_path is defined. 2014-10-14 [SS]
@@ -5617,7 +5617,7 @@ def OnAlignBars(self, evt):
56175617
lines.append(line)
56185618

56195619
# if there are more than two lines to align
5620-
if 2 <= len(lines) < 100:
5620+
if len(lines) >= 2:
56215621
# align the lines
56225622
lines = align_lines(tune.abc, lines, True)
56235623

@@ -6037,24 +6037,24 @@ def OnCheckLastestVersion(self, evt):
60376037
show_in_browser('https://sourceforge.net/projects/easyabc/files/EasyABC/')
60386038

60396039
def OnEasyABCHelp(self, evt):
6040-
show_in_browser('http://www.nilsliberg.se/ksp/easyabc/')
6040+
show_in_browser('https://www.nilsliberg.se/ksp/easyabc/')
60416041

60426042
def OnABCStandard(self, evt):
6043-
show_in_browser('http://abcnotation.com/wiki/abc:standard:v2.1')
6043+
show_in_browser('https://abcnotation.com/wiki/abc:standard:v2.1')
60446044

60456045
def OnABCLearn(self, evt):
6046-
show_in_browser('http://abcnotation.com/learn')
6046+
show_in_browser('https://abcnotation.com/learn')
60476047

60486048
# 1.3.6.1 [SS] 2015-01-28
60496049
def OnAbcm2psHelp(self, evt):
6050-
show_in_browser('http://moinejf.free.fr/abcm2ps-doc/')
6050+
show_in_browser('https://moinejf.free.fr/abcm2ps-doc/')
60516051

60526052
# 1.3.6.1 [SS] 2015-01-28
60536053
def OnAbc2midiHelp(self, evt):
6054-
show_in_browser('http://ifdo.ca/~seymour/runabc/abcguide/abc2midi_guide.html')
6054+
show_in_browser('https://abcmidi.sourceforge.io/')
60556055

60566056
def OnAbcCheatSheet(self, evt):
6057-
show_in_browser('http://www.stephenmerrony.co.uk/uploads/ABCquickRefv0_6.pdf')
6057+
show_in_browser('https://www.stephenmerrony.co.uk/uploads/ABCquickRefv0_6.pdf')
60586058

60596059
def OnClearCache(self, evt):
60606060
# make sure that any currently played/loaded midi file is released by the media control
@@ -8112,8 +8112,8 @@ class AboutFrame(wx.Dialog):
81128112
<center><img src="img/abclogo.png"/>
81138113
</center>
81148114
<p><b>{0}</b><br/>
8115-
an open source ABC editor for Windows, OSX and Linux. It is published under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU Public License</a>. </p>
8116-
<p><center><a href="http://www.nilsliberg.se/ksp/easyabc/">http://www.nilsliberg.se/ksp/easyabc/</a></center></p>
8115+
an open source ABC editor for Windows, OSX and Linux. It is published under the <a href="https://www.gnu.org/licenses/gpl-2.0.html">GNU Public License</a>. </p>
8116+
<p><center><a href="https://www.nilsliberg.se/ksp/easyabc/">https://www.nilsliberg.se/ksp/easyabc/</a></center></p>
81178117
<p><u>Features</u>:</p>
81188118
<ul style="line-height: 150%; margin-top: 3px;">
81198119
<li> Good ABC standard coverage thanks to internal use of abcm2ps and abc2midi
@@ -8139,28 +8139,28 @@ class AboutFrame(wx.Dialog):
81398139
<p><b>EasyABC</b> is brought to you by <b>Nils Liberg</b>, Copyright &copy; 2010-2012.</p>
81408140
<p><b>Credits</b> - software components used by EasyABC:</p>
81418141
<ul class="nicelist">
8142-
<li><a href="http://moinejf.free.fr/">abcm2ps</a> for converting ABC code to note images (developed/maintained by Jean-Fran&ccedil;ois Moine)</li>
8143-
<li><a href="http://abc.sourceforge.net/abcMIDI/">abc2midi</a> for converting ABC code to midi (by James Allwright, maintained by Seymour Shlien)</li>
8144-
<li><a href="http://wim.vree.org/svgParse/xml2abc.html">xml2abc</a> for converting from MusicXML to ABC (by Willem Vree)</li>
8145-
<li><a href="http://sites.google.com/site/juria90/nwc">nwc2xml</a> for converting from Noteworthy Composer format to ABC via XML (by James Lee)</li>
8146-
<li><a href="http://www.wxpython.org/">wxPython</a> cross-platform user-interface framework</li>
8147-
<li><a href="http://www.scintilla.org/">scintilla</a> for the text editor used for ABC code</li>
8148-
<li><a href="http://www.mxm.dk/products/public/pythonmidi">python midi package</a> for the initial parsing of midi files to be imported</li>
8149-
<li><a href="http://www.pygame.org/download.shtml">pygame</a> (which wraps <a href="http://sourceforge.net/apps/trac/portmedia/wiki/portmidi">portmidi</a>) for real-time midi input</li>
8150-
<li><a href="http://www.fluidsynth.org/">FluidSynth</a> for playing midi (and made fit for Python by <a href="https://wim.vree.org/svgParse/index.html">Willem Vree</a>)</li>
8142+
<li><a href="https://moinejf.free.fr/">abcm2ps</a> for converting ABC code to note images (developed/maintained by Jean-Fran&ccedil;ois Moine)</li>
8143+
<li><a href="https://abc.sourceforge.net/abcMIDI/">abc2midi</a> for converting ABC code to midi (by James Allwright, maintained by Seymour Shlien)</li>
8144+
<li><a href="https://wim.vree.org/svgParse/xml2abc.html">xml2abc</a> for converting from MusicXML to ABC (by Willem Vree)</li>
8145+
<li><a href="https://sites.google.com/site/juria90/nwc">nwc2xml</a> for converting from Noteworthy Composer format to ABC via XML (by James Lee)</li>
8146+
<li><a href="https://www.wxpython.org/">wxPython</a> cross-platform user-interface framework</li>
8147+
<li><a href="https://www.scintilla.org/">scintilla</a> for the text editor used for ABC code</li>
8148+
<li><a href="https://www.mxm.dk/products/public/pythonmidi">python midi package</a> for the initial parsing of midi files to be imported</li>
8149+
<li><a href="https://www.pygame.org/download.shtml">pygame</a> (which wraps <a href="https://sourceforge.net/apps/trac/portmedia/wiki/portmidi">portmidi</a>) for real-time midi input</li>
8150+
<li><a href="https://www.fluidsynth.org/">FluidSynth</a> for playing midi (and made fit for Python by <a href="https://wim.vree.org/svgParse/index.html">Willem Vree</a>)</li>
81518151
<li>Thanks to Guido Gonzato for providing the fields and command reference.
81528152
<li><br>Many thanks to the translators: Valerio&nbsp;Pelliccioni, Guido&nbsp;Gonzato&nbsp;(italian), Bendix&nbsp;R&oslash;dgaard&nbsp;(danish), Fr&eacute;d&eacute;ric&nbsp;Aup&eacute;pin&nbsp;(french), Bernard&nbsp;Weichel&nbsp;(german) and Jan&nbsp;Wybren&nbsp;de&nbsp;Jong&nbsp;(dutch).</li>
81538153
<li>Universal binaries of abcm2ps and abc2midi for OSX are available thanks to Chuck&nbsp;Boody.</li>
81548154
</ul>
81558155
81568156
<p><b>Links</b></p>
81578157
<ul class="nicelist">
8158-
<li><a href="http://abcnotation.com/">abcnotation.com</a></li>
8159-
<li><a href="http://abcplus.sourceforge.net/">abcplus.sourceforge.net</a></li>
8160-
<li><a href="http://moinejf.free.fr/">Jef Moine's abcm2ps page</a></li>
8161-
<li><a href="http://ifdo.ca/~seymour/runabc/top.html">Seymour Shlien's abcMIDI page</a></li>
8162-
<li><a href="http://www.folkinfo.org/">folkinfo.org</a> (uses code from EasyABC to support MusicXML to ABC conversion)</li>
8163-
<li><a href="http://www.folkwiki.se/">folkwiki.se - Swedish folk music</a> (my involvement here is the reason why I implemented the program)</li>
8158+
<li><a href="https://abcnotation.com/">abcnotation.com</a></li>
8159+
<li><a href="https://abcplus.sourceforge.net/">abcplus.sourceforge.net</a></li>
8160+
<li><a href="https://moinejf.free.fr/">Jef Moine's abcm2ps page</a></li>
8161+
<li><a href="https://abcmidi.sourceforge.io/">Seymour Shlien's abcMIDI page</a></li>
8162+
<li><a href="https://www.folkinfo.org/">folkinfo.org</a> (uses code from EasyABC to support MusicXML to ABC conversion)</li>
8163+
<li><a href="https://www.folkwiki.se/">folkwiki.se - Swedish folk music</a> (my involvement here is the reason why I implemented the program)</li>
81648164
</ul>
81658165
</body>
81668166
</html>

tune_actions.py

+34-6
Original file line numberDiff line numberDiff line change
@@ -1333,18 +1333,45 @@ def execute(self, context, params=None):
13331333
last_tune_id = context.get_last_tune_id()
13341334
new_tune_id = last_tune_id + 1
13351335
text = u'X:%d' % new_tune_id
1336-
text += os.linesep + 'T:' + _('Untitled') + '%d' % new_tune_id
1336+
text += os.linesep + 'T:' + _('Untitled') + ' %d' % new_tune_id
13371337
text += os.linesep + 'C:' + _('Unknown composer')
13381338
text += os.linesep + 'M:4/4'
13391339
text += os.linesep + 'L:1/4'
1340-
text += os.linesep + 'K:C' + os.linesep
1340+
text += os.linesep + 'Q:1/4=120'
1341+
text += os.linesep + self.key_and_body()
13411342

13421343
if not context.contains_text:
1343-
text = '%abc-2.1' + os.linesep + os.linesep + text
1344+
text = r'%abc-2.1' + os.linesep + os.linesep + text
13441345
elif context.previous_line and not context.previous_line.isspace():
13451346
text = os.linesep + text
13461347
context.insert_text(text)
13471348

1349+
def key_and_body(self):
1350+
return 'K:C' + os.linesep
1351+
1352+
1353+
class NewMultiVoiceTuneAction(NewTuneAction):
1354+
def __init__(self):
1355+
super(NewTuneAction, self).__init__('new_multivoice_tune', display_name=_('New tune with multiple voices'))
1356+
1357+
def key_and_body(self):
1358+
text = 'V:S clef=treble name=S'
1359+
text += os.linesep + 'V:A clef=treble name=A'
1360+
text += os.linesep + 'V:T clef=treble name=T'
1361+
text += os.linesep + 'V:B clef=treble name=B'
1362+
text += os.linesep + r'%%score [ (S A) (T B) ]'
1363+
text += os.linesep + 'K:C'
1364+
text += os.linesep + r'% ' + _('below the notes for each voice')
1365+
text += os.linesep + 'V:S'
1366+
text += os.linesep + 'c'
1367+
text += os.linesep + 'V:A'
1368+
text += os.linesep + 'G'
1369+
text += os.linesep + 'V:T'
1370+
text += os.linesep + 'E'
1371+
text += os.linesep + 'V:B'
1372+
text += os.linesep + 'C'
1373+
return text
1374+
13481375

13491376
class NewVoiceAction(AbcAction):
13501377
voice_re = re.compile(r'(?m)^V:\s*(\d+)')
@@ -1788,6 +1815,7 @@ def __init__(self, elements):
17881815
self.registered_actions = {}
17891816
self.register_actions([
17901817
NewTuneAction(),
1818+
NewMultiVoiceTuneAction(),
17911819
NewNoteOrRestAction(),
17921820
NewLineAction(),
17931821
RemoveAction(),
@@ -1843,10 +1871,10 @@ def __init__(self, elements):
18431871
])
18441872

18451873
self.action_handlers = {
1846-
'empty_document' : self.create_handler(['new_tune']),
1874+
'empty_document' : self.create_handler(['new_tune', 'new_multivoice_tune']),
18471875
'abcversion' : self.create_handler(['lookup_abc_standard']),
1848-
'empty_line' : self.create_handler(['new_tune']),
1849-
'empty_line_file_header' : self.create_handler(['new_tune']),
1876+
'empty_line' : self.create_handler(['new_tune', 'new_multivoice_tune']),
1877+
'empty_line_file_header' : self.create_handler(['new_tune', 'new_multivoice_tune']),
18501878
'empty_line_tune' : self.create_handler(['new_tune', 'new_note', 'insert_field_on_empty_line']),
18511879
'Whitespace' : self.create_handler(['new_note', 'insert_field', 'remove']),
18521880
'Note' : self.create_handler(['new_note', 'change_accidental', 'change_note_duration', 'change_pitch', 'add_decoration_to_note', 'add_annotation_or_chord_to_note', 'insert_field', 'remove']),

0 commit comments

Comments
 (0)