Sound on L5; talking with a dj and musician

Some people hear me OK (me on L5) but some not very good. It happened I had a conversation over L5 with a dj and musician. He was on iPhone (musicians are mostly sold to Apple…). I asked him to comment on sound quality he was receiving. He told me that my phone seems to have a problem. Specifically he pointed out the the middle frequencies are too low. The phone sends strong high frequencies and strong low frequencies but no middle frequencies.

He asked me to modify this with an equalizer. But I do not see such an option for the Input devices of L5 (only for output).

I thought that this information would be helpful to devs so I write it here.

Is it possible to modify the frequencies the mic prefers to pick and send?

13 Likes

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.)

4 Likes

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)

1 Like

One thing you can do is to use a program called sox – “SoX - Sound eXchange, the Swiss Army knife of audio manipulation”.

From gnome-sound-recorder you can export a recording as a .flac file, then you can get a spectrogram using sox like this:

sox yourfile.flac -n spectrogram

which creates an image file spectrogram.png showing frequencies over time.

There are probably better ways, this is just one I happened to find.

5 Likes

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:

SamsungA50:

3 Likes

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…

5 Likes

Yes I think so, see what @dos wrote here:

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.

3 Likes

L5 mic picks up the same frequencies with Samsung A50 but the gain (volume of recording) is too low. I would say at least 60% less than A50. Why this?

I will try the following setup that uses 4 phones and a PC.
Ph1=L5
Ph2=A50
Ph3=S8
Ph4= a tablet

PC plays a song with talk clearly above music, to Ph1 mic which is in a call with Ph3.
Ph3 has open its speaker and the sound gets recorded by Ph4.

Same setup but now PC plays the song to the mic of A50 which is in a call with Ph3.
Ph3 has open its speaker and the sound gets recorded by Ph4.

All Ph1, 2 and 3 are on the same cellular company.

Then I will recreate spectrograms.

3 Likes

I believe we’re limiting microphone gain a bit because of distortion that seems to be caused by https://source.puri.sm/Librem5/linux-next/-/issues/348

5 Likes

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 :wink:

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).

3 Likes

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.

5 Likes

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.

7 Likes

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:

L5:

Samsung A50:

So @dos do you know what causes this behavior and how can be resolved improving L5’s audio perception on the other side?

7 Likes

Was that Samsung phone using 3G/2G or 4G for that call?

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.

1 Like

Side note: 4kHz was, I think, the traditional POT bandwidth. Likely it’s also used for 2G and 3G.

2 Likes

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).

2 Likes

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.

1 Like