Outputting sound at a specific hertz range

I have a friend who has tinnitus, and he is trying to find a way to generate white noise across a specific hertz range, eg 2000-20000, while skipping a certain range in between (the idea is that you listen to white noise at everything except the range your tinnitus affects).

This is outside my expertise, and I know Codea isn’t strong in sound, but I thought I’d ask anyway if this sounds feasible.

White noise is equal power over a certain frequency range. While you can make notes of a certain frequency using the white noise waveform, I’m not sure what the pitch variables do to the frequency range. The other option is to build it yourself with soundbuffer, but it sounds tricky.

I think you can play your own wav sequence with codea, so in principle you should be able to create a noise sequence, fft it, whiten it, band-filter it, and inverse fft it, then play it. Would take quite some time to code it though.

@Ignatz - you can’t do it natively in Codea but you could use the new add on functionality to implement AVAudioPlayer (http://codeatuts.blogspot.com.au/2013/04/tutorial-28-codea-v152-objective-c-add.html) and then implement AVBufferPlayer (https://github.com/hollance/AVBufferPlayer) which uses AVAudioPlayer to play a buffer of waveform data that you give it.

It would be easier to just do it in Xcode…

Can’t you use the soundbuffer command to generate tones at a certain frequency from within Codea? Isn’t that how @Fred implemented a ‘notes’ table to generate notes at a certain frequency/pitch in his ABC Notation player… Just tossing it in the ring if this is an option… :-/

There are a bunch of white noise generators in the App Store, many are pretty customisable. I’d imagine that that be a better route.