If you are running at 120bpm then this is 2 beats per second. Therefore each beat takes half a second so a 4/4 bar will be exactly 2 seconds long. The number of samples depends on the sampling rate.
So: length(s) = 60/bpm * beats in bar
length(samples) = length(s) * samplerate (Hz)
I would leave it a bit longer and trigger it from your sequencer each bar rather than looping it so that errors don't accumulate.