Skip to content

Instantly share code, notes, and snippets.

View 41y08h's full-sized avatar
💫
nullius in verba

Piyush 41y08h

💫
nullius in verba
View GitHub Profile
@41y08h
41y08h / working pitch shift.js
Created January 26, 2023 07:18
working pitch shift
import "./styles.css";
import { useEffect, useState } from "react";
import * as Tone from "tone";
export default function App() {
const [filter, setFilter] = useState<Tone.PitchShift | undefined>(undefined);
const [pitch, setPitch] = useState(1);
async function init() {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
@41y08h
41y08h / stage 3.js
Created January 26, 2023 07:18
stage 3
import "./styles.css";
import { useEffect, useRef, useState } from "react";
import * as Tone from "tone";
export default function App() {
const [filter, setFilter] = useState<Tone.PitchShift | undefined>(undefined);
const [pitch, setPitch] = useState(1);
const audioRef = useRef<any>();
async function init() {
@41y08h
41y08h / pitch shift from audio.js
Created January 26, 2023 07:17
pitch shift from audio
import "./styles.css";
import { useEffect, useRef, useState } from "react";
import * as Tone from "tone";
export default function App() {
const [filter, setFilter] = useState<Tone.PitchShift | undefined>(undefined);
const [pitch, setPitch] = useState(1);
const audioRef = useRef<any>();
async function init() {
@41y08h
41y08h / main.txt
Created July 14, 2022 08:58
death_note_audio_filter
// Pitch change without affecting duration
./ffmpeg -i elle-raw.mp3 -af "asetrate=48000*0.8, aresample=48000, atempo=1/0.8" track1.mp3
// Merge tracks
./ffmpeg -i elle-raw.mp3 -i track1.mp3 -filter_complex amix=inputs=2:duration=longest output.mp3
@41y08h
41y08h / button.dart
Created April 28, 2022 07:55
Flutter text button with ripple effect and background color
TextButton(
onPressed: onPressed,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(color ?? const Color(0xff4e4c50)),
// padding: MaterialStateProperty.all(EdgeInsets.zero),
),
child: Container(
alignment: Alignment.center,
child: child,
#include <AceButton.h>
using namespace ace_button;
const int BUTTON1_PIN = 18;
const int BUTTON2_PIN = 19;
const int BUTTON3_PIN = 5;
ButtonConfig config1;
ButtonConfig config2;
ButtonConfig config3;
@41y08h
41y08h / gist:1439f1ef6418b928f9684098f1d688fc
Created November 3, 2021 14:17
refer to generic arguments inside a function
export default function validate<T>(schema: T) {
const {errors} = Joi.object<T>(schema); // You can use T type here
}
const validate: <T>(schema: T) => void = () => {
const {errors} = Joi.object<T>(schema); // You can't use T type here
}
auth
validation
database
@41y08h
41y08h / main.txt
Last active April 5, 2022 14:46
Web RTC Signaling
Initiate CALLER.
Create data channel.
CALLER - Create offer.
CALLER - Set the offer created as local description.
Grab the CALLER's local description.
Initiate CALLEE.
CALLEE - Set the CALLER's local description as remote description.
CALLEE - Create an answer offer.
CALLEE - Set the answer offer created as local description.
Grab the CALLEE's local description.
// @experimentalDecorators
let isAuthenticated = false;
function authenticate() {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const handler = descriptor.value
descriptor.value = (...args: any[]) => {
if(isAuthenticated) return handler(...args)
const value = prompt("login required")