Commit f7daf9f3 authored by Zach Perkins's avatar Zach Perkins

ffffff

parent 8c8c07e2
{
"python.pythonPath": "venv\\Scripts\\python.exe"
}
\ No newline at end of file
......@@ -48,24 +48,9 @@ app = FlaskApp(__name__)
auth = Authenticator(app)
@app.route('/')
@auth.web()
def home():
return "Where!"
@app.route('/unauthorized')
def unauthorized():
print("I am second!", file=sys.stderr)
return "You are not authorized to view this page"
@app.p_before_request(priority=1)
def unauthorized():
print("I am third!", file=sys.stderr)
app.logger.info("I AM FIRST")
@app.p_before_request(priority=100)
def thing():
print("I am first!", file=sys.stderr)
@app.p_before_request(priority=70)
def stuff():
print("I am second!", file=sys.stderr)
return "You are not authorized to view this page"
\ No newline at end of file
class AmbientNoiseAnalyzer {
constructor(sampleInterval, windowSize, pointCount, k) {
this.windowSize = windowSize;
this.sampleInterval = sampleInterval;
this.collectionInterval = this.sampleInterval * this.windowSize;
this.collectionSize = Math.floor((60*60) / this.collectionInterval);
self.k = k;
self.pointCount = pointCount;
this.windowAverage = 0;
this.windowAverageHistory = [];
this.context = new AudioContext();
}
function acquireAudioDevice() {
navigator.mediaDevices.getUserMedia({audio: true}).then(
stream => {
source = context.createMediaStreamSource(stream);
this.analyzer = context.createAnalyser();
source.connect(this.analyzer);
}
);
}
function start() {
setInterval(() => {
this.analyzer.getByteTimeDomainData(this.data);
let max = Math.max(...this.data);
if (firstAccess) {
average = max;
firstAccess = false;
} else {
average = ((1 - this.k) * average) + (this.k * max);
}
}, this.sampleInterval);
}
function collectWindow() {
}
function recordWindow() {
}
}
window.AVG_COMPONENT = 0.01
window.running_averages = [];
function printChunks() {
console.log(window.chunks);
}
$(document).ready(function() {
navigator.mediaDevices.getUserMedia({audio: true}).then(
stream => {
const context = new AudioContext();
const source = context.createMediaStreamSource(stream);
const analyzer = context.createAnalyser();
source.connect(analyzer);
// analyzer.connect(context.destination);
let data = new Uint8Array(analyzer.frequencyBinCount);
let average = 0;
let firstAccess = true;
setInterval(() => {
analyzer.getByteTimeDomainData(data);
let max = Math.max(...data);
if (firstAccess) {
average = max;
firstAccess = false;
} else {
average = ((1 - window.AVG_COMPONENT) * average) + (window.AVG_COMPONENT * max);
}
// console.log(max);
// console.log((average - 128)/128);
}, 20);
let count = 0;
setInterval(() => {
window.running_averages.push(average);
count++;
if (count == 30) {
let fiveLowest = window.running_averages.sort().slice(0, 5);
let sum = fiveLowest.reduce((m, x) => m + x, 0);
console.log(sum);
console.log(((sum / 5) - 128) / 128);
window.running_averages = [];
count = 0;
}
}, 1000)
}
);
});
\ No newline at end of file
<html>
<head>
<title>This is my fight song</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
<!-- DO NOT USE THIS IN PRODUCTION -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- LOOK INTO PREPROCESSING JSX -->
<script src="../static/app.jsx" type="text/babel"></script>
</head>
<body>
<h1>hbd duude</h1>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment