• 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
Recording in .wav format doesn't work properly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Recording in .wav format doesn't work properly


  • Subject: Recording in .wav format doesn't work properly
  • From: "Zhiye (Sterling) Li" <email@hidden>
  • Date: Wed, 28 Oct 2009 21:34:02 -0500

Hello,

I try to record sound to .wav format instead of .caf using the Output Audio Unit on iPhone simulator. As I understood, to change from recording in .caf format to .wav format I just need to change the kAudioFileCAFType argument to kAudioFileWAVEType, so I have:

AudioFileCreateWithURL(fileURL, kAudioFileWAVEType, &audioFormat, kAudioFileFlags_EraseFile, &audioFileID);

at the beginning of the recording code. The audio format is:

    audioFormat.mSampleRate              = 44100.0;
    audioFormat.mFormatID                   = kAudioFormatLinearPCM;
    audioFormat.mFormatFlags              = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
    audioFormat.mBytesPerPacket         = 2;
    audioFormat.mFramesPerPacket      = 1;
    audioFormat.mBytesPerFrame          = 2; 
    audioFormat.mChannelsPerFrame    = 1;
    audioFormat.mBitsPerChannel          = 16;

However, when I played the recorded sound file, it doesn't want to play. The AudioFileReadPackets() line doesn't return error, but the number of packets it reads is always 0.  I then checked the header of the recorded .wav file byte by byte, and I found that the "chunk size" bytes of the "data" chunk is always 0 0 0 0 (so the "data" chunk looks like 64 61 74 61 00 00 00 00 data....), so maybe that is the reason why it doesn't play??  But I can see all the data are stored in the "data" chunk which means the recording is good... So is this header normal? Or is there some extra step I need to do in order to successfully record to .wav format? 

Thanks!

zhiye

 _______________________________________________
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

  • Follow-Ups:
    • Re: Recording in .wav format doesn't work properly
      • From: Seth Delackner <email@hidden>
  • Prev by Date: Re: channel layout for 3DMixer
  • Next by Date: Re: multichannel mixing on iphone with multiple mixers
  • Previous by thread: Re: Adding Distortion, Reverb & Compression
  • Next by thread: Re: Recording in .wav format doesn't work properly
  • Index(es):
    • Date
    • Thread