move oscillator creation inside loop