Skip to content

Instantly share code, notes, and snippets.

View damp11113's full-sized avatar
🤗
Hi dev

Dharm Pimsen damp11113

🤗
Hi dev
View GitHub Profile
@damp11113
damp11113 / adrod 13.ino
Last active August 29, 2022 08:23
adrod 13
/*
* Created by damp11113
*
* This example code is in github https://gist.github.com/damp11113/62af5256702c661086f8ae6d2bb6716e
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int lcdColumns = A5;
int lcdRows = A4;
@damp11113
damp11113 / devtools.js
Created April 9, 2022 01:58
inspect-element-for-android
(function() {
var script = document.createElement('script');
script.src = "//cdn.jsdelivr.net/npm/eruda";
document.body.appendChild(script);
script.onload = function() {
eruda.init()
}
})();
@damp11113
damp11113 / Player.py
Created March 25, 2023 03:50
Python MIDI Player with built in synthesizer
from mido import MidiFile
import time
import easygui
import fluidsynth
import os
os.system(f'title seclect midi file')
midi_file = easygui.fileopenbox(filetypes=['*.mid', '*.midi'], title='Select a MIDI file')
# check file type
try:
@damp11113
damp11113 / MCSE.py
Last active April 20, 2023 09:31
Minecraft Sounds Extractor python
import os
import json
import shutil
# ---------------- setting here --------------------
extracted_path = <extracted folder>
objects_path = <objects folder>
index_json = <index file ex 1.19.json>
# ---------------------------------------------------
@damp11113
damp11113 / m4formatprototype.py
Last active June 15, 2023 15:17
multiplex4 (m4) is a compressed file hence has a small capacity. And can store multi IQ data simultaneously (sample 4bit)
import struct
def create_multiplex4_file(filename, sample_rate, data_format, data_streams):
with open(filename, 'wb') as file:
# Write header information
header = struct.pack('!If', sample_rate, data_format)
file.write(header)
# Write data streams
for stream_data in data_streams:
@damp11113
damp11113 / vu_meter.py
Last active September 15, 2023 14:56
python audio vu meter L R
import pyaudio
import numpy as np
import time
CHUNK = 2**11
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16, channels=2, rate=44100, input=True, input_device_index=5, frames_per_buffer=CHUNK)
@damp11113
damp11113 / EASAMETH.py
Last active October 5, 2023 15:49
The first Prototype EAS (emergency alert system) in Thailand using SAME encode (Specific Area Message Encoding) With Python. For use with Radio or audio streaming.
# same encoder for thailand by damp11113
import datetime
import numpy as np
import pyaudio
import time
import soundfile as sf
from scipy import signal
import os
import pyttsx3
#include <stdio.h>
int main() {
float epsilon = 1;
float one = 1;
while (1 + epsilon != 1) {
printf("Epsilon = %.12f\n", epsilon);
epsilon/=2;
}
@damp11113
damp11113 / opus_encoder.py
Created November 11, 2023 07:13
PyOgg opus encoder add set_bitrates and set_bandwidth
import ctypes
from typing import Optional, Union, ByteString
from . import opus
from .pyogg_error import PyOggError
class OpusEncoder:
"""Encodes PCM data into Opus frames."""
def __init__(self) -> None:
self._encoder: Optional[ctypes.pointer] = None
@damp11113
damp11113 / dearpygui_template.py
Last active March 2, 2024 10:32
dearpygui project template
import dearpygui.dearpygui as dpg
class App:
def __init__(self):
pass
def window(self):
with dpg.window(label="Test"):
dpg.add_text("Hello world")