t = i/sample_rate ton = int(t/0.5) if (ton%2): f = 580 else: f = 435