In a method, device and computer program product for extracting an EMG
signal out of a raw signal obtained with a number of electrodes, the
electrodes being adapted to interact with a patient to obtain signals
from the patient's diaphragm on respective channels associated with the
electrodes, a signal-to-noise-ratio is determined for the raw signal in
each channel, and a weighting factor is automatically determined
dependent on the signal-to-noise ratio. The respective raw signals from
the channels are weighted according to the weighting factors, and are
summed in order to generate a sum signal that represents the total EMG
signal contained in all of the raw signals.