← All projects

Win(d)Bag

A Great Highland bagpipe tune player, begun in BASIC on an IBM PCjr and rewritten for Windows 3.1 in Visual Basic 3 between 1995 and 2000. Tunes are typed as plain text, one bar per line, and played on the PC speaker with the melody and gracenote speeds set separately. It now runs in a browser.

A skeleton playing the bagpipes leads a ragged fool, coloured in bright blues, greens and reds
Le Fol (The Fool), from Hans Holbein the Younger's Dance of Death woodcuts (1538), coloured by Michael Carnright as the picture behind Win(d)Bag's main window, and taken from the VB3 form file.

▶ Play the tunes

Whose work this is. Win(d)Bag, its .wbg tune format, the practice-chanter tuning window and the Perl players are Michael Carnright's. The web edition (play.html) and the Python players are later ports of the same program. The colouring of the Holbein woodcut is his. The tunes are traditional or his own, and their .wbg transcriptions are his.

What it did

A piper learning a tune wants to hear it slowly, but bagpipe gracenotes are played as fast as the fingers allow whatever the tempo. Win(d)Bag kept the two apart: one scroll bar for the melody's pace, another for the gracenotes, and both could be moved while the tune played. The time a gracenote takes is taken from the melody note that follows it, so very slow gracenotes eat into the melody, which the original README warns about. A four-count of high-G gracenotes sets the tempo before the tune starts, and the tune can be paused, resumed or stopped.

Play
Pause
Resume
Stop
Chanter
About

The button images from version 0.2, from the VB3 source.

Versions

VersionWhat changed
The first Win(d)BagWritten in BASIC on an IBM PCjr. It is lost; no copy survives.
0.2, 20 December 1995Changes since the first version: the separate practice-chanter program merged into the player; word buttons replaced by images; the tune list split into one index per book the tunes were transcribed from, so a new book could be added on its own.
0.2, 16 September 2000A later build of the same version, and the source in this repository.
Perl playerswindbag.perl plays the same files through Audio::Beep; windbag2.perl adds named embellishments, so dbc can be written for a doubling on C instead of its three gracenotes.
Python playersA terminal player, a Tk window and a uilleann-pipe variant, for macOS.
Web editionWeb Audio in one HTML file, with a square wave to sound like the PC speaker, the tunes built in and any .wbg file droppable on it.

The .wbg format

A tune is a list of note, length pairs separated by commas or line breaks; spaces are ignored, so a tune can be laid out one bar per line. A length of 0 is a gracenote.

G,0,a,48,g,0,d,0,g,0,c,0,d,96

is a high-G gracenote on a low-A crotchet, then the four gracenotes of a doubling on D, then D as a minim. The original format notes give the reason for the odd-looking lengths: a whole note is 192, which is 3 × 64, so triplets come out as whole numbers too.

LengthNote
0gracenote
364th
632nd
1216th
248th
48quarter
96half
192whole
LengthNote
9, 18, 36, 72, 144dotted 32nd to dotted half
816th triplet
168th triplet
32quarter triplet
64half triplet

The nine notes of the chanter are g a b c d e f G A: low G up to high A, with capitals for the two high notes.

Embellishment names

The later players accept names for the common embellishments, which are expanded into gracenotes before the tune is read:

NameGracenotesEmbellishment
gg tgG · Ahigh-G, high-A ("top") gracenote
bg cg dg eg fgB · C · D · E · Fsingle gracenotes
strlg strlag · astrike on low G, low A
dbb dbc dbe dbfG b d · G c d · G e f · G f Gdoublings
dbhg dbha hdbfG f · A G · f Gdoublings on high G and high A, half doubling on F
grpg d ggrip
targ d g etaorluath
hvthrdg d g cheavy throw on D
gstrdG d gG strike on D
brl abrg a g · a g a gbirls

Tuning a practice chanter

Practice chanters are not all at the same pitch, so version 0.2's chanter window lets you match the computer to yours. Set low G by ear, and every note above it follows by fixed ratios between neighbours; then nudge each note in turn going up. The result is saved to CHANTER.TXT.

StepG→AA→BB→CC→DD→EE→FF→GG→A
Ratio9/89/810/927/2510/910/927/2510/9
Hz412→464522580626696773835928

The ratios from low A to high A multiply to exactly 2, an octave, and the frequencies in the CHANTER.TXT that ships with the source are this chain from a low G of 412 Hz, rounded to whole hertz at each step.

The tunes

The web edition has 34 tunes built in:

The tune files are in tunes/. To add one, put a .wbg in tunes/ and run python3 bundle_tunes.py, which rebuilds the list built into play.html. Or just drop the file on the page.

In this repository

play.htmlthe web edition; play.html?test runs its parser tests
vb3/the Visual Basic 3 source of version 0.2: forms, modules, project file, button images, the format notes and the original READMEs
perl/the Perl players and their chanter and four-count files
python/the Python players (they read the comma format, without embellishment names)
tunes/, bundle_tunes.pythe tunes, and the script that builds them into the page

The Visual Basic runtime and the custom controls the program needs (VBRUN300.DLL, CMDIALOG.VBX, THREED.VBX, WINSOUND.DLL) are not included; they were never the author's to share.