After the valve trumpet was invented , composers began to write for trumpet in keys with more flats , so Haydn wrote his famous trumpet concerto in the key of E-flat major . With the invention of the valve trumpet , however , preference shifted to the flatter keys , and thus Haydn wrote his famous trumpet concerto in the key of E-flat major .