This is something my friend made himself. It comes in handy all the time, the headphones never shift around under your hat or fall out like those crappy earbuds always do, and it can even be worn under a bike helmet (assuming you're biking on like the bike path or a deserted road, and not in the street among cars.)
I stole his when he went on a trip, and when he came to repo it he also brought supplies for me to make my own!
Step 1: Supplies
You only need some headphones and a hat that covers your ears (or the hood of your jacket if it's detachable. If the hood's not detachable you can make it so by cutting it off and adding buttons/snaps/hooks/separating zipper.)
The easiest headphones to use are the type where the left and right sides each have a cord that connects to the jack, as opposed to the type where only one side connects to the jack, and the other one connects to the other headphone. Not that it really matters.
The tools you need are a needle, sturdy thread (or dental floss), and an xacto knife.
Step 2: Free the Headphones
Since most headphones are made in sweatshops, they're designed to be assembled quickly, mostly with parts that snap together, and can be popped apart quickly in most spots. These headphones don't have a wire running across the headband; i just popped them out of the swivel using a small screwdriver.
At first i planned to take the back cover off of the speakers, too. But since it's a hat i decided that it's probably better to keep them sturdy.
I'd tried this with another pair of headphones that do have the wire running across the top and it was so annoying. There were a ton of things to take apart, and the wire along the top was very delicate (maybe too delicate for a hat, but where there's a will there's a way, right?)
I chose those headphones first because they have a volume control on the cord, but they were broken to start with and in the end were both still broken and not really worth the time it took to dismantle them.
Step 3: Open the Earflaps
Pop apart the seam of the ear flaps, from the bottom on the side you want the cord to run out from, to the part that's wide enough for the speaker to fit through.
Step 4: Almost Done. This Is Easy Isn't It?
Put the hat on and position the speakers inside the earflaps where you want them. Take off the hat, keeping the speakers in place, and cut out a hole over the speaker, smaller than the edge of the padding.
Step 5: Sew Everything
Around the speaker I used a stitch that's perpendicular to the cut (called a "Frankenstein Stitch"), to minimize tension at the sewing, allow the fabric and foam more flexibility, and keep the fabric from fraying.
Down the side i used a Frankenstein Stitch because i was being lazy.
Step 6: Hey, Wouldn't This Be a Great Gift?