Skip to content

Instantly share code, notes, and snippets.

@zvodd
zvodd / synth_sound_demo.py
Last active March 3, 2024 02:15
pygame, pyaudio, additive "synth" demo with bandpass filter.
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / wave_combiner.py
Created February 24, 2023 10:18
pygame + pyaudio "synth": wave generation inspection and filtering
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / spiralout.py
Created February 23, 2023 07:34
pygame spiral markov chain pixels
import pygame
import numpy as np
SCREEN_X = 256
SCREEN_Y = 256
GRID_SIZE = SCREEN_X //6
CELL_W = SCREEN_X // GRID_SIZE
CELL_H = SCREEN_Y // GRID_SIZE
@zvodd
zvodd / view_wave.py
Created February 21, 2023 14:04
interactive waveform generation and mixing using pygame and pyaudio
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / color_palette_from_images.html
Last active November 26, 2022 03:18
color palette js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>whatever</title>
<script>
/*
This is a completly disorganised mess of shoehorning old code into a new proof of concept.
@zvodd
zvodd / howtobasicrust.rs
Created May 9, 2022 16:28
Baby's first rust code. A basic guessing game that was primarily a product of trail and error, as tutorials just aren't as much fun as breaking things.
use rand::Rng;
use std::io;
static HINT_HIGHER: &str = "higher";
static HINT_LOWER: &str = "lower";
fn main() {
println!("Guess the integer between 0 and 9.");
let target: u8 = rand::thread_rng().gen_range(1..10);
@zvodd
zvodd / index.html
Created April 19, 2022 09:27
Client Side JS - Image Upload to Canvas
<!DOCTYPE html>
<html><head>
<style>
.finfo-list{
list-style: none;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
flex-direction: row;
max-height: 80vh;
@zvodd
zvodd / HTML_Canvas_Lines.htm
Created March 24, 2021 20:07
drawing stuff in canvas
<html>
<head>
<style>
.container{ display:inline-flex;}
#backButton button{width:100%; height:100%}
#nextButton{ }
#nextButton button{width:100%; height:100%}
</style>
</head>
<body>
@zvodd
zvodd / Go CGO on window.md
Last active December 23, 2020 04:48
Building Go CGO on windows

Install Msys2 Open the MSYS terminal run the updates and then enter these commands.

pacman -Syu

Close and Re-Open Msys2 Terminal

pacman -Su

pacman -Sy base-devel mingw-w64-x86_64-gcc

@zvodd
zvodd / hardmode.py
Last active September 17, 2020 19:21
python asssingment completion example using an obscene amount of generator comprehensions.
# opening the csv file
def read_file(csvfile):
file = open(csvfile, 'r')
file.readline()
line = file.readline()
while line:
line = line.strip()
values = line.split(",")
new_values = []
for i, attr in enumerate(values):