I had the same thing happen to me, everytime a turned the basement sink water off, I get what sounds like a machine gun in the water pipes. Here is what I did to correct the problem and I have not had a lick of problem since. I turned off the water to the whole house at the main in the basement, I then opened every faucet, sink, and outside spicket that I have, let all the water drain then with all the faucets still open, I opened the main shut-off to supply water to the house again then I went and shut off all the faucets and sinks. I am not for sure exactly what this does, it has something to do with the air that gets in the pipes that causes the noise. I read this technique in a book and it seemed to have worked.