• 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
m4a blank file on recording
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

m4a blank file on recording


  • Subject: m4a blank file on recording
  • From: Olivier Destrebecq <email@hidden>
  • Date: Tue, 11 Oct 2005 19:00:27 -0400

Thanks all for your answers. i'm making progress and got to a point where i can record to the drive. But when i switch to try to save the file as a m4a file, i get a blank file (0kb length)....

If i set the format to kAudioFormatMPEG4AAC and kAudioFileMPEG4Type or kAudioFileM4AType i get a blank file,
but if i switch to kAudioFormatMPEG4AAC and kAudioFileAAC_ADTSType then the file get recorded correctly.


Are there any tricks to recording m4a files? From what i see on the mailing list i might not be the first one to have this problem, but i did not find any solution.
I'm recording straight from an iMic and do not modify anything about that input device except for what is in the code listed below. Also i tried to look at the code from AudioFileTools-AFRecord (which record those file just fine...), and as far as i know the code is identical to mine. The only thing is that they pass an almost empty stream description except for the format and the number of channel. tried that too and it does not work either...
I also set the deployment target to be 10.4 to force using the new APIs


Olivier Destrebecq
http://otusweb.spymac.com/portfolio/




- (BOOL) startRecording
{
if (audioFileRecorder == nil)
{
//create a fileWriter
//
const unsigned kBufferSize = 0x8000;
audioFileRecorder = new CAAudioFileRecorder(3, kBufferSize); // 8Kb buffer


//create the directory reference and the filereference
//
FSRef parentDir;
CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath: [[self tempFileRecordingPath] stringByDeletingLastPathComponent]], &parentDir);


//set the format for the destination file (AAC for our purpose)
MTCoreAudioStreamDescription *audioStreamDescription = [MTCoreAudioStreamDescription streamDescription];//[[[[[self recordingDevice] streamsForDirection: kMTCoreAudioDeviceRecordDirection] objectAtIndex: 0] streamDescriptionForSide: kMTCoreAudioStreamLogicalSide] copy];
[audioStreamDescription setFormatID: kAudioFormatMPEG4AAC];
[audioStreamDescription setChannelsPerFrame: 2];


//create the audio file for the recorder
//
audioFileRecorder->SetFile(parentDir,
(CFStringRef) [[self tempFileRecordingPath] lastPathComponent],
kAudioFileM4AType,
CAStreamBasicDescription ([audioStreamDescription audioStreamBasicDescription]),
NULL);
}



//begin the recording // audioFileRecorder->Start();

// update the UI so the user can stop the recording
[self setRecordButtonImage: [NSImage imageNamed: @"Capture_Record_on.tif"]];
[self setAltRecordButtonImage: [NSImage imageNamed: @"Capture_Record_onPressed.tif"]];


  // start recording
  isRecording = YES;

  return YES;
}


- (void) stopRecording { // stop recording //[[self recordingDevice] deviceStop]; audioFileRecorder->Stop();

// update the UI to turn off the 'stop' button
[self setRecordButtonImage: [NSImage imageNamed: @"Capture_Record_off.tif"]];
[self setAltRecordButtonImage: [NSImage imageNamed: @"Capture_Record_offPressed.tif"]];
isRecording = NO;
}




_______________________________________________
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: m4a blank file on recording
      • From: Doug Wyatt <email@hidden>
  • Prev by Date: Re: USB vs. FireWire
  • Next by Date: Re: Why a crash in Float32ToNative16_Altivec?
  • Previous by thread: Re: Why a crash in Float32ToNative16_Altivec?
  • Next by thread: Re: m4a blank file on recording
  • Index(es):
    • Date
    • Thread