{ "cells": [ { "cell_type": "code", "execution_count": 22, "id": "israeli-hometown", "metadata": {}, "outputs": [], "source": [ "import numpy as np \n", "import os\n", "import pandas as pd \n", "from scipy.io import wavfile\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 8, "id": "waiting-today", "metadata": {}, "outputs": [], "source": [ "samplerate, data = wavfile.read('./7061-6-0-0.wav')" ] }, { "cell_type": "code", "execution_count": 9, "id": "computational-europe", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING:absl:Lingvo does not support eager execution yet. Please disable eager execution with tf.compat.v1.disable_eager_execution() or proceed at your own risk.\n" ] } ], "source": [ "import leaf_audio.frontend as frontend\n", "\n", "leaf = frontend.Leaf()\n", "melfbanks = frontend.MelFilterbanks()\n", "tfbanks = frontend.TimeDomainFilterbanks()\n", "sincnet = frontend.SincNet()\n", "sincnet_plus = frontend.SincNetPlus()" ] }, { "cell_type": "code", "execution_count": 13, "id": "disciplinary-brain", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "numpy.ndarray" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(data)" ] }, { "cell_type": "code", "execution_count": 14, "id": "compound-diesel", "metadata": {}, "outputs": [], "source": [ "data = data.astype('float')" ] }, { "cell_type": "code", "execution_count": 15, "id": "sustained-default", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dtype('float64')" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.dtype" ] }, { "cell_type": "code", "execution_count": 27, "id": "developmental-lounge", "metadata": {}, "outputs": [], "source": [ "leaf_representation = leaf(data)\n", "melfbanks_representation = melfbanks(data)" ] }, { "cell_type": "code", "execution_count": 19, "id": "fuzzy-helmet", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "tensorflow.python.framework.ops.EagerTensor" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(melfbanks_representation)" ] }, { "cell_type": "code", "execution_count": 33, "id": "funny-emperor", "metadata": {}, "outputs": [], "source": [ "leaf_representation\n", "t= melfbanks_representation.numpy" ] }, { "cell_type": "code", "execution_count": 36, "id": "raising-stephen", "metadata": {}, "outputs": [ { "data": { "text/plain": [ ">" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t" ] }, { "cell_type": "code", "execution_count": null, "id": "dressed-present", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }