Re: Write array of float's to wav file?
Re: Write array of float's to wav file?
- Subject: Re: Write array of float's to wav file?
- From: tahome izwah <email@hidden>
- Date: Tue, 08 Mar 2011 18:13:46 +0100
You could use the EAFRead and EAFWrite classes that come with Stephan
Bernsee's Dirac time stretching project. Download the package from
http://dirac.dspdimension.com and look in the Dirac mobile folder for
EAFWrite.mm (I think).
HTH
--th
2011/3/8 Sam Harman <email@hidden>:
> Hello There,
>
> I am trying to implement linear convolution using Core Audio, I have the
> algorithm implemented and working, but I am trying to write the output of
> this into a .wav audio file on the iPhone. Here is the code for the
> algorithm...
>
> //Create array containing output of convolution (size of array1 + array2 -
> 1)
> float *COutput;
>
> COutput = (float *)malloc(((size1+size2)-1)* sizeof(float));
>
> int sizeOutput = ((size1 + size2)-1);
>
> //Convolution Algorithm!!!
>
> for (i=0; i<sizeOutput; i++) {
>
> COutput[i]=0;
>
> for (j=0; j<sizeCArray1; j++) {
>
> if (((i-j)+1) > 0) {
> COutput[i] += CArray1[i - j] * CArray2[j];
> }
>
> }
>
> }
>
> I need to write the float values within 'COutput' (a standard array of
> floats) into an audio file. Am I right in assuming I need to send these
> float values to an AudioBuffer with an AudioBufferList initially? Or is
> there a way of doing this directly using the Audio File Services ?
>
> As you can see, currently the output of the convolution is stored in a
> standard array of float values, the data is within the range -1 to 1. This
> is mono audio data and I need to write it to a 16bit 44.1kHz uncompressed
> wav file.
>
> If anyone can point me in the right direction, i would be very grateful!
>
> Sam
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden