Bagpipe Tune Difficulty Calculator


How a Computer Can Calculate A Tune's Difficulty (using BWW files)

A tune's difficulty can be measured in potential fingerwork errors per second (PEPS).

For example, a Tune A that lasts 60 seconds with 180 possible fingerwork errors has a rating of 3 PEPS. Tune B, lasting 30 seconds with 60 errors, would have 2 PEPS. Therefore, Tune A is more difficult than Tune B. Easy!

What are Potential Fingerwork Errors?

Before Dojo fingerwork methodology, it was hard to quantify specific errors. Now it's straightforward. Potential errors include:

  • Missing a rhythmic target (beat/off-beat)
  • Crossing noises
  • Gracenote size errors (too big or missed)
  • Gracenote sync errors (not aligned with note changes)
  • Incorrect embellishment steps
  • Embellishments not played ASA(m)P (evenly)
  • Dot-cut rhythms where the cut note is not played ASA(m)P

Bagpipe Music Writer Code

Bagpipe Music Writer (BWW) is a way to programmatically document tunes. Below is a sample from "The Abercairny Highlanders":


& sharpf sharpc 2_4 I! dbe E_8
! gg LAr_16 'la Bl_32 grp Cr_16 'c Dl_32dbe Er_8 dbha HAl_8
! hdbf Fr_8 gg Dr_16 'd Fl_32 space dbe Er_8 gg LAr_16 'la El_32
! dbd Dr_16 'd Cl_32 dbb Bl_16 'b LAl_32 space gg LGr_16 'lg LAr_32 gg Bl_32 dg LGl_16 'lg
! dbhg HGr_8 tg Bl_8 space tar Br_8 dbha HAl_8 !t
& sharpf sharpc
  LAr_16 'la Bl_32 grp Cr_16 'c Dl_32 space dbe Er_8 dbha HAl_8
! hdbf Fr_8 gg Dr_16 'd Fl_32 space dbe Er_8 gg LAr_16 'la El_32
! dbd Dr_16 'd Cl_32 dbb Br_16 'b LAl_32 space gg LGr_16 'lg LAr_32 gg Bl_32 Dl_16 'd
! dbc Cr_8 eg LAl_8 space brl LAr_8 dbha HAl_8 !t

Cleaned-up version (post transformation):


2_4 ! dbe E_8
! gg LA16 B32 grp C16 D32 dbe E8 dbha HA8
! hdbf F8 gg D16 F32 dbe E8 gg LA16 E32
! dbd D16 C32 dbb B16 LA32 gg LG16 LA32 gg B32 dg LG16 
! dbhg HG8 tg B8 tar B8 dbha HA8
! LA16 B32 grp C16 D32 dbe E8 dbha HA8
! hdbf F8 D16 F32 dbe E8 gg LA16 E32
! dbd D16 C32 dbb B16 LA32 gg LG16 LA32 gg B32 D16 
! dbc C8 eg LA8 brl LA8 dbha HA8

Embellishment Transformation Table

Embellishment Expansion
dbe gg E32 fg
grp LG32 dg LG32
dbha HA32 gg
hdbf F32 gg
dbd gg D32 eg
dbb gg B32 dg
dbhg gg F32
tar LG32 dg LG32 eg
dbc gg C32 dg
brl strlg LA32 strlg

With embellishments transformed, the final code looks like:


2_4 ! gg E32 fg E_8
! gg LA16 B32 LG32 dg LG32 C16 D32 gg E32 fg E8 HA32 gg HA8
! F32 gg F8 gg D16 F32 gg E32 fg E8 gg LA16 E32
! gg D32 eg D16 C32 gg B32 dg B16 LA32 gg LG16 LA32 gg B32 dg LG16 
! gg F32 HG8 tg B8 LG32 dg LG32 eg B8 HA32 gg HA8
! LA16 B32 LG32 dg LG32 C16 D32 gg E32 fg E8 HA32 gg HA8
! F32 gg F8 gg D16 F32 gg E32 fg E8 gg LA16 E32
! gg D32 eg D16 C32 gg B32 dg B16 LA32 gg LG16 LA32 gg B32 D16 
! gg C32 dg C8 eg LA8 strlg LA32 strlg LA8 HA32 gg HA8 

Analysis Metrics

Rhythmic Targets

  • User input: Rhythmic targets per bar (e.g. 4)
  • User input: Number of incomplete bars (e.g. 1)
  • Calculated: Total Bars = (Count of bar pairs) - incomplete bars
  • TotalRhythmicTargetErrors = Rhythmic targets per bar × Total Bars

Crossing Noises

  • Note changes = count of unique capital letters in sequence
  • Subtract exceptions (e.g., LA:B, C:D)
  • TotalScaleNavErrors = note changes - exceptions

Gracenote Size & Sync Errors

  • Size: Count gracenotes (e.g., gg, dg, fg, etc.)
  • Sync: Gracenotes during note change = potential sync error

ASA(m)P Errors

  • User input: ASA(m)P max note value (e.g. 32)
  • Count notes with that value or less
  • TotalAsampErrors = count of ASA(m)P notes

Total Errors Calculation


totalErrors = totalRhythmicTargetErrors + totalScaleNavErrors + totalGracenoteSizeErrors + totalGracenoteSyncErrors + totalAsampErrors

Determine Tune Duration

  • User input: Targets per minute (e.g. 160)
  • totalSeconds = totalRhythmicTargetErrors × (60 / targetsPerMinute)

PEPS (Potential Errors Per Second)


pepsScore = totalErrors / totalSeconds