Posts

  • | Source | Signature

    Manjaro PinePhone no sound after October 2023 update

    After running a software upgrade yesterday (10 October 2023) with sudo pacman -Syu, my PinePhone ended up with no sound.

    See this post on the Manjaro forum for my fix. To summarize:

    • I downgraded everything by following the “Downgrading all upgraded packages” section in this article (parsing /var/log/pacman.log and restoring from /var/cache/pacman/pkg/), and uninstalled alsa-ucm-pinephone. I then re-upgraded and manually reinstalled alsa-ucm-pinephone, and it just magically worked.
    • I suspect an easier fix will be to just edit /usr/share/alsa/ucm2/conf.d/simple-card/PinePhone.conf and only keep Syntax 2 and the SectionUseCase."HiFi" and SectionUseCase."Voice Call" sections, and remove everything else.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    LibDem misleading bar chart

    LibDem MP Daisy Cooper’s newsletter for St Albans contains a misleading bar chart where a 0% bar will have a height of 6 mm (i.e. the baseline of the chart is at -3.5%). In other words, if you stack LAB’s 9% and CON’s 39% (total 48%), it will be taller than LIBDEM’s 50%.

    Measurement and regression analysis
    (Signature) Photograph with measurement (LIBDEM)
    (Signature) Photograph with measurement (CON)
    (Signature) Photograph with measurement (LAB)
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    PinePhone (Manjaro Phosh) automatic suspend bug

    On 2023-06-06 I ran a system upgrade on my PinePhone (running Manjaro Phosh) using pacman -Syu. Afterwards, automatic suspend stopped working.

    The symptoms

    If you are in the lock screen and have the display turned off (this can due to automatic blank screen, or due to manually pressing the power button), then shortly before the automatic suspend timeout, the notification blue LED will light up.

    Previously (before the upgrade), if you ignore the notification, after reaching the timeout, the notification will be cleared, and the PinePhone will be suspended. If you turn on the screen before it suspended, it will very briefly show a notification that the phone will be automatically suspended. However the notification will clear itself almost immediately.

    After the upgrade, the notification LED stays on, and the phone does not suspend. When the screen is turned on again, it will always display the notification (which will clear itself very quickly). Most notably, because it does not actually suspend, the battery drains itself within a few hours. I’d go to work in the morning (unplugging from the charger at 08:30), arrive back home at 18:00 and the phone has already turned itself off.

    The solution

    This has been provided by @alaraajavamma:urheiluaki.org from #pinephone.

    gsettings set sm.puri.phosh.notifications wakeup-screen-triggers []
    

    Note that this needs to be run on a terminal on the PinePhone. It does not work via ssh.

    For future reference, the original value was ['urgency'].

    Other observations

    Things we tried and found out before reaching the solution.

    • Automatic suspend actually works if the display is turned on and not in the the lock screen.
    • sudo systemctl suspend - works.
    • systemctl suspend - works on a terminal on the PP. Does not work via ssh.
    • systemd-inhibit --list gives the following output:

      WHO            UID  USER    PID  COMM           WHAT                                                     WHY                                          MODE
      ModemManager   0    root    3533 ModemManager   sleep                                                    ModemManager needs to reset devices          delay
      NetworkManager 0    root    3513 NetworkManager sleep                                                    NetworkManager needs to turn off networks    delay
      UPower         0    root    3993 upowerd        sleep                                                    Pause device polling                         delay
      eg25manager    0    root    3311 eg25-manager   sleep                                                    eg25manager needs to prepare modem for sleep delay
      manjaro        1000 manjaro 3826 phosh          handle-power-key                                         Phosh handling power key                     block
      manjaro        1000 manjaro 4045 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                    block
      manjaro        1000 manjaro 4045 gsd-media-keys sleep                                                    GNOME handling keypresses                    delay
      manjaro        1000 manjaro 4046 gsd-power      sleep                                                    GNOME needs to lock the screen               delay
      manjaro        1000 manjaro 3826 phosh          sleep                                                    Phosh handling suspend                       delay
      
      9 inhibitors listed.
      

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Playing 夏ノ終熄 Natsu no Owari on Wine

    When playing this game on Wine 6.17 (64-bit), after the first day, I got this error on a pop-up:

    Failed to call ConnectFilters( pSrc, pMPEG1Splitter ). : [0x80004005] Error: 0x80004005
    

    When running on the command line I get this:

    0024:fixme:quartz:mpeg_splitter_sink_query_accept Unsupported subtype {e436eb84-524f-11ce-9f53-0020af0ba770}.
    

    Searched online for these messages and found a few different solutions, but the only one that worked for me was this one by jkfloris:

    winetricks l3codecx directshow wmp10
    

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Using spectral analysis to watch a YouTube video

    So I went to watch a video on YouTube: https://www.youtube.com/watch?v=7fSq0_Ljb_s

    And about a minute in, I noticed some strange high frequency in both audio channels. Here’s a sample:

    (Signature)

    Not sure what this is, I decided to download it to investigate further:

    $ youtube-dl -F 'https://www.youtube.com/watch?v=7fSq0_Ljb_s'
    

    One of the output lines is:

    140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 84.38MiB
    

    So:

    $ youtube-dl -f 140 'https://www.youtube.com/watch?v=7fSq0_Ljb_s'
    $ ffmpeg -i '【GAMABOOKS_コラボ企画】星空古本市開催!【新人VTuber】-7fSq0_Ljb_s.m4a' -ss 02:00 -t 30 gamabooks_cut.wav
    $ octave-cli
    octave:1> [y, Fs] = audioread('gamabooks_cut.wav');
    octave:2> Y = fft(y);
    octave:3> plot(abs(Y));
    

    fft spectrum
    (Signature)

    Here’s our high frequency. Now zoom in to find the FFT index number:

    fft zoomed
    (Signature)

    The peak is at index 338543. Convert it to hertz (and note the 1-index):

    octave:4> (338543-1) / length(y) * Fs
    ans =    1.1285e+04
    

    So now we just need a way to suppress this frequency. Searching “mpv audio filter” online tells us that mpv --af=help will list all audio filters available. Looking through the list, I found:

    bandreject       Apply a two-pole Butterworth band-reject filter.
    

    So I just need to find out how to configure this filter. Searching online, I eventually came across some scripts that referenced the FFmpeg manual, specifically, the “equalizer” filter: (emphasis mine)

    Apply a two-pole peaking equalisation (EQ) filter. With this filter, the signal-level at and around a selected frequency can be increased or decreased, whilst (unlike bandpass and bandreject filters) that at all other frequencies is unchanged.

    Sounds like what I want. So to try it, with reference to the manual (the bandwidth and attenuation factor were determined by trial-and-error):

    $ mpv --af=equalizer=f=11285:t=h:width=5:g=-100 gamabooks_cut.wav
    

    Sounds a lot better. Now download the video:

    $ youtube-dl -f 136 'https://www.youtube.com/watch?v=7fSq0_Ljb_s'
    

    And play it:

    $ mpv 【GAMABOOKS_コラボ企画】星空古本市開催!【新人VTuber】-7fSq0_Ljb_s.mp4 --audio-file=【GAMABOOKS_コラボ企画】星空古本市開催!【新人VTuber】-7fSq0_Ljb_s.m4a --af=equalizer=f=11285:t=h:width=5:g=-100
    

    Done!

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Arbitrariness and randomness

    Screenshot from 2022-06-30 20-53-50.png
    (Signature)

    Veritasium seems to think that “arbitrariness” is the same as “randomness”. Without true randomness, upon repetition, the guard will gain information on how the renumbering method was chosen, thus decreasing the prisoners’ probability of success.

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Cantilever Rock

    I just learnt that there is something called “Cantilever Rock” / “Cantilever Stone” in Wales.

    Uh, what? It looks more like a simply supported beam than a cantilever…

    Photo: “Cantilever Stone on Glyder Fach” by George Tod, CC BY-SA 2.0 https://www.geograph.org.uk/photo/611071

    cantilever-rock.jpg
    (Signature)

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    How many grains are there in 5 kg of rice?

    280375 ± 21770 (Thai Hom Mali rice, 95% CI)

    p1.png
    (Signature) p2.png
    (Signature) p3.png
    (Signature)

    More details: https://adrianiainlam.tk/uploads/5kg-rice.pdf

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    OMG I JUST BEAT AN FM

    omg.png
    (Signature)

    Also apparently an IM according to chess.com?!

    https://www.chess.com/member/kubagepard https://ratings.fide.com/profile/12942839

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Using webcam to control Live2D Cubism model in Linux

    TL;DR: Code: GitHub, self-hosted, demo: video below

    I was researching how to get FaceRig to work on Linux, and eventually concluded that it is pretty much impossible. So I thought, hey, why not just code it myself? It can’t be that difficult, right? I mean, it probably won’t be as feature-rich as the original, but all I need / want is the basic “avatar moving along with my face” functionality.

    So I spent a couple weekends, digging up the (very poorly translated) Live2D docs (but still, kudos to Live2D Inc for actually translating them), struggled with some questionable anti-patterns, and arrived with this:

    (Signature) Also available on YouTube

    Source code available on GitHub and my own server. Yes the code is kind of messy and could do some refactorings, but it works so I couldn’t be bothered. ¯\_(ツ)_/¯

    With some input and suggestions from another user I have also created a spin-off project, where instead of using facial tracking, the avatar is controlled by mouse cursor position and customizable via a UI.

    Some more demos (not really that important so I haven’t bothered self-hosting them):

    Source code for this spin-off project: GitHub, self-hosted.

    Please feel free to get in touch for any comments, suggestions, bug reports, questions, or any kind of feedback!

    Preview clipped. Expand | Read full post in new tab

subscribe via RSS