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
from scipy.io.wavfile import read, write | |
import io | |
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a | |
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or | |
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function | |
with open("input_wav.wav", "rb") as wavfile: | |
input_wav = wavfile.read() |
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
from flask import Flask, Response | |
app = Flask(__name__) | |
@app.route("/wav") | |
def streamwav(): | |
def generate(): | |
with open("signals/song.wav", "rb") as fwav: | |
data = fwav.read(1024) |
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
// module with classes and logic for working with local storage in browsers via JavaScript | |
// see also: http://professorweb.ru/my/html/html5/level5/5_1.php | |
module StorageHelper { | |
export interface IStorageItem { | |
key: string; | |
value: any; | |
} | |
export class StorageItem { | |
key: string; |
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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |