what could generate a high-pitched whine in electronics where the frequency depends on the current? So I was operating a Laue machine recently which generates x-rays and fires them at a sample, and I noticed that there was a high-pitched whine coming from the instrument (nothing abnormal, just something I noticed). Both the current and the voltage could be set separately; typically values are 10 mA and 20 kV. I noticed that if you change the current, the frequency increases or decreases with it. A frequency spectrum app on my phone showed that the frequency was roughly proportional to the current being applied, so, for example, at 5 mA there'd be a 2000 Hz sound and at 10 mA it'd be 4000 Hz. (I don't remember the exact frequencies. I do remember there were lots of harmonics excited.) The voltage, on the other hand, only caused a small change of the frequency even if doubled. 
My question is how would such a sound be generated? 
My best guess is that the vacuum tube where the electrons are accelerated has its current adjusted by moving either the anode or cathode, and that forms a variable capacitor which happens to modulate the resonance frequency of the circuit such that the frequency and current increase together. Is this reasonable? 
 A: Typically it is the ferrite cores in inductors/transformers that resonate mechanically, or through magnetostrictive effects that produce a high pitched whine. Switching PSUs are the main culprit. It can also occur when the EM fields interact with steel components in the PSU.
A: Prime suspect is the switching power supply that generates the bias voltages for the tube.  As the anode voltage is changed to increase the cathode current (the anode doesn't physically move), the power supply must work harder.  Some switching power supplies operate at a fixed frequency, and so wouldn't display this behavior, but others have a variable frequency that increases with the load.  (Also, the frequencies you report look sort of reasonable for a switcher.)  
A: I appears that you are asking two questions.  1) what can generate a high pitch noise, & 2) why is the frequency of the noise directly proportional to the current applied?
The general answer to 1) is, anything electromagnetic (inside or outside the vacuum tube) "loose," that resonates in the range of the mentioned frequency.
The answer to 2) can only be a guess, and its as follows: $$ E = P \  (Energy = Power) $$ $$P = VI \ (Power = Voltage\times current) $$ $$ E = hf $$ $$ \ therefore, \ f = \frac {VI}{h} $$ Since V (voltage) and h (plank's constant) are constant, this equation shows that the frequency (f) is directly proportional to the current (I).
A: To convert one voltage to a higher voltage one often uses a transformer or a ladder network (or a combination of these).

The above from Wikipedia shows a Cockroft-Walton multiplier - commonly used to step up an alternating waveform. It acts like a bucket brigade - the charge on each capacitor is being passed on to the next capacitor, at a higher voltage, after each cycle of the input.
For this circuit to work you need an alternating input voltage - which is most efficiently generates from a DC voltage by creating a square wave (less switching loss), which is sometimes stepped up part of the way with a transformer.
Finally, the output voltage of this multiplier depends on the current drawn - to maintain a certain value you must carry enough current up the ladder and since the amount of charge transferred during one cycle of the circuit is constant for a given output voltage, you need to increase the frequency linearly with output current to regulate properly.
Finally - the currents in the transformer can be quite high, and this will generate forces and this displacements in the circuit that can be perceived as audible sound. A square wave typically contains the 3rd, 5th etc harmonics of the fundamental, although even terms can appear due to circuit nonlinearities and high frequencies can be attenuated due to finite switching speed and material properties.
There are many other potential causes - but many of the above considerations will apply to those too.
Fun fact - the Cockroft-Walton generator  was not invented by Cockroft and Walton although they did won the Nobel for work they did with it (particle accelerator to cause nuclear changes in atoms). See
