Who invented the trumpet and when?

Stoelzel reported his invention in the following letter, dated December 6, 1814, which was sent to Friedrich Wilhelm III, King of Prussia:
Most illustrious, most mighty King

Most gracious Lord and Majesty!

The horn, to which I have chiefly dedicated myself, is most defective as regards the inequality of its notes and the impossibility of producing them with the same purity and strength. This fact often made me very impatient and led me to make experiments which might alleviate the problem, which at the beginning were all failures, but which finally led me to an invention, which rewarded me for all my trouble and satisfied my demands on the instrument. My horn can play all the notes from the lowest to the highest with the same purity and strength without having to stop the hand into the bell. The mechanism of my invention is most simple, can be employed easily and quickly and everyone who plays the instrument can make himself thoroughly familiar with its application in a few days. This device renders the many crooks superfluous and makes it possible for the artist to play all the notes without losing any of the instrument's tone. This mechanism can also be applied to the far more imperfect trumpet and even to the bugles. Because the trumpet, whose compass hitherto consisted of 13 notes and through my invention has received 24 additional notes, which sound just as beautiful and pure as those 13 and for which now composers may write in not so limited fashion, but in any major or minor key as they wish, I believe that I do not exaggerate in promising your Majesty that by means of these instruments music may be made which will astound the world. I submit myself to every examination and am of the assumption that your Majesty may assist me further in this matter which is so important to the world of music ... [trans. in Heyde, ibid, 11-13].

From the above passage it is crystal clear that the original intention of Heinrich Stoelzel in inventing the valve was to make brass instruments fully chromatic. Note these passages again: "My horn can play all the notes from the lowest to the highest with the same purity and strength without having to stop the hand into the bell.... This device renders the many crooks superfluous and makes it possible for the artist to play all the notes .... I believe that I do not exaggerate in promising your Majesty that by means of these instruments music may be made which will astound the world."

Four years later...Friedrich Blühmel (fl. 1808-before 1845), a miner who played trumpet and horn in a band in Waldenburg, is also associated with the invention of the valve [NOTE: The older literature often describes Blühmel as an oboe player, which is in error]. Blühmel designed a valve independently from Stoelzel, his experiments with what were apparently rotary valves dating back to 1811/12 [Heyde, ibid, 22, 29]. [NOTE: Dahlqvist (122-23), however, believes that this was a tubular valve of some sort--Stoelzel or double piston "Vienna" valve]. While Stoelzel and Blühmel eventually agreed to apply for a common patent on the box valve, a design which Blühmel had developed in 1817/18 [Heyde, ibid, 22, 30] (see Figure Two), a document from Blühmel survives from his separate, rival, patent application of February, 1818, where he states why he wanted to add valves to brass instruments. Blühmel began by relating that the imperfections of the horn and trumpet, on which he had performed since 1808, had led him to experiment. He continued,
The numerous uses of the mechanical forces, which I had an opportunity of seeing during my presence in Upper Silesia, particularly the various air pipes used in the blast apparatus of the high and low furnaces which always led me back to the basic idea of executing an improvement on these instruments, I believe I could use to reach my goal and therefore sought the company of the keepers of the machines and other experts in order to comprehend the closing and opening of the wind pipes, whilst I started out with the idea of which way the air must pass through the tubes of the instrument, to lengthen or shorten according to certain dimensions, in order to make up the missing notes of the compass. ...

Collecting all the keys together soon made it clear, that the addition of a semitone and a whole tone loop, which could be opened and closed whilst remaining in close contact with the instrument and which lowered the note played by a semitone, whole tone or 1 1/2 tones could be effected.

In Waldenburg I experimented with my idea and learned to solder in order to reduce costs . ... In 1816 I finally got results, whereby all the whole tones and semitones could be played on the trumpet by means of 2 valves and now there was nothing left for me to do but to simplify the mechanism even more and to confine it within a narrow space [trans in Heyde, ibid, 21-22].

Now the natural trumpet, without valves, was invented sometime in the 1300's, by unknown muscians.

The slide trumpet (cornet) was invented in 1799, by one John Hyde. In 1814, the valves were added, and the cornet was invented. Trumpets were slower to adapt to the new valve system, so many pieces of musics had separate scores for trumpets (natural) and cornets (valved).

Besides BobPursley's excellent answer, I think you will find this long article on the history of the trumpet interesting:
(Broken Link Removed)

I enjoyed reading it myself

Sometimes the history of an invention is not clear. This is because the invention changes after time and sometimes the original (beginning) of the invention is very different from the invention in the 21st century. Such may be the case of the trumpet. The inclusion of valves in the trumpet is an example of a major changes It is claimed that the original trumpets were made out of hollowed out sea shells or animal horns.

If one accepts the above view then no particular individual or even groups of individuals may claim to have invented the trumpet. The history of the trumpet goes back to ancient peoples.

I hope that this answer has been helpful.

The invention of the trumpet is attributed to multiple individuals throughout history. The original trumpets were made out of hollowed-out seashells or animal horns and date back to ancient times. However, the modern trumpet that we are familiar with today, with valves to change the pitch, has a more recent history.

One notable figure in the development of the trumpet with valves is Heinrich Stoelzel. In a letter dated December 6, 1814, Stoelzel discussed his invention with Friedrich Wilhelm III, King of Prussia. He described how his horn could play all notes from the lowest to the highest with the same purity and strength, without having to stop the hand into the bell. Stoelzel's invention aimed to make brass instruments fully chromatic and allow composers to write in any major or minor key.

Around the same time as Stoelzel, another individual named Friedrich Blühmel also experimented with the invention of valves for brass instruments. Blühmel, a miner who played trumpet and horn in a band in Waldenburg, designed valve mechanisms independently, possibly rotary or tubular valves, from as early as 1811/12. Stoelzel and Blühmel eventually agreed to apply for a common patent on the box valve, a design developed by Blühmel in 1817/18.

It is worth noting that the history of the trumpet is not always clear, as inventions evolve over time. The trumpet has undergone significant changes, particularly with the addition of valves. The original purpose of the trumpet, as well as its design and functionality, have evolved throughout history.