Sunday, 24 December 2023

fluidsynth

$ amidi -l
Dir Device    Name
IO  hw:1,0,0  Q Mini MIDI 1
 

Use fluidsynth to play Q mini keyboard: 

$ fluidsynth -a pulseaudio -m alsa_raw -o "midi.alsa.device=hw:1,0,0" -o synth.polyphony=64  -g 1.0 "GeneralUser GS v1.471.sf2"

>inst 1 

000-000 Stereo Grand
000-001 Bright Grand
000-002 Electric Grand
000-003 Honky-Tonk
000-004 Tine Electric Piano
000-005 FM Electric Piano
000-006 Harpsichord
000-007 Clavinet
000-008 Celeste
000-009 Glockenspiel
000-010 Music Box
000-011 Vibraphone
000-012 Marimba
000-013 Xylophone
000-014 Tubular Bells
000-015 Dulcimer 

#select Dulcimer 

> select 0 0 0 15
 

> channels
chan 0, Dulcimer
chan 1, Stereo Grand
chan 2, Stereo Grand
chan 3, Stereo Grand
...


Wednesday, 6 December 2023

k/GT MTB link trail completed

 The Kinmathatakinta/George Town mountain bike link trail is now completed. In addition to the York Cove to Agnes St rivulet path, a trail has been forged through the trees in the Alfred St. right-of-way (which , although a declared road, had been overgrown for decades). A set of large pipes make a crossing across the small creek that used to cut across the "roadway". You can now ride from the centre of town, at the rusty pelican for example, to the trail head without going on the main road in/out of GT. 

The rusty pelican

Sign posts mark the way

Big "aggie pipe" for a creek crossing


Not the right bike for actually riding the trails,tho

The Mt.George trail head


 

Monday, 4 December 2023

Flags unfurled

 At the Pilot Station Museum, pilawaytakinta / Low Head


Green and Gold frogs

 Marvelous Green and Gold frogs at pilawaytakinta / Low Head community garden..
 
 


 

Saturday, 2 December 2023

ESP32-2432S024R "nixie" clock with micropython

Working on a (simulated) nixie tube clock on a "Cheap Yellow Display" in micropython. I used the nixie images from macsbug's M5Stack clock ( https://macsbug.wordpress.com/2019/06/16/m5stack-nixie-tube-clock/ ). Converted with the img2rgb565.py utility from rdagger's ILI9341 library  (https://github.com/rdagger/micropython-ili9341). The library had a RST pin input that the CYD did not need, so I just commented that out, is this the "right" way to fix it ? who knows ? it works. Update: added a "beats" internet time and date display in little round "nixie" tubes... 



The board has lots of built in stuff - SD card, battery charge circuit, 2W audio amp, an LDR and a RGB led

 

"""ILI9341 nixie clock"""
#from time import sleep
from ili9341 import Display, color565
from machine import Pin, SPI, Timer
from xglcd_font import XglcdFont
from beats import Beats

OldNews= XglcdFont('fonts/OldNewspaperTypes24x26.c',24,26)

spi = SPI(1, baudrate=2000000, sck=Pin(14), mosi=Pin(13))

display = Display(spi, dc=Pin(2), cs=Pin(15),width=320, height=240, rotation=270)
display.display_on()

from machine import RTC
rtc=RTC()


def nixieclock():
    """clock display"""
    days=('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
    display.draw_text8x8(0, 0, 'Time is an illusion...', color565(30, 33, 0))
    display.draw_text(25, 145,(days[rtc.datetime()[3]]) ,OldNews,color565(255, 165, 0))
    x=0
    
    if (rtc.datetime()[4] < 10 ) :
        fn='/images/raw/nix10.raw'
        display.draw_image(fn, x, 10, 70, 134)
        x=x+69
        fn='/images/raw/nix'+str(rtc.datetime()[4])+'.raw'     
        display.draw_image(fn, x, 10, 70, 134)
    else:    
        fn='/images/raw/nix'+str(rtc.datetime()[4])[0]+'.raw'
        display.draw_image(fn, x, 10, 70, 134)
        x=x+69
        fn='/images/raw/nix'+str(rtc.datetime()[4])[1]+'.raw'
        display.draw_image(fn, x, 10, 70, 134)
        
    x=x+71
    display.draw_image('/images/raw/nixc.raw', x, 10, 40, 134)
    x=x+40
    
    if (rtc.datetime()[5] < 10 ) :
        fn='/images/raw/nix0.raw'
        display.draw_image(fn, x, 10, 70, 134)
        x=x+69
        fn='/images/raw/nix'+str(str(rtc.datetime()[5]))+'.raw'
        display.draw_image(fn, x, 10, 70, 134)
    else: 
        fn='/images/raw/nix'+str(rtc.datetime()[5])[0]+'.raw'
        display.draw_image(fn, x, 10, 70, 134)
        x=x+69
        fn='/images/raw/nix'+str(str(rtc.datetime()[5])[1])+'.raw'
        display.draw_image(fn, x, 10, 70, 134)

def ndate() :    
    (year,month,day,h,m,s,dow,doy)=rtc.datetime()
    fn='/50px/'+str("%02d"%day)[0] +'_50px.raw'
    x=5
    display.draw_image(fn,1, 190, 50, 48)
    fn='/50px/'+str("%02d"%day)[1] +'_50px.raw'
    x=x+48
    display.draw_image(fn, x, 190, 50, 48)
    x=x+60
 
    fn='/50px/'+str("%02d"%month)[0] +'_50px.raw'   
    display.draw_image(fn,x, 190, 50, 48)
    x=x+48
    fn='/50px/'+str("%02d"%month)[1] +'_50px.raw'
    display.draw_image(fn, x, 190, 50, 48)
    x=x+60 
    fn='/50px/'+str(year)[2] +'_50px.raw'   
    display.draw_image(fn,x, 190, 50, 48)
    x=x+48
    fn='/50px/'+str(year)[3] +'_50px.raw'
    display.draw_image(fn, x, 190, 50, 48)

def nixbeats():
    x=150;y=140
    fn='/50px/'+Beats()[1] +'_50px.raw'
    display.draw_image(fn,x, y, 50, 48)

    x+=48
    if (Beats()[2] != '.'):
        fn='/50px/'+Beats()[2] +'_50px.raw'
        display.draw_image(fn, x, y, 50, 48)

    x+=48
    if (Beats()[3] != '.'):
        fn='/50px/'+Beats()[3] +'_50px.raw'   
        display.draw_image(fn,x, y, 50, 48)
    


nixieclock()
ndate()
tim0 = Timer(0)
tim0.init(period=30000, mode=Timer.PERIODIC, callback=lambda t:nixieclock())

nixbeats()
tim1 = Timer(1)
#attempt to sychronise with beat change
while (Beats()[-2:] != "01" ):
    pass     
tim1.init(period=86400, mode=Timer.PERIODIC, callback=lambda t:nixbeats())
nixbeats()

Saturday, 8 April 2023

Bass and Flinders Shanty Singers reformed as SEMAPHORE

The title says it all really, George Town's B&F Shanty Singers will now continue as SEMAPHORE. They are going to expand their repertoire to include non-nautical songs of any genre. They have a blog at https://semaphore-tamar.blogspot.com , which says they will meet at the B&F Bowls Club in Low Head (instead of the B&F Museum in GT).

 

Thursday, 19 January 2023

Mastodon console with vi

So with vi... 

in .bashrc 

     alias vi="vi -c AnsiEsc"

in .vimrc 

"view existing timeline
nnoremap <f5> 1GdG:r !mtl<CR>1G
"download and view timeline
nnoremap <f6> 1GdG:r !mtl 1<CR>1G
"show image 

nnoremap <C-I> <C-Right> :! /usr/bin/feh -FZ <cWORD> <CR> 

"play media

nnoremap <C-V> <C-Right> :! /usr/bin/ffplay -fs <cWORD> <CR>


run vi and push F5 (or F6) to view your home timeline 

The standard netrw plugin lets you load urls (in a browser) by pushing g x

with a bit more stuff, surely, doing a like or boost should be possible (notwithstanding that your can open a toot in the browser for that, but rather try calling the API with curl)  

Sunday, 15 January 2023

console client for Mastodon ?

 I hanker after a console Mastodon client, so initially have tinkered a home timeline reader, bit rough so far. Run with ./tl_json.py 1|less -r  (the -r on less make the ansi colours work) to get the latest, or ./tl_json.py|less -r to read the current tmp file (/tmp/tl.json). 

I imagine a stand alone that you could do likes, and pop-ups in a browser and push I to view jpegs and such, we'll see.  

Getting the timeline could have been done with urllib, but what with urllib, urllib2 and urllib3 all being a bit different, I couldn't get the Authorization in the header to work, so I squibbed it and just used curl.

#============================

#!/usr/bin/python3
import json , os , html2text ,sys

#ansi colours

LIGHT_CYAN="\033[1;36m"
YELLOW="\033[1;33m"
BLUE="\033[0;34m"
GREEN="\033[0;32m"
PURPLE="\033[0;35m"
LIGHT_GREEN="\033[1;32m"
BOLD="\033[1m"
RED="\033[0;31m"
NORMAL="\033[0m"

APIKEY="you need your own apikey"

masto_url="curl -k https://mastodon.social/api/v1/timelines/home?limit=40 -H 'Authorization: Bearer "+ APIKEY +" ' >/tmp/tl.json"
if len(sys.argv) > 1 :
    print ("Refreshing")
    os.system(masto_url)

f = open("/tmp/tl.json")
d = f.read()
dj = json.loads(d)
z = 0
#clean the text
text_maker = html2text.HTML2Text()
text_maker.images_to_alt = True
text_maker.ignore_links = True

while z < 39 :
    print (LIGHT_CYAN+str(z)+" "+dj[z]['account']['display_name']+" ["+dj[z]['account']['username']+"]")
    print (BLUE+dj[z]['created_at'])
    try:
        text =  dj[z]['content']
        print (NORMAL  + text_maker.handle(text).strip() )
       

        print (PURPLE+" "+dj[z]['url']+" .")
        print (PURPLE+"@"+dj[z]['account']['acct'])
       
    except:
        print("")
    try:     #is there any media ?
         y=0
         while  dj[z]['media_attachments'][y]  :
              print (BOLD+"\nDescription: < "+ dj[z]['media_attachments'][y]['description']+" >"+NORMAL )
              print (PURPLE+" "+ dj[z]['media_attachments'][y]['url']+NORMAL )
              y = y + 1
    except:
         print ("")

    # boosted posts
    try:
        text = dj[z]['reblog']['content']
        print (YELLOW + "Boost "+ dj[z]['reblog']['id'] )
        print (YELLOW +" "+  dj[z]['reblog']['url'] )
        print (YELLOW + text_maker.handle(text).strip() + NORMAL )
        print (" ")
    except:
        print ("")    
    z=z+1

#============================