audio input is distorted when recording using sound stream


I’m trying to get the audio example from chapter 7 of programming interactivity working, but I am having some problems.

The audio is recording correctly, but it sounds robotic regardless of the pitch shifting functions.

It sounds like this (m4a file, not mp3), seems to play in chrome though.

Can anyone help? I’d really like to know why the audio sounds bad


  1. Not enough buffering of some kind?

  2. floats are not big enough data types?

I assume the second part is the distortion you mean?
It seems that it has the same duration as the first part, so it doesn’t seem to be a buffer underrun (in that case you would have gaps).

It actually sounds exactly like a pitch shift.

Hi, thanks for coming back to me…

That is funny, as the pitch shift functions are not being triggered and infact are not even pointing at the same buffer currently. I removed them to be out of the way.

Is there anything you can think of that I could be doing in my maths to cause a pitch shift to happen?

I will post example code soon, as I think this is the only way to get to the bottom of it.