The magic flute that appeared in the original comic book story of "The Smurfs And The Magic Flute" and the animated film version was a musical instrument that had six holes in it. It made whoever listened to the person playing a tune from it dance uncontrollably; however, if the flute is played for too long, the person doing the dancing will eventually tire out until he or she just drops from exhaustion.
The magic flute came from the Smurfs, who in the comic book story "The Flute Smurfers" made it for a sorcerer named Alderic to cure somebody afflicted with a condition known as "Monotone Melancholy". The flute was believed to be lost as the sorcerer's house was burned down by an angry mob, but it eventually fell into the hands of a merchant selling various and strange musical instruments, who arrived in the kingdom that Sir Johan and Peewit had served The King in. Although The King couldn't permit the merchant to sell any of his wares (basically to keep Peewit from acquiring any instrument due to his rather off-key playing) and eventually sent him off, the merchant accidentally left behind the magic flute, which The King and Sir Johan kept out of Peewit's sight when they found it before Peewit did. The King attempted to burn the flute in the fireplace, but it ended up producing deadly green smoke that filled his bedchamber that required many hands to put out the fire.
Peewit ended up finding the flute The King tried to destroy, and, after cleaning it out, tried playing it to a passerby. While he was somehow able to play a beautiful tune from the flute, it also caused the passerby to uncontrollably dance. Peewit at first thought it was a joke, but when he tried the flute on another passerby, she also danced uncontrollably. Soon he was playing the flute all throughout the castle, and anyone who was in earshot of its tune began to dance uncontrollably -- even The King and Sir Johan, when Peewit tried it out on them. However, when Peewit again played it before a group of soldiers that he had used it on before, the soldiers eventually passed out from the extended playing. Sir Johan began to realize that the flute could be rather dangerous and tried to get it out of Peewit's hands, but he refused to give it up.
Meanwhile, the magic flute is being sought after by two groups of people -- the Smurfs who created it, and a passing thief named Matthew McCreep, who overheard what the flute could do from the passing merchant who lost it. While the Smurfs were unable to get their hands on it, Matthew McCreep had tricked Peewit into letting him play a tune from the magic flute during his visit with the young would-be minstrel, leaving Peewit unconscious and tied up while he fled and used the magic flute to rob the townsfolk. Peewit and Sir Johan then went after Matthew McCreep, searching after him until they came across him with his cart full of stolen property. Matthew used the flute on them, rendering them unconscious while he escaped.
Realizing that the flute was indeed magic, Sir Johan and Peewit sought after their friend Homnibus to see if there was any way to remove its power. Homnibus said the only ones who knew about the flute were the Smurfs, and there was no known way to find their village except through a technique called "hypno-kinesis", which would enable people to travel without actually leaving where they were. Sir Johan and Peewit allowed Homnibus to put them to sleep and to use "hypno-kinesis" to transport them as close to the Smurf Village as he could. Soon, waking up in the Smurf forest, they encountered a single Smurf who led them straight to their village where they met its leader Papa Smurf.
While Papa Smurf told them there was no way they could remove the magic from the flute, he did offer them the solution of making another flute -- a task that required cutting down a giant oak tree to get to the heart of the tree for the wood needed to make another flute. While this took two days, with Sir Johan and Peewit patiently waiting, the Smurfs succeeded in getting the second flute completed. Papa Smurf was about to give them the second flute when Homnibus pulled them back too soon and was unable to send them back to the village.
Fortunately, the Smurfs found Homnibus' hovel and delivered the second flute straight to Sir Johan and Peewit. However, by this time, Matthew McCreep had gone over to the island off the port of Terminac in order to raise up an army for his friend Earl Flatbroke to start a war against The King. Sir Johan tricked Earl Flatbroke into going over to that island by writing a letter that supposedly came from Matthew McCreep's hand, following him on board a ship with he and Peewit disguised as sailors and some of the Smurfs secretly stowing away. Upon reaching the island, Sir Johan and Peewit met up with both Matthew McCreep and Earl Flatbroke. Peewit and Matthew broke out with their flutes and played tunes toward each other, hoping that either of them would get exhausted, which caused whoever listened to their tunes to dance uncontrollably. Eventually, the both of them deadlocked in a musical duel, and also getting exhausted, Peewit and Matthew stopped playing in order to catch their breaths, which gave Peewit the opportunity to knock Matthew unconscious with a short burst from his flute.
With both flutes now in his possession, as well as Matthew McCreep and Earl Flatbroke bound and ready to be turned over to the law, Peewit was thinking of keeping both flutes when Sir Johan told him that they should both be returned to the Smurfs so that they won't cause anymore trouble. This inspires Peewit to carve out a fake flute which he intends to hand over to the Smurfs as one of the real flutes. Upon returning to the kingdom, Sir Johan and Peewit handed over the two flutes to the Smurfs, who then took them back to their village. But then, behind everyone's back, Peewit began to play a flute which he thought was a real flute...only to realize that it was the fake one that he carved
The magic flute makes three other appearances: in the Johan and Peewit story "The War of the Seven Springs", as Peewit found it in the possession of Rachel the witch, in the comic book story "The Flute Smurfers", and "The Smurf Flute", which was an episode from the 1961 Smurfs television show.