Skip to content

Instantly share code, notes, and snippets.

View williamfields's full-sized avatar

William Fields williamfields

View GitHub Profile
@williamfields
williamfields / snapToGrid.lua
Last active March 20, 2023 22:36
TouchOSC: Snap to grid
function onValueChanged()
self.values.x = math.modf(self.values.x * self.properties.gridSteps, self.properties.gridSteps) / (self.properties.gridSteps-1)
end
@williamfields
williamfields / resetGrid.lua
Last active June 15, 2021 17:22
TouchOSC: Reset all faders in a grid to a value
function resetGrid(grid,setTo)
local gridColumns = grid.properties.gridX
local gridRows = grid.properties.gridY
for i=1,gridRows*gridColumns,1
do
grid.children[i].values.x = setTo
end
end
@williamfields
williamfields / printObject.lua
Last active June 15, 2021 17:22
TouchOSC: Print object values and properties to the log
function printObject(object)
print("-------------------------------------------------")
print("Values of",object.properties.name)
print("-------------------------------------------------")
for key, value in pairs(object.values.keys) do
print(value,"=",object.values[value])
end
print("-------------------------------------------------")
@williamfields
williamfields / wf.namer.js
Created September 18, 2020 14:17
Track Title Generator
var consonants = ["t","k","p","b","m","qu","th","w","r","f","l","j","z","x","c","v","n","d","g","h"];
var vowels = ["a","o","e","i","u"];
function getConsonant()
{
return consonants[Math.floor(Math.random()*consonants.length)];
}
function getVowel()
{
@williamfields
williamfields / gist:f1a6655e4c0f77895ed800c045f7529b
Created October 18, 2017 22:32
ffmpeg command to crop 1080p video to 1080x1080 square
ffmpeg -i input.mov -vf "crop=1080:1080:420:0" output.mov
@williamfields
williamfields / gist:f4859dc39116fa90c6e4d8cd67ae5c8e
Created October 18, 2017 22:25
ffmpeg command to convert audio to video with still image
ffmpeg -loop 1 -i input.png -i input.wav -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest output.mp4
@williamfields
williamfields / PerformanceON.bat
Created June 28, 2017 20:47
Pre-Performance Script
echo "TURN OFF WINDOWS DEFENDER FROM CONTROL PANEL, THEN HIT SPACE."
pause
echo "TURN ON AIRPLANE MODE, THEN HIT SPACE."
pause
echo "TURN OFF NIGHT LIGHT FOR VIDEO WORK, THEN HIT SPACE."