abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

%%MIDI gchord sometimes drops in booms and chicks where it shouldn't...

Open seisiuneer opened this issue 8 months ago • 0 comments

I'm seeing an issue with note-only gchord strings, this generates an unwanted boom at the end of the parts on the chord changes at the second half of the first and second endings.

X: 1 T: Cooley's C: Traditional R: Reel M: 4/4 L: 1/8 Q: 1/2=90 K: Edor % % Use an Acoustic Grand Piano sound for the melody: %%MIDI program 0 % % Use an Acoustic Grand Piano sound for the chords: %%MIDI chordprog 0 % % Use an Synth Bass sound for the bass: %%MIDI bassprog 38 % %%MIDI gchord ghijjihg |:"Em"EBBA B2 EB|B2 AB dBAG|"D"F/E/D AD BDAD|F/E/D AD BAGF| "Em"EBBA B2 EB|B2 AB defg|"D"afge dBAF|1 DEFD "Em"E3D:|2 DEFD "Em"E2gf|| |:"Em"eB (3BBB eBgf|eBB2 gedB|"D"A/A/A FA DAFA|A/A/A FA defg| "Em"eB (3BBB eBgf|eBBB defg|"D"afge dBAF|1 DEFD "Em"E2gf:|2 DEFD "Em"E4|]

The issue is I'm thinking somewhere in this code:

for (var p = 0; p < minLength; p++) { if (p > 0 && currentChordsExpanded[p - 1] && currentChordsExpanded[p] && currentChordsExpanded[p - 1].boom !== currentChordsExpanded[p].boom){ firstBoom = true; } var type = thisPattern[p]; var isBoom = type.indexOf('boom') >= 0; // If we changed chords at a time when we're not expecting a bass note, then add an extra bass note in. var newBass = !isBoom && p !== 0 && (!currentChordsExpanded[p - 1] || currentChordsExpanded[p - 1].boom !== currentChordsExpanded[p].boom);

I made it somewhat better by adding setting newBass and isBoom to false in some cases, but I'm sure I have it wrong.

for (var p = 0; p < minLength; p++) {
if (p > 0 && currentChordsExpanded[p - 1] && currentChordsExpanded[p] && currentChordsExpanded[p - 1].boom !== currentChordsExpanded[p].boom){
  firstBoom = true;
}
var type = thisPattern[p];
var isBoom = type.indexOf('boom') >= 0;
// If we changed chords at a time when we're not expecting a bass note, then add an extra bass note in.
var newBass = !isBoom && p !== 0 && (!currentChordsExpanded[p - 1] || currentChordsExpanded[p - 1].boom !== currentChordsExpanded[p].boom);
// MAE FOOFOO - Code was dropping booms in at inappropriate times
if (newBass){
  newBass = false;
}
if (!isBoom){
  firstBoom = false;
}
// MAE FOOFOO End

Which at least doesn't drop a boom in over a note-only string, but I'm hearing occasional chords on patterns that have only booms and rests:

X: 1 T: Alexander's C: Traditional R: Hornpipe M: 4/4 L: 1/8 Q: 1/2=80 K: Dmaj % % Use an Acoustic Grand Piano sound for the melody: %%MIDI program 0 % % Use an Acoustic Grand Piano for the chords: %%MIDI chordprog 0 % % Use an Synth Bass sound for the bass: %%MIDI bassprog 38 % %%MIDI gchord fzfzfzfz |:(3gfe|"D"dAFA DFAd|fdcd Adef|"G"g2 ge "D"fdcd|"A"(3efe (3dcB A2 (3gfe| "D"dAFA DFAd|fdcd Adef|"G"g2 ge "D"fdcd|"A"(3efe dc"D"d2:| |:AG|"D"FAdA FAdA|"G"GBdB GBdB|"A"Acec Acec|"D"dfaf "A"(3gfe (3dAG| "D"FAdA FAdA|"G"GBdB GBdB|"A"Acef gecd|(3efe dc"D"d2:|

seisiuneer avatar Jun 17 '24 02:06 seisiuneer