Let x be the number of ducks and y be the number of pigs. We know that:
$$x + y = 22$$
$$2x + 4y = 56$$
Solving the first equation for x:
$$x = 22-y$$
Substituting into the second equation:
$$2(22-y) + 4y = 56$$
$$44 - 2y + 4y = 56$$
$$2y = 12$$
$$y = 6$$
Therefore, there are 12 ducks and 10 pigs on the farm.