Re: Convert to float and more
Re: Convert to float and more
- Subject: Re: Convert to float and more
- From: "Mark's Studio" <email@hidden>
- Date: Wed, 4 Jun 2003 21:05:00 +0200
On onsdag, jun 4, 2003, at 20:42 Europe/Copenhagen, Jeff Moore wrote:
>
On Wednesday, June 4, 2003, at 01:46 AM, Mark's Studio wrote:
>
>
> Hi
>
>
>
> I have a few questions.
>
>
>
> Im working on a Cocoa sound editing app.
>
>
>
> When i import a file i just copy the sound bytes into a NSData and
>
> keep
>
> it in the original format.
>
>
Ack! This is going to be awfully slow for files that have any
>
significant length to them. You really ought to consider buffering the
>
data on and off the disk as needed, rather than trying to stuff
>
everything into memory at once.
Well, it does not seem to be that big a problem to me, i am developing
on a 400mhz PB G4 with only 384Mb ram , and the files are 50Mb.
but i will look into that later.
>
>
In general it is a bad idea to use the VM system as a way to stream
>
audio to and from the disk. You get much better results if you use the
>
non-cached low level file IO operations. On machines with little
>
physical RAM the performance difference can be quite large in fact.
>
>
> All my drawing and DSP code use floats, so if the original sound
>
> format
>
> is 16bit i do a lot of sample/32768.
>
>
>
> I was thinking of converting the samples to float when importing the
>
> file, but that will double the data size, so i still need to decide
>
> what's best.
>
>
>
> I tried to search the archives for the fastest way to convert from int
>
> to float and back. but did not find much,
>
> someone mentioned there might be a altivec snippet for converting?
>
>
>
> I also looked at CASampleTools.cpp ( but to be honest i don't
>
> understand C++).
>
>
Don't use that code. It's about as bad as you can get. I should know,
>
I wrote it =)
>
>
Instead, you should use the blitters in the AudioConverter.
how fast is the AudioConverter compared to sample/32768?
>
>
> When i play a file through the defaultAudioOutput, and the stream
>
> format is not float, is there another conversion to float within
>
> coreaudio?
>
>
The Output Audio Units have an AudioConverter embedded in them. All
>
you need to do is to is specify what your input format is, and the
>
Output AU will massage that into what the hardware is looking for.
>
There is sample code in /Developer/Examples/CoreAudio that show how
>
this works.
>
>
> I also want to import/export MP3 and other compressed formats what is
>
> the best way to do that?
>
>
The system doesn't ship with an MP3 encoder that is programmatically
>
accessible, so you're kind of on your own. For decoding, you can use
>
QuickTime until codecs are better supported directly by the
>
AudioConverter API.
I thought iTunes used Quicktime for making mp3 files?
>
>
--
>
>
Jeff Moore
>
Core Audio
>
Apple
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
>
>
Peter Mark
Mark's Recording Studio A/S
Lundeskovsvej 3 2900 Hellerup
Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.