Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nbogie
nbogie / midipipe-youtube-midi-control-advanced-with-seek.applescript
Last active February 2, 2018 04:42
Applescript (for Midipipe) to control playback of youtube, vimeo, netflix, etc (in chrome), via MIDI device. Allows control of playback position, volume, playback speed, as well as play/pause, from midi messages.
#returns true if the message represents a positive change of
# the given controller number, as will happen when depressing buttons a midi keyb.
# We ignore messages with value bytes 0, as those are sent on button releases.
on isMidiButtonPressed(msg, controllerNumber)
return (isControlChange(msg, controllerNumber) and (item 3 of msg > 0))
end isMidiButtonPressed
on isControlChange(msg, controllerNumber)
return ((item 1 of msg = 191) and (item 2 of msg = controllerNumber))
end isControlChange
@nbogie
nbogie / neill_zip_halo_demo.js
Created April 19, 2018 00:44
Neill's demo program for the kitronik zip halo for bbc micro:bit (ring of 24 neopixels)
let passIx = 0
let index = 0
let pattern: neopixel.Strip = null
let firstColor = 0
let secondColor = 0
let fnNames: string[] = []
let myBrightness = 0
function wipe() {
for (let i = 0; i < 24; i++) {
pattern.shift(1)
@nbogie
nbogie / playsound.py
Last active April 28, 2018 07:28
neill's microbit play raw audio file - first draft
from microbit import display, sleep, button_a
import audio
def frames_from_file(sndfile, frame):
while(sndfile.readinto(frame, 32) > 0):
yield frame
def play_snd(fname):
frame = audio.AudioFrame()
with open(fname, 'rb') as sndfile:
@nbogie
nbogie / popsongs.js
Created May 9, 2018 14:20
microbit makecode js song excerpts
input.onButtonPressed(Button.A, () => {
PlayShapeOfYouBass()
})
input.onButtonPressed(Button.AB, () => {
PlayNightwishStorytime()
})
function PlayNightwishStorytime() {
music.setTempo(120)
music.rest(music.beat(BeatFraction.Half))
music.playTone(698, music.beat(BeatFraction.Half))
@nbogie
nbogie / custom.ts
Last active May 11, 2018 20:01
Custom MusicPlus blocks for micro:bit to play (arpeggiate) chords (chords mostly diatonic to C Major)
/**
* Use this file to define custom functions and blocks.
* Read more at https://makecode.microbit.org/blocks/custom
*/
enum Chord {
//% block="FMajor"
FMajor,
//% block="GMajor"
@nbogie
nbogie / servo_dial.svg
Created May 17, 2018 20:15
servo power dial template
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nbogie
nbogie / broken zip halo demo.js
Created June 9, 2018 00:39
broken ver of zip halo demo - badly converted by makecode
let passIx = 0
let index = 0
let numPixels = 0
let firstColor = 0
let pattern: neopixel.Strip = null
let secondColor = 0
let fnNames: string[] = []
let myBrightness = 0
function glow() {
myBrightness = 0
@nbogie
nbogie / LongNeoPixelStripDemo.js
Created June 9, 2018 01:09
micro:bit neopixel long strip demo
let passIx = 0
let index = 0
let item = 0
let numPixels = 0
let firstColor = 0
let pattern: neopixel.Strip = null
let myBrightness = 0
let secondColor = 0
let fnNames: string[] = []
function rainbowRotate() {