Skip to content

Instantly share code, notes, and snippets.

@omardelarosa
omardelarosa / README.md
Created January 2, 2021 22:23
Automating GodotPython Builds for Mac OSX
@omardelarosa
omardelarosa / README.md
Last active February 3, 2021 01:35
AI Autodrummer for an Elektron Digitakt + SonicPi

AI Autodrummer for an Elektron Digitakt + SonicPi

This script can be used to control your digitakt automatically via USB+MIDI. This will send generative "beats" to your Digitakt hence the name "autodrummer".

It assumes that your sample pads 1-8 are mapped to MIDI channels 1-8.

This is the instrument to channel mapping and can be re-configured accordingly:

DTAKT = {
@omardelarosa
omardelarosa / CreateTilesFromTileset.cs
Created February 20, 2019 04:11
Tilemap Importer - PyxelEdit to Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Tilemaps;
using System.IO;
public class CreateTilesFromTileset : EditorWindow
{
int padding = 5;
int buttonHeight = 25;
@omardelarosa
omardelarosa / README.md
Last active February 3, 2021 01:40
Drum Pattern Duration Randomization

Example Drum Pattern Duration Randomization

This uses some slightly more interesting drum pattern randomization than I had previously been using. It kind of uses a 2-dimensional approach:

Initial hit Position

snares = [
  ringify('0000 1000 0000 1000'),
  ringify('0000 1000 0000 1010'),
  ringify('0100 1000 0000 1000')
@omardelarosa
omardelarosa / README.md
Last active June 16, 2018 16:50
Tiny Responsive Grid System with Stylus

How To Build A Tiny Responsive Grid System

(link to post)

Since I moved my site/blog/etc over to this static, micro-site a while back, I haven't given it much ❤️ codewise. There are a lot of little visual issues, etc. I haven't had time to fix in my personal site that I spend all day fixing during my day job. Part of the issue is that I didn't design the stylesheets very well for this site and they can take time to reason about and edit. In an attempt to change that, I've built a micro, responsive grid system here to hopefully make visual updates to this site less painful based on a pretty decent tutorial I found.

How To Build Your Grid System

Variables

So for starters, you need to define a few variables. Think of these as the parameters for your grid system. These parameters are as follows:

@omardelarosa
omardelarosa / chill-lofi-hiphop.rb
Last active June 13, 2018 02:31
"Jellyfish #1" (or Markov Chain-based chill lofi hiphop for SonicPi)
###
### This is a generative/randomized piece of music "composed" by Omar Delarosa
###
### To see it in context, run this file in SonicPi.
###
### Or visit on YouTube at: https://youtu.be/MBrVGzMIpRM
###
use_bpm 70
T = 4.0
@omardelarosa
omardelarosa / keithy-piano.rb
Last active June 11, 2018 19:00
A Study in "A Study in Keith"
# Welcome to Sonic Pi v3.1
use_bpm 70
T = 4.0
# State machine utility functions
define :markov do |a, h| h[a].sample; end # Chooses the next state at random from hash
define :g do |k| get[k]; end # simplified root note in scale getter
define :s do |k, n| set k, n; end # simplified root note setter
define :mnote do |key,chain| s key, (markov (g key), chain); g key; end
set :k, 1 # Init state
@omardelarosa
omardelarosa / README.md
Last active November 6, 2021 03:45
Generative Hip Hop using Markov Chaining

Generative Hip Hop using Markov Chaining

This represents one way of creating generative music by doing a randomized walk on a graph where each node represents a note state in a scale and each edge represents a transition. Edges are chosen randomly, but repetition of edges allows the simulation of weighted choices at each transition.

For example, given the following ruby hash representation:

H = {
  8 => [0],
  7 => [8],
@omardelarosa
omardelarosa / markov-piano.rb
Last active December 29, 2020 08:19
Markov-chain based generative Piano Music for SonicPi
set :root, 60
T = 4.0
# This hash simulates a markov chain.
# Each key is the state and the array
# value represents the next state.
H = {
60 => [58, 58, 58, 55, 60, 60, 60],
58 => [60, 56, 56, 58, 60, 60],
@omardelarosa
omardelarosa / basic.js
Last active August 29, 2015 14:19
Using Pitchfork Node API
//search
var p4k = require('pitchfork')
// start the search
var search = new p4k.Search('wilco');
// listen for 'ready' event on the search
search.on('ready', function(results){
// 'results' is an array of "Review" objects. (see ./review.js for methods, etc)