Re: ExtAudioFile - mono to stereo
Re: ExtAudioFile - mono to stereo
- Subject: Re: ExtAudioFile - mono to stereo
- From: William Stewart <email@hidden>
- Date: Fri, 20 Aug 2010 19:43:13 -0700
So, ExtAudioFile is made of two objects.
For reading:
An AudioFile object that reads the data from the file (that provides data in the file's data format as you would expect)
An AudioConverter (if needed) that will convert from the file's data format, to the requested client data format. It isn't changing the audio data in the file, just converting it to the format you have requested
Writing works in reverse
The ConvertFile example (developer.apple.com) shows you two ways to convert a file from one format to another - using ExtAudioFile (which takes care of alot of the nasty details of codec priming, etc) and the far more verbose method of using and audio file and converter object explicitly. It should prove to be a useful example to understand (as the end result is the same in both cases)
Bill
On Aug 20, 2010, at 2:59 PM, Edwards, Waverly wrote:
> I have seen an example that Mo DeJong created. I'm still trying to wrap my head around the possibility that I can change the format that I read into the buffer, regardless of the files actual format.
> I'm hoping to go home and try this out so I can put the pieces of my puzzle together.
>
>
> Thank you,
>
>
> W.
>
> From: William Stewart [mailto:email@hidden]
> Sent: Thursday, August 19, 2010 8:42 PM
> To: Edwards, Waverly
> Cc: 'coreaudio-api API'
> Subject: Re: ExtAudioFile - mono to stereo
>
> You can - you use the AudioConverter (which is part of the ExtAudioFile's implementation) and you tell it to map the 1 channel source of the file, to a 2 channel client data format (you want your data in stereo). So, you:
>
> - set the client format of the ext audio file to stereo
> - get the audio converter from the ext audio file
> - set the channel map of the audio converter (this should be set to { 0, 0 } = which says take the first channel of the input (there is only 1, the source file) and place it in each of the destination channels of the client format of the ext audio file
>
> sorry for the misdirection earlier
>
> BIll
>
> On Aug 19, 2010, at 11:10 AM, Edwards, Waverly wrote:
>
>> Is it possible to read a mono formatted audio file and have it directly read into a stereo buffer?
>>
>> I am currently reading a mono file but I *always* want my buffer to be filled in stereo. I wish to
>> have the right channel be the same as the left channel.
>>
>> Currently I am reading the entire mono channel file into a buffer. I then read my mono channel buffer into a stereo buffer and discard the mono buffer.
>>
>> for ( indx = 0; indx <= numSamples -1 ; indx++ )
>> {
>> stereoChannel[ indx][_leftChannel] = monoChannel[indx];
>> stereoChannel[ indx][_rightChannel] = monoChannel[indx];
>> }
>>
>>
>> Is there a direct way to convert the mono channel to stereo, filling both channels with the original mono data?
>>
>> I searched and saw a posting on Aug 9th where William stated you cannot and Doug said you could.
>> If you can, I am not understanding how.
>>
>> http://lists.apple.com/archives/coreaudio-api/2010/Aug/msg00069.html
>>
>> http://lists.apple.com/archives/coreaudio-api/2010/Aug/msg00068.html
>>
>>
>> Thank you,
>>
>>
>> W.
>>
>> _______________________________________________
>> 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
_______________________________________________
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