Skip to content

Instantly share code, notes, and snippets.

View mattorp's full-sized avatar

Mathias Torp mattorp

  • Denmark
View GitHub Profile
@mattorp
mattorp / limit-volume-bluos.md
Created March 2, 2024 12:07
Limit Bluesound sound level while ignoring specificed inputs. E.g. for analog and optical

Running a Bash script and setting environment variables can be done in a Unix-like environment, such as Linux or macOS. If you're using Windows, you'll need a tool like Git Bash, Windows Subsystem for Linux (WSL), or Cygwin to run Bash scripts.

Running the Script

  1. Save the Script: First, you need to save the script on your computer. Create a new file named limit-volume-bluos.sh and paste the script into this file.

  2. Make the Script Executable: Before running the script, you need to make it executable. Open a terminal, navigate to the directory where limit-volume-bluos.sh is saved, and run the following command:

chmod +x limit-volume-bluos.sh
@mattorp
mattorp / limit-volume-bluos.sh
Created March 2, 2024 12:06
Limit Bluesound sound level while ignoring specificed inputs. E.g. for analog and optical
#!/bin/bash
# Default values for the script's operation
IP=''
TIMEOUT=50 # Timeout in milliseconds
LIMIT=-55 # Volume limit (negative value)
SKIP_INPUTS=('input0' "optical") # Inputs to skip when limiting volume
# Overriding default values with environment variables if they exist
if [ -n "$BLUOS_IP" ]; then
@mattorp
mattorp / showSynVariables.js
Created February 14, 2022 22:00
Show Synesthesia variables in the controller view
// Show Synesthesia variables in the controller view. Add this to your existing script.
// Combine with showSynVariables.json at: https://gist.github.com/60a571795e110c4746490450c4d6acf6
function updateSynVarIndicators() {
const synVars = [
['ToggleOnBeat', syn_ToggleOnBeat],
['MidPresence', syn_MidPresence],
['RandomOnBeat', syn_RandomOnBeat],
['MidHits', syn_MidHits],
['MidHighTime', syn_MidHighTime],
@mattorp
mattorp / showSynVariables.json
Last active February 14, 2022 22:02
Show Synesthesia variables in the controller view. Combine with https://gist.github.com/22f2d21821f2175eda1eac4432e27c61
{
"CONTROLS": [
{
"NAME": "ToggleOnBeat",
"MAX": 1,
"MIN": 0,
"TYPE": "slider",
"UI_GROUP": "variables"
},
{
@mattorp
mattorp / synesthesia-benchmarking.d.ts
Last active November 28, 2021 13:44
synesthesia benchmarking type declaration
type ControlType = 'toggle' | 'bang' | 'slider' | 'knob' | 'dropdown'
interface ControlSetting {
/**
* normalized (0-1)
* The value to test.
* toggle: <=0.5 = off, >0.5 = on
* bang: trigger on >0.5
* dropdown: 1/n*i,
* - n is the number of items in the dropdown and i is the index of the selected item.
@mattorp
mattorp / split-by-delimeter.sh
Last active November 8, 2021 11:29
split by delimeter
delimeter=/
query='f/s'
arr=(${query//$delimeter/ })
first=${arr[0]}
second=${arr[1]}
echo "$first"
echo "$second"
@mattorp
mattorp / split-arguments-alfred.sh
Created November 8, 2021 11:10
Split arguments in alfred
arr=({query})
first=${arr[1]}
second=${arr[2]}
echo "$first"
echo "$second"
osascript -e "display notification \" template: $first \" with title \"name: $second\""
@mattorp
mattorp / get_variables.glsl
Created October 2, 2021 22:55
Output Synesthesia variables as pixels
# Synesthesia scene to output the variables as pixels
# for consumption by other services
# Example: https://gist.github.com/mattorp/1f35d47b7e8a8678849e0dd38c08cc66
uniform float[9][4] variables = {
vec4(
syn_Level
syn_BassLevel
syn_MidLevel
syn_MidHighLevel
@mattorp
mattorp / synesthesia_server.py
Last active October 3, 2021 12:20
GET/POST API for Synesthesia
# Used to communicate to and from Synesthesia
# https://synesthesia.live
# Information is send to Synesthesia through midi messages.
# Information is received from Synesthesia through pixels, using NDI:
# https://github.com/buresu/ndi-python
# Getting information from Synesthesia:
# A pixel is a vec4 (r, g, b, a). Since Synesthesia variables
@mattorp
mattorp / gradientOverlay.html
Last active May 8, 2021 16:52
gradient html overlay
<!DOCTYPE html>
<head?>
<title>Gradient Overlay</title>
<style>
body {
margin: 0;
padding: 0;
}
.gradient {