Skip to content

Instantly share code, notes, and snippets.

@nihalpasham
Last active April 14, 2020 04:07
Show Gist options
  • Save nihalpasham/cc2bb5f7753e55fee680d2afb842d912 to your computer and use it in GitHub Desktop.
Save nihalpasham/cc2bb5f7753e55fee680d2afb842d912 to your computer and use it in GitHub Desktop.
Extracting the baseband signal and loading it into python
import numpy as np
import os
from scipy.io import wavfile
import matplotlib.pyplot as plt
file_path = "/Users/Nil/devspace/Github_repos/alltheFSKs/iPhone_MFSK_Gpay_samples/iPhone_stereo_r_48khz_raw_c4755658_frequency_translated_lowpass_filtered.wav"
fs, data = wavfile.read(file_path)
# print(fs)
if(data.dtype == np.int16):
data = data.astype(np.float)/2**16
number_of_complex_samples = len(data)
print(data.shape)
print(len(data))
re, im = np.hsplit(data, 2)
re = np.multiply(re.reshape(data.shape[0],), 1e+02)
im = np.multiply(im.reshape(data.shape[0],), 1e+02)
plt.figure(figsize=(20,10))
plt.plot((re))
plt.plot(im)
plt.ylabel("Amplitude")
plt.xlabel("Time (samples)")
plt.title("Samples")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment