Hearing a static noise on audio Maybe clockrate issues?

Šimon Čecháček
Wed, Apr 19, 2023 10:20 PM

Hello,

I am currently fighting with static noise whenever call is trying to be
started. I think its due to clockrate, but I am unable to fix it.

Its not just the call issue, as when I try to go with the list of
troubleshooting audio, the issue also appears when I try to playback a
WAV file. (there is a noise and then there is the WAV file in the
background being played).

Here is the full log of the ./playfile sample:
https://paste.brcb.eu/wajyxurele.apache. When I tried the sipecho or
recording a file. It all worked fine. But just to note, when the
recording was running, it reported a different sample rate:
amp.rate=44100 (the playback showed amp.rate=22050). Here is the full
log of recording: https://paste.brcb.eu/herexyxixa.apache).

I also read (here:
https://docs.pjsip.org/en/latest/specific-guides/audio-troubleshooting/checks/problematic_clock_rate.html)
that it can be an issue with clock rate. But on the doc page, there is
no way how to fix it. So I want to kindly ask for your help, how to get
this working.

My setup is: Raspberry Pi Zero 2W with ReSpeaker 2mics hat running Raspi
OS (legacy buster based) with PJSIP 2.10 (i know, older version, but
specified by my school, cant change that).

Also, my main usage is a custom script using PJSIP as a doorbell, so can
you please help me to get the settings right at least when using my
script? Here it is: ttps://paste.brcb.eu/yrygofukud.md. (there is also a
modified call.py file: https://paste.brcb.eu/gywequhaqu.rb)

Thank you!
Kind regards
Simon Cechacek

Hello, I am currently fighting with static noise whenever call is trying to be started. I think its due to clockrate, but I am unable to fix it. Its not just the call issue, as when I try to go with the list of troubleshooting audio, the issue also appears when I try to playback a WAV file. (there is a noise and then there is the WAV file in the background being played). Here is the full log of the ./playfile sample: https://paste.brcb.eu/wajyxurele.apache. When I tried the sipecho or recording a file. It all worked fine. But just to note, when the recording was running, it reported a different sample rate: amp.rate=44100 (the playback showed amp.rate=22050). Here is the full log of recording: https://paste.brcb.eu/herexyxixa.apache). I also read (here: https://docs.pjsip.org/en/latest/specific-guides/audio-troubleshooting/checks/problematic_clock_rate.html) that it can be an issue with clock rate. But on the doc page, there is no way how to fix it. So I want to kindly ask for your help, how to get this working. My setup is: Raspberry Pi Zero 2W with ReSpeaker 2mics hat running Raspi OS (legacy buster based) with PJSIP 2.10 (i know, older version, but specified by my school, cant change that). Also, my main usage is a custom script using PJSIP as a doorbell, so can you please help me to get the settings right at least when using my script? Here it is: ttps://paste.brcb.eu/yrygofukud.md. (there is also a modified call.py file: https://paste.brcb.eu/gywequhaqu.rb) Thank you! Kind regards Simon Cechacek
CH
Christian Hoff
Thu, Apr 20, 2023 4:46 AM

Hello Simon,

I had a very similar (perhaps the same) issue when using PJSIP on my
Raspberry Pi.In my case, the problem was: I was using ALSA directly (no
PulseAudio) and didn't have a .asoundrc file in my home directory with
"plug" devices defined (type plug). You need to define these plug
devices as default ALSA devices - and I think the exact reason was that
PJSIP tries to play audio in mono mode (1 channel), but only 2 channels
were natively supported by my hardware. PJSIP failed to notice this and
streamed the audio in mono mode nonetheless, which resulted in that
garbled audio output. I think there was also some way to tell PJSIP to
use stereo mode for playback and that also made things work again- even
without the .asoundrc. The plug devices in .asoundrc solve the issue,
since they will convert the audio output from mono to stereo if
required. This also solved a couple of other issues I had when using
other apps that were using audio. I have attached my .asoundrc.

Best regards,

   Christian

On 20/04/2023 00:20, Šimon Čecháček wrote:

Hello,

I am currently fighting with static noise whenever call is trying to
be started. I think its due to clockrate, but I am unable to fix it.

Its not just the call issue, as when I try to go with the list of
troubleshooting audio, the issue also appears when I try to playback a
WAV file. (there is a noise and then there is the WAV file in the
background being played).

Here is the full log of the ./playfile sample:
https://paste.brcb.eu/wajyxurele.apache. When I tried the sipecho or
recording a file. It all worked fine. But just to note, when the
recording was running, it reported a different sample rate:
amp.rate=44100 (the playback showed amp.rate=22050). Here is the full
log of recording: https://paste.brcb.eu/herexyxixa.apache).

I also read (here:
https://docs.pjsip.org/en/latest/specific-guides/audio-troubleshooting/checks/problematic_clock_rate.html)
that it can be an issue with clock rate. But on the doc page, there is
no way how to fix it. So I want to kindly ask for your help, how to
get this working.

My setup is: Raspberry Pi Zero 2W with ReSpeaker 2mics hat running
Raspi OS (legacy buster based) with PJSIP 2.10 (i know, older version,
but specified by my school, cant change that).

Also, my main usage is a custom script using PJSIP as a doorbell, so
can you please help me to get the settings right at least when using
my script? Here it is: ttps://paste.brcb.eu/yrygofukud.md. (there is
also a modified call.py file: https://paste.brcb.eu/gywequhaqu.rb)

Thank you!
Kind regards
Simon Cechacek


Visit our blog:http://blog.pjsip.org

pjsip mailing list --pjsip@lists.pjsip.org
To unsubscribe send an email topjsip-leave@lists.pjsip.org

Hello Simon, I had a very similar (perhaps the same) issue when using PJSIP on my Raspberry Pi.In my case, the problem was: I was using ALSA directly (no PulseAudio) and didn't have a .asoundrc file in my home directory with "plug" devices defined (type plug). You need to define these plug devices as default ALSA devices - and I think the exact reason was that PJSIP tries to play audio in mono mode (1 channel), but only 2 channels were natively supported by my hardware. PJSIP failed to notice this and streamed the audio in mono mode nonetheless, which resulted in that garbled audio output. I think there was also some way to tell PJSIP to use stereo mode for playback and that also made things work again- even without the .asoundrc. The plug devices in .asoundrc solve the issue, since they will convert the audio output from mono to stereo if required. This also solved a couple of other issues I had when using other apps that were using audio. I have attached my .asoundrc. Best regards,    Christian On 20/04/2023 00:20, Šimon Čecháček wrote: > Hello, > > I am currently fighting with static noise whenever call is trying to > be started. I think its due to clockrate, but I am unable to fix it. > > Its not just the call issue, as when I try to go with the list of > troubleshooting audio, the issue also appears when I try to playback a > WAV file. (there is a noise and then there is the WAV file in the > background being played). > > Here is the full log of the ./playfile sample: > https://paste.brcb.eu/wajyxurele.apache. When I tried the sipecho or > recording a file. It all worked fine. But just to note, when the > recording was running, it reported a different sample rate: > amp.rate=44100 (the playback showed amp.rate=22050). Here is the full > log of recording: https://paste.brcb.eu/herexyxixa.apache). > > I also read (here: > https://docs.pjsip.org/en/latest/specific-guides/audio-troubleshooting/checks/problematic_clock_rate.html) > that it can be an issue with clock rate. But on the doc page, there is > no way how to fix it. So I want to kindly ask for your help, how to > get this working. > > My setup is: Raspberry Pi Zero 2W with ReSpeaker 2mics hat running > Raspi OS (legacy buster based) with PJSIP 2.10 (i know, older version, > but specified by my school, cant change that). > > > Also, my main usage is a custom script using PJSIP as a doorbell, so > can you please help me to get the settings right at least when using > my script? Here it is: ttps://paste.brcb.eu/yrygofukud.md. (there is > also a modified call.py file: https://paste.brcb.eu/gywequhaqu.rb) > > Thank you! > Kind regards > Simon Cechacek > > _______________________________________________ > Visit our blog:http://blog.pjsip.org > > pjsip mailing list --pjsip@lists.pjsip.org > To unsubscribe send an email topjsip-leave@lists.pjsip.org