Skip to content

Instantly share code, notes, and snippets.

View cpmpercussion's full-sized avatar
🏠
Working from home

Charles Martin cpmpercussion

🏠
Working from home
View GitHub Profile
@cpmpercussion
cpmpercussion / short_report.tex
Created January 15, 2020 23:57
A LaTeX template for short student reports
% LaTeX Template for short student reports.
% Citations should be in bibtex format and go in references.bib
\documentclass[a4paper, 11pt]{article}
\usepackage[top=3cm, bottom=3cm, left = 2cm, right = 2cm]{geometry}
\geometry{a4paper}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage{bm}
@cpmpercussion
cpmpercussion / loop_pi_video.sh
Created July 15, 2016 08:31
omxplayer command to loop a video forever for use in video art exhibitions
#!/bin/bash
# This one-liner script plays a video in an infinite loop on a raspberry pi
# for a video-art exhibition.
# It was written for a video in portrait orientation so the video is rotated 270
# to use up the whole screen (which was also rotated).
# Charles Martin, July 2016
omxplayer -o local --loop /home/pi/video.mp4 --orientation 270
@cpmpercussion
cpmpercussion / examiner_meeting_data.py
Last active November 21, 2023 08:59
FAIS minus: a script for handling for_SAS data exported from Gradebook
#!/usr/bin/env python3
"""FAIS Minus --- a script for handling final marks exported from Wattle Gradebook
OVERVIEW:
This script helps process the final mark output from Gradebook, including:
- generating stats per cohort
- recording and updating special grades (e.g., DA/RP/WD)
- exporting CSV files that are _actually_ SAS-ready.
@cpmpercussion
cpmpercussion / charles-thesis-template.tex
Created January 21, 2016 06:26
Charles' Fairly Vanilla LaTeX Thesis Template Using Memoir
\documentclass[a4paper,12pt,oldfontcommands]{memoir}
\PassOptionsToPackage{hyphens}{url}
\usepackage{url}
\usepackage{hyperref}
\usepackage{doi}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{wrapfig}
\usepackage{natbib}
@cpmpercussion
cpmpercussion / midi_parse_script.py
Last active January 14, 2021 08:42
A script to parse lots of MIDI files into a simple melody-only 16th-note-only NumPy array format. Generates worker processes to use all available CPU power.
from music21 import converter, instrument, note, chord, stream, midi
import numpy as np
import pandas as pd
import os
import time
import h5py
import argparse
import multiprocessing
parser = argparse.ArgumentParser()
@cpmpercussion
cpmpercussion / intel-galileo-pd-howto.md
Last active September 9, 2020 21:01
HOWTO setup Pd on Intel Galileo

Putting Pd on the Intel Galileo

The Intel Galileo is a great little development/experiments board with an Intel Quark 32-bit x86 processor. We had some of these hanging around our office and I was inspired to make some computer music with it - so here's my process for getting Pure Data up and running.

Here's the things I needed:

#!/bin/bash
echo "$1"
videoname=${1%%.*}
#echo "$videoname"
ffmpeg -i $1 -c:v libx264 -b:v 2M -minrate 0.5M -preset fast -vf scale=1920:1080 -c:a aac -b:a 128K ${videoname}_1080.mp4
ffmpeg -i $1 -c:v libx264 -b:v 0.5M -minrate 0.5M -preset fast -vf scale=960:540 -c:a aac -b:a 128K ${videoname}_540.mp4
ffmpeg -i $1 -y -codec:a libmp3lame -ac 2 -ar 44100 -ab 64k -id3v2_version 3 -metadata title="$videoname" -metadata album_artist="Charles Martin" -metadata album="COMP2300 2020" -metadata genre="Vocal" -metadata date="2020" ${videoname}_audio.mp3
echo "done, phew."
@cpmpercussion
cpmpercussion / music_datasets.md
Last active November 4, 2019 05:23
Datasets and Tools for Music Research

Datasets

  • Harmonix Set - Beats, downbeats, and functional structural annotations for 912 Pop tracks.
  • da-tacos - a dataset for cover song identification and understanding

Tools

  • deezer/spleeter - Spleeter is the Deezer source separation library with pretrained models written in Python and uses Tensorflow
@cpmpercussion
cpmpercussion / get_available_gpus.py
Created November 4, 2019 05:11
get visible GPUs with Tensorflow
from tensorflow.python.client import device_lib
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
get_available_gpus()
@cpmpercussion
cpmpercussion / Makefile
Created January 27, 2017 15:28
NIME paper markdown makefile
DOCNAME=nime-paper-input.md
OUTNAME=rendered-output
REFSFILE=references.bib
ARGS=--bibliography $(REFSFILE)
nime:
pandoc --template=nime.latex --self-contained --natbib --filter pandoc-fignos $(DOCNAME) -o $(OUTNAME).tex
sed -i '.bak' 's/\citep{/\cite{/g' $(OUTNAME).tex
pdflatex $(OUTNAME)
bibtex $(OUTNAME)