LE AUDIO录音的优势
经典蓝牙TWS耳机录音一般采用的方案都是利用耳机麦克风拾音,然后通过ADC模数转换成数字信号PCM,DSP会将PCM数据经过音频编码(如SBC,LC3等)保存在本地,或者可以启用SPP协议实时传输至手机端。然后经典蓝牙TWS耳机实际上只有主耳与手机端建立ACL连接,副耳是采用监听方式,如果需要实时录音势必只有主耳能录音,副耳无法录音(无法传输数据至手机),这样就成了单声道录音。
而如果采用LE AUDIO方式的话,因为主副耳都与手机有ACL链路连接,各自录音也可以通过各自的CIS通道传输至手机,这样就可以进行双耳立体声录音了。
下面我们结合一个实例从HCI层来分析完整的LE AUDIO双耳立体声录音的协议流程:
LE AUDIO录音协议流程
LE连接建立
手机先与主耳建立BR连接,然后CTKD获得LTK后直接进行SMP Key Distribution,接着双方建立LE连接:
开启LE AUDIO相关ATT Primary Service查询
- ATT Read By Group Type Transaction (3’846 - Max Handle, Primary Service: Battery, Volume Control, Coordinated Set Identification)
- ATT Read By Group Type Transaction (18’176 - Max Handle, Primary Service: Microphone Control, Audio Stream Control, Broadcast Audio Scan)
- ATT Read By Group Type Transaction (20’480 - Max Handle, Primary Service: Published Audio Capability, Common Audio, Telephony and Media Audio)
开启Primary service下特征值的查询
- ATT Read By Type Transaction (17’408 - 17’663, Characteristic Declaration: [17’410=Volume State, Read, Notify], [17’413=Volume Control Point, Write], [17’415=Volume Flags, Read, Notify])
- ATT Read By Type Transaction (17’920 - 18’175, Characteristic Declaration: [17’922=Set Identity Resolving Key, Read, Notify], [17’925=Size, Read, Notify], [17’928=Lock, Read, Write, Notify])
- ATT Read By Type Transaction (17’928 - 18’175, Characteristic Declaration: 17’931=Rank, Read)
- ATT Read By Type Transaction (19’712 - 19’967, Characteristic Declaration: 19’714=Mute, Read, Write, Notify)
- ATT Read By Type Transaction (19’968 - 20’223, Characteristic Declaration: [19’970=ASE Control Point, Write w/o Resp, Write, Notify], [19’973=Sink ASE, Read, Notify], [19’976=Sink ASE, Read, Notify])
- ATT Read By Type Transaction (19’976 - 20’223, Characteristic Declaration: [19’979=Source ASE, Read, Notify], [19’982=Source ASE, Read, Notify])
- ATT Read By Type Transaction (20’224 - 20’479, Characteristic Declaration: [20’226=Broadcast Audio Scan Control Point, Write w/o Resp, Write], [20’228=Broadcast Receive State, Read, Notify])
- ATT Read By Type Transaction (20’480 - 20’735, Characteristic Declaration: [20’482=Available Audio Contexts, Read, Notify], [20’485=Supported Audio Contexts, Read, Notify], [20’488=Sink Audio Locations, Read, Write, Notify])
- ATT Read By Type Transaction (20’488 - 20’735, Characteristic Declaration: [20’491=Source Audio Locations, Read, Write, Notify], [20’494=Sink PAC, Read, Notify], [20’497=Source PAC, Read, Notify])
10.ATT Read By Type Transaction (21’248 - 21’503, Include: Included=17’920, End=18’175, Service=Coordinated Set Identification)
读取Identity resolving key
耳机进行TBS和GMCS服务查询
这里的0x1849 UUID是 Generic Media Control Service。
- ATT Read By Type Transaction (110 - 146, Characteristic Declaration: [112=Bearer Provider Name, Read, Notify], [115=Bearer UCI, Read], [117=Bearer Technology, Read, Notify], [120=Bearer URI Schemes, Read, Notify], [123=Bearer List Current Calls, Read, Notify], [126=Content Control ID, Read], [128=Status Flags, Read, Notify], [131=Call State, Read, Notify], [134=Call Control Point, Write w/o Resp, Write, Notify], [137=Call Control Point Optional Opcodes, Read], [139=Termination Reason, Notify], [142=Incoming Call, Read, Notify], [145=Call Friendly Name, Read, Notify])
- ATT Read By Type Transaction (60 - 97, Characteristic Declaration: [62=Media Player Name, Read, Notify], [65=Track Changed, Notify], [68=Track Title, Read, Notify], [71=Track Duration, Read, Notify], [74=Track Position, Read, Write w/o Resp, Write, Notify], [77=Playback Speed, Read, Write w/o Resp, Write, Notify], [80=Seeking Speed, Read, Notify], [83=Playing Order, Read, Write w/o Resp, Write, Notify], [86=Playing Orders Supported, Read], [88=Media State, Read, Notify], [91=Media Control Point, Write w/o Resp, Write, Notify], [94=Media Control Point Supported, Read, Notify], [97=Content Control ID, Read])
手机和副耳进行LE连接配对
副耳会和主耳共用相同的service和特征值,所以后面副耳无需再做查询。
读取主副耳的PAC
- ATT Read (Available Audio Contexts: Unspecified, Conversational, Media, Game, Instructional, Voice assistants, Live, Sound effects, Notifications, Ringtone, Alerts, Emergency alarm, Unspecified, Conversational, Media, Game, Instructional, Voice assistants, Live, Sound effects, Notifications, Ringtone, Alerts, Emergency alarm)
- ATT Read (Supported Audio Contexts: Unspecified, Conversational, Media, Game, Instructional, Voice assistants, Live, Sound effects, Notifications, Ringtone, Alerts, Emergency alarm, Unspecified, Conversational, Media, Game, Instructional, Voice assistants, Live, Sound effects, Notifications, Ringtone, Alerts, Emergency alarm)
- ATT Read (Sink PAC: N=1, Coding Format=LC3, Company ID=0, Vendor Specific Codec ID=0, Type=Supported Sampling Frequencies, 16000 Hz, 24000 Hz, 32000 Hz, 48000 Hz, Type=Supported Frame Durations, 7.5 ms, 10 ms, Type=Supported Octets Per Codec Frame, Min=26, Max=155, Type=Preferred Audio Contexts, Conversational, Media)
- ATT Read (Source PAC: N=1, Coding Format=LC3, Company ID=0, Vendor Specific Codec ID=0, Type=Supported Sampling Frequencies, 16000 Hz, 32000 Hz, 48000 Hz, Type=Supported Frame Durations, 7.5 ms, 10 ms, Type=Supported Octets Per Codec Frame, Min=26, Max=155, Type=Preferred Audio Contexts, Conversational, Media)
对主副耳进行ASCS code & qos config
创建主副耳的CIS
- 在ASCS code config之后,手机会发起HCI LE Set CIG Parameters和HCI Configure Data Path。
- 在ASCS Enable Type=Stream audio context ,Live 之后创建2路CIS。
- 手机发起设置HCI LE Setup ISO Data Path