Skip to content

Instantly share code, notes, and snippets.

View GemsGame's full-sized avatar

Anton Masanavets GemsGame

View GitHub Profile
@AssIstne
AssIstne / PcmToWavUtil.java
Created April 4, 2018 02:27
utils to convert pcm byte array to wav byte array
public class PcmToWavUtil {
/**
* @param pcmData pcm原始数据
* @param numChannels 声道设置, mono = 1, stereo = 2
* @param sampleRate 采样频率
* @param bitPerSample 单次数据长度, 例如8bits
* @return wav数据
*/
public static byte[] pcmToWav(byte[] pcmData, int numChannels, int sampleRate, int bitPerSample) {
@xj999
xj999 / PcmToWavUtil.java
Created July 31, 2019 08:19 — forked from AssIstne/PcmToWavUtil.java
utils to convert pcm byte array to wav byte array
public class PcmToWavUtil {
/**
* @param pcmData pcm原始数据
* @param numChannels 声道设置, mono = 1, stereo = 2
* @param sampleRate 采样频率
* @param bitPerSample 单次数据长度, 例如8bits
* @return wav数据
*/
public static byte[] pcmToWav(byte[] pcmData, int numChannels, int sampleRate, int bitPerSample) {
@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active July 22, 2024 12:15
Telegram Bot 6.0 Validating data received via the Web App node implementation
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => {
// The data is a query string, which is composed of a series of field-value pairs.
const encoded = decodeURIComponent(telegramInitData);
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key.
const secret = crypto