Category Archives: Software

A little audio section & notes

I use a couple of Wiim products at home for music streaming – a Mini in my home office, and a Pro in the lounge. Both are using S.M.S.L. SU1 DACs.

The Wiim Pro is a Chromecast capable device – pretty much anything can be used to control it and stream. The Mini is not Chromecast. Both have a web API, and a UPnP interface. I was able to find some projects on Github that show how to build code to drive these from Linux, or as ready apps to use.

https://www.wiimhome.com/pdf/HTTP%20API%20for%20WiiM%20Mini.pdf – API doccumentation

https://wiki.gnome.org/Projects/GUPnP – a Linux based UPnP set of tools for discovery and experimentation. Very helpful with building and debugging UPnP code when working with devices like the Wiims

https://github.com/retired-guy/WiiM-Watcher-Chrome-Extension – Chrome js. Check out some of the other examples from this user too.

https://github.com/shumatech/wiimplay – app written in Go, runs great on Linux. Precompiled binary available


Wiim Play driving my office Mini from a Linux desktop

Simple Python Demo for a Wiim Mini control
Enter the IP address of your Wiim device into target_ip

You need to have started the Wiim playing something via a phone / tablet with Wiim Home / Tidal / Spotify. The app allows the user to pause / play / skip to the next or previous track.


# Begin

import tkinter as tk
import requests
requests.packages.urllib3.disable_warnings()


# Specify the IP address here
target_ip = "192.168.1.72"

def get_now_playing():
    url = f"https://{target_ip}/httpapi.asp?command=getStatusEx"
    response = requests.get(url, verify=False)
    data = response.json()
    return data

def play():
    url = f"https://{target_ip}/httpapi.asp?command=setPlayerCmd:resume"
    response = requests.get(url, verify=False)
    update_ui()

def pause():
    url = f"https://{target_ip}/httpapi.asp?command=setPlayerCmd:onepause"
    response = requests.get(url, verify=False)
    update_ui()

def next_track():
    url = f"https://{target_ip}/httpapi.asp?command=setPlayerCmd:next"
    response = requests.get(url, verify=False)
    update_ui()

def previous_track():
    url = f"https://{target_ip}/httpapi.asp?command=setPlayerCmd:prev"
    response = requests.get(url, verify=False)
    update_ui()

def update_ui():
    now_playing = get_now_playing()
    ssid = now_playing.get("ssid", "Unknown SSID")
    device_name = now_playing.get("DeviceName", "Unknown Device")

    status_label.config(text=f"SSID: {ssid}\nDevice Name: {device_name}")


def create_buttons(root):
    char = chr(0x25BA)    
    play_button = tk.Button(root, text=char + " Play", command=play)
    play_button.pack()
    char2 = chr(0x23EF)
    pause_button = tk.Button(root, text=char2, command=pause)
    pause_button.pack()
    char3 = chr(0x23ED)
    next_button = tk.Button(root, text=char3, command=next_track)
    next_button.pack()
    char4 = chr(0x23EE)
    prev_button = tk.Button(root, text=char4, command=previous_track)
    prev_button.pack()

def main():
    root = tk.Tk()
    root.title("WiiM Mini Control")

    global status_label
    status_label = tk.Label(root, text="")
    status_label.pack()

    create_buttons(root)
    update_ui()

    root.mainloop()

if __name__ == "__main__":
    main()

Cheap GamePad Under Linux

I wanted a cheap gamepad to play TuxCart on my Linux desktop – found a PowerPlay Gamepad PC / PS3 / PS2 for NZ$25 at the red sheds.



On plugging into a USB port I could see the device recognised as a Xbox360 gamepad, but with no outputs.

A bit of google searching for the fix:

Simple fix: https://github.com/fcorsino/gamesir-g3w-fix

Make a python script, save onto desktop as fixgamepad.py:

#!/usr/bin/env python3
import usb.core
import usb.util
dev = usb.core.find(find_all=True)
for d in dev :
    
   if d.idVendor == 0x045e and d.idProduct == 0x028e :
       d.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)

Run it as sudo via a script .sh file
sudo python3 /home/graeme/Desktop/fixgamepad.py
You may need to download the Python USB interface

This initialises the gamepad with some bytes that lets it then be seen by Linux

Make a new file in 
/usr/share/X11/xorg.conf.d/50-joystick.conf

As follows:

Section "InputClass"
  Identifier "joystick catchall"
  MatchIsJoystick "on"
  MatchDevicePath "/dev/input/event*"
  Driver "joystick"
  Option "StartKeysEnabled" "off" # Disable mouse support of joypad 
  Option "StartMouseEnabled" "off"
EndSection

This stops the gamepad pretending to be a mouse.

I also installed Xboxdrv from the Package Manager as the driver, the gamepad seems a bit hit and miss with the stock xpad kernel driver.

I use JSTest GTK to test the inputs, and QJoypad to configure keyboard mapping for it.

Outliners & PIMs

I’m 30+ years into a love affair, a love affair with a specific type of software.

My first exposure to outliners was in May 1987 via ‘Nibble’ magazine, with an article and accompanying BASIC and  assembly code to type in to make magic happen. The outliner was a simple single-pane tool with a capacity of about 10kb of text.

Nibble Magazine, May 1987
Nibble Outliner running in a emulator

At the time I was about to travel to Indonesia, and immediately saw a practical use of the outliner to organise notes on interesting locations, language, tips and plans. I found the possibilities of non-linear that notes offered me an easier creative outlet than a traditional word processor document. 

Over the next couple of years as I moved through finishing my education, my outliner experience was pretty useful. The early versions of Microsoft Word (1990 v5.5) in DOS and UNIX that I used had some outlining capability which I used for essays and assignments, even though it was super basic in comparison to more modern versions of Word.

I didn’t have much use for outliners for a couple of years early in my working life, then when I found myself learning SAP in 1999 during an implementation and struggling to organise vast amounts of notes, I had a spark of inspiration to use an outliner to organise.

Word again was the tool that was available to me, except it felt clunky to use. It should be simple! I spent some time searching Altavista (remember that?) and found TreePad. At the time outliners were evolving into PIMs (Personal Information Management) and were more suited to what I needed to do.

TreePad

Treepad at the time was a huge step forwards for me. It was a basic two pane outliner that was exactly what I pictured in my head as ideal. Navigation tree on the left and content on the right. Content was both easy to take in and give out.

I used Treepad for a couple of years – it worked very well for what I wanted to do with it, which was plain text notes, code snippets, and documentation.

I moved onto a new company and had to start capturing notes – I had started using Treepad at the new place too, but found I needed to produce more printed material. I needed something with rich text, and good search capability.

Enter KeyNote

KeyNote

KeyNote has gone on to become a classic piece of software, a great blend of capability and user experience. It offers the same concept as Treepad, except with the added capability to have multiple trees shown as tabs across the top of the page.

In later years KeyNote development has slowed, and there is a plethora of similar tools now available. Probably the nearest to a KeyNote feel is CherryTree, which is available in Windows and Linux flavours.

CherryTree

I have also recently been using mind mapping software – FreePlane – which is also a cross platform tool. I’ve found mind mapping is closer to the outliners that I started with!

FreePlane

On Android I have been using SimpleMind – it both imports and exports FreePlane and FreeMind files and works prety well on the platform.

SimpleMind Pro on Android

With a sense of great timing, i.e. today (2021 ish at the point this post was initially written), the IT team at work have announced that everyone should no longer use ‘unofficial’ apps or programs other than Office 365. I just cannot warm to OneNote, it goes against the grain with limited structures and design limitations (or are they intentions?) to make getting information out of it hard.

Sort of goes against Alan Kay’s talk from Creative Think in 1982 – Sharing is important – we’re all communication junkies. We have an incredible bandwidth disparity (easy to take in, hard to give out); our devices have the reciprocal disparity (hard to take in, easy to give out)

OneNote’s UX is hard to take in, hard to take out. It’s very much a self contained ecosystem. I might be proved wrong about it, but I’ll give it a shot.

Update a few days into learning OneNote:
The online and simple versions (365 and For Windows 10) are half baked. They lack functionality e.g. cannot create sub-pages. OneNote 2016 has more capability, I still find the closed eco system not user friendly. I guess if someone hadn’t used anything else it would be ok.