commit 0d0d896a671e7cf5052e3402543a462ae90659a8
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Sun, 14 Sep 2025 13:54:39 -0300
first commit
Diffstat:
20 files changed, 970 insertions(+), 0 deletions(-)
diff --git a/tp/data/cancion1.wav b/tp/data/cancion1.wav
Binary files differ.
diff --git a/tp/data/cancion2.wav b/tp/data/cancion2.wav
Binary files differ.
diff --git a/tp/data/respuesta_impulso_1.txt b/tp/data/respuesta_impulso_1.txt
@@ -0,0 +1,201 @@
+2.204839114690606509e-04
+2.297854004046387356e-04
+2.400215604486659218e-04
+2.512869077349594977e-04
+2.636568923576342082e-04
+2.771861846911692715e-04
+2.919070760643923562e-04
+3.078280069263194434e-04
+3.249322349918174532e-04
+3.431766551201668233e-04
+3.624907818605372853e-04
+3.827759047033250797e-04
+4.039044251051490675e-04
+4.257193833190212398e-04
+4.480341819604978168e-04
+4.706325120867145204e-04
+4.932684863588705435e-04
+5.156669826145573402e-04
+5.375241998935794980e-04
+5.585084276538503610e-04
+5.782610275861838241e-04
+5.963976260993885097e-04
+6.125095142039638186e-04
+6.261652501887159149e-04
+6.369124591599326264e-04
+6.442798222136094689e-04
+6.477792467380579563e-04
+6.469082081135505563e-04
+6.411522518852843079e-04
+6.299876443547471148e-04
+6.128841584583862327e-04
+5.893079807994853168e-04
+5.587247247655543472e-04
+5.206025338151820539e-04
+4.744152582524300784e-04
+4.196456881362794697e-04
+3.557888243955641865e-04
+2.823551697473073861e-04
+1.988740206433785339e-04
+1.048967412113873315e-04
+-4.575200174816084936e-17
+-1.162110496985986055e-04
+-2.440996651068929907e-04
+-3.839945037700704961e-04
+-5.361867265869833072e-04
+-7.009272323224996232e-04
+-8.784240413421171663e-04
+-1.068839845674762886e-03
+-1.272289741778347746e-03
+-1.488839161541391206e-03
+-1.718502016121682555e-03
+-1.961239066192737093e-03
+-2.216956531055058396e-03
+-2.485504947869178905e-03
+-2.766678291000038582e-03
+-3.060213360116161713e-03
+-3.365789444291684279e-03
+-3.683028267899695566e-03
+-4.011494222593645770e-03
+-4.350694888128914598e-03
+-4.700081843224554468e-03
+-5.059051766073074073e-03
+-5.426947822524710342e-03
+-5.803061338370262348e-03
+-6.186633750574542165e-03
+-6.576858830735492212e-03
+-6.972885172516023883e-03
+-7.373818933284002897e-03
+-7.778726818745311695e-03
+-8.186639297944862254e-03
+-8.596554034672108241e-03
+-9.007439520029289493e-03
+-9.418238889733383107e-03
+-9.827873908600045019e-03
+-1.023524910365003655e-02
+-1.063925602634567362e-02
+-1.103877762365349478e-02
+-1.143269269691309445e-02
+-1.181988042689676929e-02
+-1.219922494295837441e-02
+-1.256961991381682492e-02
+-1.292997313726548803e-02
+-1.327921110599786930e-02
+-1.361628352673527678e-02
+-1.394016776998819283e-02
+-1.424987322803146841e-02
+-1.454444555906523641e-02
+-1.482297079603010249e-02
+-1.508457929917884736e-02
+-1.532844953223675040e-02
+-1.555381164284447455e-02
+-1.575995082892895846e-02
+-1.594621047372183492e-02
+-1.611199503328935786e-02
+-1.625677266170234489e-02
+-1.638007756029463344e-02
+-1.648151203887809196e-02
+-1.656074827824905241e-02
+-1.661752978486739918e-02
+-1.665167253016777357e-02
+9.831208803475340874e-01
+-1.665167253016777357e-02
+-1.661752978486739918e-02
+-1.656074827824905241e-02
+-1.648151203887809196e-02
+-1.638007756029463344e-02
+-1.625677266170234489e-02
+-1.611199503328935786e-02
+-1.594621047372183492e-02
+-1.575995082892895499e-02
+-1.555381164284447108e-02
+-1.532844953223675040e-02
+-1.508457929917884563e-02
+-1.482297079603010249e-02
+-1.454444555906523294e-02
+-1.424987322803146494e-02
+-1.394016776998819110e-02
+-1.361628352673527331e-02
+-1.327921110599786757e-02
+-1.292997313726548456e-02
+-1.256961991381682318e-02
+-1.219922494295837094e-02
+-1.181988042689676409e-02
+-1.143269269691309271e-02
+-1.103877762365349131e-02
+-1.063925602634567015e-02
+-1.023524910365003655e-02
+-9.827873908600043285e-03
+-9.418238889733381372e-03
+-9.007439520029289493e-03
+-8.596554034672108241e-03
+-8.186639297944857049e-03
+-7.778726818745309093e-03
+-7.373818933284002029e-03
+-6.972885172516023015e-03
+-6.576858830735492212e-03
+-6.186633750574539563e-03
+-5.803061338370259746e-03
+-5.426947822524708608e-03
+-5.059051766073072338e-03
+-4.700081843224553600e-03
+-4.350694888128911128e-03
+-4.011494222593644902e-03
+-3.683028267899694265e-03
+-3.365789444291683846e-03
+-3.060213360116160845e-03
+-2.766678291000036847e-03
+-2.485504947869177604e-03
+-2.216956531055057529e-03
+-1.961239066192736660e-03
+-1.718502016121682121e-03
+-1.488839161541389905e-03
+-1.272289741778347312e-03
+-1.068839845674762453e-03
+-8.784240413421170578e-04
+-7.009272323224994064e-04
+-5.361867265869828736e-04
+-3.839945037700702793e-04
+-2.440996651068928823e-04
+-1.162110496985985919e-04
+-4.575200174816084936e-17
+1.048967412113872502e-04
+1.988740206433783984e-04
+2.823551697473072235e-04
+3.557888243955641865e-04
+4.196456881362789276e-04
+4.744152582524295905e-04
+5.206025338151814034e-04
+5.587247247655540219e-04
+5.893079807994853168e-04
+6.128841584583854737e-04
+6.299876443547463558e-04
+6.411522518852835490e-04
+6.469082081135501226e-04
+6.477792467380579563e-04
+6.442798222136086016e-04
+6.369124591599317591e-04
+6.261652501887154812e-04
+6.125095142039634934e-04
+5.963976260993885097e-04
+5.782610275861830651e-04
+5.585084276538497105e-04
+5.375241998935791727e-04
+5.156669826145569065e-04
+4.932684863588705435e-04
+4.706325120867137072e-04
+4.480341819604970036e-04
+4.257193833190208603e-04
+4.039044251051488506e-04
+3.827759047033250797e-04
+3.624907818605369058e-04
+3.431766551201662270e-04
+3.249322349918172905e-04
+3.078280069263192808e-04
+2.919070760643923562e-04
+2.771861846911689463e-04
+2.636568923576340455e-04
+2.512869077349593350e-04
+2.400215604486659218e-04
+2.297854004046387356e-04
+2.204839114690606509e-04
diff --git a/tp/data/respuesta_impulso_2.txt b/tp/data/respuesta_impulso_2.txt
@@ -0,0 +1,201 @@
+1.272270275640155436e-04
+2.381332269389246480e-04
+2.536453901797883150e-04
+1.637677398870278041e-04
+-6.786357809344214569e-19
+-1.745975051466732656e-04
+-2.881025552477194259e-04
+-2.877840052277492989e-04
+-1.632719412588281931e-04
+4.483055367967091453e-05
+2.561799121535421396e-04
+3.798147748118580846e-04
+3.515264410351709033e-04
+1.648565705666328487e-04
+-1.184857409729269924e-04
+-3.863384254311889887e-04
+-5.183703446961727404e-04
+-4.379730072335053827e-04
+-1.522043948521731695e-04
+2.397461328331108215e-04
+5.779456867534876925e-04
+7.046544084457356544e-04
+5.350610037333968167e-04
+1.051107511714101367e-04
+-4.282914395331383160e-04
+-8.413331034861380514e-04
+-9.345940598394511739e-04
+-6.254334269568012942e-04
+5.875825411292550221e-18
+7.037744538872846376e-04
+1.183355607555914950e-03
+1.198599264851656293e-03
+6.864638914333846863e-04
+-1.895125117649278774e-04
+-1.084986638250752186e-03
+-1.606638626527167463e-03
+-1.481177571309190031e-03
+-6.903448133955779591e-04
+4.921560432037900418e-04
+1.589247696232961487e-03
+2.109064608352770407e-03
+1.760666164434784723e-03
+6.040765150606970495e-04
+-9.388480979021604934e-04
+-2.232188587720510247e-03
+-2.683541848923893212e-03
+-2.008953824725549526e-03
+-3.890847828646585606e-04
+1.563168638256428157e-03
+3.028164529665710453e-03
+3.318080536603977993e-03
+2.190947656070230641e-03
+-4.616495828712905706e-18
+-2.402996063069077863e-03
+-3.991670170472328208e-03
+-3.996181030084622852e-03
+-2.263323295892808763e-03
+6.182487254088219397e-04
+3.504262506030086065e-03
+5.140423433227279439e-03
+4.697518765909091711e-03
+2.171655854529516358e-03
+-1.536684877416078128e-03
+-4.928731742024702531e-03
+-6.501464331254918662e-03
+-5.398890258736407238e-03
+-1.844027754242956538e-03
+2.855454905161322089e-03
+6.769988107128051442e-03
+8.123307980487487825e-03
+6.075366788975964001e-03
+1.176678235230433018e-03
+-4.732476440217848503e-03
+-9.187938890067645983e-03
+-1.010184973970301714e-02
+-6.701587818622095627e-03
+7.103274834010306960e-18
+7.450870642935409835e-03
+1.249078698244583674e-02
+1.264240807599104413e-02
+7.253115969274582554e-03
+-2.011254331121052532e-03
+-1.160012678724980754e-02
+-1.736151664233035602e-02
+-1.623634524158762762e-02
+-7.707770276868656546e-03
+5.622709021198171730e-03
+1.867640172828218675e-02
+2.564942421663912384e-02
+2.231614741694776943e-02
+8.046854799957476115e-03
+-1.327733329121397708e-02
+-3.393422437379382123e-02
+-4.455042248887015194e-02
+-3.717920284436118661e-02
+-8.256205520974032111e-03
+3.961423279123026109e-02
+9.775207023379975380e-02
+1.534754027113892916e-01
+1.935833178216352368e-01
+2.081747370485290127e-01
+1.935833178216352368e-01
+1.534754027113892916e-01
+9.775207023379975380e-02
+3.961423279123025415e-02
+-8.256205520974032111e-03
+-3.717920284436118661e-02
+-4.455042248887015194e-02
+-3.393422437379381429e-02
+-1.327733329121397535e-02
+8.046854799957474380e-03
+2.231614741694776943e-02
+2.564942421663912037e-02
+1.867640172828218675e-02
+5.622709021198170863e-03
+-7.707770276868654812e-03
+-1.623634524158762416e-02
+-1.736151664233034908e-02
+-1.160012678724980581e-02
+-2.011254331121052098e-03
+7.253115969274581687e-03
+1.264240807599104066e-02
+1.249078698244583153e-02
+7.450870642935408968e-03
+7.103274834010305419e-18
+-6.701587818622093892e-03
+-1.010184973970301714e-02
+-9.187938890067644249e-03
+-4.732476440217847635e-03
+1.176678235230433018e-03
+6.075366788975964001e-03
+8.123307980487482621e-03
+6.769988107128048840e-03
+2.855454905161322089e-03
+-1.844027754242956322e-03
+-5.398890258736407238e-03
+-6.501464331254915192e-03
+-4.928731742024700796e-03
+-1.536684877416077694e-03
+2.171655854529515491e-03
+4.697518765909090843e-03
+5.140423433227275969e-03
+3.504262506030085197e-03
+6.182487254088217228e-04
+-2.263323295892808330e-03
+-3.996181030084622852e-03
+-3.991670170472324738e-03
+-2.402996063069076562e-03
+-4.616495828712904166e-18
+2.190947656070230207e-03
+3.318080536603977126e-03
+3.028164529665707851e-03
+1.563168638256427507e-03
+-3.890847828646583980e-04
+-2.008953824725549092e-03
+-2.683541848923892345e-03
+-2.232188587720508512e-03
+-9.388480979021598428e-04
+6.040765150606967242e-04
+1.760666164434784506e-03
+2.109064608352770407e-03
+1.589247696232959969e-03
+4.921560432037896081e-04
+-6.903448133955776339e-04
+-1.481177571309190031e-03
+-1.606638626527165294e-03
+-1.084986638250751102e-03
+-1.895125117649276334e-04
+6.864638914333842526e-04
+1.198599264851656293e-03
+1.183355607555913432e-03
+7.037744538872837703e-04
+5.875825411292543287e-18
+-6.254334269568008605e-04
+-9.345940598394511739e-04
+-8.413331034861369672e-04
+-4.282914395331377196e-04
+1.051107511714100825e-04
+5.350610037333965998e-04
+7.046544084457356544e-04
+5.779456867534869336e-04
+2.397461328331105504e-04
+-1.522043948521730611e-04
+-4.379730072335050574e-04
+-5.183703446961727404e-04
+-3.863384254311883381e-04
+-1.184857409729267891e-04
+1.648565705666326861e-04
+3.515264410351707407e-04
+3.798147748118580846e-04
+2.561799121535418685e-04
+4.483055367967083999e-05
+-1.632719412588280847e-04
+-2.877840052277491362e-04
+-2.881025552477194259e-04
+-1.745975051466730488e-04
+-6.786357809344209754e-19
+1.637677398870276957e-04
+2.536453901797883150e-04
+2.381332269389246480e-04
+1.272270275640155436e-04
diff --git a/tp/graph_data.py b/tp/graph_data.py
@@ -0,0 +1,37 @@
+import matplotlib.pyplot as plt
+from matplotlib.ticker import MultipleLocator
+from matplotlib.ticker import MaxNLocator
+import matplotlib
+import numpy as np
+
+matplotlib.rcParams['font.family'] = 'Times New Roman'
+matplotlib.use("TkAgg")
+
+def graph_data(x, y, t=0, dt=0, a=0, da=0, y_min=0, y_max=0, show=True):
+ figure, axis = plt.subplots(figsize=(10, 8))
+
+ axis.plot(x, y, label='Señal de Audio')
+ axis.set(xlabel='Tiempo [s]', ylabel='Amplitud normalizada')
+
+ axis.minorticks_on()
+ axis.grid(True, which='major', linestyle='-')
+ axis.grid(True, which='minor', linestyle=':', linewidth=0.5)
+
+ # configuracion de ticks del eje x
+ axis.xaxis.set_major_locator(MaxNLocator(nbins=18)) # ~18 ticks por plot
+ axis.xaxis.set_minor_locator(MaxNLocator(nbins=72))
+
+ axis.set_xlim([t, t+dt if dt > 0 else x[-1]])
+ axis.set_ylim([y_min if y_min != 0 else axis.get_ylim()[0],
+ y_max if y_max != 0 else axis.get_ylim()[1]])
+
+ # resaltado de parte de la señal (solo si a != 0)
+ axis.axvspan(a, a+da, color='skyblue',
+ alpha=0 if a == 0 else 0.50,
+ label=f"Un periodo T={da}s" if da != 0 else "")
+ axis.legend()
+
+ if show:
+ plt.show()
+
+ return figure, axis
diff --git a/tp/informe/informe.md b/tp/informe/informe.md
@@ -0,0 +1,139 @@
+# Trabajo Práctico
+
+Señales y sistemas (TB065) - FIUBA
+Martin Klöckner - [mklockner@fi.uba.ar](mailto:mklockner@fi.uba.ar)
+
+<!-- \vspace{-1.25em} -->
+<!-- \rule{\linewidth}{0.5pt} -->
+<!-- \vspace{-1.25em} -->
+
+En el presente trabajo se realiza un análisis visual en el dominio temporal de
+dos señales musicales. Para realizar el análisis se utiliza un script de python
+para graficar en principio las señales completas y luego porciones de ambas en
+busca de intervalos particulares. Por ultimo se analiza el comportamiento de las
+señales al aplicarse dos filtros diferentes, teniendo solo la respuesta al
+impulso de los filtros.
+
+## Primer muestra
+
+Para la primer muestra (archivo `cancion1.wav`) se realiza el gráfico de la
+misma en el dominio temporal, el resultado se muestra en la figura 1.
+
+La frecuencia de muestreo de la misma es 44100 Hz, esto se obtiene del mismo
+script utilizado para graficar el archivo.
+
+\begin{figure}[H]
+ \centering
+ \hspace*{-1mm}
+ \includegraphics[width=\linewidth]{../plot/cancion1.png}
+ \caption{Gráfico de archivo 'cancion1.wav'}
+\end{figure}
+
+### Secciones cuasi-periódicas
+
+Cuando la señal tiene una estructura repetitiva, pero con variaciones en
+amplitud, fase o frecuencia se dice que la señal es cuasi-periódica.
+
+Realizando un análisis visual en detalle de la muestra se buscan partes donde se
+comporte como tal, dos ejemplos se dan en las figuras 2 y 3. En la primera se
+gráfica el intervalo $0.248$ s y $0.256$ s, mientras que en la segunda se
+gráfica el intervalo $0.520$ s a $0.528$ s.
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion1_0_248s_a_0_256s.png}
+\caption{Sección cuasi-periódica archivo 'cancion.wav'}
+\end{figure}
+
+Dentro de los intervalos cuasi-periódicos graficados, se pueden detectar
+visualmente los períodos fundamentales $T0$, los cuales se ven resaltados en
+color celeste claro.
+
+Curiosamente en ambos casos el período es igual y resulta $T=0.003$ s,
+lo cual corresponde con una frecuencia de aproximadamente $333$ Hz. Comparando
+con notas musicales de tabla esto se asemeja a una nota *E4*, la cual tiene una
+frecuencia de $329.228$ Hz.
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion1_0_52s_a_0_528s.png}
+\caption{Sección cuasi-periódica archivo 'cancion.wav'}
+\end{figure}
+
+## Segunda muestra
+
+De manera análoga a lo realizado para la primer muestra (archivo
+`cancion1.wav`) se realiza para la segunda muestra (archivo `cancion2.wav`).
+
+Utilizando el mismo script de python se gráfica la señal en el dominio temporal,
+en este caso se gráfica a partir del segundo 6 ya que antes de esto la señal
+tiene amplitud nula, el gráfico en cuestión se muestra en la figura 4.
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion2_6s.png}
+\caption{Gráfico de archivo 'cancion2.wav'}
+\end{figure}
+
+La frecuencia fundamental de esta segunda muestra resulta $48000$ Hz, esto
+también se obtiene del script.
+
+### Secciones no-periódicas
+
+A diferencia del análisis realizado sobre la primer muestra en busca de
+secciones cuasi-periódicas, para esta segunda muestra se buscan secciones no
+periódicas, esto es, secciones donde la señal no tiene un patron repetitivo
+marcado.
+
+Se grafican dos intervalos en los cuales la señal de muestra se comporta como
+tal, el intervalo de $14.72$s a $14.73$s y el intervalo $26.57$s a $26.58$s,
+ambos intervalos se muestran en las figura 5 y 6 respectivamente. Dado que las
+secciones son no periódicas, no se puede hablar de una frecuencia fundamental
+como si se podía en las secciones cuasi-periódicas en la primer muestra.
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion2_14_72s_a_14_73s.png}
+\caption{Sección no periódica archivo 'cancion2.wav'}
+\end{figure}
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion2_26_57s_a_26_58s.png}
+\caption{Sección no periódica archivo 'cancion2.wav'}
+\end{figure}
+
+<!--
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion1_filter1_output.png}
+\caption{Representación gráfica de grafos}
+\end{figure}
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion1_filter2_output.png}
+\caption{Representación gráfica de grafos}
+\end{figure}
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion2_6s_filter1_output.png}
+\caption{Representación gráfica de grafos}
+\end{figure}
+
+\begin{figure}[H]
+\centering
+\hspace*{-1mm}
+\includegraphics[width=\linewidth]{../plot/cancion2_6s_filter2_output.png}
+\caption{Representación gráfica de grafos}
+\end{figure}
+-->
diff --git a/tp/informe/informe.pdf b/tp/informe/informe.pdf
Binary files differ.
diff --git a/tp/informe/style.tex b/tp/informe/style.tex
@@ -0,0 +1,250 @@
+% \documentclass[14pt]{extarticle}
+
+% page setup
+% \usepackage[a4paper,
+% top=2.5cm,
+% bottom=2.5cm,
+% left=2.00cm,
+% right=2.00cm,
+% bmargin=2.50cm]{geometry}
+\usepackage[a4paper,
+ top=3.00cm,
+ bottom=3.00cm,
+ left=2.20cm,
+ right=2.20cm,
+ bmargin=2.50cm]{geometry}
+
+\usepackage{titlesec}
+\usepackage{fontspec}
+\setmainfont{Helvetica}
+
+% right pointing hand
+\usepackage{utfsym}
+
+% make pictures caption font bold and small
+\usepackage[font={small}]{caption}
+\usepackage{subcaption}
+
+% inline code (backticks in md)
+\linespread{1.10}
+\definecolor{bgcolor}{HTML}{e0e0e0}
+\let\oldtexttt\texttt
+
+\renewcommand{\texttt}[1]{
+ \colorbox{bgcolor}{\oldtexttt{#1}}
+}
+
+% change boldfont bold to extrabold
+% \setmainfont[
+% BoldFont={Inter-ExtraBold}
+% ]{Inter}
+
+% change regular font to light font
+% \setmainfont{Inter light}
+
+\newfontfamily\titlefont{Inter}[
+UprightFont = *-Regular,
+BoldFont = *-ExtraBold,
+Scale = 0.90
+]
+
+\newfontfamily\sectionsfont{Inter}[
+UprightFont = *-Regular,
+BoldFont = *-Bold,
+]
+
+\setmathfont[Scale=1.05]{Fira Math}
+
+\usepackage{xcolor}
+\definecolor{ugrey}{HTML}{333333}
+
+\titleformat{\section}
+{\color{ugrey}\titlefont\Large\bfseries}
+{\color{ugrey}}
+{0em}
+{}
+
+\titleformat{\subsection}
+{\color{ugrey}\sectionsfont\large\bfseries}
+{\color{ugrey}}
+{0em}
+{}
+
+\titleformat{\subsubsection}
+{\color{ugrey}\sectionsfont\bfseries}
+{\color{ugrey}}
+{0em}
+{}
+
+\titleformat{\paragraph}
+{\color{ugrey}\sectionsfont\bfseries}
+{\color{ugrey}\theparagraph}
+{0em}
+{}
+
+\titleformat{\subparagraph}
+{\color{ugrey}\normalfont\bfseries}
+{\color{ugrey}\theparagraph}
+{0em}
+{}
+
+% spacing: how to read {12pt plus 4pt minus 2pt}
+% 12pt is what we would like the spacing to be
+% plus 4pt means that TeX can stretch it by at most 4pt
+% minus 2pt means that TeX can shrink it by at most 2pt
+%
+% \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
+
+\titlespacing*{\section}
+{0pt}{2ex plus 1ex minus .2ex}{1.75ex plus .2ex}
+
+\titlespacing*{\subsection}
+{0pt}{1.75ex plus 1ex minus .2ex}{1.5ex plus .2ex}
+
+\titlespacing*{\subsubsection}
+{0pt}{1.5ex plus 1ex minus .2ex}{1.25ex plus .2ex}
+
+\titlespacing*{\paragraph}
+{0pt}{1.5ex plus 1ex minus .2ex}{1.0ex plus .2ex}
+
+\titlespacing*{\subparagraph}
+{0pt}{1.25ex plus 1ex minus .2ex}{1.0ex plus .2ex}
+
+% spacing between formulas and text
+% \usepackage[nodisplayskipstretch]{setspace}
+% \setstretch{1.20}
+
+\setlength{\abovedisplayskip}{0pt}
+\setlength{\belowdisplayskip}{0pt}
+
+\setlength{\abovedisplayshortskip}{0pt}
+\setlength{\belowdisplayshortskip}{0pt}
+
+\setlength{\belowdisplayshortskip}{\belowdisplayskip}
+
+\setlength{\baselineskip}{0pt}
+
+% \usepackage{setspace}
+% \setstretch{1.25}
+
+\usepackage{caption}
+% \captionsetup{font=normalsize, font=bf, labelfont=bf}
+\captionsetup[sub]{font=small,labelfont=md}
+
+\renewcommand\thesubfigure{\arabic{subfigure}}
+
+\renewcommand{\figurename}{Figura}
+\renewcommand{\tablename}{Tabla}
+
+% \renewcommand{\contentsname}{Índice}
+\renewcommand\contentsname{\vspace*{-45pt}}
+
+% TOC dots separation
+% \renewcommand{\cftdotsep}{10}
+
+% \setlength{\cftsecindent}{0pt}% Remove indent for \section
+% \setlength{\cftsubsecindent}{5pt}% Remove indent for \subsection
+% \setlength{\cftsubsubsecindent}{0pt}% Remove indent for \subsubsec
+
+\setcounter{tocdepth}{4}
+
+\usepackage{titling}
+\renewcommand{\maketitle}{
+ \begin{flushleft}
+ {\bfseries\Huge\thetitle}
+ % \vspace{1mm}
+ \end{flushleft}
+ % \thispagestyle{empty}
+}
+
+% remove the page number from all the pages that the TOC occupies
+% \addtocontents{toc}{\protect\thispagestyle{empty}}
+
+% add page break after TOC set it to page number 1
+\let\oldtableofcontents\tableofcontents % remember the definition
+\renewcommand\tableofcontents{
+ \oldtableofcontents % use the standard toc
+ \thispagestyle{empty}
+ \pagebreak
+ \setcounter{page}{1}
+}
+
+% Set text color for all document
+% \color{ugrey}
+
+\usepackage[titles]{tocloft}
+\renewcommand{\cftdotsep}{1.5}
+\renewcommand{\cftsetpnumwidth}{1.5}
+\renewcommand{\cftsetrmarg}{1.5}
+
+\usepackage{float}
+% \makeatletter
+% \def\fps@figure{H}
+% \makeatother
+
+% nicer chemical figures
+\usepackage{chemfig}
+
+% change style of quote, see also https://tex.stackexchange.com/a/436253/114857
+\usepackage[most]{tcolorbox}
+
+\definecolor{linequote}{RGB}{224,215,188}
+\definecolor{bordercolor}{RGB}{221,221,221}
+% \definecolor{backquote}{RGB}{249,245,233}
+\definecolor{backquote}{RGB}{245,245,245}
+
+% change left border: https://tex.stackexchange.com/a/475716/114857
+% change left margin: https://tex.stackexchange.com/a/457936/114857
+\newtcolorbox{myquote}[1][]{%
+ enhanced,
+ breakable,
+ size=minimal,
+ left=0pt,
+ top=12pt,
+ bottom=12pt,
+ right=12pt,
+ boxrule=1pt,
+ sharp corners=all,
+ colback=backquote,
+ colframe=black,
+ #1}
+
+% redefine quote environment to use the myquote environment, see
+% https://tex.stackexchange.com/a/337587/114857
+\renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
+
+% better fractions
+\usepackage{nicefrac,xfrac}
+
+% surround footnotes number with square brackets and always use numbers (even
+% inside quoted text)
+% https://www.overleaf.com/learn/latex/Footnotes
+\renewcommand*{\thefootnote}{\ [\arabic{footnote}]\ }
+\renewcommand*{\thempfootnote}{\ [\arabic{mpfootnote}]\ }
+
+% space between text and footer
+\setlength\footskip{35pt}
+\setlength{\skip\footins}{12pt}
+
+% align first letter of all the lines in the footnotes
+\usepackage[bottomfloats,belowfloats,hang]{footmisc}
+\setlength{\footnotemargin}{1em}
+
+\newcommand{\unit}[2]{\nicefrac{#1}{#2}}
+
+\usepackage{enumitem}
+\usepackage{amsfonts}
+
+\setlist[itemize,1]{label=$\bullet$}
+\setlist[itemize,2]{label=$\textopenbullet$}
+
+\usepackage{tabularx}
+\usepackage{multirow} % Required for multirows
+\usepackage{colortbl}
+
+% Reduce space around displayed equations safely
+\makeatletter
+\setlength{\jot}{8pt} % valor por defecto es 3pt aproximadamente
+\makeatother
+
+\setlength{\columnsep}{12pt}
diff --git a/tp/main.py b/tp/main.py
@@ -0,0 +1,58 @@
+import matplotlib.pyplot as plt
+import numpy as np
+from scipy.io import wavfile
+from utils import plot, save_plot
+
+file1_path = 'data/cancion1.wav'
+file2_path = 'data/cancion2.wav'
+filter1_h_file_path = 'data/respuesta_impulso_1.txt'
+filter2_h_file_path = 'data/respuesta_impulso_2.txt'
+
+file1_fs, file1_data = wavfile.read(file1_path)
+file2_fs, file2_data = wavfile.read(file2_path)
+
+filter1_h = np.loadtxt(filter1_h_file_path)
+filter2_h = np.loadtxt(filter2_h_file_path)
+
+# 'cancion1'
+print(f'"{file1_path}", {file1_fs} Hz')
+
+## grafico completo
+plot(file1_fs, file1_data, file1_path)
+
+## porciones cuasi-periodicas 'cancion1'
+plot(file1_fs, file1_data, file1_path,
+ t_start=0.248, t_width=0.008, a=0.24978, da=0.003)
+
+plot(file1_fs, file1_data, file1_path,
+ t_start=0.520, t_width=0.008, a=0.5208, da=0.003)
+
+## salida de filtro 'cancion1'
+file1_filter1_output = np.convolve(file1_data, filter1_h, mode='full')
+file1_filter2_output = np.convolve(file1_data, filter2_h, mode='full')
+
+fig, ax = plot(file1_fs, file1_filter1_output)
+save_plot(fig, file1_path, extra_name="_filter1_output")
+
+fig, ax = plot(file1_fs, file1_filter2_output)
+save_plot(fig, file1_path, extra_name="_filter2_output")
+
+# 'cancion2'
+print(f'"{file2_path}", {file2_fs} Hz')
+
+## grafico completo
+plot(file2_fs, file2_data, file2_path, t_start=6)
+
+## porciones cuasi-periodicas 'cancion2'
+plot(file2_fs, file2_data, file2_path, t_start=14.720, t_width=0.01)
+plot(file2_fs, file2_data, file2_path, t_start=26.570, t_width=0.01)
+
+## salida de filtro 'cancion2'
+file2_filter1_output = np.convolve(file2_data, filter1_h, mode='full')
+file2_filter2_output = np.convolve(file2_data, filter2_h, mode='full')
+
+fig, ax = plot(file2_fs, file2_filter1_output, t_start=6)
+save_plot(fig, file2_path, t_start=6, extra_name="_filter1_output")
+
+fig, ax = plot(file2_fs, file2_filter2_output, t_start=6)
+save_plot(fig, file2_path, t_start=6, extra_name="_filter2_output")
diff --git a/tp/plot/cancion1.png b/tp/plot/cancion1.png
Binary files differ.
diff --git a/tp/plot/cancion1_0_248s_a_0_256s.png b/tp/plot/cancion1_0_248s_a_0_256s.png
Binary files differ.
diff --git a/tp/plot/cancion1_0_52s_a_0_528s.png b/tp/plot/cancion1_0_52s_a_0_528s.png
Binary files differ.
diff --git a/tp/plot/cancion1_filter1_output.png b/tp/plot/cancion1_filter1_output.png
Binary files differ.
diff --git a/tp/plot/cancion1_filter2_output.png b/tp/plot/cancion1_filter2_output.png
Binary files differ.
diff --git a/tp/plot/cancion2_14_72s_a_14_73s.png b/tp/plot/cancion2_14_72s_a_14_73s.png
Binary files differ.
diff --git a/tp/plot/cancion2_26_57s_a_26_58s.png b/tp/plot/cancion2_26_57s_a_26_58s.png
Binary files differ.
diff --git a/tp/plot/cancion2_6s.png b/tp/plot/cancion2_6s.png
Binary files differ.
diff --git a/tp/plot/cancion2_6s_filter1_output.png b/tp/plot/cancion2_6s_filter1_output.png
Binary files differ.
diff --git a/tp/plot/cancion2_6s_filter2_output.png b/tp/plot/cancion2_6s_filter2_output.png
Binary files differ.
diff --git a/tp/utils.py b/tp/utils.py
@@ -0,0 +1,84 @@
+import matplotlib.pyplot as plt
+from matplotlib.ticker import AutoMinorLocator
+from matplotlib.ticker import MultipleLocator
+from matplotlib.ticker import MaxNLocator
+from matplotlib.ticker import FuncFormatter
+
+import matplotlib
+import numpy as np
+import os
+
+plot_dir_name = 'plot'
+
+matplotlib.rcParams['font.family'] = 'Inter'
+matplotlib.rcParams['font.size'] = 12
+matplotlib.use("TkAgg")
+
+def ticks_label_format(x, pos):
+ # 3 decimals, strip trailing zeros
+ return f"{x:.3f}".rstrip("0").rstrip(".")
+
+def graph_data(x, y, t=0, dt=0, a=0, da=0, y_min=0, y_max=0, show=True):
+ figure, axis = plt.subplots(figsize=(5, 5))
+
+ axis.plot(x, y, label='Señal de Audio')
+ axis.set(xlabel='Tiempo [s]', ylabel='Amplitud normalizada')
+
+ axis.minorticks_on()
+ axis.grid(True, which='major', linestyle='-', linewidth=0.50)
+ axis.grid(True, which='minor', linestyle=':', linewidth=0.50)
+
+ # configuracion de ticks del eje x
+ axis.xaxis.set_major_locator(MaxNLocator(nbins=5))
+ axis.xaxis.set_minor_locator(AutoMinorLocator(4)) # 2 subdivisions between majors
+
+ plt.tight_layout()
+
+ # max 3 decimals
+ axis.xaxis.set_major_formatter(FuncFormatter(ticks_label_format))
+
+ axis.set_xlim([t, t+dt if dt > 0 else x[-1]])
+ axis.set_ylim(-1.1, 1.1)
+
+ # resaltado de parte de la señal (solo si a != 0)
+ axis.axvspan(a, a+da, color='skyblue',
+ alpha=0 if a == 0 else 0.50,
+ label=f"Un periodo T={da}s" if da != 0 else "")
+ axis.legend()
+
+ if show:
+ plt.show()
+
+ return figure, axis
+
+def plot(fs, data, file_path="", t_start=0, t_width=0, a=0, da=0):
+ # normaliza la amplitud dividiendo por el valor maximo del tipo de dato
+ data = data.astype(np.float32)
+ data /= np.max(np.abs(data))
+
+ t = np.arange(len(data)) / fs
+ fig, ax = graph_data(t, data, t=t_start, dt=t_width, a=a, da=da, show=False)
+
+ if file_path != "":
+ save_plot(fig, file_path, t_start=t_start, t_width=t_width)
+
+ return fig, ax
+
+def save_plot(fig, src_file_path, t_start=0, t_width=0, extra_name=''):
+ basename = os.path.basename(src_file_path)
+ file_name, ext = os.path.splitext(basename)
+ fig_file_name = f'{plot_dir_name}/{file_name}'
+
+ if t_start != 0:
+ fig_name_append_1 = f'_{t_start}s'
+ fig_name_append_2 = f'_a_{round(t_start + t_width, 3)}s' if t_width != 0 else ''
+ fig_file_name += fig_name_append_1.replace('.', '_')
+ fig_file_name += fig_name_append_2.replace('.', '_')
+
+ fig_file_name += extra_name
+
+ print(f'- "{fig_file_name}.png"')
+
+ # crea carpeta para plots
+ os.makedirs(plot_dir_name, exist_ok=True)
+ fig.savefig(fig_file_name, dpi=300, bbox_inches="tight")