# A piece of weird music!

As a new recruit of your favourite intelligence service, you are out enjoying a rare bit of time off at the theatres. You are laughing with the rest of the crowd when you feel a tap on your shoulder and hear the rustling of paper. You turn around. You see no one. Looking down you see a piece of paper. If you weren't in your current job, you would have just ignored this. But being a somewhat trained agent, you see that there's more to this than meets the eye. Do you have what it takes to find out what to do before you get fired, or even worse, fired at?

Hint 1

Everything except the image is flavour text, the title and author of the music are irrelevant.

Hint 2

What key is this "song" written in? Maybe it will help...

Hint 3

Try writing down each note...

Hint 4

Only the notes, lengths, ties and tempos are relevant...

Hint 5

Conventionally, a crotchet denotes one unit (or one beat in common time for you experts)...

Hint 6

Convert notes to numbers then apply some operations (addition/multiplication)...

Hint 7

There are SEVEN notes in an octave...

Hint 8:

Take the key from Hint 2 and let that be 0...

Hint 9:

Ties are to do with addition

• This is my first puzzle! So comments appreciated :D Clues will be released in due course. Also, bonus browny points if someone can make the music sound nice. – Just a browsing guest Apr 9 '18 at 3:44
• Just to be clear here, all the slurred notes in the image above all mean play legato, not tied notes? The eighth note in the ninth measure made me confused. – gparyani Apr 9 '18 at 17:50
• The key signature is in the key of F – North Apr 9 '18 at 18:23
• @gparyani yup my bad, it should be legato, doesn't matter too much though (just will annoy music experts :p ) – Just a browsing guest Apr 9 '18 at 20:07
• @gparyani Rot13(ubj vg fbhaqf qbrfa'g ernyyl nssrpg gur chmmyr) also, edited the music to put slurs not ties – Just a browsing guest Apr 9 '18 at 20:17

The message is:

URGENT MEET BACKSTA E ASAP

If we

write down all the notes (like harlan) with their durations, and add brackets to denote legato, we get the following:

3D5 2E5 G4 5D5 G5 2F5 F4 F5 5D5 5D5 2F5
2F4 2C6 3F5 (1/2G5 1/2G5 1/2A5 1/2F5 1/2G5 1/2E5) D5 (F5 E5) 2F5 3F5 F4
(D5 C5 Bb4 A4 G4 A4 Bb4 D5) (1/4F4 1/4F4 1/4F4 1/4F4) 3F5 (D5 1/2F5 1/2A5) (E5 F5 G5) (D5 1/2D5 1/2D5 2F4)

Now we compute the value of the note by counting the number of notes that it is above F4 (so F4 is 0, G4 is 1, etc.), and multiply this by the length of the note. We also add the values of notes that are played legato. The following values are found this way:

15 12 1 25 8 14 0 7 25 25 14
0 22 21 23 5 13 14 21 0
25 0 21 13 21 10

Now converting each of these values to a letter (with A = 1, B = 2, etc.) and replace 0's by spaces, we get:
OLAYHN GYYN VUWEMNU Y UMUJ
This is encoded using a Caesar cipher with key 20, decoding yields:
URGENT MEET BACKSTA E ASAP
So I guess that the message is to meet someone with codename "Backsta E" as soon as possible (or I made a mistake somewhere).

• Probably should be a G where that space is – ferret Apr 14 '18 at 17:19
• @ferret That would indeed make sense, however I have double checked and there really seems to be a space there. – Reinier Apr 14 '18 at 19:22
• I imagine it's a typo, since the original version of the score (in the first revision of the post) contained errors that were fixed in a later revision. – gparyani Apr 17 '18 at 2:02

I couldn't quite figure out what the musical notes meant, but I did find out how it sounds. Unfortunately, I'm a programmer, not a musician, so I couldn't play the music on the piano. The best I could do was to quickly write some Java code that could reproduce the music using MIDI:

import java.io.FileOutputStream;

import javax.sound.midi.MetaMessage;
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.Track;

public class PuzzlingSound {

enum Note {
C, C_SHARP, D, D_SHARP, E, F, F_SHARP, G, G_SHARP, A, B_FLAT, B
}

public static void main(String[] args) throws Exception {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
Sequence seq = new Sequence(Sequence.PPQ, 4);
Track t = seq.createTrack();

//set tempo to 203
t.add(new MidiEvent(new MetaMessage(0x51, new byte[] {0x04, (byte) 0x82, (byte) 0x8E}, 3), 0));

addNote(t, Note.D, 5, 100, 1, 3);
addNote(t, Note.E, 5, 100, 4, 1);
addNote(t, Note.E, 5, 100, 5, 1);
addNote(t, Note.G, 4, 100, 6, 1);
addNote(t, Note.D, 5, 100, 7, 2);
addNote(t, Note.D, 5, 100, 9, 3);
addNote(t, Note.G, 5, 100, 12, 1);
addNote(t, Note.F, 5, 100, 13, 2);
addNote(t, Note.F, 4, 100, 15, 1);
addNote(t, Note.F, 5, 100, 16, 1);
addNote(t, Note.D, 5, 100, 17, 4);
addNote(t, Note.D, 5, 100, 21, 1);
addNote(t, Note.D, 5, 100, 22, 3);
addNote(t, Note.D, 5, 100, 25, 2);
addNote(t, Note.F, 5, 100, 27, 2);
addNote(t, Note.F, 4, 100, 29, 2);
addNote(t, Note.C, 6, 100, 31, 2);
addNote(t, Note.F, 5, 100, 33, 3);
addNote(t, Note.G, 5, 100, 36, 0.5);
addNote(t, Note.G, 5, 100, 36.5, 0.5);
addNote(t, Note.A, 5, 100, 37, 0.5);
addNote(t, Note.F, 5, 100, 37.5, 0.5);
addNote(t, Note.G, 5, 100, 38, 0.5);
addNote(t, Note.E, 5, 100, 38.5, 0.5);
addNote(t, Note.D, 5, 100, 39, 1);
addNote(t, Note.F, 5, 100, 40, 1);
addNote(t, Note.E, 5, 100, 41, 1);
addNote(t, Note.F, 5, 100, 42, 2);
addNote(t, Note.F, 5, 100, 44, 1);
addNote(t, Note.F, 5, 100, 45, 2);
addNote(t, Note.F, 4, 100, 47, 1);
addNote(t, Note.D, 5, 100, 48, 1);
addNote(t, Note.C, 5, 100, 49, 1);
addNote(t, Note.B_FLAT, 4, 100, 50, 1);
addNote(t, Note.A, 4, 100, 51, 1);
addNote(t, Note.G, 4, 100, 52, 1);
addNote(t, Note.A, 4, 100, 53, 1);
addNote(t, Note.B_FLAT, 4, 100, 54, 1);
addNote(t, Note.D, 5, 100, 55, 1);
for(double i = 0; i < 1; i += 0.25)
addNote(t, Note.F, 4, 100, 56 + i, 0.25);
addNote(t, Note.F, 5, 100, 57, 3);
addNote(t, Note.D, 5, 100, 60, 1);
addNote(t, Note.F, 5, 100, 61, 0.5);
addNote(t, Note.A, 5, 100, 61.5, 0.5);
addNote(t, Note.E, 5, 100, 62, 1);
addNote(t, Note.F, 5, 100, 63, 1);
addNote(t, Note.G, 5, 100, 64, 1);
addNote(t, Note.D, 5, 100, 65, 1);
addNote(t, Note.D, 5, 100, 66, 0.5);
addNote(t, Note.D, 5, 100, 66.5, 0.5);
addNote(t, Note.F, 4, 100, 67, 2);

MidiSystem.write(seq, 0, new FileOutputStream("C:\\Users\\redacted\\OneDrive\\Puzzling.mid"));

//play sequence on computer
sequencer.setSequence(seq);
sequencer.start();
}

/**
* Adds a note to the musical sequence.
* @param t the musical track
* @param note the note
* @param octave the octave
* @param velocity how fast the note is hit
* @param when when to strike the note in the sequence
* @param time how long to keep the note held
* @throws Exception if an exception is thrown by code this calls
*/
public static void addNote(Track t, Note note, int octave, int velocity, double when, double time) throws Exception {
ShortMessage on = new ShortMessage();
on.setMessage(ShortMessage.NOTE_ON, 1, getNote(note, octave), velocity);
t.add(new MidiEvent(on, (int) (4 * when)));
ShortMessage off = new ShortMessage();
off.setMessage(ShortMessage.NOTE_OFF, 1, getNote(note, octave), velocity);
t.add(new MidiEvent(off, (int) (4 * (when + time))));
}

/**
* Returns MIDI note based on piano note and octave. Helper called by {@link #addNote}.
* @param note the note
* @param octave the octave (Middle C on octave 4)
* @return the MIDI note
* @throws IllegalArgumentException if octave is beyond piano range (-1 to 9)
*/
public static int getNote(Note note, int octave) {
if(octave < -1 || octave > 9)
throw new IllegalArgumentException();
return 12 * (octave + 1) + note.ordinal();
}
}


This was the MIDI file that this code outputted.

• I think you mixed some notes up, eg. your first F is actually a G in the score. At the end you have 3 B flats but those are D's in the score. I'm not going to list them all, the answer from harlan lists all the notes so it should be easy to update your code :) – Max Apr 10 '18 at 21:37
• @Max Just worth mentioning, the notes were correct, however the score in the puzzle was edited. If you look at the first few revisions of the post, you'll notice that the last few notes were in fact B-flats. – gparyani Apr 11 '18 at 13:09
• that explains it :) – Max Apr 11 '18 at 15:11

If we write out the pitches (& I'm putting in parentheses notes that if played would not be articulated--e.g. would tie across the bar--but I'm thinking are probably meant to be 'articulated' here), we get:

D5 E5 (E5) G4 D5 (D5) G5 F5 F4 F5 D5 (D5) D5 (D5) F5 F4 C6 F5 G5 G5 A5 F5 G5 E5 D5 F5 E5 F5 F5 (F5) F4 D5 C5 Bb4 A4 G4 A4 Bb4 D5 F4 F4 F4 F4 F5 D5 F5 A5 E5 F5 G5 D5 D5 D5 F4

The note lengths if combined with tempo to get duration make for some gnarly long numbers (e.g. 0.8866995073891626 sec to start) so I'm inclined to think their values as otherwise represented might be a better path to follow. The dotted half to start could be as 3 beats in the tempo, or 12 of the shortest duration used herein (16th notes), for instance.

Also, @gparyani, thanks for the midi, but some of the notes sound off pitch to me (I'm a musician and not (much of) a programmer). A couple of the F4s sounded like E4s in your midi, the last D5s sounded I think as Bb4s, and a couple others I can't recall. In case your programming route gets to the answer, might be helpful to tweak.

• I think that rot13(Grzcb eryngrf gb juvpu pnrfne gb hfr) – Alan Hoover Apr 10 '18 at 3:17
• Ah, while I was thinking that rot13(gur xrl bs S jbhyq trg hf gurer, engure guna gur grzcb). – harlan Apr 10 '18 at 3:59
• Yeah, that also gives the same information. I think that is an intentional double up on clues. – Alan Hoover Apr 10 '18 at 4:42
• @-pings don't work in answers, only in comments. Also, the notes sounded perfectly fine on my machine, it's probably just your machine's MIDI renderer making it sound weird. (MIDI just stores the notes; it's up to your system to actually play them.) That said, see the OP's comment here. – gparyani Apr 10 '18 at 6:13
• This is on the right track. @AlanHoover is somewhat right in his comment, but don't need to worry about it until a bit later. Rot13(gel trggvat n fgevat bs ahzoref sebz gur abgrf) Clue 5 might help – Just a browsing guest Apr 10 '18 at 8:23