This file contains 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
# Thanks to Job Vranish (https://spin.atomicobject.com/2016/08/26/makefile-c-projects/) | |
TARGET_EXEC := a | |
BUILD ?= release | |
BUILD_DIR ?= ./build | |
SRC_DIRS ?= ./src | |
CC ?= gcc | |
CXX ?= g++ |
This file contains 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
''' | |
Adds %ipython magic command to launch a bash terminal and connect to the current jupyter session because coding in jupyter sucks. | |
To be placed in ~/.ipython/profile_default/startup/ | |
''' | |
import os, sys | |
import ipykernel | |
from IPython.core.magic import register_line_magic | |
@register_line_magic | |
def ipython(line): |
This file contains 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 sys | |
import yaml | |
def merge_load(src, dst, loadfunc=yaml.load, **kwargs): | |
'''\ | |
Load a yaml stream (src) and merge it with another yaml stream | |
(dst) allowing *dst* to use aliases defined in *src*. | |
Other Parameters | |
---------------- |
This file contains 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 | |
def mask2runs(mask): | |
''' | |
mask2runs | |
Turns a boolean array into an array of indices indicating the start and end indices of each run of 1's. | |
''' | |
runflip = np.nonzero(mask[1:] ^ mask[:-1])[0]+1 | |
runflip[1::2] -= 1 # Note that the prior step returns end indices as the end of a run plus 1 |
This file contains 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 os | |
import glob | |
import errno | |
try: | |
from itertools import ifilter as filter | |
except ImportError: | |
pass | |
def findfile(filepath, find_all, search_path='', recursive=False, allowglob=False, rel_path='.', follow_links=False): | |
filelist = [] |
This file contains 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
# sets up a full duplex alsa loopback device | |
pcm.loophw00 { | |
type hw | |
card Loopback | |
device 0 | |
subdevice 0 | |
format S32_LE | |
rate 48000 | |
channels 8 | |
} |
This file contains 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
#!/usr/bin/env python2 | |
""" | |
Daemon for full duplex streaming with PyAudio | |
Note that recordings are always delayed by some amount and are therefore longer than the input file | |
Builds off of mpex.py: https://gist.github.com/tgarc/7120c00eb3eb5f736be93c70ade1d68a | |
""" | |
import multiprocessing, threading, Queue | |
import time |
This file contains 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
""" | |
Example of keeping a simulated IO callback thread fed using separate master and daemon (I/O) processes. | |
Builds off of mpex.py: https://gist.github.com/tgarc/7120c00eb3eb5f736be93c70ade1d68a | |
""" | |
import multiprocessing, threading, Queue | |
import time | |
import sys | |
import urllib2 |
This file contains 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
""" | |
Example of keeping a simulated IO callback thread fed using separate master and daemon (I/O) processes. | |
""" | |
import multiprocessing, threading, Queue | |
import time | |
import sys | |
import urllib2 | |
IOBLOCKSZ = 4096 # made up IO block size | |
IPCBLOCKSZ = 8192 # a size that is guaranteed to be larger than BLOCK_SZ |
This file contains 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
diff --git a/setup.py b/setup.py | |
index cccebeb..1472d06 100755 | |
--- a/setup.py | |
+++ b/setup.py | |
@@ -79,7 +79,9 @@ if not STATIC_LINKING: | |
else: | |
include_dirs = [os.path.join(portaudio_path, 'include/')] | |
extra_link_args = [ | |
- os.path.join(portaudio_path, 'lib/.libs/libportaudio.a') | |
+ os.path.join(portaudio_path, 'portaudio_static_x64.lib') |
NewerOlder