[HowTo] enable sound in Kazam

Difficulty: ★☆☆☆☆

This guide will show you how to enable the sound options in Kazam.

  1. Open your favourite terminal by pressing Ctrl+Alt+T or searching for terminal, konsole or console in your menu

  2. Copy-paste the following in there:

    sudo sed --in-place 's/time.clock/time.perf_counter/g' /usr/lib/python3.9/site-packages/kazam/pulseaudio/pulseaudio.py
    

This uses stream editor (sed) as follows:

  • sed --in-place
    invokes sed and does not create a new file put replaces inside the existing one
  • 's/time.clock/time.perf_counter/g'
    searches time.clock and replaces it with time.perf_counter and does this globally (= all occurrences in the file)
  • Does this in file /usr/lib/python3.9/site-packages/kazam/pulseaudio/pulseaudio.py.

:+1:

4 Likes

While I don’t need or indeed use sound at my computer (due to a hearing problem), I recognized that this might be a little bit easier using sed.

As far as I can tell, you only need one command, and it proved so according to this page:

sudo sed -i 's/time.clock/time.perf_counter/g' '/usr/lib/python3.9/site-packages/kazam/pulseaudio/pulseaudio.py'

This uses Stream EDitor (sed) as follows:

  1. sed -i 's/old-text/new-text/g' input.txt
    1.1 The s is the substitute command of sed for find and replace.
    1.2. It tells sed to find all occurrences of ‘time.clock’ and replace with ‘time.perf_counter’ in the file /usr/lib/python3.9/site-packages/kazam/pulseaudio/pulseaudio.py.

Or that’s my, admittedly limited, understanding any way.

2 Likes
  • First of all: thanks for the wonderful tutorial! :+1:
  • I’m an editor here on the site and I’m going through all of the tutorials here and adding a difficulty level for all of them. If you disagree with my 1 star, feel free to change that or remove it altogether: You are in control! (I just want to avoid N00bs who don’t know the difference between UEFI and BIOS to get their heads too deep in… erm… YKWIM :stuck_out_tongue_winking_eye: )
  • I’ve also improved the readability of your post by:
    • Using the third person
    • Numbering items so if anyone ever runs into an issue, they can say “While executing step #5, I get Flux capacitor not installed.
      What should I do?
    • used correct indentation
    • removed some minor spelling and/or grammar errors.

If you want to review all of the changes I made, just press the orange pencil in the top right of your post…

:+1:

P.S. @Mirdarthos your excellent propositions included as well.

2 Likes

Thank you @Fabby,

Now I learnt something from this as well!

1 Like

The proper way would be to ask the AUR maintainer to add it to the PKGBUILD: :wink:

--- PKGBUILD-a  2021-04-15 10:07:30.764178007 -0600
 +++ PKGBUILD-b  2021-04-15 10:11:36.645661331 -0600
 @@ -35,7 +35,12 @@
  _srcname=${pkgname}-${pkgver}
  
 +prepare() {
 +    cd "${_srcname}"
 +    sed -i 's/time.clock/time.perf_counter/g' ${pkgname}/pulseaudio/pulseaudio.py
 +}
 +
  build() {
      cd "${_srcname}"
 -    
 +
      local src
      for src in "${source[@]}"; do
4 Likes

What an absolute power-move!

1 Like