Sunday 18 February 2024

select instrument (fluidsynth)

launch fluidsynth with -s (among other things)  

the program will return to the menu after playing a few notes, select cancel to exit  

#!/usr/bin/awk -f
BEGIN {
   #get instrument names from fluidsynth instance
   cmd = "/inet/tcp/0/localhost/9800"
   print "inst 1" |& cmd
   while (( cmd |& getline out) > 0) {
     instrument[substr(out,8)]= substr(out,0,7);
     if (match(out,"SFX")) { break }
   }
   close(cmd);
   asorti(instrument,instrumentS)
   while(1) {
    sel=""
    for (i in instrumentS) ds= ds" \""instrumentS[i]"\" \"\""
    ("dialog --stdout --menu \"Select Instrument\" 15 35 10 " ds)|getline sel
    system("clear")
    if (sel=="") break
    print "Selected "sel , instrument[sel]

    setting=instrument[sel]
    setInst= "select 0 0 "substr(setting,0,3)" "substr(setting,5,8)
    #send the select command to fluidsynth
    print setInst |& cmd
   

 #play a few notes
    for (n=50;n<55;n++) {
      print "noteon 0 "n" 90" |& cmd
     system("sleep 0.4")
     print "noteoff 0 "n" 90" |& cmd
    }

   close(cmd)
   }
}

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).