Obtaining un-mixed RX audio?

I am using a WP7611 (R16, legato 19.11.3) and trying to generate some measurements on the output signal being sent to our speaker output. I create streams with le_voicecall_GetRxAudioStream(), le_audio_OpenSpeaker(), and le_audio_OpenRecorder(). These are then connected together to read the RxAudioStream via the recorder. What I’m seeing is that the microphone data (which also is opened and separately connected to the TxAudioStream) gets mixed in to this stream which ruins my attempt to make measurements on the received audio.

It does appears that there’s sidetone mixed into the signal that comes out the speaker, but it is at a MUCH lower level than what I see in the recorded stream. How can I get the pure received audio without local microphone mixed in?

do you see problem with AT!AVAUDIO command to record audio?

Yes, and it works the same way with AT!AVAUDIO. However, the AT command reference document says that should happen. Here’s what the reference says about using command 4:

4=WWAN record. Record both ends of a voice call to the specified .wav file
().

The only other record option is command 1 which is only the local microphone (I don’t want the microphone data).

Can you list out the step to see the issue with at!avaudio

Sure. I have also figured out something new which partially solves my problem which I will also explain.

I have an application that listens for new calls, answers, and connects the RX and TX audio to the speaker and microphone. After the call is connected and this happens, I do the following:

root@swi-mdm9x28-wp:~# microcom /dev/ttyAT
AT!AVAUDIO=4,1,/tmp/rec1.wav

Speak into the modem’s microphone and the calling cell’s microphone, and then stop the recording:

root@swi-mdm9x28-wp:~# microcom /dev/ttyAT
AT!AVAUDIO=4,0

Finally, end the call and listen to the wav file. The audio spoken into the modem’s mic and the cell’s mic will both be in the wav file (as a reminder, I only want the audio from the cell’s mic/received by the modem and NOT the audio from the modem’s mic/transmitted by the modem).

The bit of new info I have is that if I run the following command after starting the recording using AT!AVAUDIO, I get exactly what I want, but there’s a catch…

amix 'MultiMedia1 Mixer PRI_MI2S_TX' 0

The catch is that I have to stop the AT!AVAUDIO recording BEFORE the call ends, or on the next call I can’t connect the modem’s speaker and mic to the modem RX/TX streams - it fails when connecting them to their respective connectors. I can’t stop the recording before the call ends because I don’t know when the remote caller is going to hang up. Here are the errors I see when trying to connect the audio streams on the next call:

Dec  4 13:35:36 swi-mdm9x28-wp user.info Legato:  INFO | audioDaemon[1142]/le_pa_audio T=main | pa_audio.c pa_audio_SetDspAudioPath() 1942 | Set the following path: 2 (in.0 out.5)
Dec  4 13:35:36 swi-mdm9x28-wp user.err Legato: =ERR= | audioDaemon[1142]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 799 | Sending QMI_SWI_M2M_AUDIO_SET_AVCFG_REQ_V01 failed: rc=-2 (Service), resp.result=0.[0x00], resp.error=0.[0x00]
Dec  4 13:35:36 swi-mdm9x28-wp user.err Legato: =ERR= | audioDaemon[1142]/le_pa_audio T=main | pa_audio.c pa_audio_SetDspAudioPath() 2033 | Cannot set the audio physical interface to 2
Dec  4 13:35:36 swi-mdm9x28-wp user.info Legato:  INFO | audioDaemon[1142]/le_pa_audio T=main | pa_audio.c pa_audio_SetDspAudioPath() 1942 | Set the following path: 2 (in.4 out.1)
Dec  4 13:35:36 swi-mdm9x28-wp user.err Legato: =ERR= | audioDaemon[1142]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 799 | Sending QMI_SWI_M2M_AUDIO_SET_AVCFG_REQ_V01 failed: rc=-2 (Service), resp.result=0.[0x00], resp.error=0.[0x00]
Dec  4 13:35:36 swi-mdm9x28-wp user.err Legato: =ERR= | audioDaemon[1142]/le_pa_audio T=main | pa_audio.c pa_audio_SetDspAudioPath() 2033 | Cannot set the audio physical interface to 2

I have also tried using the above mixer setting while using the stream generated by le_audio_OpenRecorder(), but this causes no audio to be recorded by the recorder - it disconnects all audio somehow instead of just from the modem’s mic. Apparently AT!AVAUDIO works differently from the le_audio stream handling.

not sure if it works if you change the value of “MultiMedia1 Mixer PRI_MI2S_TX” back to original one after you end the call
you can give a try.

Unfortunately, the value I set is actually the default (the state it is in before you run the AT!AVAUDIO command). I found it by dumping all the mixer values before and after running the command.

I don’t see problem with the following procedure:

  1. WP7608 FW 13.3

  2. root@swi-mdm9x28-wp:~# amix ‘MultiMedia1 Mixer PRI_MI2S_TX’
    MultiMedia1 Mixer PRI_MI2S_TX: off

  3. open USB AT command port and type ATD1234567;

  4. Peer side answers the phone call

  5. in USB AT command port and type: at!AVAUDIO=4,1,/tmp/recording1.wav

root@swi-mdm9x28-wp:~# amix ‘MultiMedia1 Mixer PRI_MI2S_TX’
MultiMedia1 Mixer PRI_MI2S_TX: on
root@swi-mdm9x28-wp:~# amix ‘MultiMedia1 Mixer PRI_MI2S_TX’ 0
root@swi-mdm9x28-wp:~# amix ‘MultiMedia1 Mixer PRI_MI2S_TX’
MultiMedia1 Mixer PRI_MI2S_TX: off

  1. Peer side hangs the phone call
  2. NO CARRIER is received in USB AT command port
  3. in USB AT command port and type: at!AVAUDIO=4,0
  4. in USB AT command port and type ATD1234567; to dial next call
  5. Peer side answers the phone call
  6. Still able to use the audio or record the voice call by at!AVAUDIO=4,1,/tmp/recording1.wav

The failure I’m seeing isn’t when trying to use AT!AVAUDIO again, it’s when I try to connect the ModemRX to the speaker and the ModemTX to the microphone on the next call. Specifically, the calls to le_audio_Connect() to connect the ModemRX/TX streams to the connector.

you mean in step 5, step 9 and step 12 above, you are using legato application to record instead of AT!AVAUDIO?

Will you consider using AT!AVAUDIO in your application?

No, I was using a combination. I am using a legato application to configure the audio path (connect the audio streams to the speaker and microphone, and allow muting of a stream when necessary). But then I was using the AT command to do the recording (do steps 5 and 9).

as a note: When I run step 9 after the call ends, I get an ERROR response instead of OK. Do you get OK?

yes, I can get OK response in step 9:

atd12345678;
OK

CONNECT
at!AVAUDIO=4,1,/tmp/recording1.wav
OK


root@swi-mdm9x28-wp:~# amix 'MultiMedia1 Mixer PRI_MI2S_TX'
MultiMedia1 Mixer PRI_MI2S_TX: off
root@swi-mdm9x28-wp:~# amix 'MultiMedia1 Mixer PRI_MI2S_TX'
MultiMedia1 Mixer PRI_MI2S_TX: on
root@swi-mdm9x28-wp:~# amix 'MultiMedia1 Mixer PRI_MI2S_TX' 0
root@swi-mdm9x28-wp:~# amix 'MultiMedia1 Mixer PRI_MI2S_TX'
MultiMedia1 Mixer PRI_MI2S_TX: off
root@swi-mdm9x28-wp:~#



NO CARRIER
at!AVAUDIO=4,0
OK

My temporary work around for now is to use the AT!AVAUDIO command and not use the Legato API at all. I don’t consider this a solution as I still get an ERROR response when I run “AT!AVAUDIO=4,0” and I am unable to make use of the Legato SDK to control the streams. However, it gets me the data I need for the time being.