Skip to content

Instantly share code, notes, and snippets.

Avatar
Solving environment /

Scott H. Hawley drscotthawley

Solving environment /
View GitHub Profile
@drscotthawley
drscotthawley / faves2bibtex.py
Last active May 20, 2020
Generate BibTex from list of Tweets you (or another user) have favorited ('liked'), tweeted or RT'd
View faves2bibtex.py
#! /usr/bin/env python3
"""
faves2bibtex.py
Author: Scott Hawley
Scrapes URLs contained in tweets you (or another user) favorited ('liked') for DOI & other bibliographic info,
and tries to generate a set of BibTex entries to stdout.
Status messages go to stderr
Sample usage:
@drscotthawley
drscotthawley / Gamepad_Eyes_OSC.pde
Last active Apr 1, 2020
"Gamepad" Input example for Wekinator, e.g. for Xbox 360 controller
View Gamepad_Eyes_OSC.pde
// Gamepad_Eyes_OSC: demo of using game controller for OSC input.
// Uses the two thumb-sticks and either the left or right bumper buttons.
//
// Peter Lager maintains the Game Control Plus library (for Processing),
// which provides control data for joysticks and other game controllers
// ...such as my Xbox 360 controller.
//
// This is a quick mash-up using Lager's Gcp_gamepad animated eyes example code,
// (which is in the GCP library: In Processing, go to File > Examples..., then Contributed Libraries > Game Control Plus)
// and Rebecca Fiebrink's Simple_Mouse_DraggedObject_2Inputs example code for Wekinator.
@drscotthawley
drscotthawley / inst_freq.py
Last active Nov 4, 2019
Alternative method for calculating "instantaneous frequency" for use with spectrograms.
View inst_freq.py
#! /usr/bin/env python3
# Test script for Phase 'Unrolling' / Instantaneous frequency
#
# See Jesse Engel's "rainbowgrams" script, https://gist.github.com/jesseengel/e223622e255bd5b8c9130407397a0494
#
# Modifications by Scott H. Hawley, @drscotthawley and Billy Mitchell
# These modified versions seem to be both more accurate (~2000x less reconstruction error)
# and faster (>20%)
#
# note, to really see/hear the difference, change dtypes to np.float16!
@drscotthawley
drscotthawley / proc_fma.py
Last active Aug 22, 2019
FMA dataset conversion script, genre classification, to individual subdirs
View proc_fma.py
#! /usr/env/python3
#
# FMA conversion script, genre classification
# Author: Scott Hawley
# License: Do as you like
#
# For FMA dataset https://github.com/mdeff/fma
# to be used with panotti https://github.com/drscotthawley/panotti
#
# This will create a directory called Samples/
@drscotthawley
drscotthawley / osc2wek.py
Last active Apr 23, 2019
Sends incoming OSC messages (subject to some filter) to Wekinator
View osc2wek.py
#! /usr/bin/env python3
'''
osc2wek.py
Author: Scott Hawley
This listens for incoming OSC messages and sends them on to Wekinator
Steps to get running (in Terminal):
0. First you need Mercurial "hg". It might be installed by default.
1. Use hg to clone the grail osc code:
@drscotthawley
drscotthawley / scope_with_trigger.py
Last active May 3, 2018
Realtime waveform display with tunable trigger level
View scope_with_trigger.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Scott H. Hawley'
__copyright__ = 'Scott H. Hawley'
__license__ = "MIT Licence (do what you want, don't blame me)"
import numpy as np
import cv2
import soundcard as sc # https://github.com/bastibe/SoundCard
from scipy.ndimage.interpolation import shift
@drscotthawley
drscotthawley / apply_sox_effect.py
Last active Apr 29, 2018
Accessing Sox Audio Effects from Python via Pysox
View apply_sox_effect.py
import pysox
import librosa
import numpy as np
def apply_sox_effect(signal, sr, fxstr):
# This writes signal to a .wav file, processes it sox to another file, loads that and returns it.
#
# signal: a numpy list of numbers; the audio signal
# sr: the sample rate in Hz, must be an integer
# fxstr: a semicolon-separated string starting with the effect name followed by parameter values in order
@drscotthawley
drscotthawley / TestRenderMan_DexedVST.ipynb
Created Apr 28, 2018
Slight modification of RenderMan demo, made for Python 3 and MacOS
View TestRenderMan_DexedVST.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drscotthawley
drscotthawley / WebAudioFreqGain.html
Last active Mar 13, 2018
WebAudio OSC Output for use with Wekinator
View WebAudioFreqGain.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>WebAudio OSC Output Example - 2 Variables</title>
<!-- By Scott Hawley @drscotthawley. Modified from https://github.com/automata/osc-web/blob/master/web-side/app.html
No additional license restrictions are introduced with these modifications; the automata/osc-web site gives no license info.
Thus as far as this author is concerned: "unlimited license": feel free to use & modify in any way you wish! -->
</head>
<body>
<h2>WebAudio OSC Output Example - 2 Variables</h2>
@drscotthawley
drscotthawley / tictactoe_policy.py
Last active Aug 17, 2017
My implementation of a temporal difference policy method for playing Tic Tac Toe, after seeing Shlomo Bauer speak at the Brentwood A.I. meetup.
View tictactoe_policy.py
#! /usr/bin/env python3
# Uses temporal difference policy method
# See, e.g., http://www.cs.dartmouth.edu/~lorenzo/teaching/cs134/Archive/Spring2009/final/PengTao/final_report.pdf
# In this code, X plays randomly whereas O 'learns'. (Feel free to change that)
# Thus we expect O to outperform X eventually
# Author: Scott Hawley http://drscotthawley.github.io
# Unlimited License: Feel free to use any or all of this code however you like.