Posts

  • | 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

  • | Source | Signature

    En passant bug in Clubhouse Games: 51 Worldwide Classics

    In a live stream by Oga Namome it has been discovered that in the chess game in Nintendo’s Clubhouse Games: 51 Worldwide Classics, a bug exists where if a player is:

    • in check, and
    • the only legal move is to take a pawn en passant,

    then the game will incorrectly announce checkmate.

    Below is a clip of that moment:

    (Signature)

    Transcript of the game:

    1. e4 e5 2. c3 Qf6 3. Nf3 c5 4. Bc4 Qg6 5. O-O Qxe4 6. Nxe5 Qxe5 7. Re1 Nc6 8. Rxe5+ Nxe5 9. Qe2 Bd6 10. d4 cxd4 11. cxd4 Ne7 12. dxe5 Bc5 13. Nc3 Bb4 14. Qf3 f5 15. exf6 Bxc3 16. f7+ Kf8 17. Qxc3 d5 18. Bh6 Nf5 19. Bxd5 Be6 20. Qc5+ Kxf7 21. Qc7+ Kg6 22. Bxe6 Nxh6 23. Qxb7 Rab8 24. Qe4+ Kf6 25. Bh3 Rbf8 26. Re1 g5 27. Qe6+ Kg7 28. Qe5+ Kf7 29. Qxg5 Ng8 30. f4 a5 31. Qd5+ Kg7 32. f5 h5 33. Re3 Rh6 34. Rg3+ Kh7 35. Qc5 Ra8 36. Qd5 Rf8 37. Qxa5 h4 38. Rf3 Rc6 39. Qa7+ Kh6 40. Kf2 Rc2+ 41. Ke1 Rxb2 42. Qe3+ Kh5 43. g4+

    Lichess study with some annotations: https://lichess.org/study/eR7oCNAX

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    SARS-2

    sars-cov-2.svg
    (Signature)

    CC BY-SA 3.0 Derivative work based on https://commons.wikimedia.org/wiki/File:Raven_Matrix.svg by Wikimedia Commons users Life of Riley and Jirah

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    Venus

    2020-01-28T17:45Z, Kings Langley

    Venus(?) next to the Moon, bright as fuck.

    Also saw two more fainter stars (to my right - North? Venus was to my left), one of them is probably Vega. The other Altair maybe?

    Preview clipped. Expand | Read full post in new tab

  • | Source | Signature

    7 hours later...

    on9draw.png
    (Signature)

    Preview clipped. Expand | Read full post in new tab

subscribe via RSS