• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simple audio file opening/reading/conversion?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple audio file opening/reading/conversion?


  • Subject: Re: Simple audio file opening/reading/conversion?
  • From: "Art Gillespie" <email@hidden>
  • Date: Tue, 12 Feb 2008 21:24:01 -0700

It looks like you're reading in the raw bytes--you want to convert the
format to 32-bit float canonical at the current sample rate so that
you'll get the expected results in Render.  Check out
AudioConverterNew, AudioConverterFillBuffer, etc. in
<AudioToolbox/AudioConverter.h>

Best,

Art


On Feb 12, 2008 8:59 PM, Aaron Wishnick <email@hidden> wrote:
>
> I'm writing an audio unit which will need to load audio files into memory.
> I'm confused by all the different interfaces available. Here's what I'm
> using so far. When I play the sound back in Process(), I get static, so I'd
> like to know if anybody sees anything glaring here:
>
> OSStatus Sample::Open( std::string filename ) {
>  FSPathMakeRef((UInt8 *)filename.c_str(), &m_fsRef, NULL);
>  OSStatus retVal = AudioFileOpen ( &m_fsRef, fsRdPerm, 0, &m_fileID );
>
>
>  // should do error checking here
>
>
>  UInt32 uSize = sizeof( m_uLength );
>  AudioFileGetProperty( m_fileID, kAudioFilePropertyAudioDataByteCount,
> &uSize, &m_uLength);
>
>
>  m_fFrames.resize( m_uLength, 0.0f );
>
>
>  retVal = AudioFileReadBytes( m_fileID, false, 0, &m_uLength, &m_fFrames[0]
> );
>
>
>  return retVal;
>
>
>  return 0;
> }
>  _______________________________________________
> 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

References: 
 >Simple audio file opening/reading/conversion? (From: Aaron Wishnick <email@hidden>)

  • Prev by Date: Simple audio file opening/reading/conversion?
  • Next by Date: Re: Simple audio file opening/reading/conversion?
  • Previous by thread: Simple audio file opening/reading/conversion?
  • Next by thread: Re: Simple audio file opening/reading/conversion?
  • Index(es):
    • Date
    • Thread