Last active
April 14, 2020 04:07
-
-
Save nihalpasham/cc2bb5f7753e55fee680d2afb842d912 to your computer and use it in GitHub Desktop.
Extracting the baseband signal and loading it into python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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