jwdj / EasyABC

EasyABC
GNU General Public License v2.0
87 stars 36 forks source link

BarFly mode behavioural change #86

Open markblinkhorn opened 6 months ago

markblinkhorn commented 6 months ago

Has anyone else experienced problems with BarFly mode? This used to work but recent versions do not.

Using this example ABC file - temp.abc

X:55
%%MIDI control 7 96
%%MIDI control 10 64
%%MIDI program 0
%%rightmargin 0.8cm
%%leftmargin 0.8cm
%%partsbox true
%%MIDI stressmodel 2
T:Barfly
M:6/8
R:jig
L:1/8
Q:1/4=120
K:G
%%MIDI control 7 96
BAGGAB | BAGGAB | BAGGAB | BAGGAB | BAGGAB | BAGGAB |

This does not work - the midi output file is NOT stressed:

C:\Users\markb.SMBCONSULT\AppData\Local\EasyABC\cache>"\Program Files (x86)\EasyABC\bin\abc2midi.exe" temp.abc -o fred.midi -BF -TT 440
afreq = 440.000000 semitone_shift = 0.000000
bend = 8192
4.61 October 11 2021 abc2midi
writing MIDI file fred.midi
**warning stressmodel is ignored without -BF runtime option

but this does work:

C:\Users\markb.SMBCONSULT\AppData\Local\EasyABC\cache>"\Program Files (x86)\EasyABC\bin\abc2midi.exe" temp.abc -o fred.midi -BF -TT 440 -BF
afreq = 440.000000 semitone_shift = 0.000000
bend = 8192
4.61 October 11 2021 abc2midi
writing MIDI file fred.midi

The -BF parameter to abc2midi seems to have become positional when it never used to be. It only works if it is the LAST parameter seen by abc2midi. Further, EasyABC emits the -BF parameter before all others and this now breaks BarFly.

OS makes no difference - problem occurs on both Windows EasyABC 1.3.8.6 and Linux EasyABC 1.3.8.7

markblinkhorn commented 6 months ago

Shuffling the order of the conditional statements in easy_abc.py (at line 1400 onwards) does resolve this issue - but only if you are running the Python directly:

# 1.3.6 [SS] 2014-11-24
def add_abc2midi_options(cmd, settings, add_follow_score_markers):
    if str2bool(settings['nofermatas']):
        cmd.append('-NFER')
    if str2bool(settings['nograce']):
        cmd.append('-NGRA')
    if str2bool(settings['nodynamics']):
        cmd.append('-NFNP')
    # 1.3.6.3 [SS] 2015-03-20
    if settings['tuning'] != '440':
        cmd.append('-TT %s' % settings['tuning'])
    # 1.3.6.4 [JWDJ] 2016-06-22
    if add_follow_score_markers:
        cmd.append('-EA')
    if str2bool(settings['barfly']):
        cmd.append('-BF')
    return cmd
markblinkhorn commented 5 months ago

Update: latest version of abc2midi has same problem

C:\Users\markb.SMBCONSULT\EasyABC\bin>abc2midi.exe temp.abc -o fred.midi -BF -TT 440
afreq = 440.000000 semitone_shift = 0.000000
bend = 8192
4.91 March 02 2024 abc2midi
writing MIDI file fred.midi
**warning stressmodel is ignored without -BF runtime option