This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import wave | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| class LowPassFilter: | |
| def __init__(self, init=0.0, decay=0.9): | |
| self.b = 1 - decay | |
| self.y = init |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import wave | |
| from math import sqrt, sin, pi | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # Y(n) = (1-a) * 0.5 * (x(n) + x(n-1)) + a*y(n-1) | |
| #class LowPassFilter: | |
| # def __init__(self, b=0.99, n=1024): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import wave | |
| from random import randint | |
| sample_rate = 48000 | |
| samples_per_cycle = 256 | |
| for z in range(8): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import wave | |
| sample_rate = 48000 | |
| samples_per_cycle = 256 | |
| for z in range(8): | |
| filename = "{}.wav".format(z + 1) | |
| with wave.open(filename, mode="wb") as wav_file: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import wave | |
| from fractions import Fraction | |
| version = 3 | |
| sample_rate = 44100 | |
| samples_per_cycle = 512 | |
| amplitude_threshold = 1e-5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <USBHost_t36.h> | |
| #include <Audio.h> | |
| #include <Wire.h> | |
| #include <SPI.h> | |
| #include <SD.h> | |
| #include <SerialFlash.h> | |
| // GUItool: begin automatically generated code | |
| AudioPlaySdWav playSdWav1; //xy=272,942 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with open("day14_input.txt") as f: | |
| data = f.read().split('\n') | |
| # Part 1 | |
| memory = [0] * 100000 | |
| for line in data: | |
| if line[0:4] == "mask": | |
| mask = line[7:] | |
| mask0 = int(''.join(map(lambda c: '0' if c == 'X' else c, mask)), 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randrange | |
| N = 5 | |
| has_santa = set() | |
| is_santa = set() | |
| pairs = set() | |
| while len(has_santa) < N: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randrange | |
| N = 5 | |
| has_santa = set() | |
| is_santa = set() | |
| pairs = set() | |
| while len(has_santa) < N: |