But would it be possible to make it so that the frequency (pitch) would be controlled by a potentiometer?
Yes, of course.