Modified, now works from generated sine ware and noise sample.