It should be possible to test this kind of things more systematically, for example to play some chosen test-sound generated by some other sound source, play that into the L5 mic during a call that gets picked up in a voicemail, then download the resulting recording from the voicemail and compare the sound that came from the call to the original test-sound. Then do the same test for some other phone(s) to see how the L5 behaves compared to other phones.
On second thought, probably best to start by testing the mic separately by just recording something using gnome-sound-recorder or similar and check if there is a problem with some frequencies. (To see if there is an issue with the mic itself, not necessarily related to the phone call functionality.)
OK, I will do a test with gnome-sound-recorder and report back. I will try to record a call too on a samsung device. How do you record a call on android? Is it trivial?
Ah, how do you test the frequencies of a recording? (I have access only to Linux machines)
Same sound source recorded simultaneously on L5 and Samsung A50. The spectrograms are so different… However the sound is much louder on A50 and very low ion L5. In any case I upload the two spectrograms.
L5:
Oops. Sox fails on flac and gives only 8 seconds. A50 is correct because it encoded to wav. So I used sox to convert L5 flac to wav and regenerate spectrogram. So the correct spectrogram for L5 is the following:
So they look the same except that A50 used Mono (1 channel) and L5 seems to have recorded 2 channels.
Is there another sound processing going on after the mic picks up the sound? What happens when the sound gets in the modem? My next test will be to record the audio as listened to on the A50 through cellular and reproduce the spectrogram. I just do not know how to capture the audio on Android from this device…
Maybe the mic picks up sound just fine, and it is that PulseAudio echo cancellation thing that causes middle frequencies to be too low. It would be interesting then to look at spectrograms or similar before and after the echo cancellation, if someone can figure out how to do that.
So, just curious to know, how to solve it?
As you written, https://source.puri.sm/Librem5/linux-next/-/issues/348 gain itself volume, so, to prevent distortion, you reduced the power. But with low power, trouble to listen. What’s your strategy?
Perhaps less reduction of power?
Thank you, dos
I don’t know the reason why audio is off-center yet, so identifying that would be the first step
The gain isn’t lowered that much though, and it only applies to L5 microphone - so audio that the other party hears. If you find the other party too quiet, just adjust the volume with volume buttons on the side or volume slider in phosh quick settings.
There’s module-echo-cancel in PulseAudio and there’s GSM codec in the modem. For the former, you can test how it works even on your PC, since it’s a regular mainline module included by default in PulseAudio installations. When it comes to the latter, since there’s no VoLTE enabled by default, the modem uses 3G codecs (I know that VoLTE can provide higher fidelity audio than that, but I don’t know the details).
I believe we’re limiting microphone gain a bit because of distortion that seems to be caused by
There’s an audio production technique for making audio that is soft sometimes and loud other times more uniform called compression (not to be confused with audio codec compression). Limiting, a special case of compression is specifically used to limit the peak amplitude. It’s mostly used in mastering, but it basically increases the perceived volume of audio while reducing the impacts of distortion/clipping.
Here’s an article explaining the concept. There are several open source plugins for limiting available for GNU/Linux, but I don’t know how practical they would be to run inline with the phone audio. Here’s some code as an example.
This doesn’t help with the underlying issue, but maybe someone can find a way to route quiet audio through a limiter to increase the perceived volume while reducing the possibility for clipping.
Yup, that’s true - I’m just not too eager to jump into more advanced audio processing before lower level issues get sorted out, as fixing them may then invalidate the rest of the chain. That’s also why we keep things like noise reduction in module-echo-cancel disabled at the moment - there’s a higher chance that they’ll hurt rather than help, but that will surely get reevaluated at some point in the future.
I used a phone that can record from a call. I called it with L5 and Samsung A50 playing the same song with strong speaking and low music. The files then are passed from sox to produce the spectrograms. It is clear that “someone” using a software cuts the sound sent over the phone at 4KHz. The cut for L5 is so uniform that I am sure it is not done by the hardware. Some software does this damage. On the contrary notice that the L5 mic behaves as superior to Samsung’s A50, as the latter does not pass the music which is lower than speech for this song at seconds around 10, 16, 22 etc. It produces silence. This is not observed with L5. Here are the spectrograms:
Hmmm I thought that the problem was with L5. But you ask about A50. It certainly started with 4G. Now if at some point it switched to 3G, I can not be sure. Same goes for L5.
Does this imply that this test is inconclusive? the 4KHz cut is very uniform. Does it relate to 2/3/4G ?
But you know… this is typical for L5. You can hear it on the other side that it is different…
To make a proper test, both phones should be using the same connection technology, since you’re obviously not going to get the same audio quality over 2G as over VoLTE. Since VoLTE isn’t really supported yet on L5, this would mean setting the Samsung phone up in a way that limits it to 3G.
Wikipedia says that 3G cuts off at 3400 Hz (by filtering). It also says 8 kHz sampling frequency, which should mean a hard limit of 4 kHz for reproducing sound.
As @dos says, VoLTE allows much higher quality codecs, so for a guaranteed apples-to-apples comparison, you would want to disable VoLTE on the Samsung phone (and one way of achieving that may be to disable 4G).
So there is no need to re-test. If 3G has 4 kHz the hard limit, and L5 works only with 3G there is nothing to test. That is all and we should wait for VoLTE.