나는 오디오를 녹음하고 거꾸로 재생해야하는 응용 프로그램을 작성 중입니다. AVAudioRecorder를 사용하여 오디오를 caf 파일에 녹음했으며 AVAudioPlayer 및 MPMoviePlayerController를 사용하여 오디오를 전달할 수있었습니다. -1로 MPMoviePlayerController.currentPlaybackRate를 설정해 보았지만 아무런 잡음도 내지 않습니다. 연구에서 나는 오디오 파일을 바이트 단위로 뒤집을 필요가 있음을 발견했지만 어떻게해야할지 모르겠다. 배열에 caf 파일을 읽고 배열에서 쓸 수있는 방법이 있습니까? 어떤 도움을 주시면 감사하겠습니다.iPhone 재생 caf 오디오 뒤로
0
A
답변
0
나는 사용자가 말한 것을 기록하고 뒤로 거는 샘플 앱을 작업했습니다. 나는 이것을 달성하기 위해 CoreAudio를 사용했다. Link to app code.
각 샘플은 크기가 16 비트 (2 바이트) (모노 채널)이므로 (녹음에 사용 된 속성에 따라 다름) 녹음의 끝에서 시작하여 뒤로 읽음으로써 각 샘플을 다른 버퍼에 복사하여 한 번에로드 할 수 있습니다. 데이터의 시작 부분에 도달하면 데이터를 반전하고 재생이 취소됩니다.
// set up output file
AudioFileID outputAudioFile;
AudioStreamBasicDescription myPCMFormat;
myPCMFormat.mSampleRate = 16000.00;
myPCMFormat.mFormatID = kAudioFormatLinearPCM ;
myPCMFormat.mFormatFlags = kAudioFormatFlagsCanonical;
myPCMFormat.mChannelsPerFrame = 1;
myPCMFormat.mFramesPerPacket = 1;
myPCMFormat.mBitsPerChannel = 16;
myPCMFormat.mBytesPerPacket = 2;
myPCMFormat.mBytesPerFrame = 2;
AudioFileCreateWithURL((__bridge CFURLRef)self.flippedAudioUrl,
kAudioFileCAFType,
&myPCMFormat,
kAudioFileFlags_EraseFile,
&outputAudioFile);
// set up input file
AudioFileID inputAudioFile;
OSStatus theErr = noErr;
UInt64 fileDataSize = 0;
AudioStreamBasicDescription theFileFormat;
UInt32 thePropertySize = sizeof(theFileFormat);
theErr = AudioFileOpenURL((__bridge CFURLRef)self.recordedAudioUrl, kAudioFileReadPermission, 0, &inputAudioFile);
thePropertySize = sizeof(fileDataSize);
theErr = AudioFileGetProperty(inputAudioFile, kAudioFilePropertyAudioDataByteCount, &thePropertySize, &fileDataSize);
UInt32 dataSize = fileDataSize;
void* theData = malloc(dataSize);
//Read data into buffer
UInt32 readPoint = dataSize;
UInt32 writePoint = 0;
while(readPoint > 0)
{
UInt32 bytesToRead = 2;
AudioFileReadBytes(inputAudioFile, false, readPoint, &bytesToRead, theData);
AudioFileWriteBytes(outputAudioFile, false, writePoint, &bytesToRead, theData);
writePoint += 2;
readPoint -= 2;
}
free(theData);
AudioFileClose(inputAudioFile);
AudioFileClose(outputAudioFile);
희망이 도움이됩니다.
관련 문제
- 1. iPhone CAF 오디오 파일 형식
- 2. MPMoviePlayerController에서 뒤로 오디오 재생
- 3. SimpleAudioEngine, .caf 재생 파일
- 4. iphone 게임에서 오디오 재생
- 5. iPhone 앱에서 오디오 재생
- 6. iPhone 개발 : 뒤로 애니메이션 재생
- 7. iphone : 백그라운드에서 오디오 재생 목록을 재생 하시겠습니까?
- 8. 뒤로 재생 오디오 파일의 목표 다
- 9. 일정한 볼륨에서 iphone 오디오 재생
- 10. 오디오 봉투 차이점 ... ADTS, CAF,
- 11. iphone 게임 caf 효과음
- 12. iPhone caf => m4a
- 13. iPhone 합병 UIImage 및 CAF AV 파일에 오디오
- 14. iPhone SDK 작은 CAF 파일 : 오디오 대기열의 녹음 품질이 낮습니까?
- 15. 스플래시 화면에서 iPhone 사운드 재생
- 16. Android 오디오 파일 재생
- 17. iPhone : CAF 파일에 녹음하면 정적으로 만 생성됩니다.
- 18. 백그라운드에서 오디오 재생 (Iphone os 4.0)
- 19. Monotouch : iPhone 시뮬레이터로 배경 오디오 재생
- 20. Iphone 스트리밍 및 재생 오디오 문제
- 21. iPhone에서 오디오 재생
- 22. iPhone 사운드 : 재생 중에 오디오 파일의 재생 속도를 조정하십시오.
- 23. 테이블에서 오디오 파일 재생
- 24. 사용할 로컬 오디오 .caf 파일로드 중? iOS
- 25. CAF 오디오 컨테이너를 mp4로 변경 하시겠습니까?
- 26. iPhone 오디오 문제
- 27. android의 오디오 트랙에서 오디오 재생
- 28. 오디오 API로 오디오 스트림 재생
- 29. iOS의 컨트롤로 오디오 재생
- 30. 백그라운드에서 오디오 재생 - windows mango