The first is in the toilet, this is typically the fill valve. When the fill valve diaphram gasket inside the top cap of the fill valve goes bad, it looses its elastisity. The softness that once allowed it to form around the shut off seat inside the valve and shut off the water completely, is gone. The gasket becomes hard like a superball. When it tries to shut off, it bounces in micro vibrations sending a shock wave back into the piping. It vibrates with a similar pattern to a tuba players lips. Since the piping is metal, like an instrument, it creates a sound very much like a trumpet. Replace the fill valve if it is the offending part, (they are relatively inexpensive) and the noise from the toilet will quit. You can test this by taking the cover off the toilet and lifting up on the fill valve float. If the noise stops then you have found your problem.
Pipes can make noises for a lot of reasons. Since pipes are made of metal, they transmit sound throughout their length. As water flows through the system, it flows over obstructions and around turns...when it does this, it creates eddies in the water. These can be rythmic depending on the speed of the water. When they reach a certain pitch, they cause the piping to begin vibrating in harmonic reaction to the wave created inside the pipe. In order to stop the noise created, you have to remove the offending part or debris that's causing the water to fluxuate.
In addition you have expansion and contraction. Water either heats or cools the pipe, since the pipe is in holes inside the studs, when it expands it rubs against the wood, sometimes this noise will sound like a groaning.
If I had to bet though, Id check the toilet first.
Raymond VinZant Plumbing Prof.