Message Boards Message Boards


How do I do AudioPitchShift by frequency band?

Posted 8 months ago
2 Replies
0 Total Likes

The AudioPitchShift example shows how to apply a octave shift (/2) on the entire spectrum. I would like to do the shifting by bands so that, for instance, 0 to 3000 is unaffected, 3000-6000 gets /2, 6000 to 12000 gets /4, and 12000- gets /8 to map all high frequencies into a hearable range for someone with high frequency hearing loss.

I've considered using HighPass and AudioPitchShift pairs to separate the bands and apply the shifts, and recombine the results, but that seems inefficient. I do not see how to work on the raw spectrum to do this mathematically and the code for, say, AudioPitchShift is not (obviously) available.

The rest of the problem seems fairly obvious with AudioStream, etc.

2 Replies

In doing further research, it appears that I want a WSTP function/procedure to do this. The examples for using WSTP don't seem to cover how to provide/return a Spectrum object/datatype. I'm a bit surprised that there are no primitives for manipulating Spectrum (I assume it looks like a realArray[2,n] or doubleArray. I have not tried spect[i] += spect[i+offset] -- too obvious?

I ended up doing this in Python quite easily. The FFT tools in Python are excellent and the language was relatively easy after C++, Java, etc.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract