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
export function calculateCompression(audioData){ | |
// Convert the linear values to dB | |
let audioDataInDb = audioData.map(x => -20 * Math.log10(x || 1e-9)); // Avoid log(0) by replacing 0 with a very small number | |
// Compute the peak value | |
let peak = Math.max(...audioDataInDb); | |
// Compute the RMS value | |
let sumOfSquares = 0; |
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 threading | |
import cv2 | |
buffer = [] | |
cv2.namedWindow('Foooocus', cv2.WINDOW_NORMAL) | |
def worker(): | |
global buffer |
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
#!/bin/bash | |
APP_NAME="<appname>" | |
KEYS="<path_to_keys>/key/" | |
P_INFO="<path_to_sdk>/connectiq-sdk-mac-2.2.4/bin/projectInfo.xml" | |
pkill simulator | |
monkeyc -y $KEYS/developer_key.der -o $APP_NAME.iq -m manifest.xml -z resources/resources.xml -z resources/settings/* -z resources/strings/strings.xml source/* -w -p $P_INFO -g -e -r |
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
#!/bin/bash | |
APP_NAME="<appname>" | |
KEYS="<path_to_keys>/key/" | |
P_INFO="<path_to_sdk>/connectiq-sdk-mac-2.2.4/bin/projectInfo.xml" | |
# kill the simulator if it's running | |
pkill simulator | |
# build via monkeyc |
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
// -- init and handle health data ------------------------------------------ | |
static void handler_health_hr(HealthEventType type, void *context) { | |
// if the update was from the Heart Rate Monitor, query it | |
if (type == HealthEventHeartRateUpdate) { | |
field_hr_value = health_service_peek_current_value(HealthMetricHeartRateBPM); | |
//field_hr_value = (uint32_t) 0x0000008F; // debug HR | |
} | |
if (state_is == STATE_RUN || state_is == STATE_PAUSE) { |