Ubuntu

Fix ubuntu sound delay problem

Posted on Updated on

Introduction

These are the quick fix for 2 second delay when playing audio sound on ubuntu linux system

Methods

1. Disable the audio idle mode

Go to /etc/pulse/default.pa and
comment on this line

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

Find module-udev-detect & module-detect and insert tsched=0 to the back of them.

#enable the interupt based timing
load-module module-udev-detect tsched=0
load-module module-detect tsched=0

Restart your computer to apply the new configuration.

2. Create a dummy sound generator

If method 1 is not working, proceed to this step

This is a systemd service to generate a silent sound to occupy the sound channel.

Create a systemd file as /etc/systemd/system/audio_non_stop.service

#audio_non_stop.service
[Unit]
Description="Create a silent sound to keep the audio HDMI digital output running"
After=sound.target

[Service]
ExecStart=/usr/bin/aplay -c2 -r48000 -fS16_LE /dev/zero
#Restart=on-failure
ExecStop=/bin/kill -INT $MAINPID
KillSignal=SIGINT
#TimeoutStopSec=10

[Install]
WantedBy=graphical.target

After resuming the computer on hibernate mode, you need to restart the audio_non_stop.service and make it occupy the HDMI digital sound module again.

Then create another systemd service as /etc/systemd/system/audio_non_stop_resume.service

#audio_non_stop_resume.service
[Unit]
Description="Restart the audio_non_stop.services after resume from hibernate"
After=suspend.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --no-block restart audio_non_stop.service

[Install]
WantedBy=suspend.target

Reference

https://askubuntu.com/questions/218444/sound-output-starts-delayed
https://unix.stackexchange.com/questions/362223/short-audio-playback-is-muted-requires-warming-up-or-secondary-audio-in-backgro

Solving the 2-second sound delay with XBMC and HDMI


https://bbs.archlinux.org/viewtopic.php?id=183447
https://askubuntu.com/questions/1033405/crackling-and-delayed-sound-after-upgrading-to-18-04
https://askubuntu.com/questions/371595/for-pulseaudio-what-does-tsched-do-and-what-are-the-defaults

WiFi Hotspot on startup

Posted on

Introduction

Procedure

1. Initial the hotspot

This step is very easy. Just turn on the wifi hotspot mode once on the ubuntu wifi setting page. Then turn it off.

2. Modify WiFi Hotspot setting

Using nmtui to modify the setting. Then select Wi-Fi -> Hotspot. Then modify the setting. Also, please start the nmtui in sudo mode.

Some Recommend Setting:

# Recommend Setting
Mode <Access Point>
Security <WPA & WPA2 Personal>
IPv4 CONFIGURATION <Sharded>
  Addresses 192.168.100.1/24
IPv4 CONFIGURATION <Ignore>
[x] Automatically Connect

3. Verify the setting

Go to “/etc/NetworkManager/system-connections/Hotspot”
to check.

[connection]
id=Hotspot
uuid=XXXX-XXXX-XXXX-XXXX-XXXX
type=wifi
permissions=
autoconnect=true

[wifi]
mac-address=XX:XX:XX:XX:XX:XX
mac-address-blacklist=
mode=ap
ssid=WIFISSID

[wifi-security]
key-mgmt=wpa-psk
psk=WIFIPASSWORD

[ipv4]
address1=192.168.100.1/24
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore

Install Cangjie on ubuntu 18.04

Posted on Updated on

1. Install iBus Package

#install required package
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4 ibus-table-cangjie

#Select the input method to ibus
im-config -s ibus

2. Install Chinese Language Package

From system setting -> Region & Language -> Manage Installed Language -> Install/ Remove Languages button

Install the Chinese(traditional) language package

After that, check iBus is selected on the Keyboard input method system’s option.

You may need to reboot the system after the Chinese language package installation.

3. Add Cangjie to input source

From system setting -> Region & Language -> Chinese

Add Chinese (Cangjie3) to the Input source table

Reference

https://blog.csdn.net/u012707739/article/details/78469176