Hacker News new | past | comments | ask | show | jobs | submit login
Bach's prelude in C major written in sed (github.com)
88 points by vitaut 24 days ago | hide | past | web | favorite | 14 comments

I, uh, applaud the sheer chutzpah and will that would go into making something like this.

Only after the piece finishes in full, not in between movements, of course.

I love showing students sed, and then teaching them regular expressions, then showing them sed again, and then showing them stuff like this. sedtris is another fun example:


Not quite. This piece has three voices. There are two half notes in each measure, that start on beats 1 and 3, and there is a dotted eight tied to a quarter note that starts on beats 1+1/16th and 3+1/16th

See: https://www.pianoshelf.com/sheetmusic/728/bach-bwv-846---wtc...

Definitely. I propose we do this properly using only GNU parallel and m4 macros.

Amazing; I love the way he describes the usage of the program from first principles, and the programmatic translation of musical techniques, which is quite ingenious. Well worth a watch (and listen).

My compiler only supports C11, how do you compile C major?

C11 (C—E—G—Bb—D—F) is a superset of C major (C—E—G), so just use it.

Oh, wow. Is it common that Bach Prelude refers to Well Tempered Clavier or was I just biased by my obsession with Gould and his WTC book 1 prelude?

It's correct, the WTC is a collection of preludes and fugues. The first one is the Prelude in C Major.

Can this be made to work with OS X’s built-in SED? I’m getting:

    sed: 34: bach.sed: RE error: invalid repetition count(s)

Probably gonna need to install gnu-sed... the system one isn't very good.

I initially read that as "Bash's prelude in C", which still makes more sense to me.

24 SLOC. Beautiful.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact