I wanted a sustain pedal for my keyboard and didn't have one. I've no idea how much they are and where you get them, but I wanted it right at that moment, so here's my little crappy invention.
Step 1: What It Does and How It Works
I realised that, at least on my keyboard, you can just shove a guitar-lead like jack in, and the pedal will be down whenever the wires are joined.
I didn't have a spare one to cut up, and they'd only just gotten rid of all the broken equipment in my music department, so I had to use a working cable, which I didn't want to destory.
All I needed to build then was a switch which connected the wires of a socket together, and I needed to put it in one of the 9V battery cases I had lying around.
The cable I chose was the one to my violin, which ha a much smaller, headphone-sized jack on the other end, which was better because I didn't actually have any bigger sockets around, nor would they fit in the little container. If you do have a broken lead you want to reuse, feel free to ditch having a socket on the pedal and just attach the wires directly to the switch.
So yeah, you'll need:
A used 9V battery
A push switch (I had a few left over from an old, failed project)
A socket if you want to not destory your cable (I desoldered it from a piece of TV equipment, they're pretty easy to find)
Tape, wire, etc.