Instagram filter used: Lo-fi
Author: scruss
-
pre-amalgamation bookplate, East York Public Library
Instagram filter used: Normal
(original birb is here, not scanned from a book:
)
-
Raspblocks: Blocks-based Python coding for Raspberry Pi
Update, 2019-01: raspblocks.com appears to be dead, with an “Account Suspended” error from the host
Raspblocks is a new Blocks-based web programming environment for Raspberry Pi. You don’t even need to write the code on a Raspberry Pi, but the Python 3 code it produces will need to be transferred to a Raspberry Pi to run.
For maximum authenticity (and slowness), I fired up http://www.raspblocks.com/ on a Raspberry Pi Zero over VNC. It took a minute or more to load up the site in Chromium, but creating a simple program was all easy dragging and dropping:
The code it produced was pretty much exactly what you’d write by hand:
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.OUT) while True: GPIO.output(26,True) time.sleep(1) GPIO.output(26,False) time.sleep(1)
And, as you might expect, the code make an LED connected to GPIO 26 turn on and off. Science!
Raspblocks isn’t as polished as its more established rival EduBlocks, but Raspblocks doesn’t need any software installed. Edublocks installs its own Node.js-based web service, which would be painfully slow on a Raspberry Pi Zero. Raspblocks’ code needs to be run manually from a terminal, but I’d put up with that any day over having yet another Node server distribution installed under /opt.
-
not-very-good MakeCode scratchpad
Update:now updated all to include the Bluetooth module so these can be uploaded to your micro:bit with the (remarkably poor) mobile app. If you don’t include the Bluetooth module (or want to use the Radio module) you lose the ability to program over the air.
Boring Blink:
Shake temperature:
Shake temperature in ËšF:
-
loblawcard.ca
The language on the loblawcard.ca website makes me sick:
Loblaw discovered that Canadians were overcharged for the cost of some packaged bread products in our stores and other grocery stores across Canada. In response, we’re offering eligible customers a $25 Loblaw Card, which can be used to purchase items sold in our grocery stores across Canada.
How about:
Loblaw
discovered thatdeliberately and knowingly stole bread from Canadianswere overcharged for the cost of some packaged bread products in our stores and other grocery stores across Canadafor fourteen years. In response, and without accepting culpability on our part, we’re offering eligible customers a $25 Loblaw Card, whichcan be used to purchasewill only cost us $10-20 wholesale on items sold in our grocery stores across Canada.You might have to sign away your right to participate in a class-action suit by accepting the card, though.Update, Jan 2018: terms and conditions are now posted (archive link). You won’t exactly have to sign away your class action rights, but “Information pertaining to your activation and use of the Loblaw Card may be shared between and amongst Loblaw, the Program Administrator [JND Legal Administration], Blackhawk [Blackhawk Network (Canada) Ltd.] and/or Peoples [Peoples
Trust Company] and with the courts in any class actions relating to an overcharge on the price of packaged bread.†So it looks like your class action rights are affected if you apply for and activate a card. -
Circuit Playground Express Chord Guitar
Hey! This doesn’t work any more, as CircuitPython changed and I haven’t found a way to update it with the new interpreter.
Since there are seven touch pads on a Circuit Playground Express, that’s enough for traditional 3-chord (â… , â…£, â…¤) songs in the keys of C, D and G. That leaves one pad extra for a â…¥min chord for so you can play Neutral Milk Hotel songs in G, of course.
CircuitPython source and samples: cpx-chord_guitar.zip. Alternatively, on github: v1.0 from scruss/cpx_chord_guitar
The code is really simple: poll the seven touch pads on the CPX, and if one of them is touched, play a sample and pause for a short time:
# Circuit Playground Express Chord Guitar # scruss - 2017-12 # these libraries should be installed by default in CircuitPython import touchio import board import time import neopixel import digitalio import audioio # touch pins, anticlockwise from battery connector touch_pins= [ touchio.TouchIn(board.A1), touchio.TouchIn(board.A2), touchio.TouchIn(board.A3), touchio.TouchIn(board.A4), touchio.TouchIn(board.A5), touchio.TouchIn(board.A6), touchio.TouchIn(board.A7) ] # 16 kHz 16-bit mono audio files, in same order as pins chord_files = [ "chord-C.wav", "chord-D.wav", "chord-E.wav", "chord-Em.wav", "chord-F.wav", "chord-G.wav", "chord-A.wav" ] # nearest pixels to touch pads chord_pixels = [ 6, 8, 9, 0, 1, 3, 4 ] # set up neopixel access pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.2) pixels.fill((0, 0, 0)) pixels.show() # set up speaker output speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE) speaker_enable.switch_to_output(value=True) # poll touch pins while True: for i in range(len(touch_pins)): # if a pin is touched if touch_pins[i].value: # set nearest pixel pixels[chord_pixels[i]] = (0, 0x10, 0) pixels.show() # open and play corresponding file f=open(chord_files[i], "rb") a = audioio.AudioOut(board.A0, f) a.play() # blank nearest pixel pixels[chord_pixels[i]] = (0, 0, 0) pixels.show() # short delay to let chord sound # might want to try this a little shorter for faster play time.sleep(0.2)
This is roughly how I synthesized the samples, but I made them quieter (the MEMS speaker on the CPX went all buzzy at full volume, and not in a good way) and added a bit of reverb. Here’s the sox command from the modified script:
sox -n -r 16000 -b 16 "chord-${chord}.wav" synth 1 pl "$first" pl "$third" pl "$fifth" delay 0 .05 .1 remix - fade p 0 1 0.5 norm -5 reverb
Really, you do want to take a look at shortening the delay between the samples: you want it long enough for all of the notes of the chord to sound, but short enough that you can play faster songs. I came up with something that worked for me, kinda, and quickly; it’s worth fixing if you have the time.