1

To @alexbw and friends, First of all thanks for this great piece of code. I have pcm data (signed 16 bit big endian) in a byte array and I want to play it with Novocaine AudioManager setOutputBlock. I understand I first need to convert to a float array. Or is there a faster way? Cheers Philippe

  • Did you find a best way to do this? Convert indeed? Or does Novocaine also take integer based audio? – Peterdk May 22 '15 at 17:52

1 Answers1

0

Late, but for anyone else reading:

You can use the Accelerate framework here:

float *float_data = malloc(sizeof(float) * numFrames); vDSP_vflt16(my_s16_data, 1, float_data, 1, numFrames); //Scaling [-32768, 32768] to [-1, 1] float scale = 1.0 / (float)INT16_MAX; vDSP_vsmul(float_data, 1, &scale, float_data, 1, numFrames);

And "float_data" will now have the float equivalent.

AlexKoren
  • 1,605
  • 16
  • 28