{ "cells": [ { "cell_type": "raw", "id": "needed-surface", "metadata": {}, "source": [ "Notebook extracts ENF signal by pyenf_extraction application\n", "Uses reference (002_ref.wav) and original (002.wav) signal" ] }, { "cell_type": "code", "execution_count": null, "id": "endangered-scott", "metadata": { "scrolled": true, "tags": [] }, "outputs": [], "source": [ "!wget https://github.com/ghuawhu/ENF-WHU-Dataset/blob/master/ENF-WHU-Dataset/H1/002.wav?raw=true\n", "!wget https://github.com/ghuawhu/ENF-WHU-Dataset/blob/master/ENF-WHU-Dataset/H1_ref/002_ref.wav?raw=true\n", "!git clone https://github.com/deerajnagothu/pyenf_extraction\n", " \n", "!pip install scipy==1.1.0\n", "!pip install numpy==1.21.0\n", "!pip install matplotlib==3.4.2\n", "!pip install librosa==0.8.1" ] }, { "cell_type": "code", "execution_count": 1, "id": "failing-upset", "metadata": {}, "outputs": [], "source": [ "import sys\n", "import numpy as np\n", "from lib import extract_enf_signal" ] }, { "cell_type": "code", "execution_count": 2, "id": "helpful-employer", "metadata": { "scrolled": true, "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/radekludacka/miniconda3/envs/enf/lib/python3.7/site-packages/numpy/core/fromnumeric.py:1970: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n", " result = asarray(a).shape\n" ] } ], "source": [ "audio = extract_enf_signal('002.wav?raw=true')\n", "audio_reference = extract_enf_signal('002_ref.wav?raw=true')" ] }, { "cell_type": "code", "execution_count": 3, "id": "genuine-grass", "metadata": {}, "outputs": [], "source": [ "np.save('audio.npy', audio)\n", "np.save('audio_reference.npy', audio_reference)" ] } ], "metadata": { "kernelspec": { "display_name": "Conda Python 3.7 (pyenf)", "language": "python", "name": "pyenf" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }