코어 오디오 - AudioStreamBasicDescription 정보출력

 

Viewcontroller.h

 

Viewcontroller.m

 

출력결과//1.결과

더보기

 

     //fileTypeAndFormat.mFileType = kAudioFileAIFFType;

 

    //2018-11-06 21:57:17.243110+0900 3[932:67326] 0 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 8

 

    //2018-11-06 21:57:17.243354+0900 3[932:67326] 1 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 16

 

    //2018-11-06 21:57:17.243372+0900 3[932:67326] 2 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 24

 

    //2018-11-06 21:57:17.243387+0900 3[932:67326] 3 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 32

    /*

        aiff 가 pcm 형식에서 비트 깊이가 다른 형태만 지원함으로써 다양성이 부족함을 보여준다.

 

 

     2.변경

 

     아래코드로 변경했을때

 

     fileTypeAndFormat.mFileType = kAudioFileWAVEType;

 

     2018-11-06 22:13:11.776434+0900 3[981:92111] 0 : mFormatId : lpcm, mFormatFlags : 8, mBitsPerChannel: 8

 

     2018-11-06 22:13:11.777009+0900 3[981:92111] 1 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 16

 

     2018-11-06 22:13:11.777053+0900 3[981:92111] 2 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 24

 

     2018-11-06 22:13:11.777104+0900 3[981:92111] 3 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 32

 

     2018-11-06 22:13:11.777119+0900 3[981:92111] 4 : mFormatId : lpcm, mFormatFlags : 9, mBitsPerChannel: 32

 

     2018-11-06 22:13:11.777134+0900 3[981:92111] 5 : mFormatId : lpcm, mFormatFlags : 9, mBitsPerChannel: 64

 

 

     wav 파일이 다른 스타일의 pcm을 취함을 보여줌. wav파일은 항상 리틀엔디언 pcm으을 설정하고, 이는 형식이 정수 샘플에만 국한되지는 않는다.

 

 

     3.아래코드로 변경

 

     fileTypeAndFormat.mFileType = kAudioFileCAFType;

 

     2018-11-06 22:16:37.847672+0900 3[998:99577] 0 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 8

 

     2018-11-06 22:16:37.847877+0900 3[998:99577] 1 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 16

 

     2018-11-06 22:16:37.847899+0900 3[998:99577] 2 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 24

 

     2018-11-06 22:16:37.847929+0900 3[998:99577] 3 : mFormatId : lpcm, mFormatFlags : 14, mBitsPerChannel: 32

 

     2018-11-06 22:16:37.847950+0900 3[998:99577] 4 : mFormatId : lpcm, mFormatFlags : 11, mBitsPerChannel: 32

 

     2018-11-06 22:16:37.847977+0900 3[998:99577] 5 : mFormatId : lpcm, mFormatFlags : 11, mBitsPerChannel: 64

 

     2018-11-06 22:16:37.847998+0900 3[998:99577] 6 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 16

 

     2018-11-06 22:16:37.848017+0900 3[998:99577] 7 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 24

 

     2018-11-06 22:16:37.848036+0900 3[998:99577] 8 : mFormatId : lpcm, mFormatFlags : 12, mBitsPerChannel: 32

 

     2018-11-06 22:16:37.848055+0900 3[998:99577] 9 : mFormatId : lpcm, mFormatFlags : 9, mBitsPerChannel: 32

 

     2018-11-06 22:16:37.848073+0900 3[998:99577] 10 : mFormatId : lpcm, mFormatFlags : 9, mBitsPerChannel: 64

 

     caf는 여러가지 형식을 취하고, 정수와 부동소수점 샘플과 양과 음의 정수를 모두 사용한다.이는 aiff와 wav가 제공하는 하나를 제외한 모든 형식을 지원한다.

 

 

     4.아래코드로 변경

 

     fileTypeAndFormat.mFormatID = kAudioFormatMPEG4AAC;

 

     2018-11-06 22:20:17.493762+0900 3[1031:106537] 0 : mFormatId : aac , mFormatFlags : 0, mBitsPerChannel: 0

 

     aac가 caf 파일에 유요한 형태임을 알 수 있다.

 

 

     5.아래코드로 변경

 

     fileTypeAndFormat.mFileType = kAudioFileMP3Type;

 

     fileTypeAndFormat.mFormatID = kAudioFormatMPEG4AAC;

 

     오류발생 : fmt?

 

     aac데이터를 mp3 파일에 넣을 수 없다.(파일형식과 데이터 형식은 다르다.)

 

CoreAudio123.zip
4.07MB