Skip to content

Instantly share code, notes, and snippets.

View sp5wwp's full-sized avatar

Wojciech Kaczmarski sp5wwp

View GitHub Profile
@sp5wwp
sp5wwp / pico_zmq.c
Created March 19, 2026 10:15
Stream Channel A samples over ZMQ (for PicoScope 5443D)
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <windows.h>
#include "ps5000aApi.h"
#include <zmq.h>
#define BUFFER_SIZE 8192
#define RING_SIZE 256
@sp5wwp
sp5wwp / rru-flasher.sh
Last active March 4, 2026 14:18
RRU firmware flasher script
#!/bin/bash
set -e
if [ -z "$1" ]
then
echo "Usage: $0 rru-rf-fw.bin"
exit 1
fi
#BOOT0
@sp5wwp
sp5wwp / lattice.m
Last active January 4, 2026 18:10
Test Multistage Split Lattice Vector Quantizer (MSLVQ), compare with Codec2 delta-LSF encoder
clear;
clc;
% load data
X0 = csvread("lsf_0_2.csv"); % [N x 3]
X1 = csvread("lsf_3_5.csv"); % [N x 3]
X2 = csvread("lsf_6_9.csv"); % [N x 4]
Xfull = [X0 X1 X2];
@sp5wwp
sp5wwp / harvest_lsf.m
Created January 4, 2026 10:47
Dump LSF data from LibriSpeech for statistical analysis
clear;
clc;
fs_target = 8000;
frame_len = 160;
hop = 80;
lpc_order = 10;
num_files = 0;
wav_dir = "./wav_files";
@sp5wwp
sp5wwp / isinc.py
Last active October 3, 2025 15:05
Inverse sinc filter for ZOH DAC/ADC spectral equalization
import numpy as np
from gnuradio import gr
from scipy.signal import firwin2, lfilter
#granularity
N = 1000
class firwin2_filter(gr.sync_block):
def __init__(self, length=91, sinc_exp=1.0, sinc_gain=110.0, sinc_ratio=0.125):
gr.sync_block.__init__(self,
@sp5wwp
sp5wwp / isinc.m
Created July 8, 2025 16:44
Generate inverse sinc filter taps
clear; clc;
format long;
d = fdesign.isinclp(0.95, 1.0, 0.5, 20);
hd = design(d, 'SincFrequencyFactor', 0.265, 'SincPower', 27, 'SystemObject', true);
b = hd.Numerator;
%fvtool(hd);
%length(hd.Numerator)
@sp5wwp
sp5wwp / dqpsk_demod.py
Created May 10, 2025 15:03
Embedded Python Block - pi/4-DQPSK Demodulator
"""
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""
import numpy as np
from gnuradio import gr
@sp5wwp
sp5wwp / dqpsk_mod.py
Created May 10, 2025 15:02
Embedded Python Block - pi/4-DQPSK modulator
"""
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""
import numpy as np
from gnuradio import gr
@sp5wwp
sp5wwp / dpd.py
Created May 28, 2024 14:28
AM/AM poly DPD python block for GNU Radio
"""
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""
import numpy as np
from gnuradio import gr
@sp5wwp
sp5wwp / sx1255-spi.c
Last active June 6, 2025 18:00
SX1255 sample config using a RPi
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <math.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>