2013-08-10 2 views
0

저는 iOS 개발에서 새롭습니다. https://github.com/vecter/Audio-Queue-Services-Example에서 AudioToolBox 프레임 워크를 사용하여 오디오 대기열 서비스를 사용하여 샘플 오디오 녹음기 프로젝트를 다운로드했습니다. 샘플 프로젝트에서 오디오 녹음 형식은 .aif입니다. 다운로드 샘플 프로젝트를 실행하는 동안 fine.In 샘플 예제 프로젝트에서 .mp3 형식과 같은 오디오를 녹음하는 방법을 사용합니다. 내가 어떻게 할 수 있을까요?오디오 대기열 서비스 사용 방법 iPhone에서 mp3 형식으로 사운드를 녹음하는 방법

단순히 내가 kAudioFileMP3Type 내가

//---------nslog message-------------- Not recording, returning Writing buffer 0 //------------------ - (void)startRecording { [self setupAudioFormat:&recordState.dataFormat]; recordState.currentPacket = 0; OSStatus status; status = AudioQueueNewInput(&recordState.dataFormat, AudioInputCallback, &recordState, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &recordState.queue); if (status == 0) { // Prime recording buffers with empty data for (int i = 0; i < NUM_BUFFERS; i++) { AudioQueueAllocateBuffer(recordState.queue, 16000, &recordState.buffers[i]); AudioQueueEnqueueBuffer (recordState.queue, recordState.buffers[i], 0, NULL); } status = AudioFileCreateWithURL(fileURL, kAudioFileMP3Type, &recordState.dataFormat, kAudioFileFlags_EraseFile, &recordState.audioFile); if (status == 0) { recordState.recording = true; status = AudioQueueStart(recordState.queue, NULL); if (status == 0) { labelStatus.text = @"Recording"; } } } if (status != 0) { [self stopRecording]; labelStatus.text = @"Record Failed"; } } 

nslog

//로부터 메시지를 받고 있습니다에게 kAudioFileAIFFType을 변경 한 -------------------- -------------------------------------------------- -----

- (void)startPlayback 
{ 
playState.currentPacket = 0; 

[self setupAudioFormat:&playState.dataFormat]; 

OSStatus status; 
status = AudioFileOpenURL(fileURL, kAudioFileReadPermission, kAudioFileMP3Type, &playState.audioFile); 
if (status == 0) 
{ 
    status = AudioQueueNewOutput(&playState.dataFormat, 
           AudioOutputCallback, 
           &playState, 
           CFRunLoopGetCurrent(), 
           kCFRunLoopCommonModes, 
           0, 
           &playState.queue); 

    if (status == 0) 
    { 
     // Allocate and prime playback buffers 
     playState.playing = true; 
     for (int i = 0; i < NUM_BUFFERS && playState.playing; i++) 
     { 
      AudioQueueAllocateBuffer(playState.queue, 16000, &playState.buffers[i]); 
      AudioOutputCallback(&playState, playState.queue, playState.buffers[i]); 
     } 

     status = AudioQueueStart(playState.queue, NULL); 
     if (status == 0) 
     { 
      labelStatus.text = @"Playing"; 
     } 
    }   
} 

if (status != 0) 
{ 
    [self stopPlayback]; 
    labelStatus.text = @"Play failed"; 
} 
} 

답변

0

아니요 MP3로 녹음 할 수 없습니다. 그 이유는 핵심 오디오 설명서 (핵심 오디오 pdf 51 페이지)에서 명확하게 설명됩니다. 자신의 단어 ->
아이폰 OS에서

는 표 2-5에 나와있는 기록 코덱이 포함되어 있습니다. 보시다시피 MP3 또는 AAC 녹음을 사용할 수 없습니다. 이것은 CPU 오버 헤드가 높고 결과적으로 이러한 형식의 배터리가 소모되기 때문입니다.

아이폰 OS : 기록 오디오 포맷

  • 애플 무손실
  • 에서 iLBC (인터넷 낮은 비트 레이트 코덱, 음성 코덱) (또한 IMA-4라고도 함)
  • IMA/ADPCM
  • 선형 PCM
  • μμLaw 및 aLaw