Instagram filter used: Lo-fi
Blog
-
Circuit Playground Express Remote-Controlled Fart Machine
I’m not proud of this, but I made it so you won’t have to:
Craig at Elmwood Electronics very kindly gave me an ADABOX 006. It’s based around Adafruit’s Circuit Playground Express which just happens to feature a small built-in speaker, IR remote control and the ability to play back audio samples. You see where this is going, don’t you?
If you must make this, the code and samples are here: circuit_playground_express-ir_remote_fartbox_unfortunately.zip. You’ll also need to install the Adafruit CircuitPython IRRemote package into the lib/ folder of your Circuit Playground Express. Point the remote at the board, and it’s left arrow to fart, right arrow to chuckle.
The package includes CC0-licensed samples downloaded from Freesound.
-
Synthesizing simple chords with sox
SoX can do almost anything with audio files — including synthesize audio from scratch. Unfortunately, SoX’s syntax is more than a bit hard to follow, and the manual page isn’t the most clear. But there is one example in the manual that gives a glimpse of what SoX can do:
play -n synth pl G2 pl B2 pl D3 pl G3 pl D4 pl G4 \ delay 0 .05 .1 .15 .2 .25 remix - fade 0 4 .1 norm -1
While it plays a nice chord, it’s not obvious how to make audio files from this process. I have a project coming up that needs a few simple guitar chords, and with much trial and error I got SoX to spit out audio files. Here’s what I keyed into the shell:
cat guitar.txt | while read chord foo first third fifth do echo "$chord" : sox -n \ -r 16000 -b 16 "chord-${chord}.wav" \ synth pl "$first" pl "$third" pl "$fifth" \ delay 0 .05 .1 \ remix - \ fade 0 1 .095 \ norm -1 done
with these lines in the file “guitar.txtâ€
G : G2 B2 D3 C : C3 E3 G4 D : D3 F#4 A3 F : F3 A3 C4 A : A3 C#4 E4 E : E2 G#3 B3 Em : E2 G3 B3
How the SoX command line breaks down:
-
- -n —use no input file: SoX is going to generate the audio itself
- -r 16000 -b 16 “chord-${chord}.wav” — with a sample rate of 16 kHz and 16-bits per sample, write to the output file “chord-….wavâ€
- synth pl “$first” pl “$third” pl “$fifth” —synthesize three plucked tones read from the file
- delay 0 .05 .1 —delay the second tone 0.05 s after the first and likewise the third after the second. This simulates the striking of guitar strings very slightly apart.
- remix – —mix the tones in an internal pipe to the output
- fade 0 1 .095 —fade the audio smoothly down to nothing in 1 s
- norm -1 —normalize the volume to -1 dB.
The chords don’t sound great: they’re played on only three strings, so they sound very sparse. As my application will be playing these through a tiny MEMS speaker, I don’t think anyone will notice.
Update: well, now I know how to do it, why not do all 36 autoharp strings and make the “magic ensues†sound of just about every TV show of my childhood?
Glissando up:
sox -n -r 48000 -b 16 autoharp-up.wav synth pl "F2" pl "G2" pl "C3" pl "D3" pl "E3" pl "F3" pl "F#3" pl "G3" pl "A3" pl "A#3" pl "B3" pl "C4" pl "C#4" pl "D4" pl "D#4" pl "E4" pl "F4" pl "F#4" pl "G4" pl "G#4" pl "A4" pl "A#4" pl "B4" pl "C5" pl "C#5" pl "D5" pl "D#5" pl "E5" pl "F5" pl "F#5" pl "G5" pl "G#5" pl "A5" pl "A#5" pl "B5" pl "C6" delay 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55 1.6 1.65 1.7 1.75 remix - fade 0 6 .1 norm -1
Glissando down:
sox -n -r 48000 -b 16 autoharp-down.wav synth pl "C6" pl "B5" pl "A#5" pl "A5" pl "G#5" pl "G5" pl "F#5" pl "F5" pl "E5" pl "D#5" pl "D5" pl "C#5" pl "C5" pl "B4" pl "A#4" pl "A4" pl "G#4" pl "G4" pl "F#4" pl "F4" pl "E4" pl "D#4" pl "D4" pl "C#4" pl "C4" pl "B3" pl "A#3" pl "A3" pl "G3" pl "F#3" pl "F3" pl "E3" pl "D3" pl "C3" pl "G2" pl "F2" delay 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55 1.6 1.65 1.7 1.75 remix - fade 0 6 .1 norm -1
Could maybe use some reverb in there for the ultimate nostalgic effect.
-
-
MQTT Talk tonight
I’m talking at the Raspberry Pi Toronto Meetup tonight, and if all goes well, the Net-Connected Cowbell will make an appearance:
My slides: MQTT.odp
Links:
- MQTT – http://mqtt.org/
- Mosquitto: An Open Source MQTT v3.1/v3.1.1 Broker – https://mosquitto.org/
- ESP8266 Overview | Espressif Systems – http://espressif.com/en/products/hardware/esp8266ex/overview
- MicroPython – Python for microcontrollers – https://micropython.org/
- espressif/esptool: ESP8266 and ESP32 serial bootloader utility – https://github.com/espressif/esptool
- adafruit/ampy: Adafruit MicroPython Tool – Utility to interact with a MicroPython board over a serial connection – https://github.com/adafruit/ampy
- mqtt-spy – an open source utility intended to help you with monitoring activity on MQTT topics – https://kamilfb.github.io/mqtt-spy/
- gpiozero -A simple interface to GPIO devices with Raspberry Pi – https://gpiozero.readthedocs.io/en/stable/index.html
- paho-mqtt 1.3.1 : Python Package Index – https://pypi.python.org/pypi/paho-mqtt
- BlueLine PowerCost Monitor parser for Arduino – CapnBry/Powermon433: ATmega (Arduino) decoding of EM100B and PowerCost Monitor – https://github.com/CapnBry/Powermon433
-
3D printed back cover for 6502 badge
Update, 2017-12-03: So of course, as soon as I show this to someone, they ask: “Can it stand up like a display case?†It can now!
I must remember to dust before taking pics Standing on edge, just like Josh asked! Virtual render of rev 2 in Meshlab STL file and OpenSCAD source for rev 2: VCF-6502-badge.zip
(licence: CC BY-NC-SA 2.5 CA)Thingiverse: https://www.thingiverse.com/thing:2687960
Rev 1: This worked better than I could have hoped, and so the 6502 40th Anniversary Computer Badge now has a snug-fitting case to prevent shorting, and to keep the batteries in place.
Virtually … Really … Case back with 6502 badge installed Running snugly in the case It says “8-bit 4 LYFEâ€, btw Side view; any greebles my 3d printer’s fault -
True Sounds of the Halifax Donair
You know that this is what donairs really sound like …
Video from Donair Cam. Audio (CC0) from Freesound.
-
Soltec HM-102S: unboxing a 30 year old multimeter
Hey! I don’t have this meter any more. The scanned manual is all I can help you with (see link near end of article)
Graham Green had a stall at Make Change yesterday. Graham’s the former manager of Active Surplus, the much-missed Toronto surplus emporium. He had some military-surplus multimeters that hadn’t seen daylight since I was in school. That’s a while back: this (unfortunately) was #1 the week I left school. So I bought one of Graham’s meters just to see what was inside …
Neatly packed in mil-spec cardboard with a date code of 7/86. There’s a fair chance that Papa Don’t Preach was on the radio somewhere when this was sealed Inside the box, the meter’s sealed in a pouch. Mil-spec doesn’t allow anything to rattle about, after all. Unlike some surplus stuff, this looks 99.999% mouse-piss free Under the meter was this battery pouch, which exhibited the qualities of both “crunchy” and “squishy”. Neither of these are things I look for in a battery, so these weren’t going in the meter Battery pack dated January 1986. This isn’t going to be good. Daylight … for the first time in 31 years! On first glance, everything looks okay, but three decades of phenolic off-gassing was much in evidence — pew! Despite the hermetic seal, the elastic band had rotted to dry pasta consistency. Note expired elastic band ichor on the manual cover The test leads are still bright, shiny and very pliable. I suspect they might be silicone-encased, as PVC of this age has a habit of turning brittle (ask me about my late lamented Konix Navigators) The meter. unpacked. A clear (if small) dial, complete with mirror scale to reduce parallax error in reading. Hidden under the frosted cover is a small “Made in Korea” mark Handy-dandy fold-out carrying handle that also doubles as a stand Inside the case, ancient tooling marks. The plastic is thick and seems fairly robust. The captive mounting screw was a nice touch A very analogue meter. Lots and lots of 1% tolerance resistors on the main board, plus a great big thumbwheel potentiometer for zero adjustment. The foam battery pad up top was as good as new Up and running: no auto-off battery saving mode here! The test lead jacks didn’t have the shrouding we’d expect these days, so you won’t be able to use newer probes without modifying them Things I Don’t Miss from Analogue Meters, #1: setting the 0 Ω point. Expect fiddliness and drift. The test subjects: a 3.6 V Li/SOCl₂ ½-AA NVRAM battery (new: tests at 3.68 V on an Agilent U1242B meter), a 7.5 kΩ ± 5% resistor (tests at 7.52 kΩ) and a 39 kΩ ± 10% resistor (tests at 41.3kΩ) Battery test: the Soltec reports 3.8 V, or within 5% of expected. This is where I really miss auto ranging Not so good is the 7.5 kΩ resistor: the Soltec reads just under 6 kΩ. Blame faulty zero setting from me, as it really is fiddly and I just set this up quickly. The 39 kΩ resistor (which is really more like 41 kΩ) indicated 34 kΩ on the Soltec. Again, my dodgy zero set is most likely to blame, but reading this little log scale isn’t the easiest Would I recommend the Soltec as a general purpose meter? Not really. There are more capable multimeters available for about the same price, and you don’t need to go as far as the unbelievably expensive Agilent DMM I use (or even the strictly ornamental analogue ex-Forces Bach-Simpson 635 multimeter that graces/clutters my workbench). It would need a video to show where analogue meters excel: in showing changing values and getting a rough idea of the limits. It would make a great battery tester, or — if coupled with a micro-controller with PWM or DAC ouput — part of a demo rig. If nothing else, it’s a great way to learn how to appreciate modern test gear and all it does for us.
I’m probably going to regret this, but here’s a scan of the Soltec HM-102s manual:
PDF link under image. I say I regret doing this, ‘cos every cheapo ebay seller of these things is now likely to download this and splat their own horrid watermarks over it, making the file huge and ugly. But the market’s gonna market, and I wouldn’t want to make a free manual inaccessible with DRM. By contrast, my watermark’s quite tasteful and doesn’t interfere with readability in any way … Postscript: you think I’d just throw away that expired battery pack without peeking inside? If so, allow me to call you Wrongo McWrongison of that erroneous ilk! The ‘Hipower Super’ cells weren’t looking so super: the leaked electrolyte had dried into a gritty, stinky layer. I couldn’t even find the terminals on the 9 V battery to try and test it, so grotty was the corrosion. Amazingly, the slightly-less-nasty AA cell at the front tested at 1.52 V, almost as good as it could have been in the mid-80s. Doesn’t mean it’s not going in the HHW bin with the others, though.