A hydraulic transmission, comprising: a variable displacement hydraulic pump, a variable displacement hydraulic motor, a drive shaft coupled to the hydraulic pump, for driving the hydraulic pump, and an output shaft coupled to the hydraulic motor, for coupling to a load, wherein at least one of the hydraulic pump and the hydraulic motor comprises: a rotatable shaft, a shaft sensor which measures the position or speed of rotation of the rotatable shaft, at least one cam having at least one lobe, a plurality of cylinders having working volumes which vary cyclically with rotation of the rotatable shaft, a low pressure working fluid line and a high pressure working fluid line, a plurality of valves (118,126) regulating the flow of working fluid between each cylinder and the low and high pressure working fluid lines (120,122), at least one said valve (118, 126) associated with each cylinder being an electronically controlled valve, wherein the hydraulic transmission comprises control means configured to generate command signals to actively control the said electronically controlled valves to thereby determine whether each cylinder carries out an active cycle in which there is a net displacement of working fluid or an inactive cycle in which there is no net displacement of working fluid, for each cycle of cylinder working volume, wherein the fundamental frequency of cylinders carrying out active cycles or the fundamental frequency of cylinders carrying out inactive cycles is proportional to the speed of rotation of the rotatable shaft, and characterised in that the control means is configured to control the hydraulic transmission to avoid the frequency of one or more intensity peaks (400,402,452,454,456) of the frequency spectrum of the pattern of active and inactive cycles of cylinder working volume carried out by the cylinders remaining within one or more ranges of undesirable frequencies (406,410), or to reduce the intensity of one or more said intensity peaks (400,402,452,454,456) within the one or more ranges of undesirable frequencies (406,410), taking into account the speed of rotation of the rotatable shaft, the one or more ranges of undesirable frequencies (406,410) comprising one or more resonant frequencies (404,408) of a portion of a machine (4,8), which is part of or in mechanical communication with the hydraulic transmission, at least one said resonant frequency not varying proportionately to the speed of rotation of the rotatable shaft, wherein the control means is configured to calculate a proposed displacement of working fluid by the at least one of the pump and the motor, and to calculate (220, 240) the frequency of one or more intensity peaks (400,402,452,454,456) of the frequency spectrum of the pattern of active and inactive cycles of cylinder working volume which would arise if the at least one pump or motor was requested to implement the proposed displacement of working fluid and to compare (222,242) the calculated frequency or frequencies with the one or more ranges of undesirable frequencies (406,410). a variable displacement hydraulic pump, a variable displacement hydraulic motor, a drive shaft coupled to the hydraulic pump, for driving the hydraulic pump, and an output shaft coupled to the hydraulic motor, for coupling to a load, wherein at least one of the hydraulic pump and the hydraulic motor comprises: a rotatable shaft, a shaft sensor which measures the position or speed of rotation of the rotatable shaft, at least one cam having at least one lobe, a plurality of cylinders having working volumes which vary cyclically with rotation of the rotatable shaft, a low pressure working fluid line and a high pressure working fluid line, a rotatable shaft, a shaft sensor which measures the position or speed of rotation of the rotatable shaft, at least one cam having at least one lobe, a plurality of cylinders having working volumes which vary cyclically with rotation of the rotatable shaft, a low pressure working fluid line and a high pressure working fluid line,