Skip to content

Instantly share code, notes, and snippets.

View mkvenkit's full-sized avatar

Mahesh Venkitachalam mkvenkit

View GitHub Profile
@mkvenkit
mkvenkit / simple_audio_pi_gist1.py
Created January 16, 2021 13:49
Simple audio training - STFT
def stft(x):
f, t, spec = signal.stft(x.numpy(), fs=16000, nperseg=255, noverlap = 124, nfft=256)
return tf.convert_to_tensor(np.abs(spec))
def get_spectrogram(waveform):
# Padding for files with less than 16000 samples
zero_padding = tf.zeros([16000] - tf.shape(waveform), dtype=tf.float32)
# Concatenate audio with padding so that all audio clips will be of the
# same length
@mkvenkit
mkvenkit / icebling-top.v
Created December 20, 2020 13:13
icebling-top.v
// LED pattern
parameter PAT_LETTERS = 2'b00;
parameter PAT_CONWAY = 2'b01;
parameter PAT_RAIN = 2'b10;
reg [1:0] curr_patt;
...
// assign buffer based on curent pattern
wire [63:0] w_fb = (curr_patt == PAT_LETTERS) ? w_fb_lett :
((curr_patt == PAT_CONWAY) ?
@mkvenkit
mkvenkit / rain88.v
Created December 20, 2020 13:12
rain88.v
always @ (posedge clk)
begin
if (!resetn)
begin
// reset counters
refresh_counter <= 0;
// initialise grid
grid[0:7] <= 8'b01010101;
@mkvenkit
mkvenkit / icebling_snippet2.v
Created December 20, 2020 13:11
icebling_snippet2.v
// handle state machine
case (curr_state)
sSTART:
begin
// start new frame
curr_state <= sNEW_FRAME;
end
sNEW_FRAME:
@mkvenkit
mkvenkit / dott88_snippet.v
Created December 20, 2020 13:04
Here are the highlights from the frame buffer display logic in dot88.v
always @ (posedge clk)
begin
// initialise
if (!resetn)
begin
pcounter <= 0;
d88_counter <= 0;
xp <= 0;
yp <= 0;
@mkvenkit
mkvenkit / to_ipv6.py
Created August 2, 2018 11:50
Convert from ipv4 a.b.c.d to ipv6 abcd:abcd
###############################################################################
# to_ipv6.py
#
# Author: electronut.in
#
# Description:
#
# Convert from ipv4 to ipv6
# eg:
#