Programming in object pascal with the Delphi CE IDE (and maybe other stuff).

Thursday, May 30, 2024

[eng] Silent Stream Bug fix (workaround)

May 30, 2024 Posted by TikoTako , , , , , , No comments

Silent Stream Bug Fix (Workaround)

So, I had no idea my system was affected by this bug because usually, I only listen to music and watch some videos. I found out about the bug when I was testing Piper.
I had a problem with silent audio for the first second of the .wav file with --output_file and absurd audio output with --output-raw streaming to ffplay. I thought it was Piper, but after a few tests, I found out that it was actually the audio output to the HDMI.
Basically, the driver goes to sleep and takes up around a second to actually start when you play something. There is no desync in videos, so you can't tell until you open some audio with someone who starts to talk at the beginning. I tried all the things I found on Google like power management tweaks, modifying registry keys, reinstalling old drivers, etc...
Nothing worked, so I tested with Audacity. I generated a 30-second silent .wav file and had it play in the background, then opened one of the .wav files generated by Piper and it was working fine.
So, I made this simple program SilentStreamFixer (GitHub). It just plays a silent .wav file in a loop until you stop or close it.
It sits in the icon tray with a green background when active and a red background when inactive.




AI version cuz my english is crap:

The Silent Stream Bug: A Soundless Odyssey (and the Workaround I Built)

Ah, audio – the lifeblood of multimedia. But what happens when that lifeblood gets choked? That's the frustration many users face with the "silent stream bug," a gremlin plaguing some systems and causing HDMI audio outputs to fall silent.

This bug manifests as random audio dropouts, often after periods of inactivity. It's particularly maddening because restarting applications or fiddling with settings might bring the sound back temporarily, only for it to vanish again later.

So, how do we slay this audio gremlin?

Tried-and-Tried Again: Common Fixes

Many solutions abound online, but often with limited success. Here are a few I wrestled with:

  • Driver Updates: Naturally, the first port of call is updating your audio drivers. Outdated drivers can cause a multitude of issues, so keeping them current is always a good practice. Unfortunately, in my case, driver updates didn't vanquish the silent foe.
  • Power Management Settings: Some suggest tweaking power management settings for audio devices to prevent them from entering sleep mode. While this might help in some cases, it wasn't a silver bullet for me.
  • Disabling Audio Enhancements: Audio enhancements can sometimes interfere with playback. Disabling them might resolve the issue, but it also meant sacrificing some potential sound quality improvements.

The problem persisted. Each "fix" felt like chasing shadows, only to have the silence return.

Building a Better Fix: Silent Stream Fixer

Frustration can be a powerful motivator. Unable to find a reliable solution, I decided to take matters into my own hands. Enter Silent Stream Fixer, a program I built specifically to address the silent stream bug.

Silent Stream Fixer works on a simple principle: it continuously plays a very short, silent WAV file in a loop. This keeps the audio pipeline active and prevents it from going into sleep mode, effectively circumventing the bug.

The beauty of Silent Stream Fixer lies in its simplicity and effectiveness. It's a lightweight program that runs quietly in the background, keeping your audio stream flowing uninterrupted. You can find the code for Silent Stream Fixer on GitHub.

The Final Note

While Silent Stream Fixer has been a personal solution, it's important to remember that the silent stream bug can have various causes. If you're experiencing audio dropouts, investigate potential driver issues, hardware conflicts, or deeper system settings.

However, if you've exhausted those options and still find yourself battling the silence, Silent Stream Fixer might just be the hero your audio needs. It may not be the most elegant solution, but sometimes, a simple workaround is all it takes to get the music back on track.

[ita] Silent Stream Bug Fix

May 30, 2024 Posted by TikoTako , , , , , , No comments

[ita] Silent Stream Bug Fix

Non mi dilungo quindi, l'audio che clicka e/o è muto nel primo secodo do un video o un file audio è colpa
dell' hdmi che va in sleep mode "a caso".
Non sono se è un bug limitato ad intel comunque è aggirabile (non esistono fix ufficiali) mettendo in play
"un audio senza audio" in loop perenne.
Questo mantiene l'uscita audio sull'hdmi sempre attiva e risolve il problema.
E` una coa fattibile sempicemente generando un file audio vuoto con Audacity.

Per comodità ho creato un programma che fa da solo, rimane visibile nell'area delle icone, si può comodamente far partire all'avvio di windows e si può fermare e/o chiudere con un semplice click del tasto destro sull'icona nella tray.
Link: SilentStreamFixer (GitHub)

Wednesday, May 15, 2024

Testing highlight.js

May 15, 2024 Posted by TikoTako , , , No comments
hidden

Ok, tbh, i was going to write it myself but, is 2024, a truckload of content is ai generated then why i dont use some ai too?
So, this at top is written by me and the ai generated description of highlight.js is at the bottom of the page >HERE<

Install/usage:
Go here highlightjs website check the version (11.9.0 atm)
Copypaste this into the <HEAD> of the html of the page:

<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/styles/default.min.css" />
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/go.min.js"></script>
<script>hljs.highlightAll();</script>

Change the 11.9.0 with the current version if is different.
To change the theme, just change the css file in the first line, ad example change "default.min.css" in "docco.css"
Use a tool like >THIS< to convert the code (some characters mess up with the html tags) then paste it between these tags:

<pre><code class="language-html">
</code></pre>

For html ad example or simply this (autodetect):

<pre><code>
</code></pre>

DELPHI:
The the highlighting for Delphi is bugged atm, link: >GITHUB ISSUE<
My bad...
I thought delphi was included in highlight.js but it isn't either in highlight,js nor in highlight.min.js 🙄 i had to import delphi.min.js

program HelloWorld;

{$APPTYPE CONSOLE}

uses
  SysUtils;

(*
	is this a comment?
    yes it is
*)

begin
  try
  	// comment
    WriteLn('Hello, World!');
  except
  {
  	another comment
  }
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

More to test (tnx Copilot <3)

C

#include <stdio.h>
int main() {
   printf("Hello, World!");
   return 0;
}

C#

using System;
class Program {
    static void Main() {
        Console.WriteLine("Hello, World!");
    }
}

C++

#include <iostream>
    std::cout << "Hello, World!";
    return 0;
}

Java

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

ASM x86, nasm

section .data
    hello db 'Hello, World!',0

section .text
    global _start

_start:
    ; write hello to stdout
    mov eax, 4
    mov ebx, 1
    mov ecx, hello
    mov edx, 13
    int 0x80

    ; exit
    mov eax, 1
    xor ebx, ebx
    int 0x80

Demystifying Highlight.js: A Powerful Syntax Highlighter

Generated by Copilot.

Hello, fellow coders! Today, we’re going to dive into the world of syntax highlighting with a fantastic tool called Highlight.js.

So, what is Highlight.js? It’s a powerful syntax highlighter written in JavaScript. It works its magic by parsing code snippets embedded in your HTML and automatically detecting the language. However, if you’re dealing with a less common language, you can explicitly specify it.

Once Highlight.js knows what language your code is in, it gets to work applying highlighting. It does this by wrapping your code in HTML tags and applying CSS classes to these tags. These classes correspond to the different syntax elements in your code, such as keywords, operators, or literals.

Now, you might be wondering, “How does it decide what colors and styles to use?” Well, that’s where the CSS theme comes into play. Highlight.js comes with a variety of themes you can choose from, or if you’re feeling adventurous, you can create your own!

To get Highlight.js up and running on your page, you’ll need to include the library and a theme CSS file in your HTML. Then, when your page loads, call the hljs.highlightAll() function. This function will find and highlight all code snippets on your page. If you want to highlight specific blocks of code, you can use the hljs.highlightBlock(block) function instead.

And there you have it! With Highlight.js, you can bring your code to life and make it easier for others to read and understand. Happy coding!

I hope this gives you a good idea of how Highlight.js works! If you have any more questions, feel free to ask.