Re: Hearing a static noise on audio Maybe clockrate issues?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
To unsubscribe send an email to pjsip-leave@xxxxxxxxxxxxxxx
pcm.cirrus {
    type hw
    card 0
    device 0
}

pcm.myhdmi {
    type hw
    card 1
    device 0
}

pcm.cirrusmixer  {
    type dmix
    ipc_key 800
    ipc_perm 0666 # allow other users
    ipc_key_add_uid true # for testing; see https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 48000
        # channels 2
    }
    bindings {
        0 0
        1 1
    }
}

pcm.cirrusmic  {
    type dsnoop
    ipc_key 801
    ipc_perm 0666 # allow other users
    ipc_key_add_uid true # for testing; see https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 48000
        channels 2
    }
    bindings {
        0 0
        1 1
    }
}

#pcm.!default {
#    type plug
#    slave.pcm {
#        @func getenv
#        vars [ DEFAULT_PCM_DEVICE ]
#        default "cirrusmixer"
#    }
#}

pcm.!default {
    type asym

    capture.pcm {
        type plug
        slave.pcm {
            @func getenv
            vars [ DEFAULT_CAPTURE_DEVICE ]
            default "cirrusmic"
        }
    }

    playback.pcm {
        type plug
        slave.pcm {
            @func getenv
            vars [ DEFAULT_PCM_DEVICE ]
            default "cirrusmixer"
        }
    }
}

ctl.!default {
    type hw
    card 0
}

pcm.dsp0 {  
    type plug
    slave.pcm "cirrus"
}

ctl.mixer0 {
    type hw
    card 0
}
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list -- pjsip@xxxxxxxxxxxxxxx
To unsubscribe send an email to pjsip-leave@xxxxxxxxxxxxxxx

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux