controlling 4 motors independant by PWM

I think i posted my question in the wrong forum so I post it here now.
I got a Uno board, that based upon what a pixy camera en some other sensors see needs to control 4 motors.

I have to control 4 motors independent from each other.
So while motor 1 needs to get 4000 pulses at 2000Hz
Another motor needs to get pulses too, they need to be controlled independent from eachother.
So motor 1 might be at pulse 3240, and then motor 2 might to do 300 pulses at 200mhz.

At first i was thinking to use Tone(pin, freq, duration) for this, but tone cannt drive multiple pins.
Tone works pin after pin (so after a pin is processed another pin can be tone set.
Besides that tone isnt ideal for doing exact number of pulses.

I must be possible to do this, since reprap printers can also drive 2 motors at once (to set printerhead in xy directions, and meanwhile feeding extruder) so how is this done ?

I notice that the pixy part of my code doesnt always execute at the same speed (depending on what it sees), its not a big problem, because i could also dedicate another Uno for the motors, and use an opto-coupler in between, but then still i need to understand how to drive multiple motors independent from each. So how does that work ?.

"controlling 4 motors independant by PWM

I have to control 4 motors independent from each other. So while motor 1 needs to get 4000 pulses at 2000Hz..."

You mention PWM but you then specify pulse count and frequency. With Pulse Width Modulation you are generally controlling a DC motor by varying the power duty-cycle. If talking step count and frequency you are generally controlling a stepper motor driver.

Found a solution its a bit complex, but its possible to have a loop that incriments a number
Then have an array for binary phase control of a motor
And then using direct Register writes and some code like

PORTD = PORTD + PinLayoutMask) + SignalOut[step%8] // %8 or %4 depends on wires and stepper model

to control motors independent.

This is if you control directly motors
Only problem then is that you require a lot of pins

So went to a different solution BigEasyDriver,
Each board requires per motor a Step, GND and Direction as minimum.
Since GND and step can be shared acros motors; 4 motors would require ( 8 pins for individual motor on off)
Or if step can be shared as well (all motors contiously on/off together) then 5 pins.