The problem is that as loop it skips frequencies and it sounds weird
Do you mean that its skips frequencies as it is now or when you use a for loop ?
The portion of code that you posted seems to increment the frequency by 0.1. Is that always the case in the full code ?
By the way, you could have attached the code if it was too big to post.