KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO...

580
KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO TRABAJO FINAL DE GRADO dirigido por ESTEBAN DEL CASTILLO PÉREZ Grado en INGENIERÍA ELECTRÓNICA INDUSTRIAL Y AUTOMÁTICA Tarragona 2018

Transcript of KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO...

Page 1: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

KILIAN GARCIA RUIZ

EL PC COMO PROCESADOR DE SONIDO

TRABAJO FINAL DE GRADO

dirigido por ESTEBAN DEL CASTILLO PÉREZ

Grado en INGENIERÍA ELECTRÓNICA INDUSTRIAL Y AUTOMÁTICA

Tarragona

2018

Page 2: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

2

Índice

1 Objetivos 4

2 Introducción 4

3 Generalidades 4

3.1 ¿Qué es un ecualizador de sonido? 4

3.2 ¿Por qué ecualizamos un sonido? 5

3.3 Tipos de ecualizador 6

3.3.1 Ecualizador por control de tono 6

3.3.2 Ecualizador gráfico 7

3.3.3 Ecualizador paramétrico 8

3.3.4 Ecualizador paragráfico 9

3.4 ¿Cómo se lleva a cabo la atenuación/amplificación? 9

3.4.1 Filtros pasa bajos 10

3.4.2 Filtros pasa altos 10

3.4.3 Filtros pasa banda 10

3.4.4 Filtros peak 11

3.4.5 Filtros shelving 12

3.4.6 Filtros FFT 13

4 Fundamentos matemáticos 14

4.1 Análisis de Fourier 14

4.1.1 Serie de Fourier 14

4.1.2 Serie de Fourier Discreta (DFS) 14

4.1.3 Transformada discreta de Fourier (DFT) 15

4.1.4 Transformada rápida de Fourier (FFT) 15

4.1.4.1 Algoritmo FFT de reducción en frecuencia 19

4.1.4.2 Algoritmo FFT de reducción en el tiempo 21

4.1.5 Transformada inversa de Fourier (IFFT) 23

4.1.6 Tiempo de cálculo 25

4.2 Funciones ventana 27

4.3 Frecuencia de muestreo 32

4.3.1 Velocidad de muestreo (entrada) y retardo 33

4.4 Resolución frecuencial 34

5 Hardware 38

5.1 Sistema de adquisición de datos USB-1208 FS 38

5.1.1 Configuración single-ended 42

5.1.2 Configuración diferencial 42

5.1.3 Terminales de entrada analógica (CH0 IN – CH7 IN) 43

5.1.4 Terminales de salida analógicos (D/A OUT0 – D/A OUT 1) 44

5.1.5 Limitaciones de la USB-1208FS para el proyecto 44

5.1.6 USB-1208FS-plus 46

5.2 Etapas acondicionadoras 47

5.2.1 Etapa de entrada – Filtro antialiasing 47

5.2.2 Etapa de salida 48

Page 3: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3

6 Software 50

6.1 Modos de operación 50

6.1.1 Modo directo 51

6.1.1.1 Etapa 1 - A/D y preparación de los vectores de datos 51

6.1.1.2 Etapa 2 - Procesado de la señal FFT 54

6.1.1.3 Etapa 3 - Ecualización 58

6.1.1.4 Etapa 4 - IFFT 61

6.1.1.5 Etapa 5 - D/A 64

6.1.2 Modo grabación 67

6.1.3 Modo procesar muestras grabadas 69

6.1.3.1 Creación de los archivos WAVE 70

6.1.3.2 Reproducción de los archivos WAVE 72

6.1.4 Modo ecualizar sonido en diferido 72

6.2 Diseño y funcionamiento de los ecualizadores 73

6.3 Creación de las carpetas del proyecto 77

6.4 Diseño y funcionamiento de la barra de menús 78

6.5 Diseño y funcionamiento de los gráficos 80

7 Pruebas y verificaciones 83

7.1 Correcto funcionamiento de los archivos WAVE 83

7.2 Verificación de la IFFT 84

8 Posibles mejoras futuras 85

9 Conclusiones 87

10 Bibliografía 88

11 Presupuesto 90

12 Anexos 92

Page 4: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

1 Objetivo

4

1 Objetivo

El objetivo de este proyecto es el diseño y desarrollo de un ecualizador de sonido

utilizando un ordenador tipo PC junto a la tarjeta de adquisición de datos USB-1208FS.

Para poder trabajar y actuar en las frecuencias del sonido en el mundo digital, es necesario

transformar la señal del dominio temporal al dominio de la frecuencia se utilizará la

transformada rápida de Fourier (FFT) y, su inversa IFFT para devolverla al dominio

temporal.

2 Introducción

Cualquier elemento que puede generar un sonido, ya sea un instrumento, la voz humana, la

vibración de un equipo industrial, etc., tiene un espectro de frecuencias característico. El

espectro de frecuencias representa las amplitudes de las componentes de un sonido en

función de la frecuencia. Hay muchas maneras de captar un sonido, como por ejemplo con

un micrófono, una tarjeta de adquisición de datos, etc. Una vez captado el sonido, se puede

alterar la magnitud asociada a esas frecuencias, mediante un ecualizador, que es el

elemento que se va a desarrollar en este proyecto.

3 Generalidades

Para cada una de las partes que se detallan en este proyecto, es importante que

anteriormente se haga un análisis y exposición de los siguientes puntos para un encuadre

óptimo del proyecto:

¿Qué es un ecualizador de sonido?

¿Por qué ecualizamos?

Tipos de ecualizador de sonido

¿Cómo se lleva a cabo la atenuación/amplificación?

3.1 ¿Qué es un ecualizador de sonido?

Un ecualizador de sonido es un elemento (hardware o software) que permite manipular las

componentes frecuenciales de una señal, en nuestro caso, la señal de audio en la entrada de

la USB-1208FS.

El trabajo que realiza un ecualizador es atenuar o amplificar la señal en un rango de

frecuencia determinado.

Al introducir los conceptos atenuar y amplificar, hay que hablar de la intensidad de sonido

o presión sonora. La intensidad de sonido se mide en decibelios (dB), una unidad relativa y

logarítmica entre su valor medio y un valor de referencia. Como valor de referencia se

utiliza el límite de la percepción del oído humano 20 μPa de presión sonora. Entonces 0 dB

será el límite del umbral de audición, denominado silencio. En la Tabla1 se pueden ver

diferentes magnitudes sonoras y sus efectos sobre las personas descritos por la

Organización Mundial de la Salud.

Page 5: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3. Generalidades

5

Presión sonora Actividad Sensación/Efecto

140 – 160 dB Explosión o petardo a 1 m Daños permanentes inmediatos,

rotura del tímpano

130 dB Motor de avión en despegue Umbral de dolor

120 dB Motor de avión en marcha Daños permanentes a corta

exposición

110 dB Concierto de rock Sensación insoportable

100 dB Discoteca, sirena ambulancia a 10 m Sensación molesta, daños

permanentes a larga exposición 90 dB Calle principal con mucha gente y coches a 10

m

80 dB Conjunto de conversaciones en un bar Nivel incomodo para conversar

70 dB Conversación fuerte a 1 m

60 dB Conversación animada a 1 m

Nivel para la vida social agradable 50 dB Conversación normal a 1 m

40 dB Biblioteca

30 dB Oleaje suave

Nivel de descanso 20 dB Rumor de los arboles por el viento

10 dB Pisada

0 dB Umbral de audición Silencio

Tabla 1. Umbrales de sonido y sus efectos

Antes de explicar porqué se ecualiza, es necesario entender los conceptos: tono, nota, y

octava.

Se entiende como tono puro, un sonido compuesto por una onda sinusoidal vibrando a una

única frecuencia. En la música, comúnmente se conoce como nota musical.

Una octava es el intervalo entre dos sonidos donde la frecuencia de uno es el doble de la

otra. Por ejemplo tenemos la nota La afinada a 440 Hz, la siguiente octava empezará en la

misma nota situada a 880 Hz. En el rango de La a La, van comprendidas las ocho notas de

la escala musical.

3.2 ¿Por qué ecualizamos un sonido?

Hay muchos motivos para ecualizar un sonido, lo que sigue son algunos:

Umbral del oído humano: El oído humano solamente es capaz de percibir sonidos

dentro del rango frecuencial de 20 Hz a 20 kHz, a este rango se le llama espectro

audible, aunque puede variar para cada persona y dependiendo de la edad. Sonidos

por encima de 20 kHz son considerados ultrasonidos y por debajo de los 20 Hz

infrasonidos. Por medio de un ecualizador podemos atenuar y eliminar los

ultrasonidos e infrasonidos.

Page 6: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3.2 ¿Por qué ecualizamos un sonido?

6

Calidad de sonido: Cada instrumento, canción o sonido tiene una respuesta

frecuencial diferente, y esta misma puede variar dependiendo del equipo, o lugar

donde se reproduzca. Consecuentemente la ecualización ayudará a adecuar el

sonido a cada espacio (más adelante hablaré con detalle de este punto, pero antes

hay que definir otros conceptos).

Supresión de frecuencias dañinas: Puede darse la circunstancia que un

instrumento tenga algún tipo de defecto en su sonoridad, y que a una determinada

frecuencia del espectro audible, resulte molesto o incluso llegue a ser dañino

(dependiendo del volumen). Utilizando un ecualizador, se podría atenuar esa

frecuencia eliminando el problema.

El espectro audible se puede subdividir en función de los tonos. Las frecuencias bajas que

corresponden a las 4 primeras octavas (20 Hz – 256Hz) se denominan tonos graves. Las

frecuencias medias que vienen dadas por las siguientes 4 octavas (256 Hz – 2 kHz) se

denominan tonos medios. Y por último, las siguientes 3 octavas (2 kHz – 16 kHz) se

denominan tonos agudos.

3.3 Tipos de ecualizador

Principalmente existen cuatro tipos de ecualizadores, aunque solamente dos de ellos van a

ser desarrollados en este proyecto. Ecualizadores por control de tono

Ecualizadores gráficos

Ecualizadores paramétricos

Ecualizadores paragráficos

En este apartado se explicará cómo funciona cada ecualizador, pero no se entrará en el

detalle de cómo se amplifica o atenúa cada banda de frecuencia.

3.3.1 Ecualizadores por control de tono

Son los ecualizadores que suelen aparecer en los equipos musicales básicos de nuestro día

a día, como por ejemplo el reproductor de un vehículo o de una mini cadena de bajas

prestaciones. Constan de 3 bandas de frecuencia fijas que coinciden con las explicadas

anteriormente: tonos bajos (de 20 Hz a 256 Hz), medios (de 256 Hz a 2 kHz), y agudos

(de 2 kHz a 16 kHz).

Page 7: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3 Generalidades

7

3.3.2 Ecualizador gráfico

Este tipo de ecualizadores, son los más utilizados a nivel de usuario no profesional.

Figura 1. Ecualizador gráfico de octava.

Los ecualizadores gráficos disponen de varias bandas de frecuencia fijas, que pueden ir

entre 5 y 31 bandas. Los más utilizados son los de 10 bandas denominados ecualizadores

de octava, ya que la separación de cada banda justamente es una octava (Figura 1). El de

31 bandas es conocido como ecualizador de tercio de octava. Cada banda está centrada en

una frecuencia nominal estandarizada por la norma CEI 1260:1995.

Frecuencia central nominal en Hz

Tercio de

octava Octava

Tercio de

octava Octava

Tercio de

octava Octava

Tercio de

octava Octava

25

31,5

200

250

1600

2000

12500

16000 31,5 250 2000 16000

40 315 2500 20000

50

63

400

500

3150

4000

63 500 4000

80 630 5000

100

125

800

1000

6300

8000 125 1000 8000

160 1250 1000

Tabla 2. Frecuencia central nominal en Hz estandarizada por la norma CEI 1260:1995

Para atenuar o amplificar cada una de las bandas, este tipo de ecualizadores normalmente

cuentan con un deslizador vertical graduado en dB.

Page 8: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3.3 Tipos de ecualizador

8

3.3.3 Ecualizador paramétrico

En primera instancia, es similar al ecualizador por control de tonos, pero en este caso, el

paramétrico nos permite escoger la frecuencia central y el ancho de banda (Figura 2). Se

entiende como ancho de banda, la distancia equidistante a la frecuencia central, donde

actuará la ganancia. Por ejemplo, si seleccionamos un ecualizador paramétrico con una

frecuencia central de 1 kHz y un ancho de banda de 500 Hz, estaremos amplificando o

atenuando todas las frecuencias comprendidas desde 750 Hz a 1250 Hz (Figura 3).

Los ecualizadores paramétricos son los más utilizados a nivel profesional, ya que permiten

una ecualización más precisa que los gráficos o los tonales.

Figura 2. Ecualizador paramétrico implementado en el proyecto

Figura 3.Representación de la frecuencia central y el ancho de banda en un ecualizador paramétrico.

-15

-10

-5

0

5

10

15

100 1000 10000

Am

pli

tud

dB

Frecuencia Hz

Ancho de

banda

Frecuencia

central

Page 9: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3 Generalidades

9

3.3.4 Ecualizador paragráfico

Este ecualizador es una evolución del ecualizador paramétrico. Este añade una pantalla de

edición gráfica al ecualizador paramétrico, permitiendo así visualizar exactamente qué

corrección frecuencial se está llevando a cabo y, mejorando así, la calidad de la

ecualización. Actualmente es muy difícil a nivel profesional encontrarnos con un

ecualizador paramétrico sin gráfico, así que al extenderse el uso del paragráfico, se ha

acabado denominando a este paramétrico. En la Figura 4 se puede ver un ejemplo de este

tipo de ecualizador.

Figura 4. Pantalla gráfica de un ecualizador paragráfico.

3.4 ¿Cómo se lleva a cabo la atenuación/amplificación?

Cómo se ha expuesto en varias ocasiones, este proyecto implementa un ecualizador real

con el ordenador (software). A continuación, se explicarán las diferentes formas de llevar a

cabo la atenuación y amplificación.

Las tres formas más utilizadas de implementar la atenuación/amplificación es utilizando

los siguientes filtros:

Filtros Low cut

Filtros Hight cut

Filtros Pasa banda

Filtros Peak

Filtros Shelving

Filtro FFT

3.4.1 Filtros Pasa bajos

Los filtros pasa bajos solo permiten el paso de las frecuencias por debajo de la frecuencia

de corte seleccionada.

Page 10: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3.4 ¿Cómo se lleva a cabo la atenuación/amplificación?

10

Figura 5. Representación filtro pasa bajos

3.4.2 Filtros pasa altos

De forma análoga al filtro pasa bajos, el filtro pasa altos solo deja pasar las frecuencias por

encima de la frecuencia de corte seleccionada, en cambio las frecuencias inferiores las

atenúa.

Figura 6. Representación filtro pasa altos

3.4.3 Filtros Pasa banda

Los filtros pasa banda son una mezcla del filtro pasa altos y pasa bajos. Atenuará las

frecuencias altas y bajas fuera del rango del ancho de banda seleccionado alrededor de la

frecuencia central de corte. Si el ancho de banda es mayor, la franja azul se hará más

pequeña y atenuará menos rango de frecuencia.

Figura 7. Representación filtro pasa banda

Page 11: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3 Generalidades

11

3.4.4 Filtros peak

Este tipo de filtros, se podría decir que son una versión mejorada de los filtros pasa banda,

pero tal como su nombre indica, con un pico (Figura 8). Amplifican o atenúan las

frecuencias próximas a la frecuencia central fc. Contra mayor sea el ancho de banda BW la

campana del filtro se hará mayor y afectará un mayor rango de frecuencias.

Figura 8. Representación filtro peak

Los ecualizadores gráficos físicos (hardware) disponen de un banco de filtros en serie,

mayoritariamente filtros peak con una frecuencia central fija y una amplitud no

modificable. A parte, se puede encontrar un filtro pasa altos para eliminar los infrasonidos

(por debajo de los 20 Hz) y un filtro pasa bajos para eliminar los ultrasonidos (por encima

de los 20 kHz).

Diagrama 1. Conexión en serie de N filtros

Figura 9. Ejemplo gráfico de 6 filtros en serie que podríamos encontrar en un ecualizador gráfico.

Entrada Filtro 1 ... Filtro N Salida

Page 12: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3.4 ¿Cómo se lleva a cabo la atenuación/amplificación?

12

3.4.5 Filtros shelving

Este tipo de filtros se utilizan en los extremos como los pasa altos o pasa bajos, pero en

este caso, consta de dos bandas de paso como se puede ver en el Figura 10. Este filtro nos

permite atenuar y amplificar a la vez, o realizar una atenuación no tan pronunciada como

en los otros dos filtros de corte.

Figura 10. Ejemplo gráfico de un filtro shelving

3.4.6 Filtros FFT

Este tipo de filtros constituyen la parte fundamental del proyecto, así que en este apartado

se va a explicar por encima el funcionamiento del filtro y en capítulos posteriores se

explicará cada una de las partes con más detalle.

Los filtros FFT se basan en la transformada rápida de Fourier (Fast Fourier Transform),

una transformada matemática que permite convertir la señal de sonido, en el dominio del

tiempo, al dominio de la frecuencia. Dependiendo del tamaño de la FFT, se obtiene un

cierto número de muestras concretas y discretas. Esas muestras corresponden a la magnitud

asociada a cada una de las frecuencias que componen el espectro de la franja de sonido

analizado.

Figura 11. Espectro FFT de una señal.

Page 13: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

3 Generalidades

13

En la Figura 11 se puede visualizar un ejemplo de una señal después de realizarle la FFT.

Ahora, se dispone de un número de muestras que se pueden amplificar o atenuar

individualmente, o agruparlas por bandas estandarizas.

Este tipo de filtros son más precisos que los otros ya explicados anteriormente pero tienen

limitaciones que habrá que tener en cuenta debido a la FFT. Estas limitaciones hacen

referencia al tiempo de procesamiento de la FFT, por lo que, no son filtros utilizado para la

ecualización de espectáculos en directo.

Page 14: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

14

4 Fundamentos matemáticos

En este capítulo se estudiarán todos los fundamentos matemáticos necesarios para

desarrollar el proyecto. Son los siguientes:

Análisis de Fourier

Funciones ventana

Frecuencia de muestreo

Resolución frecuencial

4.1 Análisis de Fourier

En el capítulo 3, Generalidades, se introduce el concepto filtro FFT, un filtro que permite

amplificar/atenuar el espectro de una señal en el dominio de la frecuencia. El análisis de

Fourier relaciona matemáticamente el dominio del tiempo con el dominio de la frecuencia.

En el dominio de la frecuencia, una señal se descompone como la suma de infinitas señales

sinusoidales puras con una amplitud y frecuencia determinadas.

La información de este capítulo ha sido extraída de los libros [15] y [16], que a su vez fue

utilizado en el proyecto final de grado “El PC com a analitzador d’espectres a temps real”.

Las herramientas que se van a utilizar y la nomenclatura se puede encontrar en el apartado

bibliografía y no se explicará en detalle a no ser que sea necesario para el proyecto.

4.1.1 Serie de Fourier

Cualquier señal analógica, si es periódica y con un número finito de discontinuidades

admite una representación en el dominio de la frecuencia como la suma de infinitas

señales sinusoidales armónicamente relacionadas, y con una amplitud, frecuencia y fase

determinadas. Cada señal tiene una representación única, y ésta viene dada por la

definición matemática de la serie de Fourier. Para una señal periódica xp (t):

𝑥𝑝 𝑡 = 𝑋 𝑘 𝑒𝑗2𝜋𝑘𝑓𝑜 𝑡

𝑘=−∞

𝑋 𝑘 = 1

𝑇 𝑥𝑝 𝑡 𝑒

−𝑗2𝜋𝑘𝑓𝑜 𝑡𝑑𝑡𝑇

0

(5)

4.1.2 Serie de Fourier Discreta (DFS)

La cantidad 𝑋𝐷𝐹𝑆[k] define la Serie de Fourier Discreta (DFS), como una aproximación de

la serie de Fourier para una señal periódica.

𝑋𝐷𝐹𝑆 𝑘 = 1

𝑁 𝑥 𝑛 𝑒−

𝑗2𝜋𝑛𝑘𝑁

𝑁−1

𝑛=0

, 𝑘 = 0, 1, … , 𝑁 − 1 (6)

Para recuperar 𝑥[𝑛], a partir de 𝑋𝐷𝐹𝑆[k], se aplica la Serie de Fourier Discreta Inversa:

Page 15: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

15

𝑥 𝑛 = 𝑋𝐷𝐹𝑆[𝑘]𝑒𝑗2𝜋𝑛𝑘

𝑁

𝑁−1

𝑘=0

𝑛 = 0,1,2, … . . , 𝑁 − 1 (7)

La única diferencia entre la DFS y la DFT (explicada en el apartado siguiente) es el factor

de escala. La DFS es N veces la DFT, o escrito de otra manera, la DFS de N muestras será:

𝑋𝐷𝐹𝑆 𝑘 = 1

𝑁𝑋𝐷𝐹𝑇[𝑘] (8)

4.1.3 Transformada discreta de Fourier (DFT)

La transformada discreta de Fourier (DFT) de N puntos 𝑋𝐷𝐹𝑇[𝑘] de una señal con N

muestras 𝑥[𝑛], y la transformada inversa discreta de Fourier (IDFT), que invierte el

proceso obteniendo 𝑥[𝑛], en función de 𝑋𝐷𝐹𝑇 [𝑘] , se definen como:

𝑋𝐷𝐹𝑇 𝑘 = 𝑥[𝑛]𝑒−𝑗2𝜋𝑛𝑘 /𝑁

𝑁−1

𝑛=0

, 𝑘 = 0, 1, 2, … . . , 𝑁 − 1 (9)

𝑥 𝑛 = 1

𝑁 𝑋𝐷𝐹𝑇 𝑘 𝑒

𝑗2𝜋𝑛𝑘𝑁 , 𝑛 = 0, 1, 2, … . . , 𝑁 − 1

𝑁−1

𝑘=0

(10)

4.1.4 Transformada rápida de Fourier (FFT)

La DFT necesita N2 multiplicaciones para llevar a cabo el cálculo. Actualmente los

algoritmos computacionales eficientes para obtener la DFT, se denominan FFT (Fast

Fourier Transform), y necesitan una cantidad inferior de multiplicaciones. Para este

proyecto, se utilizará la FFT en base 2, que requiere solamente 𝑁 log2 𝑁 multiplicaciones.

Las ideas clave de la alta velocidad de cálculo de la FFT en comparación a la DFT son las

siguientes:

Simetría y periodicidad

Todos los algoritmos FFT aprovechan la simetría y periodicidad del exponencial 𝑊𝑁 =

𝑒−𝑗2𝜋

𝑁 como se puede ver en la Tabla 5:

Entrada Forma exponencial Forma simbólica

1 𝑒−𝑗2𝜋𝑛

𝑁 = 𝑒−𝑗2𝜋(𝑛+𝑁)

𝑁 𝑊𝑁𝑛+𝑁 = 𝑊𝑁

𝑛

2 𝑒−

𝑗2𝜋(𝑛+𝑁

2)

𝑁 = − 𝑒

−𝑗2𝜋𝑛

𝑁 𝑊𝑁

𝑛+𝑁2 = −𝑊𝑁

𝑛

3 𝑒−𝑗2𝜋𝐾 = 𝑒−𝑗2𝜋𝑛𝐾

𝑁 = 1 𝑊𝑁𝑁𝐾 = 1

4 𝑒−𝑗2(2𝜋𝑁

) = 𝑒−𝑗2𝜋(𝑁2

)

𝑊𝑁2 = 𝑊𝑁

2

Tabla 5. Simetría y periodicidad de WN

Page 16: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

16

Selección de la longitud de la señal

La longitud de la señal N se escoge como el producto de números más pequeños, y además

si son iguales, obtenemos que 𝑁 = 𝑟𝑚 , donde r se conoce como base de la FFT y m es la

cantidad de factores. La base más utilizada para los algoritmos FFT es la base 2 siendo

𝑁 = 2𝑚 .

Separación de los índices y almacenaje

Las muestras de índice par e impar se calculan separadamente para aumentar la velocidad

computacional. Para minimizar la cantidad de memoria que necesita el algoritmo FFT, se

van guardan los resultados en el mismo vector que se encontraban los datos.

Algunos resultados fundamentales

Se consideran dos resultados fundamentales:

Transformada de un punto: por definición de la ecuación (9), si el vector solo

contiene una muestra, la DFT resultante es el mismo valor de la muestra.

La transformada de dos puntos: La DFT de una sucesión de 2 números es:

𝑋𝐷𝐹𝑇 0 = 𝑥 0 + 𝑥 1 𝑦 𝑋𝐷𝐹𝑇 1 = 𝑥 0 − 𝑥 1 (11)

Como se ha comentado anteriormente, ya se ha dicho que para aumentar la velocidad de

computación de la DFT, se calculan separadamente los índices pares e impares. Entonces,

una DFT de N muestras se puede escribir como la suma de dos DFTs de 𝑁

2 muestras de

índice análogo:

𝑋𝐷𝐹𝑇 𝑘 = 𝑥 𝑛 𝑊𝑁𝑛𝑘 = 𝑥 2𝑛 𝑊𝑁

2𝑛𝑘 + 𝑥[2𝑛 + 1]𝑊𝑁 2𝑛+1 𝑘

𝑁2−1

𝑛=0

𝑁2−1

𝑛=0

𝑁−1

𝑛=0

(12)

𝑋𝐷𝐹𝑇 𝑘 = 𝑥 2𝑛 𝑊𝑁2𝑛𝑘 + 𝑊𝑁

𝑘 𝑥[2𝑛 + 1]𝑊𝑁2𝑛𝑘

𝑁2−1

𝑛=0

𝑁2−1

𝑛=0

(13)

𝑋𝐷𝐹𝑇 𝑘 = 𝑥 2𝑛 𝑊𝑁2

𝑛𝑘 + 𝑊𝑁𝑘 𝑥[2𝑛 + 1]𝑊𝑁/2

𝑛𝑘

𝑁2−1

𝑛=0

𝑁2−1

𝑛=0

(14)

Page 17: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

17

Si 𝑋𝑒[𝑘] y 𝑋𝑜[𝑘] expresan las secuencias DFT de índice para e impar de longitud 𝑁

2

respectivamente.El resultado se puede escribir como:

𝑋𝐷𝐹𝑇 𝑘 = 𝑋𝑒 𝑘 + 𝑊𝑁𝑘𝑋0 𝑘 , 𝑘 = 0, 1, 2, … . . , 𝑁 − 1 (15)

Se observa que el índice k está comprendido desde 0 hasta N – 1 y que 𝑋𝑒[𝑘]y𝑋𝑜[𝑘] son

periódicas en k con periodo 𝑁

2. Como resultado de esta periodicidad, se puede dividir la

𝑋𝐷𝐹𝑇[𝑘] como:

𝑋𝐷𝐹𝑇 𝑘 = 𝑋𝑒 𝑘 + 𝑊𝑁𝑘𝑋𝑜 𝑘 , 𝑘 = 0, 1, 2, … . . ,

1

2(𝑁 − 1)

(16)

𝑋𝐷𝐹𝑇 𝑘 + 𝑁

2 = 𝑋𝑒 𝑘 +

𝑁

2 + 𝑊𝑁

𝑘+ 𝑁2𝑋𝑜 𝑘 +

𝑁

2 = 𝑋𝑒 𝑘 − 𝑊𝑁

𝑘𝑋𝑜 𝑘 ,

(17)

𝑘 = 0, 1, 2, … . . ,1

2(𝑁 − 1)

El resultado obtenido se conoce como el lema de Danielson-Lancos. En la Figura 20 se

muestra el diagrama de flujo del resultado anterior, también conocido como diagrama de

mariposa.

Figura 20. Diagrama de mariposa

Las entradas 𝑋𝑒 y 𝑋𝑜 se transforman en 𝑋𝑒 + 𝑊𝑁𝑘𝑋𝑜 y 𝑋𝑒 − 𝑊𝑁

𝑘𝑋𝑜 . La mariposa opera

con dos sumas complejas y una multiplicación compleja. Entonces para N muestras se

necesitan 𝑁

2 mariposas, que a su vez, la DFT de cada una de ellas se puede reducir al

cálculo de 𝑁

4 secuencias de longitud:

𝑋𝑒 𝑘 = 𝑋𝑒𝑒 𝑘 + 𝑊𝑁/2𝑘 𝑋𝑒𝑜 𝑘 𝑋𝑜 𝑘 = 𝑋𝑜𝑒 𝑘 + 𝑊𝑁/2

𝑘 𝑋𝑜𝑜 𝑘 (18)

Como 𝑊𝑁/2𝑘 = 𝑊𝑁

2𝑘 , la ecuación (13) se puede reescribir como:

𝑋𝑒 𝑘 = 𝑋𝑒𝑒 𝑘 + 𝑊𝑁2𝑘𝑋𝑒𝑜 𝑘 𝑋𝑜 𝑘 = 𝑋𝑜𝑒 𝑘 + 𝑊𝑁

2𝑘𝑋𝑜𝑜 𝑘 (19)

Si se escoge el número de muestras N como 𝑁 = 2𝑚 , se reduce el cálculo de la DFT de N

puntos a un punto con m etapas. Como se ha comentado anteriormente, la transformara de

un punto, es el mismo punto. Este proceso se conoce como reducción y los bits de la FFT

Page 18: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

18

resultante se encuentran en orden inverso. Si el índice e vale 0 y el índice o vale 1, y

posteriormente se invierte el orden, entonces se obtiene el valor de la muestra en

representación binaria, 0 para par y 1 para impar.

En la siguiente Tabla 6 se muestran los dos algoritmos FFT basados en la reducción:

Entrada Característica Reducción en frecuencia Reducción en tiempo

1 Número de muestras 𝑁 = 2𝑚 𝑁 = 2𝑚

2 Secuencia de entrada Orden natural Orden inverso de los bits

3 DFT resultante Orden inverso de los bits Orden natural

4 Cálculos En el lugar En el lugar

5 Número de etapas 𝑚 = log2 𝑁 𝑚 = log2 𝑁

6 Multiplicaciones 1

2𝑁𝑙𝑜𝑔2𝑁 (𝑐𝑜𝑚𝑝𝑙𝑒𝑗𝑎𝑠)

1

2𝑁𝑙𝑜𝑔2𝑁 (𝑐𝑜𝑚𝑝𝑙𝑒𝑗𝑎𝑠)

7 Sumas 𝑁𝑙𝑜𝑔2𝑁 (𝑐𝑜𝑚𝑝𝑙𝑒𝑗𝑎𝑠) 𝑁𝑙𝑜𝑔2𝑁 (𝑐𝑜𝑚𝑝𝑙𝑒𝑗𝑎𝑠)

8 Número de mariposas 𝑁

2

𝑁

2

9 Entrada de la mariposa A (superior) y B (inferior) A (superior) y B (inferior)

10 Salida de la mariposa (𝐴 + 𝐵) y 𝐴 − 𝐵 𝑊𝑁𝑡 (𝐴 + 𝐵𝑊𝑁

𝑡 ) y 𝐴 − 𝐵𝑊𝑁𝑡

11 Factores de giro 2𝑖−1𝑄, 𝑄 = 0,1, … , 𝑃 − 1 2𝑚−𝑖𝑄, 𝑄 = 0,1, … , 𝑃 − 1

12 Valores de P 𝑃 = 2𝑚−𝑖 𝑃 = 2𝑖−1

Tabla 6. Algoritmos para el cálculo de la DFT

Page 19: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

19

4.1.4.1 Algoritmo FFT de reducción en frecuencia

El algoritmo FFT de reducción en frecuencia (DIF) empieza reduciendo la transformada de

N puntos para cada etapa, en dos transformadas de 𝑁

2, que a su vez serán reducidas a cuatro

transformadas de 𝑁

4 puntos, y así sucesivamente hasta alcanzar N transformadas de 1 punto

correspondientes a la DFT real.

En la Tabla 6 se puede ver que con la secuencia de entrada en orden natural, los cálculos se

llevan a cabo en el mismo lugar, pero teniendo en cuenta que los bits resultantes de la DFT

estarán en orden inverso y, para poder trabajar correctamente con ellos, hará falta

reordenarlos.

Cuando se habla de cálculos en el mismo lugar a nivel software, implicará que se

realizarán las operaciones y se guardarán los resultados en el mismo vector de datos que

contenían las muestras temporales de la señal original. Después será necesario ordenar los

valores del vector al tener los resultados invertidos. Esto implica unas ventajas e

inconvenientes: la DIF ocupa menos memoria de datos, pero es más lenta de procesar

debido a que deben aplicar otro algoritmo para revertir la secuencia.

El algoritmo divide la secuencia de entrada 𝑥[𝑛] en dos mitades y produce:

𝑋𝐷𝐹𝑇 𝑘 = 𝑥 𝑛 𝑊𝑁𝑛𝑘 = 𝑥 𝑛 𝑊𝑁

𝑛𝑘 +

𝑁2−1

𝑛=0

𝑥 𝑛 𝑊𝑁𝑛𝑘 =

𝑁−1

𝑛=𝑁/2

𝑁−1

𝑛=0

(20)

= 𝑥 𝑛 𝑊𝑁𝑛𝑘 + 𝑥[𝑛 +

𝑁

2]𝑊𝑁

𝑛+ 𝑁2 𝑘

𝑁2−1

𝑛=0

𝑁2−1

𝑛=0

A su vez, esta expresión se puede expresar como:

𝑋𝐷𝐹𝑇 𝑘 = 𝑥 𝑛 𝑊𝑁𝑛𝑘 + 𝑊𝑁

𝑁𝑘/2 𝑥[𝑛 +

𝑁

2

𝑁2−1

𝑛=0

]𝑊𝑁𝑛𝑘 =

𝑁2−1

𝑛=0

(21)

= 𝑥 𝑛 𝑊𝑁𝑛𝑘 + (−1)𝑘 𝑥[𝑛 +

𝑁

2]𝑊𝑁

𝑛𝑘

𝑁2−1

𝑛=0

𝑁2−1

𝑛=0

Page 20: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

20

Se separan los índices pares e impares y se escribe 𝑥 𝑛 = 𝑥𝑎 i 𝑥 𝑛 +𝑁

2 = 𝑥𝑏 , entonces:

𝑋𝐷𝐹𝑇 2𝑘 = [𝑥𝑎 + 𝑥𝑏 ]𝑊𝑁2𝑛𝑘

𝑁2−1

𝑛=0

, 𝑘 = 0, 1, 2, . . . . . ,𝑁

2− 1

(22)

𝑋𝐷𝐹𝑇 2𝑘 + 1 = 𝑥𝑎 − 𝑥𝑏 𝑊𝑁 2𝑘+1 𝑛

𝑁2−1

𝑛=0

= 𝑥𝑎 − 𝑥𝑏 𝑊𝑁𝑛𝑊𝑁

2𝑛𝑘

𝑁2−1

𝑛=0

,

𝑘 = 0, 1, … ,𝑁

2− 1

(23)

Dado que 𝑊𝑁2𝑛𝑘 = 𝑊𝑁/2

𝑛𝑘 , los términos de índice par e impar describen una FFT de 𝑁

2

puntos. Los cálculos producen una mariposa con entradas 𝑥 𝑛 y 𝑥[𝑛 + 𝑁

2], y con salidas

𝑋𝐷𝐹𝑇 2𝑘 = {𝑥 𝑛 + 𝑥 𝑛 + 𝑁

2 } y 𝑋𝐷𝐹𝑇 2𝑘 + 1 = {𝑥 𝑛 − 𝑥 𝑛 +

𝑁

2 }𝑊𝑁

𝑛 :

Figura 21. Diagrama de mariposa para el algoritmo FFT de reducción en frecuencia

Los factores 𝑊𝑁𝑡 se denominan factores de giro, y como se puede ver en la Figura 21, solo

aparecen en el extremo inferior de cada mariposa. Para un algoritmo FFT de 𝑁 = 2𝑚

puntos y m etapas, los exponentes t de los factores de giro tienen un orden finito descrito

de la siguiente manera:

Número de P factores de giro diferentes en la i-ésima etapa: 𝑃 = 2𝑚−𝑖

Valores de t en los factores de giro donde 𝑡 = 2𝑖−1𝑄 y 𝑄 = 0, 1, 2, …… , 𝑃 − 1

Page 21: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

21

Figura 22. Diagrama de mariposa del algoritmo FFT de reducción en frecuencia para N = 8 puntos

El algoritmo DIF es el utilizado para implementar la FFT en el software del proyecto.

4.1.4.2 Algoritmo FFT de reducción en el tiempo

En la Tabla 6 se pueden ver las diferencias entre el algoritmo DIF y el algoritmo FFT en

cuanto a reducción en el tiempo DIT. En este caso el algoritmo DIT, empieza con N

transformadas de un punto, que a su vez se combinan en transformadas de dos puntos y así

sucesivamente hasta llegar a la DFT de N puntos. La secuencia de entrada de la DIT

necesita que el orden de los bits esté invertido para poder realizar los cálculos en el lugar.

Entonces si se cumplen los anteriores requisitos, la DFT resultante se obtiene con su orden

natural.

Como en el caso de la DIF, que los cálculos se hagan en el lugar implica que se utilizarán

los mismos vectores que contienen la muestra original de los datos, para almacenar los

resultados de la FFT.

Para entender mejor que significa que el orden de los bits de entrada este invertido, se

expone el siguiente ejemplo: una secuencia de entrada de 8 puntos se codifican

binariamente como {000, 001, 010, 011, 100, 101, 110, 111}que corresponde a las

entradas𝑥 0 , 𝑥 1 , 𝑥 2 , 𝑥 3 , 𝑥 4 , 𝑥 5 , 𝑥 6 , 𝑥 7 . La secuencia de entrada tiene que ser

invertida para poder realizar los cálculos en el lugar, al invertirse los bits quedan

reordenados como {000, 100, 010, 110, 001, 101, 011, 111} que corresponde a las

entradas 𝑥 0 , 𝑥 4 , 𝑥 2 , 𝑥 6 , 𝑥 1 , 𝑥 5 , 𝑥 3 , 𝑥 7 . Para realizar los cálculos se utiliza:

Page 22: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

22

𝑋𝐷𝐹𝑇 𝑘 = 𝑋𝑒 𝑘 + 𝑊𝑁𝑘𝑋𝑜 𝑘 𝑋𝐷𝐹𝑇 𝑘 +

𝑁

2 = 𝑋𝑒 𝑘 − 𝑊𝑁

𝑘𝑋𝑜 𝑘 (24)

Figura 23. Diagrama de mariposa del algoritmo FFT en reducción en el tiempo para una etapa

De forma similar al algoritmo DIF, en este caso los factores de giro de cada etapa aparecen

en los extremos de la mariposa y los exponentes t tienen un orden finito descrito por:

Número P de factores de giro diferentes en la i-ésima etapa : 𝑃 = 2𝑖−1

Valores de t en los factores de giro: 𝑡 = 2𝑚−𝑖𝑄 y 𝑄 = 0, 1, 2, …… , 𝑃 − 1

Figura 24. Diagrama de mariposa del algoritmo FFT de reducción en el tiempo para N = 8 puntos

Tanto en el caso del algoritmo DIT como en el DIF, se realizan el mismo número de

operaciones y etapas. También hay que invertir el orden de las secuencias, por lo que el

tiempo que se tarda en procesar la señal en los dos casos es el mismo.

Page 23: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

23

4.1.5 Transformada inversa de Fourier (IFFT)

Para llevar a cabo la ecualización de una señal de sonido con el ordenador, primero se debe

transformar la señal del dominio del tiempo al dominio frecuencial, para trabajar con cada

una de las muestras en el dominio de la frecuencia. Una vez realizada la ecualización se

debe volver al dominio del tiempo para poder reproducir la señal de sonido.

Figura 25. Representación de vector de muestras en el dominio del tiempo y dominio de la frecuencia

En el capítulo 4.3.2 la ecuación (10) se introdujo el algoritmo de la IDFT, pero sin la

notación de factores de giro. Entonces 𝑊𝑁 = 𝑒−𝑗2𝜋

𝑁 se obtiene que:

𝑥 𝑛 = 1

𝑁 𝑋𝐷𝐹𝑇 𝑘 𝑊𝑵

−𝑡 , 𝑛 = 0, 1, 2, … . . , 𝑁 − 1

𝑁−1

𝑘=0

(25)

La ecuación (25) nos permite calcular la IFFT si dividimos el resultado de la FFT por N y

multiplicamos por los factores de giro 𝑊𝑵−𝑡 .

Para obtener la inversa de la transformada de Fourier IFFT (Inverse Fast Fourier

Transform), hay que conocer la FFT realizada anteriormente y recorrer el diagrama de

mariposa a la inversa. Se debe tener en cuenta que se necesita realizar la reversión de bits

antes de empezar con los cálculos de la IFFT, ya que la respuesta de la FFT se obtenía con

los bits invertidos. Si hay que ir hacia atrás de la mariposa se necesita partir con los bits

revertidos.

Una vez revertidos los bits y partiendo de la Figura 21, hay que recorrer la mariposa de la

etapa hacia atrás, donde en la mariposa básica del algoritmo FFT de reducción en

frecuencia se obtenía lo siguiente:

𝐴 = 𝑎 + 𝑏 (26)

FFT

IFFT

0 0 0 N-1 N/2 N/2

Im X[ ] Re X[ ] X[ ]

N muestras

Dominio del tiempo

N/2+1 N/2+1

Dominio de la frecuencia

Page 24: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

24

𝐵 = (𝑎 − 𝑏)𝑊𝑁𝑡 (27)

Ahora si se recorre hacia atrás la mariposa, hay que multiplicar la ecuación (27) por el

factor de giro 𝑊𝑵−𝑡 y se obtiene lo siguiente:

𝑎 − 𝑏 · 𝑊𝑁𝑡 · 𝑊𝑁

−𝑡 = 𝑎 − 𝑏 = 𝐵 · 𝑊𝑁−𝑡 (28)

Si se sigue recorriendo la mariposa en sentido inverso, para subir al extremo superior

izquierdo, se tiene que sumar A a la ecuación (28):

𝐴 + 𝑎 − 𝑏 → 𝐴 = 𝑎 + 𝑏 → 𝑎 + 𝑎 − 𝑏 + 𝑏 = 2𝑎 (29)

𝑎 − 𝑏 era𝐵𝑊𝑁−𝑡 y ahora hay que sumarle A para ir hacia atrás en la mariposa. Se obtiene:

2𝑎 = 𝐴 + 𝐵𝑊𝑁−𝑡 (30)

Se despeja𝑎 :

𝑎 =𝐴 + 𝐵𝑊𝑁

−𝑡

2 (31)

Y de la ecuación (29) también se obtiene que:

𝑏 = 𝐴 − 𝑎 (32)

Una vez recorrido todo el diagrama en el sentido inverso hay que multiplicar por N y

tendremos los valores correctos.

Page 25: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

25

Figura 26. Diagrama de mariposa de la IFFT

4.1.6 Tiempo de cálculo

Los algoritmos FFT, DIF y DIT requieren 𝑚 = 𝑙𝑜𝑔2𝑁 etapas y 𝑁

2 mariposas por etapa.

Para el cálculo de la FFT se requiere 𝑁

2𝑙𝑜𝑔2𝑁 multiplicaciones complejas y 𝑁𝑙𝑜𝑔2𝑁 sumas

complejas. A continuación, en la Tabla 7 se muestra la diferencia del tiempo de cálculo

entre la FFT y la DFT.

Característica DFT de N puntos FFT de N puntos

Algoritmo Solución de N ecuaciones en N

incógnitas

𝑁

2 mariposas/etapa, m etapas

Total de mariposas = 𝑚𝑁

2

Multiplicaciones N por ecuación 1 por mariposa

Sumas 𝑁 − 1 por ecuación 2 por mariposa

Total de multiplicaciones N2 𝑚𝑁

2=

𝑁𝑙𝑜𝑔2𝑁

2

Total de sumas 𝑁(𝑁 − 1) 𝑚𝑁 = 𝑁𝑙𝑜𝑔2𝑁

Tabla 7. Coste computacional de la FFT y DFT

Las sumas demoran menos tiempo computacional que las multiplicaciones o las divisiones.

Para ver realmente la diferencia de tiempo entre el cálculo FFT y DFT se van a utilizar los

ejemplos de N = 16 y N = 512 puntos de muestra, con el total de multiplicaciones a

realizar:

Page 26: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.1 Análisis de Fourier

26

𝐹𝐹𝑇 → 𝑁 = 16 → 𝑁𝑙𝑜𝑔2𝑁

2=

16𝑙𝑜𝑔216

2= 32 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑐𝑖𝑜𝑛𝑒𝑠 (33)

𝐷𝐹𝑇 → 𝑁 = 16 → 𝑁2 = 162 = 256 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑐𝑖𝑜𝑛𝑒𝑠 (34)

Si se escoge una DFT de pocos puntos se puede observar que la diferencia de

multiplicaciones es 8 veces mayor que en el caso de la FFT, lo que supondrá un tiempo de

cálculo 8 veces superior. Ahora, si se coge el ejemplo de 512 puntos, la diferencia de

multiplicaciones a realizar es muy superior.

𝐹𝐹𝑇 → 𝑁 = 512 → 𝑁𝑙𝑜𝑔2𝑁

2=

512𝑙𝑜𝑔2512

2= 2304 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑐𝑖𝑜𝑛𝑒𝑠 (35)

𝐷𝐹𝑇 → 𝑁 = 512 → 𝑁2 = 5122 = 262.144 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑐𝑖𝑜𝑛𝑒𝑠 (36)

Se ve claramente la gran diferencia entre la DFT y FFT en las ecuaciones (35) y (36). La

diferencia es ahora 113 veces superior en número de multiplicaciones en el caso de la DFT,

lo que supondrá una larga espera para obtener los resultados. En la Figura 27 se observa la

diferencia entre las dos gráficas de FFT y DFT sobre el número de multiplicaciones:

Figura 27. Nº de multiplicaciones DFT (azul) y FFT (roja)

Las multiplicaciones de la DFT tienen una respuesta creciente cuadrática 𝑁2 como se ve en

la Figura25. En cambio la FFT tiene una respuesta aproximadamente lineal 𝑁𝑙𝑜𝑔2𝑁

2. Contra

mayor sean los número de puntos seleccionados, la curva cuadrática de la DFT se dispara

hacia arriba y la diferencia de coste computacional será muy elevada.

0

2000000

4000000

6000000

8000000

10000000

12000000

14000000

16000000

18000000

2 4 8 16 32 64 128 512 1024 2048 4096

de

mu

ltip

lica

cio

nes

Nº de puntos

DFT

FFT

Page 27: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

27

4.2 Funciones ventana

En el capítulo 4 se definió que cualquier señal analógica periódica y con un número finito

de discontinuidades admitía una representación en el dominio de la frecuencia. Sin

embargo, la señal medida en la mayoría de casos no contendrá un valor entero de periodos.

Esto implicará en el cálculo del espectro FFT, la aparición de los efectos de dispersión o

leakeage.

Si el número de periodos adquiridos en la muestra no es un valor entero, en los extremos se

presentarán discontinuidades artificiales, que una vez realizada la FFT se mostrarán como

componentes de alta frecuencia no contenidas en la señal original (leakeage).

Figura 28. Señal medida con un número de periodos no entero y la aparición del fenómeno leakage en la representación

FFT. Ejemplo National Instruments 2017

Para minimizar la aparición de este fenómeno, existen diferentes técnicas, pero en este

proyecto se explicará el uso de las funciones ventana, que minimizarán las

discontinuidades en los extremos de cada paquete de muestras adquirido por el

digitalizador.

La función ventana consiste en multiplicar cada muestra capturada por un número real que

dependerá del tipo de ventana que se utilice. Esta multiplicación hace que los extremos que

presentaban discontinuidades ahora coincidan, y así, se obtiene una forma de onda

continua. La función ventana se lleva a cabo antes de realizar la operación FFT al vector de

muestras capturado.

Page 28: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.2 Funciones ventana

28

Figura 29. Efecto de la aplicación de una función ventana, donde se puede visualizar la minimización del efecto leakage.

Ejemplo obtenido de National instruments 2017

Las Figuras 28 y 29 han sido obtenidas de [13].

Las ventanas utilizadas y que el usuario podrá escoger en el software son:

1. Rectangular

2. Hanning

3. Kaiser-Bessel

4. Flat top

Las fórmulas y explicaciones de las diferentes funciones ventanas han sido obtenidas del

libro [17] y que también han sido publicadas con el permiso de Bruel & Kjaer Instruments,

Inc.

La ecuación matemática en tiempo continuo para estas ventanas es la mostrada en la

ecuación (37).

Page 29: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

29

Para 0 < 𝑡 < 𝑇:

𝑤 𝑡 = 𝑎𝑜 − 𝑎1 cos 𝑤𝑜𝑡 + 𝑎2 cos 2𝑤𝑜𝑡 − 𝑎3 cos 3𝑤𝑜𝑡 + 𝑎4 cos 4𝑤𝑜𝑡 (37)

Para cualquier otro 𝑡:

𝑤 𝑡 = 0 (38)

Los coeficientes a, se pueden ver en la siguiente Tabla 8:

Coeficientes

Ventana 𝒂𝟎 𝒂𝟏 𝒂𝟐 𝒂𝟑 𝒂𝟒

Rectangular 1 - - - -

Hanning 1 1 - - -

Kaiser-Bessel 1 1,298 0,244 0,033 -

Flat top 1 1,933 1,286 0,388 0,032

Tabla 8. Coeficientes de las funciones ventana

Cada ventana tiene una representación temporal distinta debido a la ecuación (37). Con los

valores de les coeficientes de la tabla 8, en la Figura 30, se puede visualizar la

representación temporal de cada una de las ventanas:

Figura 30. Representación temporal de las diferentes funciones ventana.

En la Tabla 9, aparecen el ancho de banda, el rizado y las características de selectividad de

las cuatro funciones ventana:

Page 30: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.2 Funciones ventana

30

Bandwidth Ripple

(dB)

Highest

Sidelobe

(dB)

Sidelobe

Falloff

(dB/decade)

B60 Shape

Factor Ventana Ruido 3 dB

Rectangular 1,00 ∆𝑓 0,89 ∆𝑓 3,92 -13,3 20 665 ∆𝑓 750

Hanning 1,50 ∆𝑓 1,44 ∆𝑓 1,42 -31,5 60 13,3 ∆𝑓 9,2

Kaiser-

Bessel 1,80 ∆𝑓 1,71 ∆𝑓 1,02 -66,6 20 6,1 ∆𝑓 3,6

Flat top 3,77 ∆𝑓 3,72 ∆𝑓 0,001 -93,6 0 9,1 ∆𝑓 2,5

Tabla 9. Ancho de banda, rizado y características de selectividad de las cuatro funciones ventana

En la Tabla 9 aparecen las siguientes magnitudes: Highest Sidelobe (dB), Sidelobe Faloff

(dB/decade), B60 y Shape Factor. El Highest Sidelobe indica cuál puede ser el máximo

valor del leakage; Sidelobe indica el ritmo de caída por década que decae el leakage; B60 es

el ancho de banda del leakage en unidades ∆𝑓 en el que la ventana no es inferior a 60 dB; y

por último Shape Factor da una idea de lo ancho que puede ser el leakage respecto a la

componente principal.

En la Figura 31 se muestran las características de los filtros digitales para cada una de las

ventanas:

Figura 31. Característica de los filtros digitales: (a) Ventana Rectangular; (b) Ventana Hanning; (c) Ventana Kaiser-

Bessel; (d) Ventana Flat-top

Se observa claramente en la Figura 31, que la ventana en la cual aparece en mayor grado el

fenómeno leakage es en la rectangular (a). La ventana de Hanning consigue reducir este

fenómeno a diferencia de la Kaiser-Bessel y la Flat-top que prácticamente lo eliminan.

Page 31: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

31

Aunque las ventanas (c) y (d) logran reducir mucho el leakage, el lóbulo central o principal

(la curva central) presenta un ancho de banda mayor que las otras dos ventanas (a) y (b),

2 ∆𝑓para la ventana rectangular, 4 ∆𝑓 para la Hanning, 6,2 ∆𝑓 para la Kaiser-Bessel, y

9,8 ∆𝑓 para la Flat top. Esto implica que a mayor tamaño de lóbulo central, menor es la

resolución frecuencial, por lo que las ventanas (c) y (d) consiguen reducir mucho el

leakage, pero como consecuencia pierden resolución frecuencial.

La utilización de cada una de las ventanas dependerá de la señal que se disponga a medir,

ya que cada una de las ventanas tiene sus peculiaridades. En general, para la mayoría de

casos, la ventana Hanning al tener una buena resolución (lóbulo central relativamente

estrecho) y un leakage aceptable, será válida para la mayoría de casos y es la que se dejará

por defecto en la selección del usuario.

A continuación, se explica un pequeño resumen de cada una de las ventanas:

Rectangular: es la que presenta mayor resolución frecuencial, pero también es la

que presenta un mayor leakage. Si se muestrea exactamente un número de periodos

enteros, esta ventana es la que mejor funcionaría, pero como ya se ha comentado

anteriormente, esto no va a ocurrir. La utilización de esta ventana al no disponer de

un número entero de periodos haría aparecer mucha dispersión en la señal

muestreada.

Hanning: esta ventana llega a cero en ambos extremos eliminando toda

discontinuidad (esto traerá unos problemas que se explicarán más adelante). Esta

ventana consigue reducir notablemente la aparición del leakage sin perder

demasiada resolución frecuencial. Es una ventana de uso general y se debe utilizar

en la mayoría de los casos para medir señales continuas.

Kaiser-Bessel: al mismo modo que la ventana de Hanning, la ventana Kaiser-

Bessel también llega a cero en ambos extremos eliminando las discontinuidades.

Ésta logra reducir aún más el leakage pero como consecuencia, se pierde resolución

frecuencial y se sobrevalora la componente continua. Para el análisis de señales

continuas, probablemente esta ventana sea la mejor elección, pero resulta ser más

lenta (en cálculo) que la ventana de Hanning.

Flat-Top: esta ventana es ideal para medir amplitudes precisas ya que consigue

reducir prácticamente todo el leakage y tiene un error de medida prácticamente

despreciable. Es efectiva en la medida de amplitudes cuando las componentes en

frecuencia están separadas varias líneas del espectro. Acostumbra a ser una ventana

utilizada para calibración.

Page 32: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.3 Frecuencia de muestreo

32

4.3 Frecuencia de muestreo

El teorema de Nyquist-Shannon dice que para poder digitalizar una señal analógica,

transportarla (en nuestro caso procesarla) y poder recuperarla con la mayor calidad posible,

es necesario que dicha señal sea procesada como mínimo al doble de su frecuencia límite o

máxima.

Debido que no existen filtros analógicos pasa-bajos (filtros antialiasing) ideales, se deja un

margen de frecuencia en torno al 10% entre la frecuencia máxima y la frecuencia de

Nyquist. En este proyecto y en los sistemas de audio convencionales, la frecuencia crítica

es de 44100 muestras por segundo, teniendo en cuenta que la frecuencia máxima de

cualquier componente a registrar, procesar o reproducir es de 20 kHz añadiéndole

aproximadamente el 10% de margen de los filtros.

Figura 32. Filtro antialiasing ideal versus real.

Nyquist, desde el punto de vista matemático plantea que para reconstruir una señal de por

ejemplo 5 kHz, es exactamente igual si se muestrea a 10 kHz que a 20 kHz, no aporta nada

incrementar la tasa de muestreo una vez cumplido el criterio de Nyquist. Matemáticamente

es cierto sí, pero ¿cómo afecta esto al procesamiento de una señal de audio? Si hablamos

de calidad de audio, y si solo se utiliza el doble de la frecuencia máxima para registrar un

sonido, se puede perder mucha información como se puede ver en la Figura 31:

Figura 33. Tono puro de 15 kHz muestreado a 44100 kHz.

0 0.0001 0.0002 0.0003 0.0004 0.0005

Time (s)

0

-0.5

-1

0.5

1

Muestreo Sonido

Page 33: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

33

Debido a la limitación del oído humano y, que la mayoría de instrumentos tienen el grueso

de sus harmónicos por debajo de los 10 kHz, es prácticamente inaudible esta falta de

calidad en la adquisición y procesado del sonido.

No obstante, si nos referimos a la alta fidelidad (Hi-Fi) o en estudios de masterización, se

llega a utilizar muestreos de hasta 96 kHz para procesar y masterizar audios.

Figura 34. Tono puro de 15 kHz muestreado a 96200 Hz.

En la Figura 34 se ve claramente que la calidad de la señal muestreada a 96200 kHz para

procesar es más fiable que la de 44100 kHz. El sonido procesado tendría mucha más

calidad aunque el oído humano no sería capaz de apreciarlo.

4.3.1 Velocidad de muestreo (entrada) y retardo

El convertidor A/D de entrada de la USB-1208 FS es totalmente programable hasta un

máximo de 50000 muestras/s. Para facilitar el cálculo, se muestreará a 40.000 Hz o 50.000

Hz dando a elegir al usuario la velocidad de muestreo.

Como existe un compromiso entre la resolución frecuencial y el retardo, también llamado

latencia, se le permitirá al usuario seleccionar el tamaño del vector de datos (puntos FFT)

dependiendo del modo de funcionalidad del programa. ¿Qué supone esto? Es necesario

encontrar un punto de equilibrio entre la cantidad de puntos a procesar (para no perder

calidad) y el retardo de la salida debido al tiempo de procesado y adquisición de los datos.

En la ecuación (38) se muestra el tiempo que se tarda en capturar un vector de 1024 puntos

con una velocidad de muestreo de 40.000 Hz:

𝑐𝑎𝑝𝑡𝑢𝑟𝑎 = 1024 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 ·1 𝑠

40.000 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠= 25,6 𝑚𝑠 (38)

A partir de retardos superiores a 30 ms, se puede producir el efecto eco y, en el caso de ser

un ecualizador de tiempo real no sería aceptable. Si se aumenta el número de puntos de

FFT, el tiempo de captura del vector de datos aumentará.

0 0.0001 0.0002 0.0003 0.0004 0.0005

Time (s)

0

-0.5

-1

0.5

1

Muestreo Sonido

Page 34: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.4 Resolución frecuencial

34

4.4 Resolución frecuencial

Un ecualizador atenúa o eleva la ganancia de una banda de frecuencias, pero

concretamente, ¿a qué frecuencias podemos acceder y cuál es nuestra resolución

frecuencial? Se entiende como resolución frecuencial el incremento de frecuencia mínimo

que hay entre cada una de las muestras. Es fácilmente calculable utilizando la siguiente

expresión:

∆𝑓 =𝑓𝑚

𝑁º 𝑝𝑢𝑛𝑡𝑜𝑠 𝐹𝐹𝑇 (39)

Para entender que supone la resolución frecuencial, se coge como en el capítulo anterior, el

caso de una FFT de 1024 puntos y una frecuencia de muestreo 𝑓𝑚 de 40.000 Hz:

∆𝑓 =𝑓𝑚

𝑁º 𝑝𝑢𝑛𝑡𝑜𝑠 𝐹𝐹𝑇=

40.000

1024= 39,0625 𝐻𝑧 (40)

Esto supondrá que cualquier información por debajo de 39,0625 Hz, va a ser información

perdida. Esta pérdida de información, no supone ningún problema, ya que el espectro

audible humano por debajo de 20 Hz es nulo y por debajo de nuestra resolución

prácticamente no aporta nada.

Se puede ver claramente que, si aumentamos el número de muestras, la resolución

frecuencial aumentará. Hay que encontrar un punto de equilibrio entre la resolución

frecuencial y el tiempo de muestreo, ya que como se vio en el capítulo anterior, al

aumentar los puntos de FFT también deberá aumentar el tiempo de muestreo.

Si se pretende ecualizar un sonido ya grabado (por ejemplo una canción guardada en el

PC), al no producirse el efecto eco que se obtiene al ecualizar en directo, se podrán coger

muestras de mayor tamaño aumentando la resolución y la calidad de ecualización. En este

caso, el retardo no será influyente.

Page 35: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

35

Actualmente los ecualizadores por octavas y tercios de octava, su frecuencia central

nominal de ecualización de cada una de las bandas, están estandarizadas por la norma CEI

1260:1995, y es la siguiente:

Frecuencia central nominal en Hz

Tercio de

octava Octava

Tercio de

octava Octava

Tercio de

octava Octava

Tercio de

octava Octava

25

31,5

200

250

1600

2000

12500

16000 31,5 250 2000 16000

40 315 2500 20000

50

63

400

500

3150

4000

63 500 4000

80 630 5000

100

125

800

1000

6300

8000 125 1000 8000

160 1250 1000

Tabla 10. Frecuencia central nominal en Hz estandarizadas por la norma CEI 1260:1995

Al estar las bandas centrales normalizadas y como disponemos de una resolución diferente

a este valor, es necesario conocer los extremos de cada banda para saber exactamente

dónde se encuentra cada muestra.

Existe una ecuación para el cálculo de las frecuencias inferiores fly superiores fh del ancho

de banda de la frecuencia central k, dependiendo de la fracción de la octava x. La ecuación

es la siguiente, obtenida de [20]:

𝑓𝑙𝑘 = 2(−𝑥2

) · 𝑓𝑐𝑘 (41)

𝑓𝑕𝑘= 2(

𝑥2

) · 𝑓𝑐𝑘 (42)

Donde 𝑓𝑐𝑘es la frecuencia central de la banda de octava k. En el caso de un ecualizador de

en octava, x será 1, y en el caso de tercio de octava, x será 1/3.

Page 36: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4.3 Resolución frecuencial

36

Utilizando las expresiones (41) y (42) y redondeando los valores a la media entre la

frecuencia superior de la banda y la siguiente inferior, se obtiene la siguiente tabla:

Frecuencia

inferior de la

banda

Hz

Tercio de

octava

Hz

Frecuencia

superior de la

banda

Hz

Frecuencia

inferior de la

banda

Hz

Octava

Hz

Frecuencia

superior de la

banda

Hz

22,0 25 28,0

22,0 31,5 45,0 28,0 31,5 35,5

35,5 40 45,0

45,0 50 56,0

45,0 63 89,5 56,0 63 71,0

71,0 80 89,5

89,5 100 112,0

89,5 125 179,0 112,0 125 141,5

141,5 160 179,0

179,0 200 223,5

179,0 250 355,0 223,5 250 281,0

281,0 315 355,0

355,0 400 447,0

355,0 500 710,0 447,0 500 561,0

561,0 630 710,0

710,0 800 894,5

710,0 1.000 1.414,0 894,5 1.000 1.118,0

1.118,0 1.250 1.414,0

1.414,0 1.600 1.789,0

1.414,0 2.000 2.806,0 1.789,0 2.000 2.236,0

2.236,0 2.500 2.806,0

2.806,0 3.150 3.550,0

2.806,0 4.000 5.612,0 3.550,0 4.000 4.472,0

4.472,0 5.000 5.612,0

5.612,0 6.300 7.099,0

5.612,0 8.000 11.180,0 7.099,0 8.000 8.944,0

8.944,0 1.000 11.180,0

11.180,0 12.500 14.143,0 11.180,0 16.000 20.000,0

14143,0 16.000 20000,0

Tabla 11. Frecuencias superiores e inferiores de cada banda.

Page 37: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

4 Fundamentos matemáticos

37

Al conocer los márgenes de cada banda y la resolución frecuencial de nuestro ecualizador,

dependiendo del número de puntos FFT y la velocidad de captura, ahora se podrá agrupar

cada una de las muestras del espectro con su banda correspondiente. Si el usuario decide

aumentar la ganancia de la banda de 1 kHz en el ecualizador por octavas (1024 puntos FFT

y 40.000 muestras/segundo), estará aumentando la ganancia de todos los valores

frecuenciales extraídos de la FFT, comprendidos en el rango de 710 Hz a 1.414 Hz.

Figura 35. Ejemplo de funcionamiento de la banda de 1.000 Hz al aplicar una ecualización, con una FFT de 1024 puntos

y 40.000 muestras/segundo.

0

2

4

6

8

10

12

dB

Hz

Banda 1000 Hz con EC +1 dB Banda 1000 Hz sin EC

Page 38: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

38

5 Hardware

En este capítulo, se explicará con detalle cómo funciona el sistema de adquisición de datos

que se dispone para realizar este proyecto, la USB-1208 FS. También se explicarán las

etapas hardware, a la entrada y la salida de la tarjeta, que son necesarias para adecuar las

señales de sonido captadas y procesadas.

5.1 Sistema de adquisición de datos USB-1208 FS

Para poder adquirir los datos del mundo analógico y trabajar con ellos en el PC, se necesita

un sistema de adquisición de datos (SAD). En este proyecto, se dispone de la tarjeta USB-

1208 FS proporcionada por el ex-alumno de la universidad Albert Porta Torell. Su

proyecto El PC com a analitzador d’espectres a temps real dirigido por el profesor

Esteban del Castillo Pérez es el punto de partida de este proyecto. Toda la información de

este apartado se puede encontrar en la referencia [11] de la bibliografía.

La tarjeta dispone de 8 entradas analógicas si está configurada en modo single-ended, o 4

entradas analógicas si está en modo diferencial. También cuenta con 2 salidas analógicas

de 12 bits cada una y 16 I/O digitales. A parte, tiene un contador de 32 bits para eventos

externos. La tarjeta se alimenta a través del puerto USB del PC a +5 V.

Figura 12. Tarjeta de adquisición de datos USB-1208 FS de la casa Measurement CompuntingTM

Mediante el software del fabricante, se pueden configurar las entradas o salidas de la

tarjeta. Si configuramos la tarjeta en single-ended, dispondremos de 11 bits para cada una

de las 8 entradas analógicas, en cambio si la configuramos en modo diferencial

dispondremos de 12 bits para cada una de las 4 entradas. Para las I/O digitales, se puede

seleccionar cada línea independientemente como entrada o salida, disponiendo de hasta 8

bits de resolución.

Además de las I/O ya explicadas, la tarjeta dispone de una entrada SYNC que permite

sincronizar la USB-1208FS con el reloj de otra tarjeta.

En la Figura 13 se puede visualizar el diagrama de bloques de la tarjeta USB-1208FS.

Page 39: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

39

Figura 13. Diagrama de bloques de la USB -1208FS

A continuación en la Figura 14 se explica con más detalle la funcionalidad de cada uno de

los pins de la tarjeta en los dos modos de operación single-ended y diferencial.

Figura 14. Pins de salida de la USB-1208FS modo single-ended

Page 40: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5.1 Sistema de adquisición de datos USB-1208 FS

40

Pin Nombre Funcionalidad

1 CH0 IN Entrada analógica de 11 bits±10 V

2 CH1 IN Entrada analógica de 11 bits ±10 V

3 AGND Tierra analógico

4 CH2 IN Entrada analógica de 11 bits ±10 V

5 CH3 IN Entrada analógica de 11 bits ±10 V

6 AGND Tierra analógico

7 CH4 IN Entrada analógica de 11 bits ±10 V

8 CH5 IN Entrada analógica de 11 bits ±10 V

9 AGND Tierra analógico

10 CH6 IN Entrada analógica de 11 bits ±10 V

11 CH7 IN Entrada analógica de 11 bits ±10 V

12 AGND Tierra analógico

13 D/A OUT 0 Salida analógica D/A 10.000 muestras/s máx.

14 D/A OUT 1 Salida analógica D/A 10.000 muestras/s máx.

15 AGND Tierra analógico

16 CAL Terminal de calibración

17 GND Tierra

18 TRIG IN Entrada de disparo externo. Configurable por flanco creciente o decreciente

19 SYNC Pin I/O de sincronización

20 CTR Entrada contador de eventos externos de 32 bits.

21 Port A0 I/O digital {+5V TRUE}{GND FALSE}

22 Port A1 I/O digital {+5V TRUE}{GND FALSE}

23 Port A2 I/O digital {+5V TRUE}{GND FALSE}

24 Port A3 I/O digital {+5V TRUE}{GND FALSE}

25 Port A4 I/O digital {+5V TRUE}{GND FALSE}

26 Port A5 I/O digital {+5V TRUE}{GND FALSE}

27 Port A6 I/O digital {+5V TRUE}{GND FALSE}

28 Port A7 I/O digital {+5V TRUE}{GND FALSE}

29 GND Tierra

30 PC +5V Salida +5V

31 GND Tierra

32 Port B0 I/O digital {+5V TRUE}{GND FALSE}

33 Port B1 I/O digital {+5V TRUE}{GND FALSE}

34 Port B2 I/O digital {+5V TRUE}{GND FALSE}

35 Port B3 I/O digital {+5V TRUE}{GND FALSE}

36 Port B4 I/O digital {+5V TRUE}{GND FALSE}

37 Port B5 I/O digital {+5V TRUE}{GND FALSE}

Page 41: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

41

38 Port B6 I/O digital {+5V TRUE}{GND FALSE}

39 Port B0 I/O digital {+5V TRUE}{GND FALSE}

40 GND Tierra

Tabla 3. Detalle de funcionalidad de cada pin en el modo single-ended

La única diferencia, en referencia a los pins, entre el modo single-ended y el modo

diferencial está en los 11 primeros pis, los demás 29 se mantienen iguales, por eso solo se

mostrará la tabla de los 11 primeros pins.

Figura 15. Pins de salida de la USB-1208FS modo diferencial

Pin Nombre Funcionalidad

1 CH0 HI Entrada analógica a medir. 12 bits de resolución

2 CH0 LO Entrada analógica de referencia

3 AGND Tierra analógico

4 CH1 HI Entrada analógica a medir. 12 bits de resolución

5 CH1 LO Entrada analógica de referencia

6 AGND Tierra analógico

7 CH2 HI Entrada analógica a medir. 12 bits de resolución

8 CH2 LO Entrada analógica de referencia

9 AGND Tierra analógico

10 CH3 HI Entrada analógica a medir. 12 bits de resolución

11 CH3 LO Entrada analógica de referencia

Tabla 4. Detalle de funcionalidad de cada pin en el modo diferencial

Page 42: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5.1 Sistema de adquisición de datos USB-1208 FS

42

5.1.1 Configuración single-ended

Cuando se selecciona mediante software la configuración single-ended, los canales del

CH0 IN al CH7 IN disponen de 11 bits de resolución con un rango de voltaje de entrada de

±10 V. Más adelante se explicarán las restricciones del convertidor A/D que influyen a los

CH# IN limitándolos a 11 bits de resolución.

Figura 16. Ejemplo de conexión para medir en el modo single-ended

La Figura 16 muestra un ejemplo de conexión en modo single-ended para llevar a cabo la

medida del voltaje de una pila. Un terminal se tiene que conectar al canal CH# IN que se

desee y el otro en la conexión AGND más próxima.

5.1.2 Configuración diferencial

En modo diferencial, la señal de entrada conectada a un canal CHN IN se mide respecto a

la señal de referencia CHN LO. Un amplificador de precisión, bajo ruido y programable

nos permite tener un rango dinámico de 12 bits (4096 muestras) y un rango de voltaje

diferencial seleccionable de ±20 V, ±10 V, ±5 V, ±4 V, ±2,5 V, ±2,0 V, ±1,25 V, o ±1,0 V,

según la señal que nos interese medir.

A menor rango de voltaje escogido, se dispondrá de una mayor resolución ya que se

aprovecha mucho más el rango dinámico. Así que es muy importante si se trabaja en modo

diferencial, seleccionar un rango de entrada de voltaje correcto, ya que, en caso contrario

un rango superior al necesario, va a hacer que se pierda resolución.

El fabricante limita las entradas analógicas entre -10 V y 20 V respecto a tierra. Si se

introduce un voltaje superior al determinado por el fabricante, la señal se satura a -10 V o

20 V, aunque se podría llegar a dañar la tarjeta si se introduce un valor demasiado elevado.

¿Cómo funciona exactamente el modo diferencial?

Supongamos que la señal de entrada de la Figura 15 es una entrada sinusoidal de 8 Vpp

conectada al pin CH1 HI y la misma señal pero desfasada 180º conectada al pin CH1 LO

como referencia.

Page 43: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

43

1Figura 17. Ejemplo 1 modo diferencial ±8V del manual de usuario de la USB-1208FS

𝑀𝑒𝑎𝑠𝑢𝑟𝑒𝑑 𝑆𝑖𝑔𝑛𝑎𝑙(𝑡) = 𝐶𝐻𝐻𝐼(𝑡) − 𝐶𝐻𝐿𝑂(𝑡) (1)

El valor medido (measured signal) en un instante t será la diferencia entre el valor medido

en el pin HI menos el valor medido en el pin LO en ese instante t. En la Figura 17se puede

ver que los valores de picos análogos tendrían 8 V de diferencia, así que el rango ideal para

medir está señal será de±8 V.

Ahora se toma como ejemplo una señal de entrada también de 8 Vpp pero en este caso

centrada en -7 V para el pin CHIN y como en el caso anterior, la señal del pin CHLO igual

pero desfasada 180º. En este caso, se está incumpliendo la especificación del fabricante del

rango de entrada situado entre -10 V y 20 V. En la Figura 15 extraída del manual de

usuario del fabricante, se puede visualizar que las señales de los pines CHIN y CHLO se

saturan a -10 V, perdiendo 1 V de información y obteniendo una señal medida de ±7 V.

Figura 18. Ejemplo 2 modo diferencial ±8V del manual de usuario de la USB-1208FS

5.1.3 Terminales de entrada analógica (CH0 IN – CH7 IN)

Como se ha explicado al principio del capítulo 3, según el modo de operación, se dispone

de una resolución de 12 bits (modo diferencial) o 11 bits (modo single-ended). En la

Figura 19 se muestra la transferencia ideal del valor de voltaje en la entrada del valor

entero convertido por el A/D.

Page 44: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5.1 Sistema de adquisición de datos USB-1208 FS

44

Figura 19. Función de transferencia ideal del convertidor A/D de la USB-1208FS

±FS es el fondo de escala seleccionado por el usuario, que en el modo diferencial puede

ser: ±20 V, ±10 V, ±5 V, ±4 V, ±2,5 V, ±2,0 V, ±1,25 V, o ±1,0 V. Si se escoge como

ejemplo el rango ±10 V, el valor -10 V será convertido a 0 a la salida del A/D. El valor 5 V

será convertido a 2048 a la salida del A/D y el extremo +10 V será convertido a 4095.

Los datos convertidos del A/D son transferidos en bloques de 31 muestras en la USB-

1208FS a la memoria del buffer del PC.

5.1.4 Terminales de salida analógicos (D/A OUT0 – D/A OUT 1)

En diferencia a las entradas analógicas de la tarjeta que son bipolares y pueden tener una

resolución distinta dependiendo del modo de operación, las salidas analógicas de la USB-

1208FS trabajan siempre con 12 bits de resolución. Esto implica disponer de un rango de

salida comprendido entre 0 V y 4,096 V, con 1 mV por LSB. Este rango es fijo y no

programable.

Si solamente se utiliza una (single channel output) de las dos salidas analógicas, se dispone

de una velocidad de 10.000 muestras/segundo. Si se trabaja con las dos salidas analógicas

(dual channel output) se dispone de una velocidad máxima de salida de 5.000

muestras/segundo. El D/A transfiere datos en bloques de 32 muestras.

5.1.5 Limitaciones de la USB-1208FS para el proyecto

Las limitaciones que nos presenta la tarjeta USB-1208FS para desarrollar el proyecto son

las siguientes:

Velocidad de muestreo convertidor D/A muy inferior a la del convertidor A/D

Rango de salida

Paquete de datos a la salida del A/D

No simultaneidad de trabajo A/D y D/A

Page 45: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

45

Velocidad de muestreo convertidor D/A

El convertidor D/A está limitado a 10.000 muestras/segundo a diferencia del convertidor

A/D que dispone de hasta 50.000 muestras/segundo. Esta diferencia supone una pérdida de

información muy importante en referencia al sonido. Cómo se explica en el capítulo 2, el

espectro audible de las personas puede llegar hasta los 20 kHz, entonces con una

frecuencia máxima de muestreo de 10 kHz, a la salida del D/A y según el teorema de

muestreo Nyquist que se explicará más adelante, como que hay que muestrear el doble de

la frecuencia deseada y solo disponemos de 10 kHz, solo se puede obtener 5 kHz de la

señal de salida.

Rango de salida

El rango de salida de la USB-1208FS como se ha escrito anteriormente, no es programable

y fijo de 0 V a 4,095 V. En sí mismo, esto no implica ninguna limitación, pero la salida al

ser unipolar, se necesita convertir a bipolar sin componente continua. Para realizar esto, tal

y como se explicará en el Apartado 5.2.2 se debe añadir una etapa RC para filtrar la

componente continua.

Paquete de datos a la salida del A/D

El convertidor A/D de la USB-1208FS transfiere datos en paquetes de 31 muestras en

modo de escaneo continuo. 31 no es un número múltiplo de 2, por lo que al dividir las

muestra seleccionadas por el número de paquetes de 31, siempre se obtendrá un valor

decimal, el cual supondría una pérdida de información no controlada.

Para reducir esta limitación en el caso de la USB-1208FS, se obtendrá el múltiplo de 31

muestras más próximo por exceso a la potencia de 2 deseada y las muestras excedentes, no

se tendrán en cuenta. Esto supondrá unos silencios de microsegundos conocidos y

controlados.

1024 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠

𝑝𝑎𝑞𝑢𝑒𝑡𝑒𝑠 𝑑𝑒 31 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠= 33,03225 𝑝𝑎𝑞𝑢𝑒𝑡𝑒𝑠 → 34 𝑝𝑎𝑞𝑢𝑒𝑡𝑒𝑠 (2)

31 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 · 34 𝑝𝑎𝑞𝑢𝑒𝑡𝑒𝑠 = 1054 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 𝑡𝑜𝑡𝑎𝑙𝑒𝑠 (3)

1054 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 − 1024 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 = 30 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠 𝑐𝑎𝑝𝑡𝑢𝑟𝑎𝑑𝑎𝑠 𝑛𝑜 𝑝𝑟𝑜𝑐𝑒𝑠𝑎𝑑𝑎𝑠 (4)

En las ecuaciones (2), (3) y (4) se muestra un ejemplo de cómo se obtendrán las muestras

para el caso de 1024 puntos seleccionado por el usuario.

No simultaneidad de trabajo A/D y D/A

Otra de las limitaciones encontradas en la tarjeta USB-1208FS es la no simultaneidad de

trabajo del convertidor A/D y D/A. Esta tarjeta no permite trabajar en segundo plano

Page 46: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5.1 Sistema de adquisición de datos USB-1208 FS

46

(background); es decir, el convertidor A/D a la vez del convertidor D/A. Esta limitación

implicará que no podremos realizar ecualizaciones en tiempo real.

5.1.6 USB-1208FS-plus

Todas las limitaciones encontradas en la tarjeta USB-1208FS, quedan solventadas con

otras tarjetas que ya hay disponible en el mercado de la misma compañía, la USB-1208FS-

plus. Entonces, aunque el proyecto se base con la tarjeta 1208FS como demostrativo,

también se implementará el software con las mejoras que brinda la nueva tarjeta, dando la

opción al usuario de seleccionar una tarjeta u otra.

Las mejoras de la USB-1208FS-plus son:

La velocidad de muestreo del convertidor D/A es la misma que la de entrada,

50.000 muestras por segundo. Implicará no tener pérdida de información y llegar a

todo el rango de frecuencias del espectro audible.

También se dispone de una resolución de salida de 12 bits, pero un rango de salida

de voltaje de 0 V a 5 V.

Los datos a la salida del convertidor A/D son transferidos en bloques de 32

muestras a la memoria del PC. Cómo 32 es divisor de todos los tamaños FFT que

se utilizan (128, 256…), se podrán procesar todas las muestras adquiridas.

Simultaneidad de trabajo del convertidor A/D y D/A. La versión plus de la tarjeta,

permite trabajar en segundo plano el convertidor D/A a la vez que se adquieren

muestras por el A/D, esto implica que sí se podrá realizar un procesado de señal en

“tiempo real”.

Page 47: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

47

5.2 Etapas acondicionadoras

5.2.1 Etapa de entrada – Filtro antialiasing

El problema del aliasing es evitable y de solución inmediata mediante la implementación

de un filtro paso-bajo a la frecuencia de Nyquist, y así asegurar que la señal muestreada no

contiene componentes espectrales superiores a este valor.

Un filtro ideal, como se puede ver en la Figura 32, produce una atenuación instantánea e

infinita sobre la banda a atenuar, pero en realidad es imposible conseguir esa atenuación.

Además, un filtro antialiasing no debe alterar la fase de la señal.

En el momento de implementar el filtro antialiasing, se pueden mostrar varias limitaciones

cuando se trata de cumplir las prestaciones del filtro ideal. Si se desea una banda de

transición muy estrecha, esto puede impedir cumplir las otras especificaciones, ya que sería

muy difícil conseguir una respuesta totalmente plana en la banda de paso y una baja

distorsión de fase. Debido a esta limitación se permite un margen de tolerancia, que suele

ser del 10% para reducir los problemas de limitación de fase y la introducción de

frecuencias no deseadas.

Características importantes del filtro antialiasing

Respuesta temporal (overshoot) y rizado: si se desean pendientes elevadas en la banda de

transición del filtro, pueden producir resonancias alrededor de la frecuencia de corte, que

permitirían la aparición de frecuencias que el sonido original no tenía.

Linealidad de fase: los sistemas magnético-analógicos de grabación (micrófonos y

altavoces) y los mismos filtros pasa-bajos introducen un retardo que depende de la

frecuencia, denominado retardo de grupo. Mediante un circuito analógico antes o después

del filtro que compense los retardos, se puede conseguir una linealidad de fase en el

sistema.

Figura 35. (A) Filtro ideal pasa-bajos (B) Filtro real con rizado en la banda de paso y banda atenuada, y aparición de una

banda de paso entre ambas bandas.

Page 48: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5.2 Etapas acondicionadoras

48

Para lograr un incremento en la pendiente de la banda de transición y hacer más estrecha la

banda incrementando el orden de los filtros se aplican estructuras básicas en cascada. Los

más utilizados son los siguientes:

RC: el filtro pasa bajo más sencillo es el formado por una resistencia y

condensador. Cada etapa RC en cascada, aumenta la pendiente del filtro 6

dB/octava. Este tipo de filtro no presenta ni overshoot ni rizado, pero siempre

existirán anomalías en la banda de paso.

Butterworth: este tipo de filtros actúa en las proximidades de la frecuencia de

corte, en la banda de paso, añadiendo resonancias que no influyen en el valor de la

pendiente, consiguiendo así suavizar la pendiente de la banda de transición.

El problema de los filtros Butterworth es que requieren un elevado orden para

lograr una banda de transición mínima y atenuar correctamente la banda atenuada.

Para ver un ejemplo de la magnitud del filtro necesario, haría falta un filtro de

orden 33 para obtener una banda de transición de 0,4 octavas o una atenuación de

80 dB.

Cauer: este filtro es el que menor banda de transición produce a menor orden. Se

necesita un séptimo orden para una atenuación de 89 dB en 0,4 octavas

produciendo un rizado de 0,25 dB.

Chebyshev: este tipo de filtro, a medida que se incrementa el orden en cascada,

acentúa la pendiente, sin embargo, la distorsión de fase también aumenta

proporcionalmente al orden del filtro. Se muestra un ejemplo en la Figura 36 de

este tipo de filtro.

5.2.2 Etapa de salida

La señal a la salida de la tarjeta, es unipolar y, por lo tanto, posee componente continua.

Para poder reproducir un sonido en un altavoz externo es necesario realizar diferentes

adecuaciones a la señal de salida. Primero de todo, se necesita que la señal sea bipolar y sin

componente continua. Colocando un filtro pasa altos RC en la salida de la tarjeta podremos

eliminar escogiendo unos parámetros adecuados para el filtro. La ecuación que controla

frecuencia de corte según los parámetros RC para un filtro de primer orden es la siguiente:

𝑓𝑐 =1

2𝜋𝑅𝐶 (65)

Hay que tener en cuenta qué se vamos a conectar a la salida del filtro RC, porque si se

diseña el filtro sin tener en cuenta la impedancia de un altavoz, no se tendrá en cuenta que

la R de la ecuación (65) será la resultante del paralelo entre la R diseñada y la impedancia

de entrada del altavoz. Los valores más comunes de impedancia de entrada de altavoz son

de 4 Ω, 6 Ω y 8Ω.

Se coge como caso extremo la impedancia de entrada de 4 Ω y consultando los valores

comerciales de los condensadores se calculan los parámetros RC del filtro.

Page 49: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

5 Hardware

49

𝑓𝑐 =1

2𝜋 · 4 Ω · 3,3 𝑚𝐹= 12,057 𝐻𝑧 (66)

La R escogida es directamente la R de la impedancia del altavoz, ya que si se coloca una R

en paralelo a la impedancia, la resultante siempre será un valor inferior a la impedancia,

elevando la frecuencia de corte. Observando los valores comerciales de condensadores

electrolíticos, para alcanzar una frecuencia de corte por debajo de los 20 Hz necesitamos se

necesita un condensador del orden de 2,2 mF o 3,3 mF. Se debe considerar que se trata de

capacidades muy elevadas. En caso de que la impedancia del posible amplificador

subsiguiente fuese alta, este condensador daría problemas. Como todos los elementos

tienen una tolerancia, se escoge el valor de 3,3 mF asegurando que al aplicar la tolerancia

más desfavorable, se esté por debajo de los 20 Hz.

La mayoría de altavoces disponen de su propio filtro para evitar ser dañados por las

componentes continuas, pero como medida de seguridad, se implementará dicho filtro RC.

Una limitación que existe en la USB-1208FS es la intensidad máxima de salida, que para

cada pin analógico de salida es de 15 mA como máximo. Este valor es muy pequeño y se

necesitará una amplificación externa si el altavoz no es activo.

Figura 36. Ejemplo circuital y respuesta de varias etapas de filtros Chebyshev en cascada.

En la mayoría de los casos, debido a los problemas que presentan los filtros analógicos de

elevado orden, se acaba implementando el filtro antialiasing con filtros RC en cascada

hasta lograr la atenuación deseada.

Page 50: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

50

6 Software

En este capítulo se explicará con detalle cómo se ha llevado a cabo la realización del

software. A su vez, este capítulo se ha dividió en los siguientes apartados:

Modos de operación del software

Diseño y funcionamiento de los ecualizadores

Interfaz gráfico

6.1 Modos de operación del software

Al usuario se le permite seleccionar entre 5 modos de operación:

Directo: procesado y reproducción “en tiempo real” de la señal. La señal entra por

la tarjeta de adquisición de datos, se procesa en el PC y se extrae por la misma

tarjeta para ser reproducida por un altavoz externo. Este modo de funcionamiento el

sonido es generado en ese mismo instante por el usuario mediante la manipulación

de un instrumento y, a su vez, el usuario está escuchando el instrumento

manipulado, por lo que el retraso generado por el procesado de la señal tiene que

ser pequeño.

Grabación: este modo permite grabar sonidos en archivos de datos que se

guardarán en el PC. El sonido, luego de digitalizarlo, se guarda directamente sin

realizar ningún procesado. El tiempo de grabación será seleccionable por el usuario

y el formato del archivo será de extensión .grab.

Procesar muestras grabadas: las muestras, previamente registradas en el modo

grabación, son ecualizadas y reproducidas o bien registradas nuevamente en

archivos del tipo WAVE.

Ecualizar sonido en diferido: este modo de funcionamiento es similar al modo

directo, pero la única diferencia es que el usuario debe introducir un sonido

previamente registrado, como puede ser la salida de un reproductor mp3 o un

tocadiscos. La diferencia entre el modo directo y el diferido radica si en sonido se

escucha o no antes de ser procesado.

Dependiendo de la tarjeta seleccionada, la USB-1208FS o la USB-1208FS plus, se tendrán

unas prestaciones diferentes, ya explicadas en el Capítulo 3, en cada modo de

funcionamiento del software.

Page 51: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

51

6.1.1 Modo directo

En el apartado 6.1 se ha introducido la funcionalidad del modo directo. A continuación se

va a explicar con detalle cada una de las etapas y procesos necesarios que se aplica a la

señal de sonido desde que entra por la tarjeta de adquisición de datos, hasta que ha sido

procesada y lista para reproducir.

En el siguiente diagrama se muestran las diferentes etapas que componen el modo directo

(Figura 34):

Señal de entrada

FiltroAntialiasing

A/DProcesadode la señal

D/AAdecuación

salidaAltavoz

Figura 34. Diagrama de flujo general de los procesos a realizar a la señal de entrada a ecualizar

Se puede ver que antes de enviar la señal al convertidor A/D, se aplica un filtro

antialiasing. ¿Por qué?:

Para garantizar que todas las frecuencias superiores a 20 kHz han sido eliminadas y así

evitar la aparición del fenómeno de aliasing explicado en el capítulo 5.

6.1.1.1 Etapa 1 - A/D y preparación de los vectores de datos.

En esta etapa (Figura 37) se explican todos los procesos realizados a la señal de entrada ya

filtrada, desde el momento que la captamos y convertimos mediante el convertidor A/D,

hasta que se depositan los valores adquiridos en el vector que le corresponde.

CapturarDades()

A/D

Buffer de windows de tamaño M

memHandle1

DadesAD[M]

Señal de

entrada

QuatreBitsAltsAZero()

VectorDadesReal[n]

VectorDadesIm[n]

LecturaAVolts()

DeBufferAVector()

DadesAD[M]

Figura 37. Diagrama del proceso de obtención de los vectores de datos que contienen las muestras listas para ser

procesadas.

Primero de todo se necesita crear un buffer de memoria de Windows para depositar las

muestras aportadas por el convertidor A/D. La función WinBufAllocEx(M) es la que nos

permite realizar dicha operación y nos retorna un puntero de memoria memHandle. No se

puede crear un buffer de 12 bits, solamente permite crear de 16, 32 o 64 bits. Como no se

conoce y no especifica el usuario que ocurre con los 4 bits restantes de cada palabra, habrá

que implementar una función que disponga los últimos 4 bits a 0 en el momento de

Page 52: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

52

depositar los valores en el vector DadesAD[ ]. Una vez obtenido el vector DadesAD[ ] se

le aplica el rango de escala escogido por el usuario (±10 V,…, ±1,0 V) y se rellena el

vectorDadesReal[ ] con los valores convertidos.

A continuación se explica detalladamente cada uno de los procesos de la Figura 37:

CapturarDades( )

La captura de las M muestras consecutivas (ver Tabla 12) y deposición en el buffer de

Windows de tamaño M, viene dada por función AInScan( ) de la biblioteca Mccdaq del

fabricante:

AInScan( int lowChan, int highChan, int numPoints, ref int rate, MccDaq.Range range, int

memHandle, MccDaq.ScanOptions options).

Cada uno de los parámetros está explicado en detalle en el documento help de Universal

Library, expuesto en la bibliografía del proyecto.

DeBufferAVector( )

Una vez capturadas las M muestras, estas pasan a un vector de datos de tamaño M del tipo

unsigned short que es el tipo de datos que genera el A/D. La función que nos permite pasar

los datos del buffer al vector DadaesAD[ ] es la función WinBufToArray(int memHandle,

ushort[ ] dataArray, int firstPoint, int numPoints). Este proceso es necesario y especifico

de la tarjeta USB-1208FS. La tarjeta captura los datos y los coloca en un buffer de

Windows. Son especificaciones del fabricante.

QuatreBitsAltsAZero( )

Únicamente los 12 bits bajos de la palabra de 16 bits contienen información sobre la

muestra. Los 4 bits altos de cada envío al buffer de Windows de 16 bits, por defecto no

especifica el fabricante como vienen puestos, así que, para evitar posibles errores, se

pondrán a 0 manualmente por programa creando una máscara 0x0FFF.

El fabricante especifica que envía palabras de 16 bits.

LecturaAVolts( )

Lo siguiente es rellenar, según el rango de escala escogido por el usuario, el

VectorDadesReal[ ] que contendrá las N primeras muestras y el VectorDadesIm[ ] que

contendrá N ceros. Contendrá N ceros debido a que no se tiene en cuenta la fase de cada

muestra. Los diferentes fondos de escalas están explicados en el Apartado 5.1.2 y eran:

±10 V, ±5 V, ±4 V, ±2,5 V, ±2,0 V, ±1,25 V, o ±1,0 V. Más adelante estos mismos son los

que contendrán los valores procesados por las etapas FFT y IFFT. EL máximo desfase

seria medio periodo.

Por último hay que liberar la memoria y resetear el puntero memHandle, para aceptar

futuros paquetes de muestras. La función que permite realizar esto es

WinBuffFreeEx(memHandle).

Page 53: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

53

Constantemente se está hablando de M muestras o N muestras, y en capítulos anteriores ya

se ha hablado de la limitación de paquetes de 31 muestras que captura la USB-1208FS y

como se solucionaba dicha limitación. Así que las N muestras son las seleccionadas por el

usuario (128, 256, 512,...) y las M muestras son la que realmente se capturan excediendo a

la potencia de 2 muestras que sean necesarias, tal y como se muestra en la tabla 12:

Muestras seleccionadas

por el usuario N

𝑵

𝟑𝟏

Aprox.

superior 𝑴 = 𝑵 · 𝑨𝒑𝒓𝒐𝒙. 𝒔𝒖𝒑𝒆𝒓𝒊𝒐𝒓

128 4,12903 5 155

256 8,25806 9 279

512 16,51612 17 527

1024 33,03225 34 1054

2048 66,06451 67 2077

4096 132,12903 133 4123

8192 264,25806 265 8215

Tabla 12. Valores de M y N muestras

Una posible solución para no tener este exceso de muestras, sería implementar un buffer

circular, donde la última posición de la última muestra, sería la primera posición de la

primera muestra del siguiente paquete.

Page 54: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

54

6.1.1.2 Etapa 2 - Procesado de la señal FFT

La etapa 2 explica todos los procesos realizados al vectorDadesReal[ ] desde la salida de la

etapa 1, hasta que se dispone del vectorAmplitudsEq[ ] listo para ser ecualizado. En la

Figura 38 se pueden ver todos los procesos aplicados:

SALIDA

FFT

VectorDadesReal[n]

VectorDadesIm[n]

vectorDadesReal[n]

CalcularFinestra

()

vectorFinestra[n]

Enfinestrar()

CalcularFactors

DeGir()

vectorFactorDeGirReal[n]

vectorFactorDeGirIm[n]

vectorDadesReal[n]

CalcularFFT

()

Salida etapa

1

vectorDadesIm[n]

CalcularAm

plituds()

VectorDadesReal[n]

VectorDadesIm[n]

Salida

FFT

CrearVectorsAm

plituds()

VectorAmplitudsl[n]

VectorAmplitudsEq[n]

OmplirVectorsAmplituds()

VectorAmplitudsl[n]

VectorAmplitudsEq[n]

Figura 38. Diagrama del proceso de la Etapa 3

CalcularFactorsDeGir( )

Los factores de giro son necesarios para calcular la FFT y la IFFT. La única diferencia

entre el cálculo de les factores de giro para la FFT y IFFT, es que el signo del

VectorDeGirIm[ ] tendrá signo contrario en el cálculo IFFT respecto a FFT. No se

implementarán dos funciones para el cálculo de los factores de giro de cada uno de los

algoritmos, sino que, sabiendo que tienen el signo contrario, en el cálculo de la IFFT se

multiplicará por el signo negativo.

Page 55: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

55

Los vectores de giro solamente dependen de N, así que se crearán 2 vectores del tipo

double de tamaño𝑁

2 con la parte real e imaginaria de los factores de giro llamados

vectorFactorDeGirReal[ ] y vectorFactorDeGirIm[ ].

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑎𝑐𝑡𝑜𝑟𝐺𝑖𝑟𝑅𝑒𝑎𝑙 𝑛 = cos(2𝜋𝑛

𝑁) (43)

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑎𝑐𝑡𝑜𝑟𝐺𝑖𝑟𝐼𝑚 𝑛 = sin(2𝜋𝑛

𝑁) (44)

CalcularFinestra( )

Las características matemáticas de cada una de las funciones ventana ya se han explicado

en el Capítulo 5. Según la ventana escogida por el usuario, se llenará un vector del tipo

double de tamaño N con la función ventana correspondiente. Este vector se denominará

vectorFinestra[ ]. Para el caso de la ventana rectangular, no hace falta realizar la función

ventana ya que se trata de multiplicar por 1 en toda la ventana.

Enfinestrar( )

Para realizar la función ventana hay que multiplicar cada elemento del vectorDadesReal[n]

por el elemento vectorFinestra[n] que le corresponde al mismo elemento n. Se utilizará el

mismo vectorFinestra[n] para guardar el nuevo valor. En el caso de la ventana rectangular,

este paso no hace falta realizarlo. En la ecuación (45) se muestra el proceso realizado.

Desde n = 0, hasta n = N:

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 · 𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑖𝑛𝑒𝑠𝑡𝑟𝑎 𝑛

(45)

CalcularFFT( )

El algoritmo FFT de reducción en frecuencia de base 2, proviene del trabajo de Albert

Porta Torrell, ya comentado anteriormente, que a su vez es implementación concreta del

diagrama de mariposa clásico está basado en el “artículo [2]” que se puede consultar en la

bibliografía.

Siendo N el tamaño de FFT escogido por el usuario, la mariposa básica (Figura 21) es la

encontrada en las ecuaciones (26) y (27):

𝐴 = 𝑎 + 𝑏 (26)

𝐵 = (𝑎 − 𝑏)𝑊𝑁𝑡 (27)

Como ya se ha explicado el orden resultante de los bits a la salida de la FFT no está en

orden natural, y hay que aplicar un algoritmo.

Page 56: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

56

Se procesa el vectorDadesReal[ ] y vectorDadesIm[ ] anteriormente enventanados, y a la

salida de la FFT, esos dos vectores contienen la parte real e imaginaria de la FFT

correctamente ordenada.

La FFT en el modo directo estará limitada a un máximo de 1024 puntos en la selección del

usuario. Esto es debido a que si se permitiera utilizar una FFT con más puntos, el tiempo

de procesamiento sería demasiado elevado, produciéndose retardos demasiado grandes y

percibidles para el usuario.

CalcularAmplituds( )

Está función determina las amplitudes de los diferentes armónicos. La amplitud del

armónico n quedará colocada en la posición n del vectorDadesReal[ ]. Hay dos amplitudes

que se calculan por separado; son la componente continua y la amplitud a la frecuencia de

Nyquist.

El cálculo de la componente continua es el siguiente:

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 0 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 0 2 + 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝐼𝑚[0] 2

𝑁 (46)

El cálculo de la amplitud a la frecuencia de Nyquist es el siguiente:

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑁

2 =

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑁2

2

+ 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝐼𝑚[𝑁2]

2

𝑁

(47)

Para todas las demás amplitudes, la ecuación (48) muestra el proceso a seguir.

Desde 𝑛 = 1, hasta 𝑛 ≤𝑁

2 :

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 = 2 · 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 2 + 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝐼𝑚[𝑛] 2

𝑁 (48)

CrearVectorsAmplituds( )

El vector vectorAmplituds[ ] y vectorAmplitudsEq[ ] son tamaño 𝑁

2+ 1 y de tipo double.

Contendrán la amplitud en Voltios o dBV, dependiendo del punto del proceso donde se

encuentren, de cada componente espectral de la señal. El vectorAmplituds[ ] será copiado

en el vectorAmplitudsEq[ ], siendo este último el único que será procesado, es decir, será el

único que contendrá los resultados de aplicar la ecualización. Esto permitirá poder

representar los dos vectores y visualizar las dos señales, la ecualizada y la no ecualizada.

El método para llenar el vectorAmplituds[ ] es la función OmplirVectorsAmplituds( ).

Page 57: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

57

OmplirVectorsAmplituds()

Una vez aplicadas de forma consecutiva los métodos CalcularFFT() y

CalcularAmplituds(-), el vectorDadesReal[ ] contiene las amplitudes en Voltios de cada

componente en las primeras 𝑁

2+ 1 posiciones. Ahora se copiará cada una de las amplitudes

del vectorDadesReal[n] en la misma posición del vectorAmplituds[n] y

vectorAmplitudsEq[n]:

Desde n = 0 hasta 𝑛 ≤𝑁

2:

𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 (49)

𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠 𝑛 (50)

CrearVectorFrequencies( )

El vectorFrequencies[ ] de tamaño 𝑁

2+ 1 y de tipo double contiene la frecuencia de cada

componente espectral de la señal. Esta información se obtiene con el uso del método

OmplirVectorFrequencies( ).

OmplirVectorFrequencies( )

A cada posición del vectorFrequencies[n] le corresponde una frecuencia en Hz. Esta

frecuencia variará dependiendo del tamaño de puntos de la FFT (el valor N) y de la

velocidad de muestreo seleccionada del convertidor A/D. La relación es la siguiente:

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑖𝑒𝑠 𝑛 = 𝑛 ·𝑉𝑒𝑙𝑜𝑐𝑖𝑑𝑎𝑑 𝑑𝑒 𝑚𝑢𝑒𝑠𝑡𝑟𝑒𝑜

𝑁 (51)

Page 58: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

58

6.1.1.3 Etapa 3 – Ecualización

Una vez realizada la etapa 2, se dispone del vectorAmplituds[ ] el cuál contiene los valores

de las amplitudes de cada muestra en el dominio de la frecuencia en Voltios. La etapa 3 es

la encargada de realizar los procesos de ecualización (Figura 39).

Convertir_volts_a_

dBV()

Equalitzar()

AplicarLimitador

()

Convertir_dBV_a_

volts()

VectorAmplituds[n]

en V

VectorAmplituds[n]

en dBV

VectorAmplitudsEq[n]

en dBV

VectorAmplitudsEq[n]

en V

AplicarGuany

Global()

Figura 39. Diagrama del proceso de ecualización

El método realizado para ecualizar es multiplicar a cada componente espectral de la señal,

la ganancia correspondiente según la ecualización seleccionada por el usuario. Las

amplitudes están siempre en dBV y las ganancias en dB. Como ya se ha explicado

anteriormente, los dB son una unidad relativa, en cambio dBV es absoluta.

Las unidades de magnitud de las componentes frecuenciales de los espectros son Voltios.

La etapa de ecualización requiere unidades de dBV. Se realizarán 2 funciones que

coinvertirán los dBV a V y viceversa, ya que una vez ecualizado el sonido, es necesario

trabajar con Voltios para poder realizar la IFFT.

Convertir_volts_a_dBV( )

Primero de todo, siempre se realizará un control de cada posición buscando el valor de

0,0001 V, que es valor mínimo de tensión que se ha establecido. Si alguno de los valores

encontrados en alguna de las posiciones n es menor o igual que 0,0001 V, se convertirá a

-80 dBV.

Para todos los otros valores superiores se realizará la ecuación (52).

Desde 𝑛 = 0 hasta 𝑛 ≤𝑁

2:

𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠 𝑛 {𝑑𝐵𝑉} = 20 log10 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠 𝑛 {𝑉} (52)

Y una vez realizada la operación (52), se copiará el vectorAmplituds[-] en el

vectorAmplitudsEq[ ].

Page 59: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

59

Corte altas frecuencias y bajas frecuencias

Sea cual sea el ecualizador seleccionado por el usuario, 1-Octava, 2-Tercio de octava, 3-

Paramétrico, antes de realizar la ecualización deseada, se van a forzar a (-80 dBV) las

componentes espectrales por debajo de los 20 Hz y por encima de los 20 kHz. Una vez

solucionados los extremos de la señal, se aplica el tipo de ecualización deseada por el

usuario a cada banda frecuencial.

Equalitzar ( )

Se dispone de dos vectores, el VectorFrequencies[N], y el VectorAmplitudsEq[N]. A cada

frecuencia x, le corresponde una amplitud y. Si la frecuencia x está comprendida dentro de

un rango Octava#Hz_LF – Octava#Hz_HF, se le aplicará la ganancia elegida por el usuario

dentro de ese rango de octava. La amplitud ecualizada se guardará en la misma del vector

VectorAmplitudsEq[N].

Por ejemplo, si estamos en el ecualizador de octava y el usuario desea aumentar la

ganancia de la banda de 1 kHz, se realizarán las siguientes operaciones:

If:

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑟𝑒𝑐𝑢𝑒𝑛𝑐𝑖𝑒𝑠 𝑛 ≥ 𝑂𝑐𝑡𝑎𝑣𝑎1000𝐻𝑧_𝐿𝐹

And:

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑟𝑒𝑐𝑢𝑒𝑛𝑐𝑖𝑒𝑠 𝑛 ≤ 𝑂𝑐𝑡𝑎𝑣𝑎1000𝐻𝑧_𝐻𝐹

Then:

𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞 𝑛 + 𝐺𝑎𝑛𝑎𝑛𝑐𝑖𝑎

(54)

En el caso del ecualizador paramétrico hay varios parámetros más a considerar. Se dispone

de 4 bandas que el usuario puede escoger donde se sitúa la frecuencia central de cada una

de las bandas, limitándolo en cuatro rangos: low, low-medium, high-medium y high.

Al usuario también se le permite seleccionar el ancho de banda de cada uno de los rangos.

Entonces, la frecuencia de corte superior fhc e inferior flc, según el ancho de banda BW

seleccionado en cierta frecuencia central fc, será:

𝑓𝑕𝑐 = 𝑓𝑐 +𝐵𝑊

2 (55)

𝑓𝑙𝑐 = 𝑓𝑐 −𝐵𝑊

2 (56)

Especificando valores para cada uno de los cuatro rangos, estos serán los valores máximos

y mínimos que el usuario podrá seleccionar:

Page 60: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

60

Rango Frecuencia central

𝒇𝒄

Ancho de banda

𝑩𝑾

low 20 Hz a 250 Hz 0 Hz a 230 Hz

Low-medium 250 Hz a 2000 Hz 0 Hz a 1750 Hz

High-medium 2000 Hz a 4000 Hz 0 Hz a 2000 Hz

High 4000 Hz a 16000 Hz 0 Hz a 12000 Hz

Tabla 13. Rango de frecuencias centrales y ancho de banda seleccionable por el usuario

La aplicación de la ganancia en el rango seleccionado por el usuario, se realiza de la misma

manera que en la ecuación (54).

En el ecualizador paramétrico, el corte de las frecuencias altas y bajas se debe aplicar en la

etapa final de la ecualización, ya que pueden ser amplificados o atenuados dependiendo de

los valores escogidos por el usuario.

AplicarGuanyGlobal( )

La ganancia global se aplica a todas las amplitudes de las muestras dentro del rango de 20

Hz a 20 kHz, sumando los dB que el usuario haya seleccionado a cada amplitud de la

posición n del vectorAmplitudsEq[n]. La ganancia global que se puede aplicar es de hasta

±15 dB, con pasos de ±1 dB (Figura 40)

AplicarLimitador( )

Una vez aplicadas todas las ganancias del ecualizador, se comprueba que ninguna de las

amplitudes supere la limitación seleccionada por el usuario, y si alguna supera dicha

limitación, se igualará en valor de la amplitud a la limitación seleccionada. El rango de

limitación va de +20 dBV que equivalen a 10 V, hasta -80 dBV que equivalen a 0,0001 V.

Figura 40. Elementos de selección de limitación y ganancia global del usuario

Page 61: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

61

Convertir_dBV_a_volts( )

Igual que en el caso de conversión de Voltios a a dBV se realizaba un control para que los

valores inferiores a 0,0001 V se forzaran a -80 dBV, ahora se realizará un control sobre los

-80 dBV. Si alguna posición n contiene un valor inferior o igual a -80 dBV, se convertirá a

0 V. Más adelante todos los 0 V se convertirán a 0,0001 V.

Para todos los otros valores superiores a -80 dBV se realizará la ecuación (53).

Desde 𝑛 = 0 hasta 𝑛 ≤𝑁

2:

𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞 𝑛 {𝑉} = 10𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞 𝑛 {𝑑𝐵𝑉 }

20 (53)

6.1.1.4 Etapa 4 - IFFT

Una vez se ha finalizado la etapa de ecualización y el vectorAmplitudsEq[ ] ya dispone de

las amplitudes ecualizadas y en Voltios, la etapa 4 se encarga de revertir el proceso de la

etapa 2 y disponer del vectorDadesReal[ ] con los valores en el dominio del tiempo.

VectorAmplitudsEq[n]

en V

ReomplirVectorReIm

()

VectorDadesReal[n]

Salida etapa

3Calcular_IFFT()

VectorDadesReal[n]

CalcularInvers

Finestra()

VectorInvFinestra[n]

Desenfinestrar()

VectorDadesReal[n]

Figura 41. Diagrama de proceso de la etapa 5

Al salir de la etapa de ecualización, se dispone del vectorAmplitudsEq[ ] de tamaño 𝑁

2+ 1,

y para realizar el algoritmo IFFT, se necesita trabajar con el vectorDadesReal[ ] y el

vectorDadesIm[ ] de tamaño N.

ReomplirVectorReIm( )

Se supone que todas las fases de todas las componentes espectrales valen cero, por lo que

todos los valores de fase de cada posición n desde 𝑛 = 0 hasta 𝑛 = 𝑁 valdrán cero.

Primero, hay que depositar individualmente el valor de la componente continua de la señal

y de la componente a la frecuencia de Nyquist en el vectorDadesReal[ ]:

Page 62: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

62

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 0 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞[0] (57)

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑁

2 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞

𝑁

2

(58)

Para el resto de valores del vectorDadesReal[ ], se utilizará un llenado en espejo, de 1

hasta 𝑁

2 y de N hasta

𝑁

2+ 1, como se muestra en las ecuaciones (59) y (60).

Desde 𝑛 = 1 hasta 𝑛 =𝑁

2:

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞[𝑛] (59)

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑁 − 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑠𝐸𝑞[𝑛] (60)

Una vez tenemos los valores correctamente depositados en los vectores pertinentes, se

puede llevar a cabo el método Calcular_IFFT( )

Calcular_IFFT( )

El algoritmo IFFT ya se ha explicado en el Apartado 4.1.5. Este algoritmo ha sido

deducido del algoritmo FFT ya mencionado, procediendo de manera inversa.

Primero de todo es necesario revertir los bits intercambiando las posiciones en la entrada

de la IFFT como se mostraba en la Figura 27. Hay que intercambiar las posiciones que

leídas en orden inverso sean iguales. Por ejemplo, para 𝑁 = 64 tenemos que log2 64 = 6

bits, entonces si buscamos 2 posiciones con las propiedades explicadas encontramos la

posición 5 y 40. Si nos fijamos en su representación binaria se tiene que 5 = 000101 y que

40 = 101000. Esas dos posiciones cumplen el requisito mencionado de que disponen de la

misma lectura, si se leen en orden invertido, por lo tanto, esas dos posiciones

intercambiarán sus contenidos.

Una vez intercambiadas todas las posiciones necesarias, se aplicará las mariposas

correspondientes a cada etapa de la IFFT, dadas por las ecuaciones (30) y (31), a cada uno

de los vectores real e imaginario:

2𝑎 = 𝐴 + 𝐵𝑊𝑁−𝑡

𝑎 =𝐴 + 𝐵𝑊𝑁

−𝑡

2

Para finalizar el proceso IFFT, hay que multiplicar todas las posiciones del

vectorDadesReal[ ] por el valor N, que es el tamaño de la IFFT. Una vez realizada dicha

multiplicación, el vectorDadesReal[ ] ya contiene la señal expresada en el dominio del

tiempo.

Una vez acabado el proceso IFFT será necesario revertir el proceso Enfinestrar( ).

Page 63: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

63

CalcularInversFinestra( )

Para llevar a cabo el proceso de desenfinestrar( ) es necesario disponer de un vector que

contenga el inverso de la función ventana calculada. Este vector será el

vectorInvFinestra[_] y se calcula de la siguiente manera:

𝑣𝑒𝑐𝑡𝑜𝑟𝐼𝑛𝑣𝐹𝑖𝑛𝑒𝑠𝑡𝑟𝑎 𝑛 =1

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑖𝑛𝑒𝑠𝑡𝑟𝑎[𝑛]

Desenfinestrar( )

Cuándo se realizaba el proceso Enfinestrar( ), se multiplicaba el vectorDadesReal[ ] por el

vectorFinestra[ ] que contenía el valor de la ventana seleccionada por el usuario. Para

revertir este proceso, habrá que multiplicar el vectorDadesReal[ ] por el inverso de dicho

vector.

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 ·1

𝑣𝑒𝑐𝑡𝑜𝑟𝐹𝑖𝑛𝑒𝑠𝑡𝑟𝑎[𝑛] (61)

Ahora, una vez realizado el proceso Desenfinestrar( ), el vectorDadesReal[ ] ya contiene

la secuencia de voltajes a enviar al D/A.

Page 64: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

64

6.1.1.5 Etapa 5 - D/A

Esta etapa explica los procesos realizados al vectorDadesReal[ ] para enviar los valores

ecualizados y en voltios al convertidor D/A.

VectorDadesReal[ ]

Salida Etapa 4

CanviarEscala

( )

OmplirVectorDadesDA

( )

DeVectorABuffer

( )

EnviarDades()

D/A

VectorDadesReal[ ]

DadesDA[ ]Buffer Windows

Salidatarjeta

Figura 42. Diagrama de proceso de la etapa 6 del convertidor D/A

Antes de enviar al D/A la señal de salida es necesario someterla a un cambio de escala para

que ésta esté comprendida dentro del rango de valores del convertidor. Esto permitirá

garantizar que la señal de salida no sea recortada por el D/A y que ocupe el mayor rango

posible y así, aprovechar toda la resolución de 12 bits. La tarjeta USB-1208FS tiene un

rango de salida comprendido entre 0 V y 4,095 V.

CanviarEscala( )

La salida analógica del convertidor D/A de la tarjeta USB-1208FS es unipolar y con una

resolución de 12 bits. El rango de salida está comprendido entre 0 V a 4 V nominales

(4,095 V reales). Esto implica la realización de un traslado de nivel de la señal de salida

para que quede comprendida entre -2 V y +2V bipolares. Posteriormente, como ya se ha

explicado en el apartado 5.2 se dispone de una etapa acondicionadora a la salida para

eliminar la componente continua.

A parte, hay que tener en cuenta la limitación escogida por el usuario y esta venía dada en

dB. Es necesario convertir esos decibelios a Voltios, (ver ecuación (53)).

Finalmente, en el caso de la USB-1208FS, la operación para obtener el vectorDadesReal[ ]

en la escala correcta, es la siguiente:

𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 = 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 ·2,0

𝑙𝑖𝑚𝑖𝑡𝑎𝑐𝑖ó𝑛 𝑒𝑛 𝑉 (62)

En el caso de la USB-1208FS plus, al tener el rango de voltaje de salida comprendido entre

0 y 5V, habría que realizar la misma operación (62), pero modificando el valor 2,0 por 2,5.

Page 65: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

65

OmplirVectorDadesDA( )

En este caso hay que distinguir entre las dos tarjetas programadas:

USB-1208FS

Para evitar desbordamientos, inicialmente se realizará una comprobación de que los

valores de cada posición del vectorDadesReal[ ] están dentro del rango -2 V a +2V, de no

ser así, se procede a un recorte.

Como el convertidor D/A tiene una velocidad máxima de muestreo de 10.000

muestras/segundo, y dado que en el A/D muestrea a 40.000 muestras/segundo, se enviará

al D/A un valor de cada cuatro contenidos en el vectorDadesReal[ ] convertidos al código

correspondiente. Hay que tener en cuenta que el vector DadesDA[ ] es de un tamaño cuatro

veces inferior en número de puntos al vectorDadesReal[ ] y, además, es del tipo unsigned

short. El algoritmo (63) muestra el proceso de llenado del vector DadesDA[ ].

Para 𝑛 = 0 hasta 𝑛 < 𝑁 en intervalos de 𝑛 + 4:

𝐷𝑎𝑑𝑒𝑠𝐷𝐴 𝑛

4 = [2048 + 1024 · 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 ] (63)

El valor +2 V debe tener aproximadamente el código 4095 y el valor -2 V el código 0.

Todos los otros valores de voltaje estarán comprendidos dentro de este rango. En la

ecuación (63) aparece el valor 1024 multiplicando el vectorDadesReal[ ]. Ese valor es el

resultado de dividir 2048 por el máximo valor del rango que es 2.

USB-1208FS plus

A diferencia de su anterior versión, esta tarjeta permite operar a ambos convertidores (A/D

y D/A) a la misma velocidad de muestreo el A/D y el D/A, de hasta 50.000

muestras/segundo. Se pueden enviar todos los valores contenidos en el vectorDadesReal[],

aplicando anteriormente el cambio de escala explicado en CanviarEscala( ).

De la misma forma explicada en la USB-1208FS, para evitar desbordamientos,

inicialmente se realizará una comprobación y posible corrección de los valores de cada

posición del vectorDadesReal[ ] están dentro del rango -2,5 V a +2,5V.

El la ecuación (64) muestra el proceso de llenado del vector DadesDA[ ].

Para 𝑛 = 0 hasta 𝑛 < 𝑁:

𝐷𝑎𝑑𝑒𝑠𝐷𝐴 𝑛 = [2048 + 819 · 𝑣𝑒𝑐𝑡𝑜𝑟𝐷𝑎𝑑𝑒𝑠𝑅𝑒𝑎𝑙 𝑛 ] (64)

El vector de DadesDA[ ] tiene el mismo tamaño de puntos que el vectorDadesReal[ ], pero

hay que tener en cuenta que el vector DadesDA[ ] es del tipo unsigned short, y será

necesario convertir el tipo de dato del vectorDadesReal[ ].

Page 66: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

66

Por último el valor +2,5 V debe tener aproximadamente el código 4095 y el valor -2,5 V el

código 0. Por ese motivo aparece multiplicando al vectorDadesReal[n] el valor 819, que es

justamente el valor obtenido de dividir 2048 entre 2,5.

DeVectorABuffer( )

Una vez se ha llenado el vector DadesDA[n], hay que enviar los datos al buffer de

Windows, controlado con el método WinArrayToBuf(ushort[ ] dataArray, IntPtr

memHandle, int firstPoint, int numPoints).

En el caso de la USB-1208FS el parámetro int numPoints será 𝑁

4 y en el caso de la tarjeta

USB-1208FS plus, será 𝑁.

EnviarDades( )

Cuando ya se tiene listo el buffer, se procederá a enviar los datos por la tarjeta

correspondiente a la salida del canal 0. Este proceso se realiza con el método AOutScan():

AOutScan( int lowChan, int highChan, int numPoints, ref int rate, MccDaq.Range range,

int memHandle, MccDaq.ScanOptions options).

El parámetro int numPoints le pasa exactamente lo mismo que en el caso anterior

explicado DeVectorABuffer().

La explicación detallada de este método y de todos sus parámetros se puede encontrar en el

documento “Universal library help” de MccDaq.

DeslliurarMemoria( )

Para finalizar, cuando la conversión se ha realizado completamente, es necesario liberar la

memoria y resetear el puntero manejador de memoria memHandle. Para liberar la memoria

se utiliza el método de la biblioteca MccDaq WinbufFreeEx (int memHandle).

Page 67: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

67

6.1.2 Modo grabación

Este modo de funcionamiento permite al usuario registrar en un archivo las muestras

captadas por la tarjeta de adquisición de datos. Los archivos creados tendrán una estructura

y un formato propio con una extensión .grab. La información almacenada corresponderá a

la existente al finalizar la etapa 1, explicada en el Apartado 6.1.1.1.

Señal de entrada

FiltroAntialiasing

A/DCreación archivo.grab

ArchivoGuardado

PC

Figura 43. Diagrama de flujo general de los procesos del modo grabación

En la salida de la etapa 1 se obtenían los vectores vectorDadesReal[ ] y vectorDadesIm[ ].

El vectorDadesIm[ ], no se guardará ya que todos los valores que contiene son nulos. En la

Figura 43 se puede ver el diagrama de flujo del modo de grabación, donde la única

diferencia inicial con el modo directo, es que a la salida de la etapa 1 del convertidor A/D

se ha añadido la etapa de creación de archivos .grab.

Para poder procesar el archivo .grab en un futuro, hay que tener en cuenta ciertos

parámetros que serán incluidos en la cabecera del archivo .grab. Esos parámetros son: la

frecuencia de muestreo, el tiempo de grabación, el número de muestras y cada una de las

muestras.

La estructura interna del archivo .grab es la siguiente:

Posición Elemento guardado Valor

0 Frecuencia de muestreo

𝑓𝑚 40.000 o 50.000

1 Tiempo de grabación

𝑡𝑔𝑟𝑎𝑏 Entre 10 y 300

2 Número de muestras grabadas

𝑁𝑚 𝑡𝑔𝑟𝑎𝑏 · 𝑓𝑚 = 𝑁𝑚

3 Rango seleccionado A/D 1 (±1V), 2 (±1,25 V),…,

7 (±10 V)

4,5,…,𝑁𝑚 Muestras Valor de cada muestra

Tabla 14. Estructura interna de los archivos .grab

Al usuario se le mostrará un nombre por defecto para los archivos .grab que es Fitxer.grab.

Este nombre, si ya está siendo utilizado dentro de la carpeta raíz de los archivos .grab,

aparecerá como Fitxer1.grab y así sucesivamente. Este nombre es optativo, el usuario, lo

podrá borrar y escoger su propio nombre si así lo desea.

Page 68: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

68

Para crear y escribir los datos en el archivo .grab, se utiliza la función FileStream( ) y el

método BinaryWriter.

El tiempo de grabación es seleccionable por el usuario por medio de un trackBar, este está

limitado por programa con un tiempo mínimo de 10 segundos y un máximo de 5 segundos

(Figura 44).

Figura 44. Interfaz de usuario de la selección del tiempo de grabación.

Una vez seleccionado el tiempo de grabación, si se hace clic en el botón grabar, se procede

a capturar los datos recibidos por la tarjeta de adquisición de datos. Se informa al usuario

del estado de la grabación mediante una progressBar.

Figura 45. Información del estado de la grabación de un archivo .grab.

Una vez acabado el tiempo de grabación, se informa al usuario si desea guardar o no el

archivo. Si el usuario selecciona SÍ, aparece un cuadro de diálogo de Windows con los

procesos explicados al principio de este apartado. Si selecciona NO, se desechan los datos.

Page 69: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

69

6.1.3 Modo “procesar muestras grabadas”

Este modo de funcionamiento permite abrir y procesar la información previamente

guardada en los archivos .grab. Se permite escoger al usuario como desea reproducir el

nuevo archivo, si a través de la salida de la tarjeta de adquisición de datos o a través de los

altavoces internos del PC (Figura 46).

ArchivoGuardado

PC

CreaciónvectorDadesReal[ ]

A/DProcesadode la señal

Seleccióntipo de salida

Seleccióntipo de salida

D/AAdecuación

salidaAltavozExterno

Conversióna archivo

.wav

AltavozPC

Figura 46. Diagrama de flujo de los procesos del modo procesar muestras grabadas

En la etapa de selección del tipo de salida, si el usuario escoge la reproducción externa se

ejecutarán las etapas 4 y 5 del Apartado 6.1.1.1, en cambio, si el usuario escoge reproducir

el archivo utilizando la salida interna del PC (altavoz interno o salida de auricular), será

necesario crear un archivo WAVE previo.

Para volcar los datos del archivo .grab al vectorDadesReal[ ] se hace de forma análoga al

modo de grabación. En el modo de grabación se utilizaba la función FileStream( ) con el

método BinaryWriter, pero en este caso se utiliza el método BinaryReader. Hay que tener

en cuenta en el momento de leer los datos guardados que, en el método BinaryReader, hay

que especificar el tipo de dato (int16, int32, string…) que se va a leer cada vez, a

diferencia del método BinaryWriter, en el cual no hay que especificar el tipo de dato a

escribir.

Page 70: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

70

6.1.3.1 Creación de los archivos WAVE

Los ordenadores actuales aceptan y reproducen una amplia variedad de archivos de audio.

Aquí se ha optado por usar el formato WAVE (.wav) para mantener la calidad del sonido.

WAVE es un formato de audio digital sin compresión de datos desarrollados y propiedad

de Microsoft y de IBM.

La estructura de formato de un fichero .wav, está formado por dos grandes bloques: una

cabecera con las características del formato y las muestras de sonido. Esta información ha

sido obtenida del artículo [18] y es la siguiente:

Tamaño

Bytes Nombre Descripción Endian

4 ChunkID Contiene la palabra “RIFF” en ASCII big-endian

0x52494646 Big

4 ChunkSize Tamaño total del fichero en bytes menos 8 de los 2

campos iniciales Little

4 Format Contiene la palabra “WAVE” en ASCII big-endian

0x57415645 Big

4 Subchunk1ID Contiene la palabra “fmt “en ASCII big-endian

0x666d7420. Después de la t viene un espacio en blanco. Big

4 Subchunk1Size Tamaño del resto de Subchunk. 16 para PCM Little

2 AudioFormat Valor 1. Cualquier valor diferente a 1, indica algún tipo de

compresión. Little

2 NumChannels Mono = 1, Stereo = 2 Little

4 SampleRate 8.000, 40.000, 44.100, etc Little

4

ByteRate Número de bytes por segundo que debe reproducir/grabar

la tarjeta de sonido:

𝑆𝑎𝑚𝑝𝑙𝑒𝑅𝑎𝑡𝑒 · 𝑁𝑢𝑚𝐶𝑕𝑎𝑛𝑛𝑒𝑙𝑠 ·𝐵𝑖𝑡𝑠𝑃𝑒𝑟𝑆𝑎𝑚𝑝𝑙𝑒

8

Litlle

2

BlockAlign Número de bytes por captura:

𝑁𝑢𝑚𝑐𝑕𝑎𝑛𝑛𝑒𝑙𝑠 ·𝐵𝑖𝑡𝑠𝑃𝑒𝑟𝑆𝑎𝑚𝑝𝑙𝑒

8

Little

2 BitsPerSample Número de bits por muestra. 8 bits = 8, 16 bits = 16 Little

4 SubChunk2ID Contiene la palabra “data” en ASCII big-endian

0x64617461 Big

4

SubChunk2Size Número total de bytes que ocupan las muestras:

𝑁𝑢𝑚𝑆𝑎𝑚𝑝𝑙𝑒𝑠 · 𝑁𝑢𝑚𝐶𝑕𝑎𝑛𝑛𝑒𝑙𝑠 ·𝐵𝑖𝑡𝑠𝑃𝑒𝑟𝑆𝑎𝑚𝑝𝑙𝑒

8

Little

# Data Muestras de sonido Little

Tabla 15. Formato detallado de un archivo WAV del tipo non-PCM

En la Tabla 15 se puede ver que se habla del formato big-endian y little-endian. Para

entenderlo primero, de la misma manera que existen lenguajes que se escriben y se leen de

Page 71: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

71

derecha a izquierda, o de izquierda a derecha, en los ordenadores ocurre algo similar en la

lectura de los bits. El valor 25 escrito en hexadecimal de 2 bytes en formato big-endian

sería 0x32 0x35 y en little-endian 0x35 0x32. Para ver un ejemplo con más tamaño, por

ejemplo la palabra “hola” en big-endian se escribiría 0x68 0x6F 0x6C 0x61 y en little-

endian de derecha a izquierda, 0x61 0x6C 0x6F 0x68.

Big-endian es más similar a la forma natural de escritura manual de las personas y es el

utilizado por los procesadores y maquinas Apple, en cambio el formato little-endian es el

utilizado por la mayoría de procesadores Intel.

52 49 46 46 24 04 00 00 57 41 56 45 66 6d 74 20

R I F F 1024+36 W A V E f m t

ChunkID ChunkSize Format Subchunk1ID

10 00 00 00 01 00 01 00 40 9c 00 00 88 38 01 00

16 PCM Mono 40.000 Hz 80.000

Subchunk1Size AudioFormat NumChannels SampleRate ByteRate

02 00 10 00 64 61 74 61 00 40 00 00

2 16 d a t a 1024

BlockAlign BitsPerSample SubChunk2ID SubChunk2Size

00 23 a6 f2 16 3c e7 11 25 f2 ac 23 1b 5a cc 11

M1 M2 M3 M4 M5 M6 M7 M8

Data (mono)

Tabla 16. Ejemplo de los 60 primeros bytes detallados de un archivo WAVE. Los 44 primeros bytes son la cabecera

Una vez conocida la estructura interna de los archivos WAVE, ya se pueden escribir todos

los datos que se pueden ver en el ejemplo de la Tabla 16 en archivo .wav, utilizando los

métodos que incorpora la función FileStream ( ), ya comentados en los Apartados 6.1.2 y

6.1.3.

Page 72: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.1 Modos de operación

72

6.1.3.2 Reproducción de los archivos WAVE

Para reproducir los archivos .wav se hace uso de las funciones de la librería de Windows

WMPLib (Windows Media Player Library). La librería Media, también permite reproducir

los archivos .wav, pero no dispone de tantas funciones de control sobre el archivo a

reproducir.

Las opciones de control aplicadas y utilizadas sobre los archivos .wav son las siguientes:

controls.play( ): permite que el archivo de sonido empiece a reproducirse o que

reanude su reproducción en caso de ser pausado.

controls.pause( ): permite pausar la reproducción del archivo de sonido.

controls.stop( ): permite parar la reproducción del archivo de sonido y a su vez

resetear la variable interna currentPosition.

controls.currentPosition( ): devuelve la posición actual de reproducción del

archivo de sonido, en segundos. El valor currentPosition permitirá llevar a cabo

una barra de estado de reproducción, y así informar al usuario del estado actual de

la reproducción del archivo de sonido.

controls.currentItem.duration( ): devuelve el valor de la duración del archivo de

sonido a reproducir en segundos. Este valor es necesario para poder visualizar

correctamente la barra de estado de reproducción y que la duración del archivo de

sonido se adecúe a la barra de estado de reproducción.

6.1.4 Modo ecualización en diferido

Este modo de funcionamiento está compuesto por los mismos procesos y etapas del modo

directo explicado en el apartado 6.1.1.1, con lo cual, no se repetirá la explicación de los

procesos y etapas.

La única diferencia con el modo directo radica en que no se limitará la selección de puntos

de la FFT. En el modo directo se limitaba a un máximo de 1024 puntos, pero en el modo

en diferido se podrá seleccionar hasta un máximo de 8192 puntos de FFT.

Para entender el por qué de este modo de funcionamiento, imaginemos que se desea

reproducir y ecualizar el sonido que se obtiene de la salida de auricular de un teléfono

móvil. El sonido obtenido del teléfono móvil no será escuchado por el usuario antes de ser

ecualizado, como consecuencia, no aparecerá el efecto eco causado por el tiempo requerido

para procesar el archivo de sonido. Esto permitirá poder seleccionar, si se desea, la FFT

con más puntos y obtener una ecualización de mayor calidad.

Page 73: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

73

6.2 Diseño y funcionamiento ecualizadores

El diseño desarrollado trata de emular los ecualizadores hardware que existen en el

mercado. La manipulación de las diferentes ganancias se va a llevar a cabo mediante

TrackBars verticales emulando los faders de las mesas de mezclas.

Como se puede ver en la Figura 43, cada TrackBar hace referencia a una banda de

frecuencias. La ganancia por defecto es de 0 dB, permitiendo un máximo de ±12 dB en

incrementos de ±1 dB. Cada TrackBar controla una variable global con la ganancia de

cada banda de frecuencia, que se actualizará en el momento que se desplace el TrackBar.

Señal de entrada

FiltroAntialiasing

A/DCreación archivo.grab

ArchivoGuardado

PC

Figura 43. Diagrama de flujo general de los procesos del modo grabación

El usuario puede guardar las ecualizaciones realizadas para volver a cargarlas en un futuro

o para tener un banco de ecualizaciones por estilo y/o instrumento.

Los archivos con las posiciones de ecualización de los TrackBar se guardarán con un

formato propio; .eq1 si se trata del ecualizador de una octava, .eq2 en el caso del

ecualizador de tercio de octava y, .eq3 para el ecualizador paramétrico. Se utilizará un

cuadro de diálogo, permitiendo nombrar el archivo. Internamente guardará los valores

como integer.

La estructura interna del archivo .eq1es la siguiente:

Posición Elemento guardado Valor

0 Ecualizador 1

1 Valor limitador Entre -80 y 20

2 Ganancia global ± 12

3,4,..,12 Ganancias de las bandas ±12

Tabla 17. Estructura interna del archivo .eq1

La posición inicial del archivo .eq1 puede contener los valores 1, 2 o 3. Estos valores

hacen referencia al tipo de ecualizador que corresponde a este archivo. Es una medida de

seguridad para evitar que el usuario modifique manualmente el formato .eq1 e intente abrir

el archivo con otro ecualizador. Antes de cargar un archivo .eq1 se comprobará esta

posición y si su valor no concuerda con el ecualizador a utilizar, aparecerá un mensaje de

error.

Page 74: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.2 Diseño y funcionamiento de los ecualizadores

74

A continuación se muestra la estructura interna de los archivos .eq2 y .eq3:

Posición Elemento guardado Valor

0 Ecualizador 2

1 Valor limitador Entre -80 y 20

2 Ganancia global ± 12

3 Corte bajas frecuencias Entre 20 y 400

4 Corte altas frecuencias Entre 4 k y 20 k

5,6,..,35 Ganancias de las bandas ±12

Tabla 18. Estructura interna del archivo .eq2

Posición Elemento guardado Valor

0 Ecualizador 3

1 Valor limitador Entre -80 y 20

2 Ganancia global ± 12

3 Corte bajas frecuencias Entre 20 y 400

4 Corte altas frecuencias Entre 4 k y 20 k

5 Ganancia bajas frecuencias ± 12

6 Ganancia medias-bajas frecuencias ± 12

7 Ganancia medias-altas frecuencias ± 12

8 Ganancia altas frecuencias ± 12

9 𝑓𝑐 bajas frecuencias Entre 20 y 250

10 𝑓𝑐 medias bajas frecuencias Entre 250 y 2 k

11 𝑓𝑐 medias-altas frecuencias Entre 2 k y 4 k

12 𝑓𝑐 altas frecuencias Entre 4 k y 16 k

13 𝐵𝑊 bajas frecuencias Entre 0 y 230

14 𝐵𝑊 medias bajas frecuencias Entre 0 y 1750

15 𝐵𝑊 medias-altas frecuencias Entre 0 y 2 k

16 𝐵𝑊 altas frecuencias Entre 0 y 12 k

Tabla 19. Estructura interna del archivo .eq3

Debido a que los ecualizadores de tercio de octava y paramétrico tienen una cantidad

elevada de faders, se ha implementado un botón de reset que devuelve a todos los

elementos del ecualizador a su posición inicial para facilitar el trabajo al usuario.

Page 75: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

75

Figura 47. Diseño gráfico implementado del ecualizador de octava

Figura 48. Diseño gráfico implementado del ecualizador de tercio de octava

Page 76: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.2 Diseño y funcionamiento de los ecualizadores

76

Figura 49. Diseño gráfico implementado del ecualizador paramétrico

En las Figuras 47, 48 y 49 se muestra como es el diseño final implementado para cada uno

de los ecualizadores.

Para crear y escribir los datos en los archivos .eq1, .eq2 y .eq3 se utiliza la función

FileStream( ) y los métodos BinaryWriter y BinaryReader, ya comentados en los

Apartados 6.1.2 y 6.1.3.

De la misma forma que se ha explicado en el Apartado 6.1.2, al usuario le aparecerá un

nombre por defecto para cada uno de los archivos ecualización: EqOctava.eq1,

EqTerçOctava.eq2 y EqParametric.eq3. Si este nombre ya existe dentro de la carpeta del

ecualizador en cuestión, automáticamente le aparecerá el mismo nombre con un subíndice

superior al existente (EqOctava1.eq1, EqOctava2.eq1, etc).

El funcionamiento del botón EQ OK es simple, cuando el usuario hace clic en él, se

modifican los valores de las variables globales que contienen las ganancias de las octavas.

Una vez actualizados los valores, el ecualizador se cierra.

El botón EQ RESET devuelve los valores de los faders al estado inicial. Esta funcionalidad

solo aparece en el ecualizador de tercio de octava y en el paramétrico, debido a la gran

cantidad de faders existentes.

Page 77: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

77

6.3 Creación de las carpetas del proyecto

El proyecto desarrollado trabaja con diferentes archivos que tienen una extensión propia.

Las extensiones de los archivos creados son las siguientes: .eq1, .eq2, .eq3, .grab y .wav.

Para poder almacenar correctamente estos archivos, se crea una carpeta llamada

EqualitzadorFFT, que a su vez contiene cinco subcarpetas.

Cada uno de los archivos nombrados se guarda en una subcarpeta diferente. En la Tabla

20 se muestra el nombre de las subcarpetas y los archivos que contiene cada una:

Nombre de la

carpeta principal

Variable string

contenedora de la

ruta

Nombre de la

subcarpeta

Variable

string

contenedora

de la ruta

Extensión de

los archivos

EqualitzadorFFT carpetaProjecte

Eq Octava subCarpeta1 .eq1

Eq terç Octava subCarpeta2 .eq2

Eq parametric subCarpeta3 .eq3

Arxius grab subCarpeta4 .grab

Arxius wav subCarpeta5 .wav

Tabla 20. Nombre de la carpeta principal, subcarpetas y extensión de los ficheros que contienen.

Al ejecutar por primera vez el programa EqualitzadorFFT, si se realice la instancia LOAD,

se comprueba si en la carpeta mis documentos existe la carpeta EqualitzadorFFT y sus

subcarpetas. Si alguna de las carpetas mencionadas no existe, se crea.

Cada ordenador tiene un usuario diferente y cada versión del sistema operativo de

Windows puede tener una ruta diferente de la carpeta mis documentos. Para poder adquirir

esta ruta en cualquier ordenador se utilizará el método GetFolderPath( ) de la carpeta

SpecialFolder.MyDocuments.

Una vez adquirida la ruta a la carpeta mis documentos y, creadas las variables del tipo

string que contendrán las rutas a la carpeta EqualitzadorFFT y sus subcarpetas (ver Tabla

20), se utilizará el método PathCombine( ), para combinar y crear cada una de las rutas. A

continuación se muestra el ejemplo para combinar y crear la ruta a la subCarpeta1:

subCarpeta1 = Path.Combine(carpetaProjecte, "Eq Octava");

Para comprobar si no existe alguna de las carpetas y poder crearla, se utilizán los métodos

Directoy.Exists( ) y Directory.CreateDirectory( ).

Page 78: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.4 Diseño y funcionamiento de la barra de menús

78

6.4 Diseño y funcionamiento de la barra de menús

La interacción inicial con el usuario se lleva a cabo por medio de una barra de menús en la

que le aparecen todas las opciones (ver Figura 50). Se ha seguido la misma línea de

interfaz que el proyecto [24], para aprovechar al máximo el trabajo ya realizado.

Debido a que el tamaño y complejidad de este proyecto es elevado, se ha optado por

distribuir el proyecto en diferentes formularios. Se dispone de un formulario padre

(Form1) el cual contendrá múltiples formularios hijos. Toda la información de trabajo

entre formularios ha sido obtenida del libro [1] que se puede consultar en el capítulo

bibliografía.

Figura 50. Barra de menús principal del programa

Distribuir el proyecto en diferentes formularios ha permitido estructurar mejor el programa

y trabajar individualmente en cada una de sus partes. Cada formulario hijo es un

subprograma que se ha programado y probado individualmente. Por ejemplo, cada

ecualizador es un formulario hijo diferente, este es llamado una vez que el usuario hace

clic en el botón Equalitzador de la barra de menús (Figura 49). Los formularios hijos de

los ecualizadores son: FormFill_EqUnaOctava, FormFill_Eq_1DIV3_Octava y

FormFill_Eq_Parametric. Cada uno de estos formularios se cierra cuando se hace clic en

el botón EQ OK.

Figura 51. Desplegable del menú Equalitzador donde se puede visualizar los tres tipos de ecualizadores a seleccionar.

Los menús desplegables con múltiples opciones son las siguientes:

Equalitzador: permite seleccionar uno de los tres ecualizadores implementados

(Figura 51). Cuando se hace clic en el tipo de ecualizador, se abre el ecualizador en

cuestión.

Finestra: permite seleccionar una de las cuatro funciones ventana: Rectangular,

Hanning, Kaiser-Bessel o Flat top.

Num_Punts FFT: permite seleccionar el número de puntos de cálculo de la FFT y

la IFFT, seleccionables entre: 128, 256, 512, 1024, 2048, 4096, 8192.

Page 79: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

79

Mostres / segon: permite seleccionar la frecuencia de muestreo de la tarjeta de

adquisición de datos independientemente del modelo: 40.000 muestras/segundo o

50.000 muestras/segundo.

Fons d’escala ADC: permite seleccionar el rango de escala del convertidor A/D.

Los rangos a seleccionar son: ±1 V, ±1,25 V, ±2 V, ±2,5 V, ±4 V, ±5 V y ±10 V.

Tarjeta: permite seleccionar una de las dos tarjetas de adquisición de datos, la

USB-1208FS y su evolución USB-1208FSplus. Se ha añadido una tercera opción

Treballar sense tarjeta, para llevar a cabo las pruebas matemáticas.

Visualitzar_Espectre: permite seleccionar al usuario si desea visualizar el espectro

de la señal o no.

Espectre: Si el usuario ha seleccionado la opción representar el espectro, este

menú desplegable da la opción de seleccionar el tipo de escala del eje X: lineal o

logarítmica.

A parte de los menús desplegables, las otras opciones visibles en la Figura 48 son las

siguientes:

Grabar: cuando se hace clic en la opción Grabar, se abre el formulario

Arxius_grab que es el encargado de controlar la grabación de los archivos .grab

entrantes por la tarjeta de adquisición de datos. Este formulario realiza los procesos

explicados en el Apartado 6.1.2.

Reproduïr: al hacer clic en la opción Reproduïr se abre un cuadro de diálogo que

permite al usuario seleccionar el archivo .grab. A este se le aplica la ecualización

con los parámetros seleccionados en la barra de menús, y se reproduce por la tarjeta

de adquisición de datos.

Directe: primero de todo, esta opción solamente está habilitada si se tiene

seleccionado en el menú Tarjetes, la opción USB-1208FS plus o Treballar sense

tarjeta. Cuando se hace clic en la opción Directe, se aplican todas las opciones

seleccionadas en los diferentes desplegables de la barra de menús y, se ecualiza en

tiempo real la señal que entra por la tarjeta de adquisición de datos seleccionada.

Fitxers_Wav: cuando el usuario hace clic en esta opción del menú, se abre el

formulario Grabar_audio que es el encargado de crear y reproducir los archivos

.wav. Si se hace clic en Crear WAVE, aparece un cuadro de diálogo donde se le

permite escoger el archivo .grab a procesar y convertir en archivo .wav. Los

parámetros de ecualización seleccionados en ese momento, son los que se aplicarán

al archivo .grab. Con los diferentes botones Play, Continuar, Pause, y Stop, se

controlará la reproducción de los archivos .wav.

Pausa: está opción solo está habilitada cuando se está ejecutando el modo Directe.

Como la palabra indica, pausa todos los procesos.

Page 80: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.5 Diseño y funcionamiento de los gráficos

80

Continuar: como la opción Pausa, solo está habilitada cuando se está ejecutando

el modo Directe. Está opción permite reanudar los procesos pausados en la opción

Pausa.

Parar: está opción detiene cualquier proceso que se esté llevando a cabo,

devolviendo el programa a su estado inicial.

6.5 Diseño y funcionamiento de los gráficos

Ya se ha mencionado, este proyecto parte de la base y utiliza parte del proyecto [24]. En

ese proyecto, se implementó la representación gráfica del espectro de la señal, la cual se va

a utilizar y mejorar para este proyecto. A parte, se implementan otros gráficos que se

explican a continuación.

Al usuario se le permitirá escoger si desea representar o no el espectro de la señal. Esta

acción, no se requiere para llevar a cabo la ecualización, pero puede ser muy útil al usuario

dado que aporta gran cantidad de información. Por ejemplo, si nuestro oído no es capaz de

identificar qué frecuencias resultan molestas, visualmente sí que es posible.

Otra modificación añadida a la representación del espectro de la señal es la escala del eje

de frecuencias. Esta podrá ser seleccionada como lineal (tal y como estaba en el proyecto

[24]) o logarítmica. Se ha añadido esta opción debido a que la escala logarítmica permite

visualizar más componentes de las frecuencias graves y medias, a diferencia de la escala

lineal que quedan más “apretadas”.

En el proyecto [24] se podían escoger las unidades de magnitud, pero en este proyecto

están fijadas en dBV.

Si el usuario ha escogido dibujar el espectro, se visualizará en rojo el espectro de la señal

sin ecualizar y en verde el espectro de la señal ecualizada.

Un punto a tener en cuenta es que cada uno de los ecualizadores, una vez realizada la

ecualización y pulsado el botón EQ OK, se cierran. Entonces el usuario ya no puede

visualizar la ecualización que ha realizado. Se ha implementado así para liberar espacio en

la pantalla. Como esto supone un problema y es interesante y necesario, a veces, visualizar

la ecualización realizada, se ha dividido la pantalla del cliente en dos partes. En la mitad

superior, si el usuario ha escogido visualizar el espectro, éste será representado y, en la

mitad inferior, se representará un gráfico con la ecualización realizada por el usuario.

Hay que diferenciar tres tipos de gráficos a visualizar en la mitad inferior de la pantalla del

cliente, que dependerán del tipo de ecualizador seleccionado.

Las variables globales que contienen las ecualizaciones se escribirán en orden en el

vectorEqualització[ ], que será de diferente tamaño dependiendo del ecualizador

seleccionado. La ecualización realizada se representará con el color azul, en el caso de los

ecualizadores de octava (Figura 52) y tercio de octava (Figura 53). En el caso de la

representación de la ecualización paramétrica se utilizará el color rojo para las bajas-

frecuencias, el verde para las medias-bajas frecuencias, el color azul para las medias-altas

frecuencias y el color marrón para las altas frecuencias (Figura 54).

Page 81: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6 Software

81

Figura 52. Representación gráfica de la ecualización escogida por el usuario en el ecualizador de octava.

En la Figura 52 se puede ver un ejemplo de la ecualización realizada por el usuario en el

filtro de 10 octavas. En la misma pantalla también se proporciona la información de las

variables globales ganancia global y limitación. La ecualización escogida por el usuario en

el ejemplo es alternar +10 dB y -10 dB en cada octava. También se puede ver como las

frecuencias inferiores a 20 Hz y las superiores a 20 kHz quedan eliminadas. Los ejes X de

la representación gráfica de la ecualización de octava y tercio de octava se han fijado en

escala lineal.

Figura 53. Representación gráfica de la ecualización escogida por el usuario en el ecualizador de tercio de octava.

Page 82: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

6.5 Diseño y funcionamiento de los gráficos

82

En la Figura 53 se muestra un ejemplo de la representación gráfica de la ecualización

escogida por el usuario en el ecualizador de tercio de octava. En la parte inferior del

gráfico, se le proporciona al usuario la información de las variables globales ganancia

global, limitación, frecuencia de corte inferior y frecuencia de corte superior. La

ecualización escogida es en forma de escalera para cada banda de tercio de octava (+4 db,

+8 dB, +10 dB, -4 dB, -8 dB, -10 dB). También aparece representado correctamente los

cortes a 20 Hz y 20 kHz.

Figura 54. Representación gráfica de la ecualización escogida por el usuario en el ecualizador paramétrico.

En la Figura 54 se puede apreciar un cambio significativo en la escala del eje X. En la

representación gráfica de los otros dos ecualizadores, el eje X era lineal y, en el

ecualizador paramétrico se ha dibujado logarítmica. Ocurre exactamente lo mismo que en

el caso de la representación del espectro de la señal. La representación logarítmica permite

distribuir las octavas de tal manera que se da importancia a los 4 rangos tonales del

ecualizador paramétrico. Como ya ocurría en los otros dos ecualizadores, en la parte

inferior aparece la información de las variables globales.

Page 83: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

7 Pruebas y verificaciones

83

7 Pruebas y verificaciones

El beneficio de trabajar con diferentes formularios y, estos ser llamados dentro de un

formulario padre, ha sido poder verificar por separado cada una de las partes del proyecto.

Se han implementado y comprobado cada parte por separado y, una vez verificadas, se han

incorporado al programa principal. Las pruebas y verificaciones realizadas son las

siguientes:

7.1 Correcto funcionamiento de los archivos WAVE

Para verificar la creación de los archivos WAVE, se ha desarrollado un programa a parte

nombrado Grabador_audio, el cual permite crear un sonido de diez segundos con la nota

(frecuencia) deseada por el usuario. En la Figura 55, se puede visualizar el diseño gráfico

desarrollado.

Figura 55. Interfaz de usuario del programa Grabador_audio.

Una vez explicadas las funciones para reproducir e interactuar con los archivos de sonido

(Apartado 6.1.3), se crea una función sinusoidal que contendrá los valores del sonido, de la

siguiente manera:

Desde 𝑛 = 0 hasta 𝑛 < 𝑛º 𝑚𝑢𝑒𝑠𝑡𝑟𝑎𝑠:

vectorDadesReal n = 1 + sin 2𝜋

𝑓𝑚𝑢𝑒𝑠𝑡𝑟𝑜· 𝑓𝑛𝑜𝑡𝑎 · 𝑛 (65)

𝑓𝑛𝑜𝑡𝑎 es la frecuencia escogida por el usuario, por ejemplo, 440 Hz (nota La). A la función

seno, como se puede ver en la ecuación (65), se le suma 1, ¿Por qué? Eso es debido a que

los datos de los archivos WAVE no pueden contener valores negativos. La función seno

ondula entre ±1, entonces hay que desplazarla realizando un offset de +1, consiguiendo

que la señal oscile entre +2 y 0. Si se reprodujera actualmente el vectorDadesReal[n] no se

escucharía nada, así que se implementa una variable Volum que aplicará un desplazamiento

a cada posición del vectorDadesReal[n].

Una vez creado y reproducido el sonido, utilizando un medidor externo (afinador), se ha

comprobado que la nota escogida fuera exactamente la escuchada.

Page 84: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

7.2 Verificación de la IFFT

84

7.2 Verificación de la IFFT

De la misma manera que en el proyecto [24] se implementó una prueba para verificar la

FFT, en este proyecto se ha realizado la verificación de la IFFT, partiendo de la base del

programa ProvaFFT del proyecto [24]. Se ha creado un programa (Prova_IFFT) que

calcula la IFFT de una señal en el dominio de la frecuencia y obtiene la señal en el dominio

del tiempo.

Cuando se ejecuta el programa y el usuario pulsa el botón IFFT, en la pantalla aparecen las

32 muestras de la señal en el dominio del tiempo duplicadas. En cada pareja, el primer

valor es el calculado utilizando la IFFT implementada y, el segundo valor es el calculado

matemáticamente en el dominio del tiempo de la señal. Se puede ver en la Figura 56 como

los dos valores son prácticamente iguales y con una diferencia despreciable debido a los

errores de aproximación.

Figura 56. Resultados obtenidos de la Prova_IFFT. Se demuestra el correcto funcionamiento del cálculo de la IFFT.

Page 85: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

8 Posibles mejoras futuras

85

8 Posibles mejoras futuras

El ecualizador realizado en este proyecto es completamente funcional, pero con

limitaciones (Apartado 5.1.5) debido a la tarjeta de adquisición de datos USB-1208FS.

Una de las mejoras y que además ya ha sido implementada en el código del programa sería

la utilización de la nueva versión de la USB-1208FS, la USB-1208FS plus. Las mejoras de

la tarjeta ya han sido explicadas en el Apartado 5.1.6.

Efectos digitales

Una posible mejora sería ampliar la funcionalidad del ecualizador incluyendo algún

efecto. Los efectos que se podrían incluir son:

Compresor: en esencia, es un control de volumen automático. El compresor se

encarga de reducir el nivel de la señal cuando ésta se eleva en exceso, superando

los parámetros seleccionados por el usuario. Principalmente se utiliza en las voces,

batería (o cualquier instrumento de percusión) y bajo. Un ejemplo sería la voz de

un cantante durante un concierto. En el momento álgido de una canción, el cantante

puede llegar a cantar más fuerte que en otras partes. Mediante un compresor se

reduce la intensidad de las partes fuertes nivelando la voz en toda la canción.

Delay: como su nombre inglés indica, el efecto delay es añadir un retraso a la

misma señal de salida. Esto proporcionaría un efecto de eco sobre la señal

ecualizada a la salida. Es un efecto muy utilizado, sobre todo por las guitarras para

realizar un solo.

Hay una infinidad de efectos en el mundo digital del sonido, que se podrían implementar y

así ampliar la funcionalidad del proyecto. No obstante, los dos mencionados se podrían

implementar fácilmente.

Otra mejora que se podría realizar en un futuro es la realización de un ecualizador

paragráfico de dibujo. Para realizar la ecualización habría que dibujar por puntos la

ecualización deseada encima del espectro de la señal. El dibujo realizado se traduciría en

ganancias a cada una de las bandas de frecuencias.

Paralelización de procesos

Se podría mejorar el tiempo de computación de la FFT y la IFFT paralelizando el cálculo

del bucle for principal. Paralelizar significa dividir una tarea y repartirla entre los

diferentes procesadores (si están disponibles). Hay funciones especificas en C# como

Parallel.For que permiten realizar esta acción, pero hay que tener en cuenta que si se

modifican variables globales dentro del Parallel.For, estas se sobrescribirían obteniendo

un valor erróneo. Para solucionar este problema existen varias soluciones como por

ejemplo, crear una instancia dentro del Parallel.For, consiguiendo así que la variable no se

sobre escriba en la otra subdivisión del proceso (en los diferentes hilos). Otra solución

sería crear una matriz para cada hilo, modificando el valor de cada matriz local y, al acabar

el Parallel.For, agregar los resultados de cada matriz local a la matriz global.

Si realizar un Parallel.For acorta el tiempo de cálculo de un programa, ¿por qué no

realizar todos los bucles for paralelos? Porque eso no se cumple en todos los casos. En

Page 86: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

8 Posibles mejoras futuras

86

muchas ocasiones no se va a obtener ningún rendimiento en paralelizar un bucle, por

ejemplo, si se trata de bucles pequeños, se tardará más tiempo en dividir las tareas en los

diferentes hilos y procesarlos, que en realizar un bucle for no paralelo. Existe otro motivo:

no siempre se puede paralelizar un algoritmo.

Opción preguntas frecuentes (FAQ)

Debido al tamaño que ha adquirido el programa y a la gran cantidad de opciones que

dispone el usuario para seleccionar, el programa puede, en un principio, aparentar de uso

complejo. Si el usuario no ha trabajado anteriormente con algún ecualizador o no conoce el

lenguaje específico utilizado, puede perderse dentro de la gran variedad de parámetros a

controlar. Para ayudar al usuario, se podría implementar un glosario de preguntas

frecuentes, dando respuesta a todas las cuestiones que se pueden plantear.

Selección de idioma

Para ampliar la funcionalidad del programa, se podría realizar una selección de idioma,

para ampliar el rango de usuarios de utilización del mismo. Siguiendo el proyecto [24] el

idioma del programa ha sido catalán, pero a través de una selección en la barra de menús se

podría modificar el idioma de todas las etiquetas dando a escoger entre catalán, castellano

e inglés.

Page 87: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

9 Conclusiones

87

9 Conclusiones

Primero de todo, me gustaría decir que el proyecto ha superado todas mis expectativas.

Inicialmente se planteó desarrollar un ecualizador de sonido de 10 octavas, utilizando los

procesos FFT e IFFT, que transforman entre los dominios temporales y frecuenciales y

posibilitan alterar las magnitudes asociadas a frecuencias específicas. El presente proyecto

es una continuación de otro [24] y hace uso del mismo hardware: PC y tarjeta de

adquisición de datos.

Ha sido necesario estudiar el funcionamiento de la tarjeta de adquisición de datos USB-

1208FS. Para ello, he consultado los manuales del fabricante, las librerías internas y

realizado los ejemplos que incorpora el disco de instalación de la tarjeta. Gracias a esto, he

logrado expandir mis conocimientos y aprender a programar convertidores A/D y D/A.

Los conocimientos adquiridos de programación en C durante la carrera, me han ayudado a

asimilar y aprender más rápidamente a programar con el lenguaje C#. Nunca antes había

realizado aplicaciones de Windows por objetos, así que, he tenido que dedicar una gran

parte del tiempo de este proyecto, a la búsqueda de información para asimilar, entender y

saber utilizar todo el abanico de posibilidades que permite el programa Visual Studio.

Como se puede ver en la memoria de este proyecto, he desarrollado más aspectos de los

que inicialmente se habían planteado. He realizado dos ecualizadores adicionales que

permiten un mayor control de la ecualización del sonido con el consiguiente incremento de

la complejidad del proyecto.

Como se trabaja con el PC para procesar la señal, parece coherente, reproducir la señal de

audio ecualizada por los altavoces del ordenador. Para poder realizarlo he tenido que

aprender a usar los archivos de audio de Windows (WAVE).

Los archivos del tipo WAVE no han sido los únicos creados por este proyecto, también se

han desarrollado formatos propios para guardar los parámetros de ecualización de cada uno

de los ecualizadores o para grabar sonidos introducidos por el usuario. Otro aspecto clave,

al que se ha dedicado mucho tiempo, es el desarrollo de la interface de usuario. El

propósito perseguido ha sido facilitar el uso de los recursos generados, ofreciendo una

imagen similar a la de otros productos comerciales.

En definitiva, creo que he cumplido los objetivos marcados, realizando un proyecto muy

completo y complejo. Ello ha requerido dedicar muchas más horas de las que especifican

los créditos del Proyecto Final de Grado.

Page 88: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

10 Bibliografía

88

10 Bibliografía

[1] Enciclopedia de Microsoft. Visual C#. Interfaces gráficas y aplicaciones para Internet

con Windows Forms y ASP.NET. Cuarta edición

Fco. Javier Ceballos

Editorial Ra-Ma

[2] Digital signal processing

Alan V. Oppenheim & Ronald W. Schafer

Editorial Prentice-Hall, 1975

[3] The Scientist and Engineer’s Guide to Digital Signal Processing. Second edition

Steven W. Smith

California Technical Publishing 1999

[4] Four Ways to Compute an Inverse FFT Using the Forward FFT Algorithm

Rick Lyons, July 7, 2015

https://www.dsprelated.com/showarticle/800.php

[5] El tratamiento del sonido a través de un lenguaje de programación

Jesus Bernal, Pedro Gómez y Jesús Bobadilla

Universidad Politécnica de Madrid

[6] Análisis Espectral 1: Transformada Corta de Fourier y Ventanas

Juan-Pablo Cáceres

CCRMA Stanford University, Agosto 2007

[7] Filtro Antialiasing

Emmanuel Jesús Delgado, Victoria F. Rejala & Pablo R. Narvaez

Universidad católica de Salta, Ciudad de Salta, 2015

[8] Guidelines for community noise

Edited by Birgitta Berglund, Thomas Lindvall & Dietrich H. Schwela

World Health Organization, 1999

[9] Numerical recipes in C: The art of scientific computing. Chapter 12 Fast Fourier

Transform

Cambridge University Press, 1988-1992

[10] Fourier Transforms and the Fast Fourier Transform (FFT) Algorithm

Paul Heckbert

Feb. 1995 – Revised 27 Jan. 1998

[11] USB-1208FS User’s Guide

Measurement Computing

Agosto 2004

[12] Universal Library Help

Measurement Computing, Setiembre 2015

www.mccdaq.com/pdfs/manuals

Page 89: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

10 Bibliografía

89

[13] Comprender FFTs y Funciones Ventana

Marzo 30, 2017

http://www.ni.com/white-paper/4844/es/

[14] An FFT in C#

Gerry Beauregard

https://gerrybeauregard.wordpress.com/2011/04/01/an-fft-in-C/

[15] Procesamiento de señales analógicas y digitales, segunda edición

Ashok Ambardar

Thomson Editores 2002

[16] Tratamiento digital de señales, Cuarta edición

John G. Proakis, Dimitris G. Manolakis

Editorial Prentice Hall

[17] Vibration Testing: Theory and Practice, Second edition

Kenneth G. McConnell, Paulo S. Varoto

Editorial Wiley

[18] WAVE PCM soundfile format

Scott Wilson

CCRMA Stanford University, Jan 20, 2003

https://web.archive.org/web/20040317073101/http://ccrma-

www.stanford.edu/courses/422/projects/WaveFormat/

[19] Ecualizadores

Federico Miyara

Universidad Nacional de Rosario, Junio 2006

[20] Acústica y Sistemas de Sonido

Federico Miyara

Universidad Nacional de Rosario, 1999

[21] Acústica y fundamentos del sonido

Juan Gabriel Cabrera Ortiz & Milton Eduardo Salgado

Universidad Nacional Abierta y a Distancia, Bogotá 2010

[22] Ecualizadores

Pablo Rabinovich

Instituto de Sonido Orion

[23] Curso Ecualizadores

Universitat Politècnica de València, 2015

http://www.upv.es/

[24] El PC com a analitzador d’espectres en temps real, utilitzant la tarjeta USB-1208FS

Albert Porta Torell y dirigido por Esteban del Castillo Perez

Proyecte final de carrera Universitat Rovira y Virgili, 2015

Page 90: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

11 Presupuesto

90

11 Presupuesto

Para la realización del presupuesto, se supone que este proyecto ha sido una petición

laboral de la Universidad Rovira y Virgili. No se tiene en cuenta el precio de la tarjeta de

adquisición de datos ni los elementos hardware necesarios para la adecuación de las

señales. Se supone que la universidad ha facilitado todo ese material.

Coste de la mano de obra

En este apartado se contabilizan el cómputo total de horas invertidas para el desarrollo del

software. El precio unitario de la hora del programador ha sido establecida a 30 €, IVA no

incluido. Finalmente habrá que aplicar el 21 % de IVA establecido por la ley.

Concepto Cantidad Precio

Unitario Precio

Horas

programador

260 30,00 € 7.800,00 €

21 % IVA 1.638,00€

Precio

total 9.438,00 €

Tabla 21. Coste de la mano de obra

El importe total del proyecto asciende a la cantidad de NUEVE MIL CUATROCIENTOS

TRENTA Y OCHO euros.

Coste de la licencia

Si se espera vender un total de 150 licencias en un año, el precio final de una sola licencia

debería ser:

𝐶𝑜𝑠𝑡𝑒 𝑑𝑒 𝑑𝑒𝑠𝑎𝑟𝑟𝑜𝑙𝑙𝑜 9438,00 €

150 𝑙𝑖𝑐𝑒𝑛𝑐𝑖𝑎𝑠= 62,92 €

(66)

Según la ecuación (66), el precio de una licencia para cubrir todos los gastos del desarrollo

del programa debería de ser de 62,92 €. Para redondear el valor, se fija el precio a 63 €.

Para comparar el precio del programa realizado en este proyecto con otros productos

similares en el mercado, se realiza una búsqueda de los ecualizadores más importantes que

hay en el mercado (Tabla 22):

Page 91: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

11 Presupuesto

91

Software Precio licencia

EQuality 99,99 €

Voxengo GlissEQ 79,95 €

SonarWorks 99,99 €

AudioTrack 68,00 €

GEQ Graphic Equalizer 59,00 €

F6 Floating-Band Dynamin EQ 85,00 €

Tabla 22. Precio de la licencia de los programas de ecualización

Observando la Tabla 22, se puede ver que el precio propuesto de nuestro software, está

dentro del rango de precios de las licencias encontradas en internet.

Si comparamos los programas de la Tabla 22 con el programa realizado en este proyecto, a

nivel de interfaz gráfico están más trabajados y visualmente tienen una estética más

moderna. Eso no quiere decir que a nivel funcional dispongan de más o mejores

prestaciones pero, sí que hay que tener en cuenta, que el usuario no profesional no tiene en

cuenta la funcionalidad del programa sino que le da más importancia al acabado. Así que,

para poder competir con el precio de la licencia establecido de 63 €, sería necesario

mejorar la visualización de la interfaz gráfica, o por consiguiente, bajar el precio de la

licencia.

Page 92: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

92

12 Anexos

Page 93: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

93

Índice Anexos

Anexo 1 94

Form1.cs 95

Form1.Designer.cs 311

FormFill_EqUnaOctava.cs 330

FormFill_EqUnaOctava.Designer.cs 351

FormFill_Eq_1DIV3_Octava.cs 370

FormFill_Eq_1DIV3_Octava.Designer.cs 402

FormFill_Eq_Parametric.cs 449

FormFill_Eq_Parametric.Designer.cs 473

FormFill_Prova2.cs 504

FormFill_Prova2.Designer.cs 508

FormFill_Prova3.cs 519

FormFill_Prova3.Designer.cs 523

Program.cs 534

VG.cs 536

Anexo 2 544

Form1.cs 545

Form1.Designer.cs 556

Program.cs 562

Anexo 3 563

Form1.cs 564

Form1.Designer.cs 575

Program.cs 580

Page 94: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

94

ANEXO 1

Programa Equalitzador FFT 1

Page 95: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

95

/*************************************************************

* Fitxer Form1.cs

*

* Programa: Equalitzador FFT 1

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Drawing.Drawing2D;

using System.Drawing.Text;

using System.Threading;

using System.IO;

using MccDaq;

namespace Equalitzador_FFT_1

{

public partial class Form1 : Form

{

private const double PI = 3.14159265358979; //Nº Pi

private MccDaq.MccBoard DaqBoard;

private int canalBaixADC; //1r canal de l'ADC a escanejar

private int canalAltADC; //Últim canal de l'ADC a escanejar

private int canalBaixDAC; //1r canal del DAC a escanejar

private int canalAltDAC; //Últim canal del DAC a escanejar

Page 96: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

96

private int primerPunt1; //1r punt del buffer 1 de Windows

//a transferir per WinBufToArray()

private int primerPunt2; //1r punt del buffer 2 de Windows

//per transferir dades per

//WinArrayToBuf()

private MccDaq.Range rang1; //Rang ADC

private MccDaq.Range rang2; //Rang DAC

private MccDaq.ScanOptions opcions1; //Manera de treballar

//escollida ADC.

private MccDaq.ScanOptions opcions2; //Manera de treballar

//escollida DAC.

private MccDaq.ErrorInfo ULStat; //Manejador d'errors.

private ushort[] DadesAD; //Vector que contindrá les dades

//capturades per l'ADC.

private ushort[] DadesDA; //Vector que contindrá les dades

//a enviar al DAC.

private IntPtr memHandle1; //Variable que contindrá

//el manejador a la memòria

//de per al buffer de

//Windows de l'ADC a través de

//MccDaq.MccService.WinBufAlloc().

private IntPtr memHandle2; //Variable que contindrá

//el manejador a la memòria

//de per al buffer de

//Windows del DAC a través de

//MccDaq.MccService.WinBufAlloc().

private int N; //Nº de punts de la FFT

private int logN; //log en base 2 de N

private int M; //Nº de punts a capturar

Page 97: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

97

//per la funció AInScan()

private int mostresPerSegon; //Freqüència de mostreig de l'ADC

private int enviamentsPerSegon; //Número de enviaments per segon

//del DAC

private int finestra; //Tipus de Finestra:

//1 Rectangular

//2 Hanning

//3 Kaiser-Bessel

//4 Flat top

private bool run; //mode run = true

//mode stop = false

private bool usb1208FS; //Indica la tarjeta utilitzada:

//USB-1208FS = true

//USB-1208FS Plus = false

private bool treballSenseTarjeta; //Indica si es treballa o no amb tarjeta:

//sense tarjeta = true

//amb tarjeta = false

private int prova; //Indica quina prova es vol realitzar

//quan es treballa sense tarjeta.

private int fonsEscalaADC; //Indica el fons d'escala de l'ADC

//Els valors possibles són:

//Fons d'escala ADC +/- 10 V

//fonsEscalaADC = 7

//Fons d'escala ADC +/- 5 V

//fonsEscalaADC = 6

//Fons d'escala ADC +/- 4 V

//fonsEscalaADC = 5

//Fons d'escala ADC +/- 2,5 V

//fonsEscalaADC = 4

Page 98: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

98

//Fons d'escala ADC +/- 2 V

//fonsEscalaADC = 3

//Fons d'escala ADC +/- 1,25 V

//fonsEscalaADC = 2

//Fons d'escala ADC +/- 1 V

//FonsEscalaADC = 1

private int escalaEixXEspectre; //Variable que contindrá l'escala

//de l'eix X en la representació

//gràfica de l'espectre:

//escalaEixXEspectre = 1

//Eix X escala lineal en Hz.

//escalaEixXEspectre = 2

//Eix X escala log en octaves.

private bool representarEspectre; //Indica si es vol o no representar

//l'espectre en pantalla

//Si = true

//No = false

private bool dibuixarEspectre; //Indica quan el càlcul de l'espectre

//està llest (true).

private bool dibuixAcabat; //Indica si el dibuix realitzat pel

//FormPare_EqFFT_Paint està acabat.

private Pen llapisNegreN1; //Llapis negre d'un píxel,

private Pen llapisVermellN2; //Llapis vermell de dos píxels,

private Pen llapisVerdN2; //Llapis verd de dos píxels,

private Pen llapisNegreN4; //Llapis negre de quatre píxels.

private Pen llapisVermellN4; //Llapis vermell de quatre píxels.

private Pen llapisVerdN4; //Llapis verd de quatre píxels.

Page 99: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

99

private Pen llapisBlauN4; //Llapis blau de quatre píxels.

private Pen llapisMarroN4; //Llapis marró de quatre píxels.

private Rectangle rect; //Rectangle que formará el marc de

//la quadrícula de l'espectre

private double[] vectorFactorDeGirReal; //Part real dels factors de gir

private double[] vectorFactorDeGirIm; //Part imaginario dels factors de gir

private double[] vectorFinestra; //Vector que contindrá els punts de la finestra.

private double[] vectorInvFinestra; //Vector que contindrá els punts de l'invers

//de la finestra

private double[] vectorDadesReal; //Vector que 1r contindrá els valors

//els quals calcular la FFT. En etapes

//intermitjes del càlcul, contindrá

//els resultats intermitjos. En

//l'última etapa, la FFT calculada,

//i després les amplituds. Aquest vector

//només contindrá la part real dels punts.

private double[] vectorDadesIm; //Igual que el vectorDadesReal però només

//contindrá la part imaginaria dels punts.

private double[] vectorAmplituds; //Vector que contindrá les amplituds.

private double[] vectorAmplitudsEq; //Vector que contindrá les amplituds ja

//equalitzades.

private double[] vectorFases; //Vector que contindrá les fases.

private double[] vectorFrequencies; //Vector que contrindrá les freqüències.

private double[] vectorEqualitzacio; //Vector que contindrá la equalització

//a realitzar a la senyal.

private double[] vectorDadesTemporals; //Vector utilitzat en la

//prova2 quan es treballa sense

//tarjeta.

Page 100: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

100

/************************************************************************

* Declaració e inicialització de les constants que contenen on comencen

* i acaben les respectives octaves. La freqüència d'una octava acaba on

* on comença la següent octava. Valors en Hz.

**********************************************************************/

private const double Octava31coma5Hz_LF = 20.0; //Principi octava 31,5 Hz

private const double Octava31coma5Hz_HF = 45.0; //Final octava 31,5 Hz

private const double Octava63Hz_LF = 45.0; //Principi octava 63 Hz

private const double Octava63Hz_HF = 89.0; //Final octava 63 Hz

private const double Octava125Hz_LF = 89.0; //Principi octava 125 Hz

private const double Octava125Hz_HF = 177.0; //Final octava 125 Hz

private const double Octava250Hz_LF = 177.0; //Principi octava 250 Hz

private const double Octava250Hz_HF = 354.0; //Final octava 250 Hz

private const double Octava500Hz_LF = 354.0; //Principi octava 500 Hz

private const double Octava500Hz_HF = 707.0; //Final octava 500 Hz

private const double Octava1000Hz_LF = 707.0; //Principi octava 1 kHz

private const double Octava1000Hz_HF = 1414.0; //Final octava 1 kHz

private const double Octava2000Hz_LF = 1414.0; //Principi octava 2 kHz

private const double Octava2000Hz_HF = 2828.0; //Final octava 2 kHz

private const double Octava4000Hz_LF = 2828.0; //Principi octava 4 kHz

private const double Octava4000Hz_HF = 5657.0; //Final octava 4 kHz

private const double Octava8000Hz_LF = 5657.0; //Principi octava 8 kHz

private const double Octava8000Hz_HF = 11314.0; //Final octava 8 kHz

private const double Octava16000Hz_LF = 11314.0; //Principi octava 16 kHz

private const double Octava16000Hz_HF = 20000.0; //Final octava 16 kHz

/************************************************************************

* Declaració e inicialització de les constants que contenen on comencen

* i acaben els respectius terços d'octava. La freqüència d'un terç

* d' octava acaba on comença el següent terç. Valors en Hz.

**********************************************************************/

Page 101: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

101

private const double TersOctava20Hz_LF = 20.0; //Principi terç d'octava 20 Hz

private const double TersOctava20Hz_HF = 22.0; //Final terç d'octava 20 Hz

private const double TersOctava25Hz_LF = 22.0; //Principi terç d'octava 25 Hz

private const double TersOctava25Hz_HF = 28.0; //Final terç d'octava 25 Hz

private const double TersOctava31coma5Hz_LF = 28.0; //Principi terç d'octava 31,5 Hz

private const double TersOctava31coma5Hz_HF = 35.5; //Final terç d'octava 31,5 Hz

private const double TersOctava40Hz_LF = 35.5; //Principi terç d'octava 40 Hz

private const double TersOctava40Hz_HF = 45.0; //Final terç d'octava 40 Hz

private const double TersOctava50Hz_LF = 45.0; //Principi terç d'octava 50 Hz

private const double TersOctava50Hz_HF = 56.0; //Final terç d'octava 50 Hz

private const double TersOctava63Hz_LF = 56.0; //Principi terç d'octava 63 Hz

private const double TersOctava63Hz_HF = 71.0; //Final terç d'octava 63 Hz

private const double TersOctava80Hz_LF = 71.0; //Principi terç d'octava 80 Hz

private const double TersOctava80Hz_HF = 89.5; //Final terç d'octava 80 Hz

private const double TersOctava100Hz_LF = 89.5; //Principi terç d'octava 100 Hz

private const double TersOctava100Hz_HF = 112.0; //Final terç d'octava 100 Hz

private const double TersOctava125Hz_LF = 112.0; //Principi terç d'octava 125 Hz

private const double TersOctava125Hz_HF = 141.5; //Final terç d'octava 125 Hz

private const double TersOctava160Hz_LF = 141.5; //Principi terç d'octava 160 Hz

private const double TersOctava160Hz_HF = 179.0; //Final terç d'octava 160 Hz

private const double TersOctava200Hz_LF = 179.0; //Principi terç d'octava 200 Hz

private const double TersOctava200Hz_HF = 223.5; //Final terç d'octava 200 Hz

private const double TersOctava250Hz_LF = 223.5; //Principi terç d'octava 250 Hz

private const double TersOctava250Hz_HF = 281.0; //Final terç d'octava 250 Hz

Page 102: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

102

private const double TersOctava315Hz_LF = 281.0; //Principi terç d'octava 315 Hz

private const double TersOctava315Hz_HF = 355.0; //Final terç d'octava 315 Hz

private const double TersOctava400Hz_LF = 355.0; //Principi terç d'octava 400 Hz

private const double TersOctava400Hz_HF = 447.0; //Final terç d'octava 400 Hz

private const double TersOctava500Hz_LF = 447.0; //Principi terç d'octava 500 Hz

private const double TersOctava500Hz_HF = 561.0; //Final terç d'octava 500 Hz

private const double TersOctava630Hz_LF = 561.0; //Principi terç d'octava 630 Hz

private const double TersOctava630Hz_HF = 710.0; //Final terç d'octava 630 Hz

private const double TersOctava800Hz_LF = 710.0; //Principi terç d'octava 800 Hz

private const double TersOctava800Hz_HF = 894.5; //Final terç d'octava 800 Hz

private const double TersOctava1000Hz_LF = 894.5; //Principi terç d'octava 1000 Hz

private const double TersOctava1000Hz_HF = 1118.0; //Final terç d'octava 1000 Hz

private const double TersOctava1250Hz_LF = 1118.0; //Principi terç d'octava 1250 Hz

private const double TersOctava1250Hz_HF = 1414.0; //Final terç d'octava 1250 Hz

private const double TersOctava1600Hz_LF = 1414.0; //Principi terç d'octava 1600 Hz

private const double TersOctava1600Hz_HF = 1789.0; //final terç d'octava 1600 Hz

private const double TersOctava2000Hz_LF = 1789.0; //Principi terç d'octava 2000 Hz

private const double TersOctava2000Hz_HF = 2236.0; //Final terç d'octava 2000 Hz

private const double TersOctava2500Hz_LF = 2236.0; //Principi terç d'octava 2500 Hz

private const double TersOctava2500Hz_HF = 2806.0; //Final terç d'octava 2500 Hz

private const double TersOctava3150Hz_LF = 2806.0; //Principi terç d'octava 3150 Hz

private const double TersOctava3150Hz_HF = 3550.0; //final terç d'octava 3150

Page 103: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

103

Hz

private const double TersOctava4000Hz_LF = 3550.0; //Principi terç d'octava 4000 Hz

private const double TersOctava4000Hz_HF = 4472.0; //Final terç d'octava 4000 Hz

private const double TersOctava5000Hz_LF = 4472.0; //Principi terç d'octava 5000 Hz

private const double TersOctava5000Hz_HF = 5612.0; //Final terç d'octava 5000 Hz

private const double TersOctava6300Hz_LF = 5612.0; //Principi terç d'octava 6300 Hz

private const double TersOctava6300Hz_HF = 7099.0; //Final terç d'octava 6300 Hz

private const double TersOctava8000Hz_LF = 7099.0; //Principi terç d'octava 8000 Hz

private const double TersOctava8000Hz_HF = 8944.0; //Final terç d'octava 8000 Hz

private const double TersOctava10000Hz_LF = 8944.0;//Principi terç d'octava 10000 Hz

private const double TersOctava10000Hz_HF = 11180.0;//Final terç d'octava 10000 Hz

private const double TersOctava12500Hz_LF = 11180.0;//Principi terç d'octava 12500 Hz

private const double TersOctava12500Hz_HF = 14143.0;//Final terç d'octava 12500 Hz

private const double TersOctava16000Hz_LF = 14143.0;//Principi terç d'octava 16000 Hz

private const double TersOctava16000Hz_HF = 20000.0; //Final terç d'octava 16000 Hz

/************************************************************************

* Declaració de les freqüències on comencen i acaben les bandes de

* l'equalitzador paramètric. Es calculen en funció dels paràmetres

* freqüència central i ample de banda (BW). Valors en Hz.

**********************************************************************/

private double freqBaixa_LF; //Principi de la banda LF

private double freqAlta_LF; //Final de la banda LF

Page 104: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

104

private double freqBaixa_MLF; //Principi de la banda MLF

private double freqAlta_MLF; //Final de la banda MLF

private double freqBaixa_MHF; //Principi de la banda MHF

private double freqAlta_MHF; //Final de la banda MHF

private double freqBaixa_HF; //Principi de la banda HF

private double freqAlta_HF; //Final de la banda HF

//Fil per a executar una tasca secundària

private Thread filSecundari;

//Controladors d'espera d'events:

//"Parar Fil" i "Fil Parat"

private ManualResetEvent controladorPararFilSecundari;

private ManualResetEvent controladorFilSecundariParat;

public Form1()

{

InitializeComponent();

}

/************************************************************************

* Funció que s'executa quan es carrega per primera vegada el Form1.cs

***********************************************************************/

private void Form1_Load(object sender, EventArgs e)

{

//El formulari es repintarà mitjançant la tècnica

//del doble buffer per a evitar parpadejos i

//inestabilitats de la imatge tal i com es feia al projecte [24]

DoubleBuffered = true;

//Inicialització de les variables globals en l'àmbit

//del formulari pare Form1.cs.

N = 1024;

logN = 10;

mostresPerSegon = 40000;

enviamentsPerSegon = 10000;

Page 105: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

105

finestra = 2;

run = false;

usb1208FS = false;

treballSenseTarjeta = true;

prova = 1;

fonsEscalaADC = 7;

escalaEixXEspectre = 2;

representarEspectre = false;

dibuixarEspectre = false;

dibuixAcabat = true;

//Inicialització d'etiquetes

etActivitat.Text = "Repòs ";

etEqualitzador.Text = " Eq 1 octava ";

etFinestra.Text = " Hanning ";

etNumPuntsFFT.Text = " FFT 1024 punts ";

etMostresPerSegon.Text = " 40000 mostres / s ";

etFonsEscalaADC.Text = " Rang ADC +/- 10 V ";

etTarjeta.Text = " Treball sense tarjeta ";

etVisualitzarEspectre.Text = " No visualitzar espectre ";

etEspectre.Text = " Eix X escala log ";

//Obtenció dels llapisos

llapisNegreN1 = new Pen(Color.Black, 1);

llapisVermellN2 = new Pen(Color.Red, 2);

llapisVerdN2 = new Pen(Color.Green, 2);

llapisNegreN4 = new Pen(Color.Black, 4);

llapisVermellN4 = new Pen(Color.Red, 4);

llapisVerdN4 = new Pen(Color.Green, 4);

llapisBlauN4 = new Pen(Color.Blue, 4);

llapisMarroN4 = new Pen(Color.Brown, 4);

//Nou objecte MccBoard per al canal Board 0

DaqBoard = new MccDaq.MccBoard(0);

//Inicialització a 0 del manejador del buffer1 de memòria de

//Windows per l'ADC.

memHandle1 = IntPtr.Zero;

Page 106: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

106

//Inicialització a 0 del manejador del buffer2 de memòria de

//Windows pel DAC.

memHandle2 = IntPtr.Zero;

//Canal Baix i Alt de l'ADC inicialitzats a zero.

//El programa treballarà només amb el canal 0 de l'ADC.

canalBaixADC = 0;

canalAltADC = 0;

//Canal Baix i Alt del DAC inicialitzats a zero.

//El programa treballarà només amb el canal 0 del DAC.

canalBaixDAC = 0;

canalAltDAC = 0;

//El primer punt que es transfereix del buffer1 de Windows

//al vector DadesAD[] per la funció WinBufToArray(), es el

//punt 0 del buffer. Aquest buffer es l'utilitzat per

//l'ADC per a transeferir-hi els voltatges mostrejats

//i codificats. Aquest es l'anomenat buffer1 de Windows.

primerPunt1 = 0;

//El primer punt del vector DadesDA[] es transfereix

//al primer punt del buffer de Windows, es el punt 0

//del buffer per la funció WinArrayToBuf(). El buffer de

//Windows utilitza el programa per a enviar els codis

//al DAC, que aquest convertirà en voltatges a la

//sortida del canal 0. Aquest es l'anomenat buffer2

//de Windows.

primerPunt2 = 0;

//Rang ADC inicialitzat per a treballar en

//bipolar +/- 10 volts.

rang1 = MccDaq.Range.Bip10Volts;

//El DAC s'inicialitza per a treballar en rang

Page 107: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

107

//unipolar de 4 V. Aquest és l'únic rang que pot

//treballar el DAC de la USB-1208FS. El DAC de la

//USB-1208FS Plus es unipolar de 5 V.

//Quan es carrega el Form1 es considera que la tarjeta

//connectada és la USB-1208FS. Si no s'està fent servir

//aquesta, l'usuari, mitjançant l'opció "USB-1208FS Plus",

//del menú "Tarjeta", de la barra de menús, podrà

//modificar la tarjeta seleccionada.

rang2 = MccDaq.Range.Uni4Volts;

//Escollir la manera de treballar de AInScan()

opcions1 = 0; //Opcions per defecte

//Escollir la manera de treballar de AOutScan().

//Degut a les limitaciones de la USB-1208FS, no

//poden treballar simultàneament el ADC i el DAC

//(mode BACKGROUND). En canvi, la USB-1208FS Plus

//si que permet treballar en un segon pla el DAC

opcions2 = 0; //Opcions per defecte

//Inicialització del manejador d'errors:

//Tots els avisos i errors trobats s'imprimiran en pantalla.

//Si es troba un error el programa pararà.

ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll,

MccDaq.ErrorHandling.StopAll);

//Adquisició de la ruta espececifica de la capeta els meus documents

//en qualsevol ordinador, mitjançant la funció GetFolderPath.

string ElsMeusDocuments = Environment.GetFolderPath

(Environment.SpecialFolder.MyDocuments);

//es crea la la ruta de la carpeta del projecte dins la carpeta

//els meus documents

string carpetaProjecte = Path.Combine

(ElsMeusDocuments, "EqualitzadorFFT");

Page 108: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

108

//Es creen les rutes a les subcarpetes.

//5 subcarpetes contindrán els diferents arxius del projecte:

//subCarpeta 1 contindrá els arxius .eq1

//subCarpeta 2 contindrá els arxius .eq2

//subCarpeta 3 contindrá els arxius .eq3

//subCarpeta 4 contindrá els arxius .grab

//subCarpeta 5 contindrá els arxius .wav

string subCarpeta1 = Path.Combine(carpetaProjecte, "Eq Octava");

string subCarpeta2 = Path.Combine(carpetaProjecte, "Eq terç Octava");

string subCarpeta3 = Path.Combine(carpetaProjecte, "Eq parametric");

string subCarpeta4 = Path.Combine(carpetaProjecte, "Arxius grab");

string subCarpeta5 = Path.Combine(carpetaProjecte, "Arxius wav");

//Si no existeix el directori arrel o alguna de les subcarpetes

//es creen mitjançant la funció de System.IO Directory.createDirectory

if (!Directory.Exists(carpetaProjecte))

{

Directory.CreateDirectory(carpetaProjecte);

}

if (!Directory.Exists(subCarpeta1))

{

Directory.CreateDirectory(subCarpeta1);

}

if (!Directory.Exists(subCarpeta2))

{

Directory.CreateDirectory(subCarpeta2);

}

if (!Directory.Exists(subCarpeta3))

{

Directory.CreateDirectory(subCarpeta3);

}

if (!Directory.Exists(subCarpeta4))

{

Directory.CreateDirectory(subCarpeta4);

}

if (!Directory.Exists(subCarpeta5))

{

Directory.CreateDirectory(subCarpeta5);

}

Page 109: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

109

/****************************************************************

* Inicialització de les variables globals declarades dins de la

* classe VG.cs

****************************************************************/

VG.guanyGlobal = 0; //Inicialització a 0 dB del guany global

//Inicialització a +20 dBV (+10 volts),

//de l'amplitud màxima que pot assolir cada

//component freqüencial de la senyal. Si alguna

//supera aquest valor, serà retallada.

VG.limitador = 20; //Limitador inicialitzat a +20 dB

VG.lowCut = 20; //Inicialització tall a 20 Hz lowCut

VG.highCut = 20000; //Inicialització tall a 20 kHz highCut

//Inicialització a 0 dB dels guanys dels fadders

//de l'equalitzador d'una octava i d'un terç d'octava.

VG.guany20Hz = 0;

VG.guany25Hz = 0;

VG.guany31coma5Hz = 0;

VG.guany40Hz = 0;

VG.guany50Hz = 0;

VG.guany63Hz = 0;

VG.guany80Hz = 0;

VG.guany100Hz = 0;

VG.guany125Hz = 0;

VG.guany160Hz = 0;

VG.guany200Hz = 0;

VG.guany250Hz = 0;

VG.guany315Hz = 0;

VG.guany400Hz = 0;

VG.guany500Hz = 0;

VG.guany630Hz = 0;

VG.guany800Hz = 0;

VG.guany1000Hz = 0;

VG.guany1250Hz = 0;

Page 110: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

110

VG.guany1600Hz = 0;

VG.guany2000Hz = 0;

VG.guany2500Hz = 0;

VG.guany3150Hz = 0;

VG.guany4000Hz = 0;

VG.guany5000Hz = 0;

VG.guany6300Hz = 0;

VG.guany8000Hz = 0;

VG.guany10000Hz = 0;

VG.guany12500Hz = 0;

VG.guany16000Hz = 0;

//Inicialització a 0 dB dels guanys del fadders

//de l'equalitzador paramètric.

VG.guany_LF = 0;

VG.guany_MLF = 0;

VG.guany_MHF = 0;

VG.guany_HF = 0;

//Inicialització de les freqüències centrals de

//cada banda. S'inicialitza amb el valor de freqüència més

//baix de cada banda. Valors en Hz.

VG.freqCentral_LF = 20;

VG.freqCentral_MLF = 250;

VG.freqCentral_MHF = 2000;

VG.freqCentral_HF = 4000;

//Inicialització dels amples de banda (BW) a 0

VG.bW_LF = 0;

VG.bW_MLF = 0;

VG.bW_MHF = 0;

VG.bW_HF = 0;

//Variable que contindrá l'índex de l'equalitzador que

//s'està utilitzant. Per defecte, al iniciar el programa

//està inicialitzat l'equalitzador d'una octava.

VG.equalitzador = 1; //1 = Equalitzador d'una octava

//2 = Equalitzador de terç d'octava

Page 111: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

111

//3 = Equalitzador paramètric

} //Fi Form1_Load

/************************************************************************

* Funció que s'executa cada vegada que el formulari pare Form1 passa

* a ser el formulari actiu. Es redibuixa el formulari i el control

* pictureBox1. Així, quan es tanca el formulari fill d'un dels

* equalitzadors, els gràfics de Form1 s'actualitzaran amb l'equalització

* i el processament escollits per l'usuari.

***********************************************************************/

private void Form1_Activated(object sender, EventArgs e)

{

ActiveForm.Invalidate(); //Redibuixar el formulari pare Form1.

//Formulari actiu

pictureBox1.Invalidate(); //Redibuixar pictureBox1

}

/****************************************************************

* Funció que s'executa quan es fa clic en l'opció "Equalitzador

* 1 Octava" del menú desplegable "Equalitzador" de la barra de menús

****************************************************************/

private void EqualitzadorUnaOctava_Click(object sender, EventArgs e)

{

if (run == false)

{

VG.equalitzador = 1; //1 = Equalitzador d'una octava

etEqualitzador.Text = " Equalitzador 1 Octava ";

etActivitat.Text = "Repòs ";

EqualitzadorUnaOctava.Checked = true;

Equalitzador_1DIV3_Octava.Checked = false;

EqualitzadorParametric.Checked = false;

//Redibuixar el formulari pare Form 1 i el control pictureBox1,

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Es crea una nova instància del formulari fill

//Equalitzador d'una octava, anomenada frm.

Page 112: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

112

FormFill_EqUnaOctava frm = new FormFill_EqUnaOctava();

//Es mostra frm en pantalla. A partir d'aquest moment,

//frm pren el control del programa.

frm.Show();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Equalitzador

* 1/3 Octava" del menú desplegable "Equalitzador" de la barra de menús

******************************************************************/

private void Equalitzador_1DIV3_Octava_Click(object sender, EventArgs e)

{

if (run == false)

{

VG.equalitzador = 2; //2 = Equalitzador de terç d'octava

etEqualitzador.Text = " Equalitzador 1/3 Octava ";

etActivitat.Text = "Repòs ";

EqualitzadorUnaOctava.Checked = false;

Equalitzador_1DIV3_Octava.Checked = true;

EqualitzadorParametric.Checked = false;

//Redibuixar el formulari pare Form 1 i el control pictureBox1,

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Es crea una nova instància del formulari fill

//Equalitzador de terç d'octava, anomenada frm.

FormFill_Eq_1DIV3_Octava frm = new FormFill_Eq_1DIV3_Octava();

//Es mostra frm en pantalla. A partir d'aquest moment,

//frm pren el control del programa.

frm.Show();

}

}

Page 113: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

113

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Equalitzador

* paramètric" del menú desplegable "Equalitzador" de la barra de menús.

******************************************************************/

private void EqualitzadorParametric_Click(object sender, EventArgs e)

{

if (run == false)

{

VG.equalitzador = 3; //3 = Equalitzador paramètric

etEqualitzador.Text = " Equalitzador Paramètric ";

etActivitat.Text = "Repòs ";

EqualitzadorUnaOctava.Checked = false;

Equalitzador_1DIV3_Octava.Checked = false;

EqualitzadorParametric.Checked = true;

//Redibuixar el formulari pare Form 1 (el formulari actiu),

//i el control pictureBox1, superficie de dibuix de Form1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Es crea una nova instància del formulari fill

//Equalitzador paramètric, anomenada frm.

FormFill_Eq_Parametric frm = new FormFill_Eq_Parametric();

//Es mostra frm en pantalla. A partir d'aquest moment,

//frm pren el control del programa.

frm.Show();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Reproduir"

* de la barra de menús.

******************************************************************/

private void menuReproduir_Click(object sender, EventArgs e)

{

//Indicar al programa que està en mode "run".

Page 114: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

114

run = true;

//Inhabilitar totes les opcions del menú.

menuGrabar.Enabled = false;

menuReproduir.Enabled = false;

menuDirecte.Enabled = false;

menuEqualitzador.Enabled = false;

menuFinestra.Enabled = false;

menuNumPuntsFFT.Enabled = false;

menuMostresPerSegon.Enabled = false;

menuFonsEscalaADC.Enabled = false;

menuTarjeta.Enabled = false;

menuVisualitzarEspectre.Enabled = false;

menuEspectre.Enabled = false;

menuFitxersWav.Enabled = false;

//Habilitar menuParar.

menuParar.Enabled = true;

//Escriure en l'etiqueta Activitat de la barra d'estat

//el text "Reproduïnt".

etActivitat.Text = "Reproduïnt ";

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Directe"

* de la barra de menús.

******************************************************************/

private void menuDirecte_Click(object sender, EventArgs e)

{

//Indicar al programa que està en mode "run".

run = true;

//Inhabilitar totes les opcions del menú.

menuGrabar.Enabled = false;

menuReproduir.Enabled = false;

Page 115: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

115

menuDirecte.Enabled = false;

menuEqualitzador.Enabled = false;

menuFinestra.Enabled = false;

menuNumPuntsFFT.Enabled = false;

menuMostresPerSegon.Enabled = false;

menuFonsEscalaADC.Enabled = false;

menuTarjeta.Enabled = false;

menuVisualitzarEspectre.Enabled = false;

menuEspectre.Enabled = false;

menuFitxersWav.Enabled = false;

//Habilitar menuParar.

menuParar.Enabled = true;

//Escriure en l'etiqueta Activitat de la barra d'estat

//el text "Directe".

etActivitat.Text = "Directe ";

//Crear els controladors "Parar Fil" i "Fil Parat".

//False = l'estat dels controladors és no senyalitzat.

controladorPararFilSecundari = new ManualResetEvent(false);

controladorFilSecundariParat = new ManualResetEvent(false);

//Creació del fil.

filSecundari = new Thread(Calculs);

//Execució del fil.

filSecundari.Start();

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Parar"

* de la barra de menús.

******************************************************************/

private void menuParar_Click(object sender, EventArgs e)

{

Page 116: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

116

//Indicar al programa que està en mode parar.

run = false;

//Escriure en l'etiqueta Activitat de la barra d'estat

//el text "Repòs".

etActivitat.Text = "Repòs ";

//Inhabilitar menuParar.

menuParar.Enabled = false;

//Habilitar tots els menús, excepte menuParar;

menuGrabar.Enabled = true;

menuReproduir.Enabled = true;

menuDirecte.Enabled = true;

menuEqualitzador.Enabled = true;

menuFinestra.Enabled = true;

menuNumPuntsFFT.Enabled = true;

menuMostresPerSegon.Enabled = true;

menuFonsEscalaADC.Enabled = true;

menuTarjeta.Enabled = true;

menuVisualitzarEspectre.Enabled = true;

menuEspectre.Enabled = true;

menuFitxersWav.Enabled = true;

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Grabar"

* de la barra de menús.

******************************************************************/

private void menuGrabar_Click(object sender, EventArgs e)

{

//Indicar al programa que està en mode "run"..

run = true;

//Inhabilitar totes les opcions del menú.

Page 117: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

117

menuGrabar.Enabled = false;

menuReproduir.Enabled = false;

menuDirecte.Enabled = false;

menuEqualitzador.Enabled = false;

menuFinestra.Enabled = false;

menuNumPuntsFFT.Enabled = false;

menuMostresPerSegon.Enabled = false;

menuFonsEscalaADC.Enabled = false;

menuTarjeta.Enabled = false;

menuVisualitzarEspectre.Enabled = false;

menuEspectre.Enabled = false;

menuFitxersWav.Enabled = false;

//Escriure en l'etiqueta Activitat de la barra d'estat

//el text "Grabant".

etActivitat.Text = "Grabant ";

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "128" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT128_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 128;

logN = 7;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = true;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "128 punts"

Page 118: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

118

etNumPuntsFFT.Text = "128 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "256" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT256_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 256;

logN = 8;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = true;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "256 punts"

etNumPuntsFFT.Text = "256 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

Page 119: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

119

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1,

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "512" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT512_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 512;

logN = 9;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = true;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "512 punts"

etNumPuntsFFT.Text = "512 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

Page 120: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

120

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "1024" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT1024_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 1024;

logN = 10;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = true;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "1024 punts"

etNumPuntsFFT.Text = "1024 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

Page 121: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

121

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "2048" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT2048_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 2048;

logN = 11;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = true;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "2048 punts"

etNumPuntsFFT.Text = "2048 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/******************************************************************

Page 122: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

122

* Funció que s'executa quan es fa clic en l'opció "4096" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

private void NumPuntsFFT4096_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 4096;

logN = 12;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = true;

NumPuntsFFT8192.Checked = false;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "4096 punts"

etNumPuntsFFT.Text = "4096 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/******************************************************************

* Funció que s'executa quan es fa clic en l'opció "8192" del menú

* desplegable "NumPuntsFFT" de la barra de menús.

******************************************************************/

Page 123: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

123

private void NumPuntsFFT8192_Click(object sender, EventArgs e)

{

if (run == false)

{

N = 8192;

logN = 13;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

NumPuntsFFT128.Checked = false;

NumPuntsFFT256.Checked = false;

NumPuntsFFT512.Checked = false;

NumPuntsFFT1024.Checked = false;

NumPuntsFFT2048.Checked = false;

NumPuntsFFT4096.Checked = false;

NumPuntsFFT8192.Checked = true;

//Escriure a l'etiqueta NumPuntsFFT de la barra d'estat "8192 punts"

etNumPuntsFFT.Text = "8192 punts";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Rectangular" del

* menú desplegable "Finestra" de la barra de menús.

*******************************************************************/

private void FinestraRectangular_Click(object sender, EventArgs e)

{

if (run == false)

{

Page 124: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

124

finestra = 1;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

FinestraRectangular.Checked = true;

FinestraHanning.Checked = false;

FinestraKaiserBessel.Checked = false;

FinestraFlatTop.Checked = false;

//Escriure a l'etiqueta Finestra de la barra d'estat "Rectangular"

etFinestra.Text = "Rectangular";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Hanning" del

* menú desplegable "Finestra" de la barra de menús.

*******************************************************************/

private void FinestraHanning_Click(object sender, EventArgs e)

{

if (run == false)

{

finestra = 2;

//Marcar l'element seleccionat del menú i desmarcar tots els altres

FinestraRectangular.Checked = false;

FinestraHanning.Checked = true;

FinestraKaiserBessel.Checked = false;

FinestraFlatTop.Checked = false;

Page 125: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

125

//Escriure a l'etiqueta Finestra de la barra d'estat "Hanning"

etFinestra.Text = "Hanning";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Kaiser-Bessel"

* del menú desplegable "Finestra" de la barra de menús.

*******************************************************************/

private void FinestraKaiserBessel_Click(object sender, EventArgs e)

{

if (run == false)

{

finestra = 3;

//Marcar l'element seleccionat del menú, i desmarcar tots els altres

FinestraRectangular.Checked = false;

FinestraHanning.Checked = false;

FinestraKaiserBessel.Checked = true;

FinestraFlatTop.Checked = false;

//Escriure a l'etiqueta Finestra de la barra d'estat "Kaiser-Bessel"

etFinestra.Text = "Kaiser-Bessel";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

Page 126: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

126

//Redibuixar el formulari pare Form1

//i el control pictureBox1

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Flat Top"

* del menú desplegable "Finestra" de la barra de menús.

*******************************************************************/

private void FinestraFlatTop_Click(object sender, EventArgs e)

{

if (run == false)

{

finestra = 4;

//Marcar l'element seleccionat del menú, i desmarcar tots els altres

FinestraRectangular.Checked = false;

FinestraHanning.Checked = false;

FinestraKaiserBessel.Checked = false;

FinestraFlatTop.Checked = true;

//Escriure a l'etiqueta Finestra de la barra d'estat "Flat top"

etFinestra.Text = "Flat top";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

Page 127: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

127

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "40000"

* del menú desplegable "MostresPerSegon" de la barra de menús.

*

* Nota: La freqüència de mostreig de 40000 mostres/s és la

* única habilitada per la USB-1208FS. En canvi per la USB-1208FS

* plus estáran habilitades les dos opcions 40000 i 50000

*******************************************************************/

private void MostresPerSegon40000_Click(object sender, EventArgs e)

{

if (run == false)

{

mostresPerSegon = 40000;

//Si la tarjeta és la USB-1208FS, la frequència de mostreig

//màxima del DAC per a un sol canal, és 10 kHz.

if (usb1208FS == true)

{

enviamentsPerSegon = 10000;

}

//Si la tarjeta és la USB-1208FS Plus, la freqüència de mostreig

//màxima del ADC i del DAC per a un sol canal, és 50 kHz.

//Llavors es fa treballar tant a l'ADC com al DAC a la

//mateixa freqüència de mostreig, 40000 mostres/s.

else

{

enviamentsPerSegon = 40000;

}

//Marcar l'element seleccionat del menú, i desmarcar tots els altres

MostresPerSegon40000.Checked = true;

MostresPerSegon50000.Checked = false;

//Escriure a l'etiqueta MostresPerSegon de la barra d'estat "20000 mostres / s"

Page 128: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

128

etMostresPerSegon.Text = "40000 mostres / s";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs".

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "50000"

* del menú desplegable "MostresPerSegon" de la barra de menús.

*

* Nota: La freqüència de mostreig de 40000 mostres/s és la

* única habilitada per la USB-1208FS. En canvi per la USB-1208FS

* plus estáran habilitades les dos opcions: 40000 i 50000

*******************************************************************/

private void MostresPerSegon50000_Click(object sender, EventArgs e)

{

if (run == false)

{

//La única tarjeta que pot treballar a aquesta freqüència es

//la USB-1208FS Plus. S'igualen les freqüències de mostreig

//de l'ADC i del DAC.

mostresPerSegon = 50000;

enviamentsPerSegon = mostresPerSegon;

//Marcar l'element seleccionat del menú, i desmarcar tots els altres

MostresPerSegon40000.Checked = false;

MostresPerSegon50000.Checked = true;

//Escriure a l'etiqueta MostresPerSegon de la barra d'estat "50000 mostres / s"

Page 129: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

129

etMostresPerSegon.Text = "50000 mostres / s";

//Escriure en l'etiqueta Activitat de la barra d'estat "Repòs"

etActivitat.Text = "Repòs ";

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 1 volt"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_1_volt_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip1Volts;

fonsEscalaADC = 1;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 1 V ";

FonsEscalaADC_1_volt.Checked = true;

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

Page 130: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

130

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 1,25 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_1coma25_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip1Pt25Volts;

fonsEscalaADC = 2;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 1,25 V ";

FonsEscalaADC_1_volt.Checked = false;

FonsEscalaADC_1coma25_volts.Checked = true;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 2 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_2_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip2Volts;

fonsEscalaADC = 3;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 2 V ";

FonsEscalaADC_1_volt.Checked = false;

Page 131: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

131

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = true;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 2,5 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_2coma5_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip2Pt5Volts;

fonsEscalaADC = 4;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 2,5 V ";

FonsEscalaADC_1_volt.Checked = false;

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = true;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

Page 132: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

132

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 4 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_4_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip4Volts;

fonsEscalaADC = 5;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 4 V ";

FonsEscalaADC_1_volt.Checked = false;

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = true;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 5 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_5_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip5Volts;

fonsEscalaADC = 6;

etActivitat.Text = "Repòs ";

Page 133: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

133

etFonsEscalaADC.Text = " Rang ADC +/- 5 V ";

FonsEscalaADC_1_volt.Checked = false;

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = true;

FonsEscalaADC_10_volts.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "+/- 10 volts"

* del menú desplegable "Fons d'escala ADC" de la barra de menús.

*******************************************************************/

private void FonsEscalaADC_10_volts_Click(object sender, EventArgs e)

{

if (run == false)

{

rang1 = MccDaq.Range.Bip10Volts;

fonsEscalaADC = 7;

etActivitat.Text = "Repòs ";

etFonsEscalaADC.Text = " Rang ADC +/- 10 V ";

FonsEscalaADC_1_volt.Checked = false;

FonsEscalaADC_1coma25_volts.Checked = false;

FonsEscalaADC_2_volts.Checked = false;

FonsEscalaADC_2coma5_volts.Checked = false;

FonsEscalaADC_4_volts.Checked = false;

FonsEscalaADC_5_volts.Checked = false;

FonsEscalaADC_10_volts.Checked = true;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

Page 134: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

134

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "USB-1208FS"

* del menú desplegable "Tarjeta" de la barra de menús.

*******************************************************************/

private void TarjetaUSB1208FS_Click(object sender, EventArgs e)

{

if (run == false)

{

rang2 = MccDaq.Range.Uni4Volts;

usb1208FS = true;

treballSenseTarjeta = false;

etActivitat.Text = "Repòs ";

etTarjeta.Text = " USB-1208FS ";

TarjetaUSB1208FS.Checked = true;

TarjetaUSB1208FSPlus.Checked = false;

TarjetaTreballarSenseTarjeta.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "USB-1208FS Plus"

* del menú desplegable "Tarjeta" de la barra de menús.

*******************************************************************/

private void TarjetaUSB1208FSPlus_Click(object sender, EventArgs e)

{

if (run == false)

{

rang2 = MccDaq.Range.Uni5Volts;

usb1208FS = false;

treballSenseTarjeta = false;

etActivitat.Text = "Repòs ";

etTarjeta.Text = " USB-1208FS Plus ";

TarjetaUSB1208FS.Checked = false;

Page 135: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

135

TarjetaUSB1208FSPlus.Checked = true;

TarjetaTreballarSenseTarjeta.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Prova1"

* del desplegable "Treballar sense tarjeta" del menú desplegable

* "Tarjeta" de la barra de menús.

*******************************************************************/

private void TarjetaTreballarSenseTarjetaProva1_Click(object sender, EventArgs e)

{

if (run == false)

{

usb1208FS = false;

treballSenseTarjeta = true;

prova = 1;

etActivitat.Text = "Repòs ";

etTarjeta.Text = " Treball sense tarjeta, prova 1 ";

TarjetaUSB1208FS.Checked = false;

TarjetaUSB1208FSPlus.Checked = false;

TarjetaTreballarSenseTarjeta.Checked = true;

TarjetaTreballarSenseTarjetaProva1.Checked = true;

TarjetaTreballarSenseTarjetaProva2.Checked = false;

TarjetaTreballarSenseTarjetaProva3.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

Page 136: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

136

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "Prova2"

* del desplegable "Treballar sense tarjeta" del menú desplegable

* "Tarjeta" de la barra de menús.

*******************************************************************/

private void TarjetaTreballarSenseTarjetaProva2_Click(object sender, EventArgs e)

{

if (run == false)

{

usb1208FS = false;

treballSenseTarjeta = true;

prova = 2;

etActivitat.Text = "Repòs ";

etTarjeta.Text = " Treball sense tarjeta, prova 2 ";

TarjetaUSB1208FS.Checked = false;

TarjetaUSB1208FSPlus.Checked = false;

TarjetaTreballarSenseTarjeta.Checked = true;

TarjetaTreballarSenseTarjetaProva1.Checked = false;

TarjetaTreballarSenseTarjetaProva2.Checked = true;

TarjetaTreballarSenseTarjetaProva3.Checked = false;

//Redibuixar el formulari pare Form1,

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Executar Prova2().

Prova2();

}

}

/*******************************************************************

Page 137: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

137

* Funció que s'executa quan es fa clic en l'opció "Prova3"

* del desplegable "Treballar sense tarjeta" del menú desplegable

* "Tarjeta" de la barra de menús.

*******************************************************************/

private void TarjetaTreballarSenseTarjetaProva3_Click(object sender, EventArgs e)

{

if (run == false)

{

usb1208FS = false;

treballSenseTarjeta = true;

prova = 3;

etActivitat.Text = "Repòs ";

etTarjeta.Text = " Treball sense tarjeta, prova 3 ";

TarjetaUSB1208FS.Checked = false;

TarjetaUSB1208FSPlus.Checked = false;

TarjetaTreballarSenseTarjeta.Checked = true;

TarjetaTreballarSenseTarjetaProva1.Checked = false;

TarjetaTreballarSenseTarjetaProva2.Checked = false;

TarjetaTreballarSenseTarjetaProva3.Checked = true;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Executar Prova3().

Prova3();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "SÍ"

* del menú desplegable "Visualitzar_Espectre" de la barra de menús

*******************************************************************/

private void VisualitzarEspectreSi_Click(object sender, EventArgs e)

Page 138: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

138

{

if (run == false)

{

representarEspectre = true;

etActivitat.Text = "Repòs ";

etVisualitzarEspectre.Text = " Sí visualitzar espectre ";

VisualitzarEspectreSi.Checked = true;

VisualitzarEspectreNo.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/*******************************************************************

* Funció que s'executa quan es fa clic en l'opció "NO"

* del menú desplegable "Visualitzar_Espectre" de la barra de menús

*******************************************************************/

private void VisualitzarEspectreNo_Click(object sender, EventArgs e)

{

if (run == false)

{

representarEspectre = false;

etActivitat.Text = "Repòs ";

etVisualitzarEspectre.Text = " No visualitzar espectre ";

VisualitzarEspectreSi.Checked = false;

VisualitzarEspectreNo.Checked = true;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Eix X escala

Page 139: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

139

* lineal" del menú desplegable "Espectre" de la barra de menús

*******************************************************************/

private void EspectreEixXEscalaLineal_Click(object sender, EventArgs e)

{

if (run == false)

{

escalaEixXEspectre = 1;

etActivitat.Text = "Repòs ";

etEspectre.Text = " Eix X escala lineal ";

EspectreEixXEscalaLineal.Checked = true;

EspectreEixXEscalaLog.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Eix X escala

* log" del menú desplegable "Espectre" de la barra de menús

*******************************************************************/

private void EspectreEixXEscalaLog_Click(object sender, EventArgs e)

{

if (run == false)

{

escalaEixXEspectre = 2;

etActivitat.Text = "Repòs ";

etEspectre.Text = " Eix X escala log ";

EspectreEixXEscalaLineal.Checked = false;

EspectreEixXEscalaLog.Checked = true;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

}

Page 140: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

140

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Produïr Fitxer

* wav" del menú desplegable "Fitxers_wav" de la barra de menús

*******************************************************************/

private void FitxersWavProduirFitxerWav_Click(object sender, EventArgs e)

{

run = true;

//Inhabilitar totes les opcions del menú.

menuGrabar.Enabled = false;

menuReproduir.Enabled = false;

menuDirecte.Enabled = false;

menuEqualitzador.Enabled = false;

menuFinestra.Enabled = false;

menuNumPuntsFFT.Enabled = false;

menuMostresPerSegon.Enabled = false;

menuFonsEscalaADC.Enabled = false;

menuTarjeta.Enabled = false;

menuVisualitzarEspectre.Enabled = false;

menuEspectre.Enabled = false;

menuFitxersWav.Enabled = false;

etActivitat.Text = "Creant fitxer wav ";

FitxersWavProduirFitxerWav.Checked = true;

FitxersWavEscoltarFitxerWav.Checked = false;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Falta incolure codi del formulari fill

//Grabador_audio

}

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Escoltar Fitxer

* wav" del menú desplegable "Fitxers_wav" de la barra de menús

*******************************************************************/

Page 141: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

141

private void FitxersWavEscoltarFitxerWav_Click(object sender, EventArgs e)

{

run = true;

//Inhabilitar totes les opcions del menú.

menuGrabar.Enabled = false;

menuReproduir.Enabled = false;

menuDirecte.Enabled = false;

menuEqualitzador.Enabled = false;

menuFinestra.Enabled = false;

menuNumPuntsFFT.Enabled = false;

menuMostresPerSegon.Enabled = false;

menuFonsEscalaADC.Enabled = false;

menuTarjeta.Enabled = false;

menuVisualitzarEspectre.Enabled = false;

menuEspectre.Enabled = false;

menuFitxersWav.Enabled = false;

etActivitat.Text = "Reproduïnt fitxer wav ";

FitxersWavProduirFitxerWav.Checked = false;

FitxersWavEscoltarFitxerWav.Checked = true;

//Redibuixar el formulari pare Form1

//i el control pictureBox1.

ActiveForm.Invalidate();

pictureBox1.Invalidate();

//Falta incolure codi del formulari fill

//Grabador_audio

}

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Pausa"

* de la barra de menús

*******************************************************************/

private void menuPausa_Click(object sender, EventArgs e)

{

//Falta incolure el codi

}

Page 142: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

142

/********************************************************************

* Funció que s'executa quan es fa clic en l'opció "Continuar"

* de la barra de menús

*******************************************************************/

private void menuContinuar_Click(object sender, EventArgs e)

{

//Falta incolure el codi

}

/********************************************************************

* Funció que calcula els factors de gir necessaris per a calcular

* la FFT i la IFFT. Les funcions CalcularFFT() i Calcular_IFFT

* necessitaran fer crida d'aquesta funció

*******************************************************************/

private void CalcularFactorsDeGir()

{

vectorFactorDeGirReal = new double[N / 2];

vectorFactorDeGirIm = new double[N / 2];

for (int n = 0; n < N / 2; n++)

{

vectorFactorDeGirReal[n] = Math.Cos((2 * PI * n) / N);

vectorFactorDeGirIm[n] = -Math.Sin((2 * PI * n) / N);

}

}

/**************************************************************************

Funcions de finestra obtingudes del següent llibre:

Vibration Testing

Theory and Practice

Second Edition

Kenneth G. McConnell Paulo S. Varoto

A la vegada, aquest llibre publica les funcions de finestra per cortesia

del fabricant d'instruments Bruel & Kjaer Instruments, Inc.

Les característiques matemàtiques d'aquestes finestres estan explicades

en la documentació externa del programa. Una característica és la següent:

Si s'agafa un número enter de períodes de la senyal per a calcular-ne la FFT,

Page 143: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

143

i s'enfinestra amb una d'aquestes finestres, amb totes elles s'obté un valor

correcte de l'amplitud de cada armònic, excepte per a la component continua i

per a l'armònic corresponent a la freqüència de Nyquist, en el cas de les

finestres Kaiser-Bessel i Flat top, en que s'obtenen per a aquestes dues

components valors una mica superiors als reals. O sigui, són finestres ben

ponderades en amplitud, lo més ben ponderades en amplitud possible.

La utilitat de cada finestra i les característiques matemàtiques de cada una

d'elles estan explicades a la documentació externa del programa, així com

també s'explica la necessitat d'enfinestrar.

Nota: Aquesta funció està extreta íntegrament del projecte [24]

***************************************************************************/

private void CalcularFinestra()

{

switch (finestra)

{

case 1: //Finestra rectangular. Tot 1's. Quan s'utilitza la finestra

//rectangular, no cal enfinestrar (enfinestrament implícit,

//no explícit)

break;

case 2: //Finestra Hanning

vectorFinestra = new double[N];

for (int n = 0; n < N; n++)

{

vectorFinestra[n] = 1 - Math.Cos((2 * PI * n) / N);

}

break;

case 3: //Finestra Kaiser-Bessel

vectorFinestra = new double[N];

for (int n = 0; n < N; n++)

{

vectorFinestra[n] = 1

- 1.298 * Math.Cos((2 * PI * n) / N)

+ 0.244 * Math.Cos((4 * PI * n) / N)

Page 144: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

144

- 0.003 * Math.Cos((6 * PI * n) / N);

}

break;

case 4: //Finestra Flat top

vectorFinestra = new double[N];

for (int n = 0; n < N; n++)

{

vectorFinestra[n] = 1

- 1.933 * Math.Cos((2 * PI * n) / N)

+ 1.286 * Math.Cos((4 * PI * n) / N)

- 0.388 * Math.Cos((6 * PI * n) / N)

+ 0.032 * Math.Cos((8 * PI * n) / N);

}

break;

}

}//Fi Calcular_Finestra()

/********************************************************************

* La funció Enfinestrar(): Si la finestra és diferent de la finestra

* rectangular, llavors fer que vectorDadesReal[n] =

* vectorDadesReal[n] * vectorFinestra[n], per a

* 0 <= n <= N. Quan la finestra és la rectangular,

* l'enfinestrament és implícit, no explícit.

*

* Nota: Aquesta funció està extreta íntegrament del projecte [24]

*******************************************************************/

private void Enfinestrar()

{

if (finestra != 1)

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = vectorDadesReal[n] * vectorFinestra[n];

}

}

}

/********************************************************************

Page 145: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

145

* Funció que calcula l'invers de la finestra.

*

* Nota: El vector de tamany N capturat per l'ADC, un cop convertit a

* voltatges els seus valors, s'enfinestra abans de calcular la FFT.

* Una vegada calculada la IFFT, s'ha de desenfinestrar abans

* d'enviar-ho al DAC. Per desenfinestrar es necessari realitzar

* la inversa del algoritme realitzar a la funció Enfinestrar()

*******************************************************************/

private void CalcularInversFinestra()

{

vectorInvFinestra = new double[N];

//Si la finestra és diferent a rectangular

//es calcula el vector vectorInvFinestra[n].

if (finestra != 1)

{

for (int n = 0; n < N; n++)

{

//Impedir la divisió per 0.

if (vectorFinestra[n] <= 1e-12)

{

vectorFinestra[n] = 1e-12;

}

//Omplir vectorInvFinestra[n].

vectorInvFinestra[n] = 1 / vectorFinestra[n];

}

}

}

/********************************************************************

* Funció que desenfinestra la senyal de sortida.

*

* Nota: Aplicar el vectorInvFinestra[n] a cada valor del

* vectorDadesReal[n]

*******************************************************************/

Page 146: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

146

private void Desenfinestrar()

{

if (finestra != 1)

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = vectorDadesReal[n] * vectorInvFinestra[n];

}

}

}

/********************************************************************

* Funció que crea els vectors vectorAmplituds[] i vectorAmplitudsEq[].

*******************************************************************/

private void CrearVectorsAmplituds()

{

vectorAmplituds = new double[(N / 2) + 1];

vectorAmplitudsEq = new double[(N / 2) + 1];

}

/********************************************************************

* La funció OmplirVectorsAmplituds() omple el vectorAmplituds[] amb

* els valors d'amplitud corresponents a cada posició del vector en V.

* El VectorAmplituds[] serà copiat en el vectorAmplitudsEq[]. Aquest

* últim serà el que serà processat.

*

* Nota: Es duplica el vectorAmplituds[] per tal de visualitzar a la

* vegada, l'espectre processat i el no processat.

*******************************************************************/

private void OmplirVectorsAmplituds()

{

for (int n = 0; n <= N / 2; n++)

{

vectorAmplituds[n] = vectorDadesReal[n];

vectorAmplitudsEq[n] = vectorAmplituds[n];

}

}

/********************************************************************

* Funció que crea el vectorFrequencies[].

Page 147: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

147

*

* Nota: El vectorFrequencies[] conté la freqüència de cada component

* espectral de la senyal.

*******************************************************************/

private void CrearVectorFrequencies()

{

vectorFrequencies = new double[(N / 2) + 1];

}

/********************************************************************

* La funció OmplirVectorFrequencies() omple el vectorFrequencies[]

* amb els valors de la freqüència corresponents a cada posició del

* vector en Hz.

*******************************************************************/

private void OmplirVectorFrequencies()

{

//A cada posició de vectorFrequencies, li correspon la següent

//freqüència (en Hz):

//n * incrementDeFrequencia, essent l'increment freqüencial

//igual a la les mostresPerSegon dividit per N, on N és el

//tamany de la FFT.

double incrementDeFrequencia = (double)(mostresPerSegon / N);

for (int n = 0; n <= N / 2; n++)

{

vectorFrequencies[n] = (double)(n * incrementDeFrequencia);

}

}

/********************************************************************

* Funció que aplica a les components freqüèncials (en dbV) dins del

* rang de 20 Hz a 20 kHz (rang audible), una suma amb el valor

* guanGlobal en dbV.

*

* Nota: Aquesta funció s'utilitza en el tres equalitzadors.

*******************************************************************/

private void AplicarGuanyGlobal()

{

Page 148: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

148

for (int n = 0; n <= N / 2; n++)

{

//Les components espectrals fora del rang audible s'eliminen.

if ((vectorFrequencies[n] < 20) || (vectorFrequencies[n] > 20000))

{

//Per eliminar l'amplitud d'una component freqüencial

//en dBV, s'haura d'igualar a menys infinit dBV (0 V)

//Això no ho es pot fer degut a que després es fan càlcus

//logarítmics, i el log(0) no existeix. Per tant, es

//és suficient igualant-la a -80 dBV (0.0001V)

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

//Les components espectrals dins del rang audible se'ls suma

//el guany global en dBV.

else

{

vectorAmplitudsEq[n] = VG.guanyGlobal + vectorAmplitudsEq[n];

if (vectorAmplitudsEq[n] > 20.0)

{

vectorAmplitudsEq[n] = 20.0;

}

if (vectorAmplitudsEq[n] < -80.0)

{

vectorAmplitudsEq[n] = -80.0;

}

}

}//Fi for

}

/********************************************************************

* Funció que aplica a les components freqüèncials (en dbV) dins del

* rang de 20 Hz a 20 kHz (rang audible), una limitació en amplitud,

* continguda en la variable global limitador (en dBV).

*

* Nota: Aquesta funció s'utilitza en el tres equalitzadors.

*******************************************************************/

Page 149: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

149

private void AplicarLimitador()

{

for (int n = 0; n <= N / 2; n++)

{

//Les components espectrals fora del rang audible s'eliminen.

if ((vectorFrequencies[n] < 20) || (vectorFrequencies[n] > 20000))

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

//Les components espectrals dins del rang audible, si superen

//el valor de la variable global limitador, s'igualen a aquesta.

else

{

if (vectorAmplitudsEq[n] > VG.limitador)

{

vectorAmplitudsEq[n] = VG.limitador;

}

}

}

}

/********************************************************************

* Funció que aplica a les components freqüèncials inferiors a la

* continguda en la variable global lowCut s'eliminen.

*

* Nota: Aquesta funció s'utilitza en els equalitzadors de terç

* d'octava i paramètric.

*******************************************************************/

private void AplicarTallBaixesFreq()

{

for (int n = 0; n <= N / 2; n++)

{

if (vectorFrequencies[n] < VG.lowCut)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

}

Page 150: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

150

}

/********************************************************************

* Funció que aplica a les components freqüèncials superiors a la

* continguda en la variable global highCut s'eliminen.

*

* Nota: Aquesta funció s'utilitza en els equalitzadors de terç

* d'octava i paramètric.

*******************************************************************/

private void AplicarTallAltesFreq()

{

for (int n = 0; n <= N / 2; n++)

{

if (vectorFrequencies[n] > VG.highCut)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

}

}

/********************************************************************

* Funció que permet convertir els volts del vectorAmplituds[] i

* vectorAmplitudsEq[] a dBV. La fórmula es la següent:

*

* voltatge[dBV] = 20 * log10 (voltatge[V])

*

*******************************************************************/

private void Convertir_volts_a_dBV()

{

for (int n = 0; n <= N / 2; n++)

{

//Si el voltatge és major que 0.0001 V

//es converteixen els volts a dBV.

//Per el vectorAmplituds[]

if (vectorAmplituds[n] > 0.0001)

{

vectorAmplituds[n] = 20 * Math.Log10(vectorAmplituds[n]);

}

Page 151: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

151

//Per voltatges menors o iguals a 0.0001 V s'igualen

//a -80 dBV.

//Per el vectorAmplituds[]

else

{

vectorAmplituds[n] = -80.0;

}

//Es repeteix el procès realitzat al vectorAmplitudsEq[]

if (vectorAmplitudsEq[n] > 0.0001)

{

vectorAmplitudsEq[n] = 20 * Math.Log10(vectorAmplitudsEq[n]);

}

else

{

vectorAmplitudsEq[n] = -80.0;

}

}

}

/********************************************************************

* Funció que permet convertir els dBV del vectorAmplitudsEq[]

* a volts. La fórmula es la següent:

*

* voltatge[volts] = 10 ^ (voltatge[dBV] / 20)

*

*******************************************************************/

private void Convertir_dBV_a_volts()

{

//Per a cada posició del vector VectorAmplitudsEq[]

for (int n = 0; n <= N / 2; n++)

{

//Les amplituds en dBV <= a -80 dBV,

//es converteixen directament a 0 V.

if (vectorAmplitudsEq[n] <= -80.0)

Page 152: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

152

{

vectorAmplitudsEq[n] = 0;

}

//Si l'amplitud en dBV és major que -80 dBV es converteix a volts.

else

{

vectorAmplitudsEq[n] = Math.Pow(10.0, (vectorAmplitudsEq[n] / 20.0));

}

}

}

/********************************************************************

* La funció Equalitzar() suma a cada component espectral de la senyal

* el guany corresponent seleccionat per l'usuari.

*

* Nota: Per calcular l'amplitud d'una component equalitzada, s'ha

* de sumar a la component no equalitzada el guany corresponent a

* l'octava que li pertoca.

* Amplitud equalitzada [dBV] = Amplitud [dBV] + guany [dB]

* dBV és una unitat logarítmica absoluta i dB és una unitat

* logarítmica relativa.

*******************************************************************/

private void Equalitzar()

{

//Segons l'equalitzador escollit:

//equalitzador = 1 -> Equalitzador d'una octava

//equalitzador = 2 -> Equalitzador de terç d'octava

//equalitzador = 3 -> Equalitzador paramètric

switch (VG.equalitzador)

{

case 1: //Equalització d'una octava

//Per a cada posició del vectorFrequencies[] s'ha d'assignar a la

//mateixa posició del vectorAmplitudsEq[]

for (int n = 0; n <= N / 2; n++)

{

Page 153: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

153

//Les components espectrals menors a 20 Hz (infrasons)

//s'eliminen (-80 dBV per evitar ceros)

if ((int)vectorFrequencies[n] < 20)

{

vectorAmplitudsEq[n] = -80.0;

}

//Les components espectrals superiors a 20 kHz

//(ultrasons)s'eliminen (-80 dBV per evitar ceros).

if ((int)vectorFrequencies[n] > 20000)

{

vectorAmplitudsEq[n] = -80.0;

}

//Si pertany a l'octava de 31,5 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava31coma5Hz_LF) &&

(vectorFrequencies[n] < Octava31coma5Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany31coma5Hz;

}

//Si pertany a l'octava de 63 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava63Hz_LF) &&

(vectorFrequencies[n] < Octava63Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany63Hz;

}

//Si pertany a l'octava de 125 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava125Hz_LF) &&

(vectorFrequencies[n] < Octava125Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany125Hz;

Page 154: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

154

}

//Si pertany a l'octava de 250 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava250Hz_LF) &&

(vectorFrequencies[n] < Octava250Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany250Hz;

}

//Sipertany a l'octava de 500 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava500Hz_LF) &&

(vectorFrequencies[n] < Octava500Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany500Hz;

}

//Si pertany a l'octava de 1 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava1000Hz_LF) &&

(vectorFrequencies[n] < Octava1000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany1000Hz;

}

//Si pertany a l'octava de 2 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava2000Hz_LF) &&

(vectorFrequencies[n] < Octava2000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany2000Hz;

}

//Si pertany a l'octava de 4 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava4000Hz_LF) &&

Page 155: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

155

(vectorFrequencies[n] < Octava4000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany4000Hz;

}

//Si pertany a l'octava de 8000 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= Octava8000Hz_LF) &&

(vectorFrequencies[n] < Octava8000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany8000Hz;

}

//Si pertany a l'octava de 16 kHz,

//sumar el guany corresponent.

if ((vectorFrequencies[n] >= Octava16000Hz_LF) &&

(vectorFrequencies[n] <= Octava16000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany16000Hz;

}

}

break;

case 2: //Equalització de terç d'octava

//Repetim el mateix procès de l'equalitzador d'una

//octava

for (int n = 0; n <= N / 2; n++)

{

//Les components espectrals menors a 20 Hz

//i superiors a 20 kHz

if (vectorFrequencies[n] < 20)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

if (vectorFrequencies[n] > 20000)

{

Page 156: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

156

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

//Per calcular l'amplitud d'una component equalitzada, s'ha

//de sumar a la component no equalitzada el guany corresponent a

//l'octava que li pertoca.

//Amplitud equalitzada[dBV] = Amplitud[dBV] + guany[dB]

//Si pertany al terç d'octava de 20 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava20Hz_LF) &&

(vectorFrequencies[n] < TersOctava20Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany20Hz;

}

//Si pertany al terç d'octava de 25 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava25Hz_LF) &&

(vectorFrequencies[n] < TersOctava25Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany25Hz;

}

//Si pertany al terç d'octava de 31,5 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava31coma5Hz_LF) &&

(vectorFrequencies[n] < TersOctava31coma5Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany31coma5Hz;

}

//Si pertany al terç d'octava de 40 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava40Hz_LF) &&

(vectorFrequencies[n] < TersOctava40Hz_HF))

{

Page 157: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

157

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany40Hz;

}

//Si pertany al terç d'octava de 50 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava50Hz_LF) &&

(vectorFrequencies[n] < TersOctava50Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany50Hz;

}

//Si pertany al terç d'octava de 63 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava63Hz_LF) &&

(vectorFrequencies[n] < TersOctava63Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany63Hz;

}

//Si pertany al terç d'octava de 80 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava80Hz_LF) &&

(vectorFrequencies[n] < TersOctava80Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany80Hz;

}

//Si pertany al terç d'octava de 100 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava100Hz_LF) &&

(vectorFrequencies[n] < TersOctava100Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany100Hz;

}

//Si pertany al terç d'octava de 125 Hz,

//es suma el guany corresponent.

Page 158: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

158

if ((vectorFrequencies[n] >= TersOctava125Hz_LF) &&

(vectorFrequencies[n] < TersOctava125Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany125Hz;

}

//Si pertany al terç d'octava de 160 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava160Hz_LF) &&

(vectorFrequencies[n] < TersOctava160Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany160Hz;

}

//Si pertany al terç d'octava de 200 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava200Hz_LF) &&

(vectorFrequencies[n] < TersOctava200Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany200Hz;

}

//Si pertany al terç d'octava de 250 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava250Hz_LF) &&

(vectorFrequencies[n] < TersOctava250Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany250Hz;

}

//Si pertany al terç d'octava de 315 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava315Hz_LF) &&

(vectorFrequencies[n] < TersOctava315Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany315Hz;

}

Page 159: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

159

//Si pertany al terç d'octava de 400 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava400Hz_LF) &&

(vectorFrequencies[n] < TersOctava400Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany400Hz;

}

//Si pertany al terç d'octava de 500 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava500Hz_LF) &&

(vectorFrequencies[n] < TersOctava500Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany500Hz;

}

//Si pertany al terç d'octava de 630 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava630Hz_LF) &&

(vectorFrequencies[n] < TersOctava630Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany630Hz;

}

//Si pertany al terç d'octava de 800 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava800Hz_LF) &&

(vectorFrequencies[n] < TersOctava800Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany800Hz;

}

//Si pertany al terç d'octava de 1 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava1000Hz_LF) &&

(vectorFrequencies[n] < TersOctava1000Hz_HF))

{

Page 160: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

160

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany1000Hz;

}

//Si pertany al terç d'octava de 1250 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava1250Hz_LF) &&

(vectorFrequencies[n] < TersOctava1250Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany1250Hz;

}

//Si pertany al terç d'octava de 1600 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava1600Hz_LF) &&

(vectorFrequencies[n] < TersOctava1600Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany1600Hz;

}

//Si pertany al terç d'octava de 2 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava2000Hz_LF) &&

(vectorFrequencies[n] < TersOctava2000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany2000Hz;

}

//Si pertany al terç d'octava de 2500 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava2500Hz_LF) &&

(vectorFrequencies[n] < TersOctava2500Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany2500Hz;

}

//Si pertany al terç d'octava de 3150 Hz,

//es suma el guany corresponent.

Page 161: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

161

if ((vectorFrequencies[n] >= TersOctava3150Hz_LF) &&

(vectorFrequencies[n] < TersOctava3150Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany3150Hz;

}

//Si pertany al terç d'octava de 4 kHz,

//es suma el guany corresponent..

if ((vectorFrequencies[n] >= TersOctava4000Hz_LF) &&

(vectorFrequencies[n] < TersOctava4000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany4000Hz;

}

//Si pertany al terç d'octava de 5 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava5000Hz_LF) &&

(vectorFrequencies[n] < TersOctava5000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany5000Hz;

}

//Si pertany al terç d'octava de 6300 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava6300Hz_LF) &&

(vectorFrequencies[n] < TersOctava6300Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany6300Hz;

}

//Si pertany al terç d'octava de 8 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava8000Hz_LF) &&

(vectorFrequencies[n] < TersOctava8000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany8000Hz;

}

Page 162: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

162

//Si pertany al terç d'octava de 10 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava10000Hz_LF) &&

(vectorFrequencies[n] < TersOctava10000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany10000Hz;

}

//Si pertany al terç d'octava de 12500 Hz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava12500Hz_LF) &&

(vectorFrequencies[n] < TersOctava12500Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany12500Hz;

}

//Si pertany al terç d'octava de 16 kHz,

//es suma el guany corresponent.

if ((vectorFrequencies[n] >= TersOctava16000Hz_LF) &&

(vectorFrequencies[n] <= TersOctava16000Hz_HF))

{

vectorAmplitudsEq[n] = vectorAmplituds[n] + VG.guany16000Hz;

}

}

break;

case 3: //Equalització paramètrica

//La freq. més baixa de la banda LF,

//és = a la freq. central de la banda LF, menys

//el BW de la banda LF / 2.

//La freq. més alta de la banda LF,

//és = a la freqüència central de la banda LF, més

//el BW de la banda LF / 2.

freqBaixa_LF = (VG.freqCentral_LF - ((VG.bW_LF) / 2));

//Després de fer els càlculs, si freqBaixa_LF es menor

Page 163: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

163

//que 20 Hz, s'iguala a 20 Hz.

if (freqBaixa_LF < 20)

{

freqBaixa_LF = 20;

}

freqAlta_LF = (VG.freqCentral_LF + ((VG.bW_LF) / 2));

//Després de fer els càlculs, si freqAlta_HF es mejor

//que 20 kHz, s'iguala a 20 kHz.

if (freqAlta_LF > 20000)

{

freqAlta_LF = 20000;

}

//La freq. més baixa de la banda MLF,

//és = a la freq. central de la banda MLF, menys

//el BW de la banda MLF / 2.

//La freq. més alta de la banda LF,

//és = a la freqüència central de la banda MLF, més

//el BW de la banda MLF / 2.

freqBaixa_MLF = (VG.freqCentral_MLF - ((VG.bW_MLF) / 2));

//Després de fer els càlculs, si freqBaixa_MLF es menor

//que 20 Hz, s'iguala a 20 Hz.

if (freqBaixa_MLF < 20)

{

freqBaixa_MLF = 20;

}

freqAlta_MLF = (VG.freqCentral_MLF + ((VG.bW_MLF) / 2));

//Després de fer els càlculs, si freqAlta_MLF es major

//que 20 kHz, s'iguala a 20 kHz.

if (freqAlta_MLF > 20000)

{

freqAlta_MLF = 20000;

Page 164: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

164

}

//La freq. més baixa de la banda MHF,

//és = a la freq. central de la banda MHF, menys

//el BW de la banda MHF / 2.

//La freq. més alta de la banda LF,

//és = a la freqüència central de la banda MHF, més

//el BW de la banda MHF / 2.

freqBaixa_MHF = (VG.freqCentral_MHF - ((VG.bW_MHF) / 2));

//Després de fer els càlculs, si freqBaixa_MHF es menor

//que 20 Hz, s'iguala a 20 Hz.

if (freqBaixa_MHF < 20)

{

freqBaixa_MHF = 20;

}

freqAlta_MHF = (VG.freqCentral_MHF + ((VG.bW_MHF) / 2));

//Després de fer els càlculs, si freqAlta_MHF es major

//que 20 kHz, s'iguala a 20 kHz.

if (freqAlta_MHF > 20000)

{

freqAlta_MHF = 20000;

}

//La freq. més baixa de la banda HF,

//és = a la freq. central de la banda HF, menys

//el BW de la banda HF / 2.

//La freq. més alta de la banda LF,

//és = a la freqüència central de la banda HF, més

//el BW de la banda MHF / 2.

freqBaixa_HF = (VG.freqCentral_HF - ((VG.bW_HF) / 2));

//Si després de fer el càlcul, freqBaixa_HF resulta ser menor

//que 20 Hz, igualar-la a 20 Hz.

if (freqBaixa_HF < 20)

Page 165: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

165

{

freqBaixa_HF = 20;

}

freqAlta_HF = (VG.freqCentral_HF + ((VG.bW_HF) / 2));

//Després de fer els càlculs, si freqAlta_HF es major

//que 20 kHz, s'iguala a 20 kHz.

if (freqAlta_HF > 20000)

{

freqAlta_HF = 20000;

}

//Per a totes les components espectrals de la senyal fer:

for (int n = 0; n <= N / 2; n++)

{

//Si la component espectral pertany a la banda LF

//s'aplica el guany corresponent.

//Es suma l'amplitud (dbV) i el guany (db).

//S'obté l'amplitud equalitzada en dBV

if ((vectorFrequencies[n] >= freqBaixa_LF) &&

(vectorFrequencies[n] < freqAlta_LF))

{

vectorAmplitudsEq[n] = vectorAmplitudsEq[n] + VG.guany_LF;

}

//Si la component espectral pertany a la banda MLF

//s'aplica el guany corresponent.

if ((vectorFrequencies[n] >= freqBaixa_MLF) &&

(vectorFrequencies[n] < freqAlta_MLF))

{

vectorAmplitudsEq[n] = vectorAmplitudsEq[n] + VG.guany_MLF;

}

//Si la component espectral pertany a la banda MHF

//s'aplica el guany corresponent.

if ((vectorFrequencies[n] >= freqBaixa_MHF) &&

Page 166: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

166

(vectorFrequencies[n] < freqAlta_MHF))

{

vectorAmplitudsEq[n] = vectorAmplitudsEq[n] + VG.guany_MHF;

}

//Si la component espectral pertany a la banda HF

//s'aplica el guany corresponent.

if ((vectorFrequencies[n] >= freqBaixa_HF) &&

(vectorFrequencies[n] < freqAlta_HF))

{

vectorAmplitudsEq[n] = vectorAmplitudsEq[n] + VG.guany_HF;

}

//En l'equalitzador paramètric el filtrat dels ultrasons

//i ultrasons s'aplica al final de la equalització i no al principi

//com en els altres equalitzadors. Això es degut a que degut els

//valors escollits per l'usuari (freq. central i BW) es poden

//amplificar/atenuar els ultrasons i infrasons.

//Les components espectrals menors a 20 Hz (infrasons)

//s'eliminen (-80 dBV per evitar ceros)

if (vectorFrequencies[n] < 20)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

//Les components espectrals superiors a 20 kHz

//(ultrasons) s'eliminen (-80 dBV per evitar ceros)

if (vectorFrequencies[n] > 20000)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

}

break;

}

}

/********************************************************************

Page 167: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

167

* Funció que realitza el tall de les freqüències superiors a 5 kHz.

*

* Nota: El DAC de la USB-1208FS pot enviar un màxim de 10000

* mostres/s, llavors, per tal d'evitar l'efecte aliasing, es

* filtraràn les components espectrals superiors a 5 kHz. En el cas

* de la USB-1208FS Plus, aquest tall no serà necessari ja que pot

* enviar mostres a 50000 mostres/s

*******************************************************************/

private void FiltrePassaBaixos5000Hz()

{

for (int n = 0; n <= N / 2; n++)

{

//Les components espectrals superiors a 5 kHz

//s'eliminen (-80 dBV per evitar ceros)

if (vectorFrequencies[n] > 5000)

{

vectorAmplitudsEq[n] = -80.0; //-80 dBV

}

}

}

/************************************************************************

Algorisme FFT de reducció en freqüència de base 2, amb càlculs "in situ",

o sigui, en el mateix lloc, en el mateix vector de dades. Implementa un

diagrama de flux que està dibuixat a la documentació externa del programa.

La papallona bàsica és la següent:

A = a + b

t

B = (a - b) * W

N

Es tracta d'una implementació de l'algorisme més habitual, juntament amb

el seu anàleg FFT de reducció en el temps de base 2, amb càlculs

"in situ".

Quan l'algorisme que implementa el diagrama de flux arriva al final, la

FFT resultant apareix en ordre de reversió de bits, i s'ha d'aplicar un

algorisme final de reversió de bits per tal de deixar la FFT ordenada en

l'ordre correcte.

Page 168: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

168

Aquesta implementació concreta del diagrama de flux clàssic, està basada

en una implementació de Gerry Beauregard, penjada a Internet en el

següent article:

An FFT in C# | Gerry Beauregard

Nota: Aquesta funció està extreta íntegrament del projecte [24]

***********************************************************************/

private void CalcularFFT()

{

int numFlies = N >> 1; //Número de papallones per subFFT, inicialitzat

//a N/2.

int span = N >> 1; //Amplada de la papallona, inicialitzat a N/2.

int spacing = N; //Distància entre començaments de subFFT's

//consecutives d'una etapa. Inicialitzat a N.

int wIndexStep = 1; //Per a buscar els factors de gir. Inicialitzat

//a 1.

double tempReal; //Per a guardar temporalment la part real d'un número.

double tempIm; //Per a guardar temporalment la part imaginaria d'un

//número.

//Per a cada etapa de la FFT...

for (int etapa = 0; etapa < logN; etapa++)

{

//...calcular cada subFFT de l'etapa

for (int start = 0; start < N; start += spacing)

{

int a; //Índex de l'element "alt" de la papallona,

//d'index numèricament més baix, però situat a

//dalt en el diagrama de flux tal i com s'acostuma

//a dibuixar.

int b; //Índex de l'element "baix" de la papallona,

//d'index numèricament més alt, però situat abaix

//en el diagrama de flux tal i com s'acostuma a

//dibuixar.

a = start;

Page 169: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

169

b = start + span;

//El factor de gir inicial està en

//vectorFactorDeGirReal[0] (Part Real), i

//vectorFactorDeGirIm[0] (Part imaginària).

int n = 0;

//Calcular cada papallona de la subFFT

for (int flyCount = 0; flyCount < numFlies; flyCount++)

{

//Calcular papallona

tempReal = vectorDadesReal[a];

tempIm = vectorDadesIm[a];

vectorDadesReal[a] = vectorDadesReal[a] + vectorDadesReal[b];

vectorDadesIm[a] = vectorDadesIm[a] + vectorDadesIm[b];

vectorDadesReal[b] = tempReal - vectorDadesReal[b];

vectorDadesIm[b] = tempIm - vectorDadesIm[b];

tempReal = vectorDadesReal[b];

vectorDadesReal[b] = vectorDadesReal[b] * vectorFactorDeGirReal[n] -

vectorDadesIm[b] * vectorFactorDeGirIm[n];

vectorDadesIm[b] = tempReal * vectorFactorDeGirIm[n] +

vectorDadesIm[b] * vectorFactorDeGirReal[n];

//Actualitzar a i b als de la nova papallona a calcular

a++;

b++;

//Actualitzar l'índex del factor de gir

n = n + wIndexStep;

}

Page 170: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

170

}

//En acabar una etapa, actualitzem les següents variables als valors

//corresponents a la nova etapa

numFlies >>= 1; //En la nova etapa, el número de papallones per

//subFFT passa a valer la meitat. Divisió per 2

//per desplaçament a la dreta.

span >>= 1; //Lo mateix per a l'amplada de la papallona.

spacing >>= 1; //Lo mateix per a la distància entre el

//començament de les subFFT consecutives de

//l'etapa.

wIndexStep <<= 1; //En canvi, aquesta variable per a buscar els

//nous factors de gir corresponents a la nova

//etapa, s'ha de multiplicar per 2.

//Multiplicació per 2 per desplaçament cap a

//l'esquerra.

}

//REVERSIÓ DE BITS I INTERCANVI DE POSICIONS

int i, j; //Posicions de vectorDades[] a ser intercanviades

int k; //Còpia a manipular de i. Finalment quedarà manipulada

//Reversió de bits i intercanvi de posicions

//Per a cada posició d'un vector de longitud N (o sigui, desde la

//posició "0" a la "N - 1", trobar amb quina posició s'ha

//d'intercanviar cada posició, per a que el vector de longitud N

//quedi "bit revertit". S'han d'intercanviar les posicions que,

//escrites en binari natural, una llegida d'esquerra a dreta,

//i l'altra llegida de dreta a esquerra, siguin iguals. Per exemple,

//per a N = 64, logN = 6, posicions de la "0" a la "63", la posició

//"5" i la "40" s'han d'intercanviar, perque 5d = 000101,

//i 40d = 101000.

for (i = 0; i < N; i++)

{

k = i; //Copiar i en k. i és la posició a ser bit-revertida

Page 171: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

171

j = 0; //j inicialitzada a 0. Al sortir del següent llaç,

//j contindrà la posició que ha d'intercanviar contingut

//amb la posició i.

//Per a cada bit de la posició, desde el bit 0 al bit N-1,

for (int bit = 0; bit < logN; bit++)

{

j = (j << 1);

j = (j | (k & 0x00000001));

k = (k >> 1);

}

//Intercanvi de posicions

//La posició "i" únicament s'ha d'intercanviar amb la posició "j"

//si la posició "i" és més baixa que la "j", per tal d'evitar que

//les posicions "i" i "j" s'intercanviin dues vegades, i el vector

//quedi com al principi, sense canvis. Per exemple, les posicions

//5 i 40 s'han d'intercanviar (Per a N = 64), al recorrer el vector,

//s' arriva a que la posició 5 s'ha d'intercanviar amb la 40, i s'ha

//de fer perque 5 < 40, però després també s'arriva a que 40 s'ha

//d'intercanviar amb 5, i llavors no s'ha de fer perque 40 > 5,

//i si es fés es desfaria el canvi anterior, i les posicons

//5 i 40 quedarien finalment com si no s'haguessin intercanviat.

if (i < j)

{

tempReal = vectorDadesReal[j];

tempIm = vectorDadesIm[j];

vectorDadesReal[j] = vectorDadesReal[i];

vectorDadesIm[j] = vectorDadesIm[i];

vectorDadesReal[i] = tempReal;

vectorDadesIm[i] = tempIm;

}

}

}

/********************************************************************

Page 172: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

172

* Funció que calcula les amplituds dels diferents armònics calculats

* de la senyal. L'amplitud de l'armònic i-èssim, quedarà dipositada

* a la posició i-èssima de vectorDadesReal[], podent valdre i desde

* 0 a N/2, ambdós inclosos.

*

* Nota: Aquesta funció està extreta íntegrament del projecte [24]

*******************************************************************/

private void CalcularAmplituds()

{

//L'amplitud de la component continua és el mòdul del número complexe

//de la posició 0, dividit per N.

vectorDadesReal[0] = (Math.Sqrt(vectorDadesReal[0] * vectorDadesReal[0] +

vectorDadesIm[0] * vectorDadesIm[0])) / N;

//L'amplitud de la resta de components, excepte la component a la

//freqüència de Nyquist, és la següent:

//L'amplitud de la component i-èssima, anant i desde 1 fins a (N/2 - 1),

//ambdós inclosos, és el mòdul del número complexe de la posició [i],

//multiplicat per 2/N.

for (int n = 1; n < (N / 2); n++)

{

vectorDadesReal[n] = (2 * (Math.Sqrt(vectorDadesReal[n] * vectorDadesReal[n] +

vectorDadesIm[n] * vectorDadesIm[n])) / N);

}

//L'amplitud a la freqüència de Nyquist és el mòdul del número complexe

//de la posició N/2, dividit per N.

vectorDadesReal[N / 2] = (Math.Sqrt(vectorDadesReal[N / 2] * vectorDadesReal[N / 2] +

vectorDadesIm[N / 2] * vectorDadesIm[N / 2])) / N;

}

/**************************************************************

* Funció que calcula l'algoritme IFFT.

*

Page 173: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

173

* Nota: Aquesta funció a sigut obtinguda a partir de

* l'algorisme FFT desenvolupat en el projecte [24]. S'utilitzen

* part dels comentaris desenvolupats en aquest ja que nomès

* s'ha de recorrer a l'inversa el diagrama de papallona, però

* les variables i moltes operacions son les mateixes amb petits

* canvis.

**************************************************************/

private void Calcular_IFFT()

{

//la inicialització de numFiles, span, spacing i wIndexStep

//son diferents respecte a les inicialitzacións fetes

//en la FFT del projecte [24]. La IFFT recorre el diagrama

//de papallona en sentit contrari

int numFlies = 1; //Número de papallones per subIFFT.

//S'inicialitza a 1.

int span = 1; //Amplada de la papallona,

//S'inicialitza a 1.

int spacing = 2; //Distància entre començaments

//de subIFFT's consecutives

//d'una etapa. Inicialitzada a 2.

int wIndexStep = N >> 1; //Per a buscar els factors de gir.

//Inicialitzat a N/2.

double tempReal; //Per a guardar temporalment la part real

//d'un número.

double tempIm; //Per a guardar temporalment la part

//imaginària d'un número.

//REVERSIÓ DE BITS E INTERCANVI DE POSICIONS

int i, j; //Posicions de vectorDades[] a ser intercanviades

int k; //Còpia a manipular de i. Finalment quedarà manipulada.

Page 174: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

174

//Reversió de bits i intercanvi de posicions.

//Com estem revertir els pasos fets en la FFT, primer de tot

//s'ha de revertir els vits e intercanviar les posicions

//Per a cada posició d'un vector de longitud N (o sigui, desde la

//posició "0" a la "N - 1", trobar amb quina posició s'ha

//d'intercanviar cada posició, per a que el vector de longitud N

//quedi "bit revertit". S'han d'intercanviar les posicions que,

//escrites en binari natural, una llegida d'esquerra a dreta,

//i l'altra llegida de dreta a esquerra, siguin iguals. Per exemple,

//per a N = 64, logN = 6, posicions de la "0" a la "63", la posició

//"5" i la "40" s'han d'intercanviar, perque 5d = 000101,

//i 40d = 101000.

for (i = 0; i < N; i++)

{

k = i; //Copiar i en k. i és la posició a ser bit-revertida

j = 0; //j inicialitzada a 0. Al sortir del següent llaç,

//j contindrà la posició que ha d'intercanviar contingut

//amb la posició i.

//Per a cada bit de la posició, desde el bit 0 al bit N-1,

for (int bit = 0; bit < logN; bit++)

{

j = (j << 1);

j = (j | (k & 0x00000001));

k = (k >> 1);

}

//Intercanvi de posicions

//La posició "i" únicament s'ha d'intercanviar amb la posició "j"

//si la posició "i" és més baixa que la "j", per tal d'evitar que

//les posicions "i" i "j" s'intercanviin dues vegades, i el vector

//quedi com al principi, sense canvis. Per exemple, les posicions

//5 i 40 s'han d'intercanviar (Per a N = 64), al recorrer el vector,

//s' arriva a que la posició 5 s'ha d'intercanviar amb la 40, i s'ha

//de fer perque 5 < 40, però després també s'arriva a que 40 s'ha

//d'intercanviar amb 5, i llavors no s'ha de fer perque 40 > 5,

//i si es fés es desfaria el canvi anterior, i les posicons

Page 175: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

175

//5 i 40 quedarien finalment com si no s'haguessin intercanviat

if (i < j)

{

tempReal = vectorDadesReal[j];

tempIm = vectorDadesIm[j];

vectorDadesReal[j] = vectorDadesReal[i];

vectorDadesIm[j] = vectorDadesIm[i];

vectorDadesReal[i] = tempReal;

vectorDadesIm[i] = tempIm;

}

}

//Per a cada etapa de la IFFT...

for (int etapa = 0; etapa < logN; etapa++)

{

//...calcular cada subIFFT de l'etapa.

for (int start = 0; start < N; start += spacing)

{

int a; //Índex de l'element "alt" de la papallona,

//d'index numèricament més baix, però

//situat a dalt en el diagrama de flux tal

//i com s'acostuma a dibuixar.

int b; //Índex de l'element "baix" de la papallona,

//d'index numèricament més alt, però situat

//abaix en el diagrama de flux tal i com

//s'acostuma a dibuixar.

a = start;

b = start + span;

//El factor de gir inicial està en

//vectorFactorDeGirReal[0] (Part Real), i

//vectorFactorDeGirIm[0] (Part imaginària).

int n = 0;

Page 176: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

176

//Calcular cada papallona de la subIFFT.

for (int flyCount = 0; flyCount < numFlies; flyCount++)

{

//Per calcular la papallona en sentit contrari a

//la FFT, el nou algoritme a calcular ha de ser:

// -t

// A + B * W

// N

// a = ______________

// 2

//

// b = A - a

tempReal = vectorDadesReal[a];

tempIm = vectorDadesIm[a];

vectorDadesReal[a] = ((vectorDadesReal[b] *

vectorFactorDeGirReal[n] +

vectorDadesIm[b] *

vectorFactorDeGirIm[n]) +

vectorDadesReal[a]) / 2;

vectorDadesIm[a] = ((vectorDadesReal[b] *

(-1) *

vectorFactorDeGirIm[n] +

vectorDadesIm[b] *

vectorFactorDeGirReal[n]) +

vectorDadesIm[a]) / 2;

vectorDadesReal[b] = tempReal - vectorDadesReal[a];

vectorDadesIm[b] = tempIm - vectorDadesIm[a];

//Actualizar els valors de a i b.

a++;

b++;

Page 177: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

177

//Actualitzar l'índex del factor de gir.

n = n + wIndexStep;

}

}

//En acabar una etapa, s'actualitzen les següents

//variables als valors corresponents de la nova etapa.

//(Aquestes actualitzacions canvien respecte de les

//de la FFT, ja que per a la IFFT s'ha de recórrer

//el mateix diagrama de papallona, en sentit contrari.

numFlies <<= 1; //En la nova etapa, el número

//de papallones per subIFFT

//passa a valer el doble.

//Multiplicació per 2 per

//desplaçament a l'esquerra.

span <<= 1; //El mateix per l'amplada de la

//papallona.

spacing <<= 1; //El mateix per la distància

//entre el començament de les

//subIFFT consecutives de l'etapa.

wIndexStep >>= 1; //En canvi, aquesta variable per

//obtenir els nous factors

//de gir corresponents a la nova

//etapa s'ha de dividir

//per 2. Divisió per 2 per

//desplaçament a la dreta.

}

//Per acabar, totes les posicions de vectorDadesReal[]

//s'han de multiplicar per N (tamany de la IFFT).

//Un cop feta aquesta multiplicació,

//vectorDadesReal[] passa a contenir la senyal

//estudiada expressada en el domini del temps.

for (int n = 0; n < N; n++)

Page 178: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

178

{

vectorDadesReal[n] = N * vectorDadesReal[n];

}

}

/**************************************************************

* Funció que reomple els vectorsDadesReal[] i vectorDadesIm[].

* amb la senyal ecualitzada vectorAmplitudsEq[] per calcular

* la IFFT de la senyal.

**************************************************************/

private void ReomplirVectorsReIm()

{

//Suposant que les fases de totes les components espectrals

//de la senyal valen 0º, tots els valors del

//vectorDadesIm[] han de ser 0.

for (int n = 0; n < N; n++)

{

vectorDadesIm[n] = 0;

}

//Omplir el vectorDadesReal[].

//Component contínua.

vectorDadesReal[0] = vectorAmplitudsEq[0];

//Component a la freqüència de Nyquist.

vectorDadesReal[N / 2] = vectorAmplitudsEq[N / 2];

//Resta de components de la senyal.

for (int n = 1; n < N / 2; n++)

{

vectorDadesReal[n] = 0.5 * vectorAmplitudsEq[n];

vectorDadesReal[N - n] = 0.5 * vectorAmplitudsEq[n];

}

}

/**************************************************************

Page 179: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

179

* Funció que permet que es redibuixi el control pictureBox1.

* Per tal de fer-ho, utilitza la funció pictureBox1.Invalidate(),

* Aquest fa que s'invoqui la funció respota a l'event

* pictureBox1_Paint() que es realment dibuixa a l'area de

* control.

*

* Nota: fins que la variable booleana dibuixAcabat no es true,

* realment no es dóna per acabat el dibuix y no quan surt de

* la funció Dibuizar()

**************************************************************/

private void Dibuixar()

{

dibuixAcabat = false;

pictureBox1.Invalidate();

}

/**************************************************************

* Aquesta funció es la que realment dibuixa sobre l'àrea

* de dibuix del control PictureBox1

*

* Nota: al projecte [24] es dibuixava directament al clientSize

* però en aquest cas, al dispossar de un fòrmulari pare i fills,

* no es pot fer d'aquesta manera. Es crea un pictureBox1, que

* al cap i a la fi, no deix de ser com un formulari fill dins

* del formulari pare. En aquesta funció es reutilitzen els

* gràfics del projecte [24] amb les modificaciones necessàries

* per la funcionalitat d'aquest projecte.

**************************************************************/

private void pictureBox1_Paint(object sender, PaintEventArgs e)

{

//S'utilitza la tècnica del doble buffer, per tal d'evitar

//parpadejos i inestabilitats de la imatge.

DoubleBuffered = true;

//S'obté una superficie de dibuix de l'objecte pictureBox1.

Graphics g = e.Graphics;

//S'obté la font, per a poder escriure text en la superficie

Page 180: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

180

//de dibuix del control pictureBox1.

Font font = new Font("Arial", 12);

//Si l'usuari vol que es dibuixi l'espectre en pantalla, a més del

//processament de senyal.

if (representarEspectre == true)

{

//Es dibuixarà l'escala X de l'espectre lineal o logarítmica.

//Elecció de l'usuari

switch (escalaEixXEspectre)

{

//Dibuixar l'espectre en escala X lineal, en la meitat superior

//de la pantalla, i el processament de senyal, en la meitat inferior.

case 1:

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Marges simètrics resepecte de l'àrea del control

//pictureBox1.

int margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//dibuix de pictureBox1.

int margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//dibuix de pictureBox1.

Page 181: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

181

int marcX = 8 * margeX; //Amplada del marc en píxels.

int marcY = 5 * margeY; //Alçada del marc en píxels.

rect = new Rectangle(margeX, margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

int xPuntA;

int yPuntA;

int xPuntB;

int yPuntB;

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

Page 182: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

182

}

//Repetim -> Aresta horitzontal superior del marc.

for (int marcaVertical = 0; marcaVertical <= 100; marcaVertical++)

{

xPuntA = margeX + (int)((marcaVertical * marcX) / 100);

yPuntA = margeY - (int)(marcY / 100);

xPuntB = xPuntA;

yPuntB = margeY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Repetim -> Aresta horitzontal inferior del marc.

for (int marcaVertical = 0; marcaVertical <= 100; marcaVertical++)

{

xPuntA = margeX + (int)((marcaVertical * marcX) / 100);

yPuntA = margeY + marcY;

xPuntB = xPuntA;

yPuntB = margeY + marcY + (int)(marcY / 100);

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = margeY;

Page 183: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

183

xPuntB = xPuntA;

yPuntB = margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia horitzontal en 100 parts equiespaiades.

Page 184: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

184

for (int marcaVertical = 1; marcaVertical <= 99; marcaVertical++)

{

xPuntA = margeX + (int)((marcaVertical * marcX) / 100);

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10) - (int)(marcY / 200);

xPuntB = xPuntA;

yPuntB = margeY + (int)((liniaHoritzontal * marcY) / 10) + (int)(marcY / 200);

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Variables locals per a escriure les escales dels eixos.

int margeXX;

int margeYY;

int marcXX = (int)(marcX / 10);

int marcYY = (int)(marcY / 10);

//Escriure els dBV a l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = margeY - 12;

g.DrawString("+20 dBV", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dBV", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" 0 dBV", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString("-10 dBV", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString("-20 dBV", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-30 dBV", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-40 dBV", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-50 dBV", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-60 dBV", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-70 dBV", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

Page 185: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

185

g.DrawString("-80 dBV", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

switch (mostresPerSegon)

{

case 50000:

//Escriure els Hz a l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString("0", font, Brushes.Black, margeXX + 13, margeYY);

g.DrawString("2500", font, Brushes.Black, margeXX + marcXX, margeYY);

g.DrawString("5000", font, Brushes.Black, margeXX + 2 * marcXX, margeYY);

g.DrawString("7500", font, Brushes.Black, margeXX + 3 * marcXX, margeYY);

g.DrawString("10000", font, Brushes.Black, margeXX + 4 * marcXX, margeYY);

g.DrawString("12500", font, Brushes.Black, margeXX + 5 * marcXX, margeYY);

g.DrawString("15000", font, Brushes.Black, margeXX + 6 * marcXX, margeYY);

g.DrawString("17500", font, Brushes.Black, margeXX + 7 * marcXX, margeYY);

g.DrawString("20000", font, Brushes.Black, margeXX + 8 * marcXX, margeYY);

g.DrawString("22500", font, Brushes.Black, margeXX + 9 * marcXX, margeYY);

g.DrawString("25000 Hz", font, Brushes.Black, margeXX + 10 * marcXX, margeYY);

break;

case 40000:

//Escriure els Hz a l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString("0", font, Brushes.Black, margeXX + 13, margeYY);

g.DrawString("2000", font, Brushes.Black, margeXX +

Page 186: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

186

marcXX, margeYY);

g.DrawString("4000", font, Brushes.Black, margeXX + 2 * marcXX, margeYY);

g.DrawString("6000", font, Brushes.Black, margeXX + 3 * marcXX, margeYY);

g.DrawString("8000", font, Brushes.Black, margeXX + 4 * marcXX, margeYY);

g.DrawString("10000", font, Brushes.Black, margeXX + 5 * marcXX, margeYY);

g.DrawString("12000", font, Brushes.Black, margeXX + 6 * marcXX, margeYY);

g.DrawString("14000", font, Brushes.Black, margeXX + 7 * marcXX, margeYY);

g.DrawString("16000", font, Brushes.Black, margeXX + 8 * marcXX, margeYY);

g.DrawString("18000", font, Brushes.Black, margeXX + 9 * marcXX, margeYY);

g.DrawString("20000 Hz", font, Brushes.Black, margeXX + 10 * marcXX, margeYY);

break;

}

//Dibuixar l'espectre. Nomès es dibuixa quan es crida la funció

//pictureBox1_Paint per la funció Dibuixar(). Inicialment no s'ha

//de dibuixar l'espectre, nomès la quadrícula i les escales X

//i Y de l'instrument

if (dibuixarEspectre == true)

{

dibuixarEspectre = false;

GraphicsPath Espectre1 = new GraphicsPath();

GraphicsPath Espectre2 = new GraphicsPath();

int xPuntAnterior;

int yPuntAnterior;

int xPunt;

int yPunt;

//Es representa l'espectre de la senyal capturada i no processada.

//Línea de color vermell. Escala eix Y dBV.

xPuntAnterior = margeX;

Page 187: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

187

yPuntAnterior = margeY + (int)(marcY / 5) - (int)((vectorAmplituds[0] * marcY) / 100);

for (int n = 1; n <= (N / 2); n++)

{

xPunt = margeX + (int)((n * marcX) / (N / 2));

yPunt = margeY + (int)(marcY / 5) - (int)((vectorAmplituds[n] * marcY) / 100);

Espectre1.AddLine(xPuntAnterior, yPuntAnterior, xPunt, yPunt);

xPuntAnterior = xPunt;

yPuntAnterior = yPunt;

}

g.DrawPath(llapisVermellN2, Espectre1);

//Es representa l'espectre de la senyal capturada i processada.

//Línea de color verd. Escala eix Y dBV.

xPuntAnterior = margeX;

yPuntAnterior = margeY + (int)(marcY / 5) - (int)((vectorAmplitudsEq[0] * marcY) / 100);

for (int n = 1; n <= (N / 2); n++)

{

xPunt = margeX + (int)((n * marcX) / (N / 2));

yPunt = margeY + (int)(marcY / 5) - (int)((vectorAmplitudsEq[n] * marcY) / 100);

Espectre2.AddLine(xPuntAnterior, yPuntAnterior, xPunt, yPunt);

xPuntAnterior = xPunt;

yPuntAnterior = yPunt;

}

g.DrawPath(llapisVerdN2, Espectre2);

}

//Es dibuixa en la meitat inferior de la pantalla, l'equalització

//escollida per l'usuari.

Page 188: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

188

//Si l'equalitzador és el d'una octava...

if (VG.equalitzador == 1)

{

//La variable "y" val la meitat de l'alçada del control pictureBox1,

int y = (int)((pictureBox1.Height) / 2);

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de dibuix del

//control pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y + margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

Page 189: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

189

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Repetim el mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

Page 190: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

190

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y + margeY;

xPuntB = xPuntA;

yPuntB = y + margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

Page 191: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

191

xPuntA = margeX;

yPuntA = y + margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de les variables locals.

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y + margeY - 8;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

Page 192: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

192

margeXX = margeX - 20;

margeYY = y + margeY + marcY + 12;

g.DrawString("31,5", font, Brushes.Black, margeXX + (int)(0.5 * marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.5 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.5 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.5 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX + (int)(4.5 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.5 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.5 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.5 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.5 * marcXX), margeYY);

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.5 * marcXX), margeYY);

//Escriure les anotacions en pantalla, referents a l'equalització escollida.

g.DrawString("Equalització d'una octava",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.8)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 0.8)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)((2 * y) - (int)(margeY * 0.8)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

Page 193: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

193

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de variables locals.

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[10];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany31coma5Hz;

vectorEqualitzacio[1] = VG.guany63Hz;

vectorEqualitzacio[2] = VG.guany125Hz;

vectorEqualitzacio[3] = VG.guany250Hz;

vectorEqualitzacio[4] = VG.guany500Hz;

vectorEqualitzacio[5] = VG.guany1000Hz;

vectorEqualitzacio[6] = VG.guany2000Hz;

vectorEqualitzacio[7] = VG.guany4000Hz;

vectorEqualitzacio[8] = VG.guany8000Hz;

vectorEqualitzacio[9] = VG.guany16000Hz;

//Representar en pantalla l' equalització de la senyal.

//Color de línea blau. Escala eix Y dB. Escala eix X octaves (Hz).

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany31coma5Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 9; n++)

{

xPunt0 = margeX + (int)(marcX * 0.1 * n);

xPunt1 = margeX + (int)(marcX * 0.1 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 *

Page 194: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

194

vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (y + margeY + (int)(marcY * 0.3)),

(margeX + marcX), (y + margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el de terç d'octava...

if (VG.equalitzador == 2)

{

//La variable "y" val la meitat de l'alçada de l'àrea del control

//pictureBox1, en píxels.

int y = (int)((pictureBox1.Height) / 2);

Page 195: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

195

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y + margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) /

Page 196: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

196

100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y + margeY;

xPuntB = xPuntA;

yPuntB = y + margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

Page 197: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

197

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = y + margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de les variables locals.

Page 198: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

198

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y + margeY - 8;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = y + margeY + marcY + 12;

g.DrawString(" 31,5", font, Brushes.Black, margeXX + (int)(0.8 * marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.8 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.8 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.8 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX +

Page 199: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

199

(int)(4.8 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.8 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.8 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.8 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.8 * marcXX), margeYY);

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.8 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització escollida.

g.DrawString("Equalització de terç d'octava",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de variables locals.

Page 200: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

200

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[30];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany20Hz;

vectorEqualitzacio[1] = VG.guany25Hz;

vectorEqualitzacio[2] = VG.guany31coma5Hz;

vectorEqualitzacio[3] = VG.guany40Hz;

vectorEqualitzacio[4] = VG.guany50Hz;

vectorEqualitzacio[5] = VG.guany63Hz;

vectorEqualitzacio[6] = VG.guany80Hz;

vectorEqualitzacio[7] = VG.guany100Hz;

vectorEqualitzacio[8] = VG.guany125Hz;

vectorEqualitzacio[9] = VG.guany160Hz;

vectorEqualitzacio[10] = VG.guany200Hz;

vectorEqualitzacio[11] = VG.guany250Hz;

vectorEqualitzacio[12] = VG.guany315Hz;

vectorEqualitzacio[13] = VG.guany400Hz;

vectorEqualitzacio[14] = VG.guany500Hz;

vectorEqualitzacio[15] = VG.guany630Hz;

vectorEqualitzacio[16] = VG.guany800Hz;

vectorEqualitzacio[17] = VG.guany1000Hz;

vectorEqualitzacio[18] = VG.guany1250Hz;

vectorEqualitzacio[19] = VG.guany1600Hz;

Page 201: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

201

vectorEqualitzacio[20] = VG.guany2000Hz;

vectorEqualitzacio[21] = VG.guany2500Hz;

vectorEqualitzacio[22] = VG.guany3150Hz;

vectorEqualitzacio[23] = VG.guany4000Hz;

vectorEqualitzacio[24] = VG.guany5000Hz;

vectorEqualitzacio[25] = VG.guany6300Hz;

vectorEqualitzacio[26] = VG.guany8000Hz;

vectorEqualitzacio[27] = VG.guany10000Hz;

vectorEqualitzacio[28] = VG.guany12500Hz;

vectorEqualitzacio[29] = VG.guany16000Hz;

//Representació en pantalla de l'equalització de la senyal.

//Color de línea blau. Escala eix Y dB. Escala eix X octaves (Hz).

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany20Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 29; n++)

{

xPunt0 = margeX + (int)(marcX * 0.03333333333 * n);

xPunt1 = margeX + (int)(marcX * 0.03333333333 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Page 202: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

202

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9666666666667 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (y + margeY + (int)(marcY * 0.3)),

(margeX + marcX), (y + margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el paramètric...

if (VG.equalitzador == 3)

{

//La variable "y" val la meitat de l'alçada de l'àrea de pictureBox1,

//en píxels.

int y = (int)((pictureBox1.Height) / 2);

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

Page 203: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

203

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 16); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta

Page 204: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

204

del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y;

xPuntB = xPuntA;

yPuntB = y + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + (int)((marcaHoritzontal * marcY) /

Page 205: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

205

100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = y + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de les variables locals.

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y - 8;

Page 206: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

206

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure la freqüència (en Hz) en l'escala de l'eix X. Escala logarítmica.

margeXX = margeX - 20;

margeYY = y + marcY + 12;

g.DrawString(" 20", font, Brushes.Black, margeXX, margeYY);

g.DrawString(" 40", font, Brushes.Black, margeXX + (int)(1 * marcXX), margeYY);

g.DrawString(" 80", font, Brushes.Black, margeXX + (int)(2 * marcXX), margeYY);

g.DrawString(" 160", font, Brushes.Black, margeXX + (int)(3 * marcXX), margeYY);

g.DrawString(" 320", font, Brushes.Black, margeXX + (int)(4 * marcXX), margeYY);

g.DrawString(" 640", font, Brushes.Black, margeXX + (int)(5 * marcXX), margeYY);

g.DrawString("1280", font, Brushes.Black, margeXX + (int)(6 * marcXX), margeYY);

g.DrawString("2560", font, Brushes.Black, margeXX + (int)(7 * marcXX), margeYY);

g.DrawString("5120", font, Brushes.Black, margeXX + (int)(8 * marcXX), margeYY);

g.DrawString("10240", font, Brushes.Black, margeXX + (int)(9 * marcXX), margeYY);

g.DrawString("20480 [Hz]", font, Brushes.Black, margeXX +

Page 207: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

207

(int)(10 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització de la senyal.

g.DrawString("Equalització paramètrica",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 2.4)));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 2.4)));

g.DrawString("Freq Baixa LF = " + freqBaixa_LF + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta LF = " + freqAlta_LF + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa MLF = " + freqBaixa_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta MLF = " + freqAlta_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa MHF = " + freqBaixa_MHF + " Hz ",

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta MHF = " + freqAlta_MHF + " Hz ",

Page 208: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

208

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa HF = " + freqBaixa_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta HF = " + freqAlta_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Guany LF = " + VG.guany_LF + " dB ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Guany MLF = " + VG.guany_MLF + " dB ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Guany MHF = " + VG.guany_MHF + " dB ",

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Guany HF = " + VG.guany_HF + " dB ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (y + (int)(marcY * 0.3)),

(margeX + marcX), (y + (int)(marcY * 0.3)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio1.

//Equalitzacio2, Equalitzacio3 i Equalitzacio4.

GraphicsPath Equalitzacio1 = new GraphicsPath();

GraphicsPath Equalitzacio2 = new GraphicsPath();

GraphicsPath Equalitzacio3 = new GraphicsPath();

Page 209: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

209

GraphicsPath Equalitzacio4 = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2, xPunt3;

int yPunt0, yPunt1, yPunt2, yPunt3;

double x0, x1;

//Representació en pantalla de l'equalització del filtre LF.

//Color de línea vermella. Escala eix Y dB. Escala eix X logarítmica [Hz].

//L'eix X [Hz], està en escala logarítmica,

//per visualitzar correctament l'equalització

//escollida en els 4 rangs tonals.

//Comença en 20 Hz i acaba en 20480 Hz.

//Llavors:

//log10(20480) - log10(20) = marcX

//on MarcX és l'amplada del marc del gràfic

//de l'equalització, en píxels.

//Per tant, tenim la següent regla de tres:

// (log10(20480) - log10(20)) ---> marcX

// (log10(freq) - log10(20)) ---> x

//Apliquem la regla de tres:

// (log10(freq) - log10(20)) * marcX

// X = _________________________________

//

// (log10(20480) - log10(20)

//La resta de dos logarítmes, es el mateix que el logaritme de la divisió

//dels valors del logaritme:

// log10(20480) - log10(20) = log10(20480 / 20) = log10(1024) = 3.010299957

// x = ((log10(freq) - log10(20)) * marcX) / 3.010299957

Page 210: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

210

//Per acabar, la coordenada x d'un punt, en píxels, en aquest gràfic

//d'escala X logarítmica, que comença en 20 Hz, i acaba en 20480 Hz, és

//la següent:

//Coordenada x d'un punt en píxels:

//marge X + x

x0 = ((Math.Log10(freqBaixa_LF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_LF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_LF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio1.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio1.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio1.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre LF,

//en vermell, línia gruixuda de 4 píxels.

g.DrawPath(llapisVermellN4, Equalitzacio1);

//Representació en pantalla de l'equalització deguda al filtre MLF.

//Color de línea verda. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MLF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MLF) - Math.Log10(20)) * marcX) /

Page 211: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

211

3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_MLF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio2.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio2.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio2.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MLF,

//en verd, línia gruixuda de 4 píxels.

g.DrawPath(llapisVerdN4, Equalitzacio2);

//Representació en pantalla de l'equalització deguda al filtre MHF.

//Color de línea blau. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_MHF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio3.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Page 212: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

212

Equalitzacio3.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio3.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MHF,

//en blau, línia gruixuda de 4 píxels.

g.DrawPath(llapisBlauN4, Equalitzacio3);

//Representació en pantalla de l'equalització deguda al filtre HF.

//Color de línea Marró. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_HF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_HF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_HF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio4.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio4.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio4.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre HF,

//en marró, línia gruixuda de 4 píxels.

g.DrawPath(llapisMarroN4, Equalitzacio4);

}

//Dibuix ja acabat.

dibuixAcabat = true;

Page 213: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

213

break;

//Dibuixar l'espectre en escala X logarítmica, en la meitat superior

//de la pantalla, i el processament de senyal escollit per l'usuari,

//en la meitat inferior de la pantalla.

case 2:

//Dibuixar el marc de l'instrument amb llapis negre de gruix 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = 5 * margeY; //Alçada del marc en píxels.

rect = new Rectangle(margeX, margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de gruix un pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds

Page 214: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

214

(voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Lo mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = margeY;

xPuntB = xPuntA;

Page 215: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

215

yPuntB = margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de variables locals per a dibuixar les escales dels eixos X i Y.

Page 216: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

216

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dBV en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = margeY - 12;

g.DrawString("+20 dBV", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dBV", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" 0 dBV", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString("-10 dBV", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString("-20 dBV", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-30 dBV", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-40 dBV", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-50 dBV", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-60 dBV", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-70 dBV", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-80 dBV", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure els Hz en l'escala de l'eix X (escala logarítmica).

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString("20", font, Brushes.Black, margeXX + 13, margeYY);

g.DrawString("40", font, Brushes.Black, margeXX + marcXX, margeYY);

g.DrawString("80", font, Brushes.Black, margeXX + 2 * marcXX, margeYY);

g.DrawString("160", font, Brushes.Black, margeXX + 3 * marcXX, margeYY);

g.DrawString("320", font, Brushes.Black, margeXX + 4 * marcXX, margeYY);

g.DrawString("640", font, Brushes.Black, margeXX + 5 * marcXX, margeYY);

Page 217: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

217

g.DrawString("1280", font, Brushes.Black, margeXX + 6 * marcXX, margeYY);

g.DrawString("2560", font, Brushes.Black, margeXX + 7 * marcXX, margeYY);

g.DrawString("5120", font, Brushes.Black, margeXX + 8 * marcXX, margeYY);

g.DrawString("10240", font, Brushes.Black, margeXX + 9 * marcXX, margeYY);

g.DrawString("20480 [Hz]", font, Brushes.Black, margeXX + 10 * marcXX, margeYY);

//Dibuixar l'espectre. L'espectre únicament s'ha de dibuixar

//quan la funció pictureBox1_Paint() sigui invocat per la funció

//Dibuixar(). Quan pictureBox1_Paint() és invocat en altres

//llocs del programa per la funció pictureBox1.Invalidate(),

//únicament es desitja que es dibuixi el marc, la quadrícula

//i les escales X i Y de l'instrument, però no s'ha de dibuixar

//l'espectre.

//La variable booleana dibuixarEspectre té la finalitat de

//que únicament es dibuixi l'espectre quan el càlcul de

//l'espectre estigui llest.

if (dibuixarEspectre == true)

{

dibuixarEspectre = false;

GraphicsPath Espectre1 = new GraphicsPath();

GraphicsPath Espectre2 = new GraphicsPath();

int xPuntAnterior;

int yPuntAnterior;

int xPunt;

int yPunt;

int frequencia;

double x;

//Representació en pantalla de l'espectre de la senyal capturada

//i no processada. Color de línea vermella. Escala eix Y dBV. Escala eix X logarítmica.

//L'eix X comença en 20 Hz i acaba en 20480 Hz.

//El primer punt de l'espectre a representar, se suposa que és el

Page 218: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

218

//corresponent a 20 Hz, 0 dBV.

xPuntAnterior = margeX; //20 Hz

yPuntAnterior = margeY + (int)(marcY / 5); //0 dBV

for (int n = 0; n <= (N / 2); n++)

{

//Passar la freqüència del punt n del vectorFrequencies[n]

//a enter i dipositar-la en la variable entera frequencia.

frequencia = (int)(vectorFrequencies[n]);

//Nomès es presenten en pantalla els punts de l'espectre de freqüències

//majors o iguals a 20 Hz, i menors o iguals a 20480 Hz, que són els

//extrems de l'eix X.

if ((frequencia >= 20) && (frequencia <= 20480))

{

//Es realitza el mateix càlcul per la coordnada x

//d'un punt en píxels. El mateix que al filtre LF.

//Coordenada x d'un punt en píxels:

//marge X + x

x = ((Math.Log10(vectorFrequencies[n]) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt = (int)(margeX + x);

yPunt = margeY + (int)(marcY / 5) - (int)((vectorAmplituds[n] * marcY) / 100);

Espectre1.AddLine(xPuntAnterior, yPuntAnterior, xPunt, yPunt);

xPuntAnterior = xPunt;

yPuntAnterior = yPunt;

}

}//Fi for()

Page 219: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

219

//Dibuixar l'espectre de la senyal no processada en llapis vermell de 1 píxel.

g.DrawPath(llapisVermellN2, Espectre1);

//Representació en pantalla de l'espectre de la senyal capturada i ja processada.

//Color de línea verda. Escala eix Y dBV. Escala eix X logarítmica.

//L'eix X comença en 20 Hz i acaba en 20480 Hz.

//El primer punt de l'espectre a representar, se suposa que és el

//corresponent a 20 Hz, -80 dBV.

xPuntAnterior = margeX; //20 Hz

yPuntAnterior = margeY + (int)(marcY / 5) - (int)((-80 * marcY) / 100); //-80 dB

for (int n = 0; n <= (N / 2); n++)

{

//Passar la freqüència del punt n del vectorFrequencies[n]

//a enter i dipositar-la en la variable entera frequencia.

frequencia = (int)(vectorFrequencies[n]);

//Únicament es presenten en pantalla els punts de l'espectre de freqüències

//majors o iguals a 20 Hz, i menors o iguals a 20480 Hz, que són els

//extrems de l'eix X.

if ((frequencia >= 20) && (frequencia <= 20480))

{

//El mateix càlcul que el de la coordenada x d'un punt

//en píxels del filtre LF.

//Coordenada x d'un punt en píxels:

//marge X + x

x = ((Math.Log10(vectorFrequencies[n]) -

Page 220: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

220

Math.Log10(20)) * marcX) / 3.010299957;

xPunt = (int)(margeX + x);

yPunt = margeY + (int)(marcY / 5) - (int)((vectorAmplitudsEq[n] * marcY) / 100);

Espectre2.AddLine(xPuntAnterior, yPuntAnterior, xPunt, yPunt);

xPuntAnterior = xPunt;

yPuntAnterior = yPunt;

}

}//Fi for()

//Dibuixar l'espectre de la senyal ja processada en llapis verd de 1 píxel.

g.DrawPath(llapisVerdN2, Espectre2);

}

//Dibuixar en la meitat inferior de la pantalla, l'equalització

//escollida l'usuari.

//Si l'equalitzador és el d'una octava...

if (VG.equalitzador == 1)

{

//La variable y val la meitat de l'alçada de l'àrea de pictureBox1,

//en píxels.

int y = (int)((pictureBox1.Height) / 2);

//Dibuixar el marc de l'instrument amb llapis negre de gruix 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

Page 221: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

221

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y + margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de un pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Lo mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100;

Page 222: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

222

marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y + margeY;

xPuntB = xPuntA;

yPuntB = y + margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

Page 223: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

223

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = y + margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de variables locals.

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y + margeY - 8;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

Page 224: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

224

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = y + margeY + marcY + 12;

g.DrawString("31,5", font, Brushes.Black, margeXX + (int)(0.5 * marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.5 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.5 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.5 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX + (int)(4.5 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.5 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.5 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.5 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.5 * marcXX), margeYY);

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.5 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents al processament de la senyal.

Page 225: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

225

g.DrawString("Equalització d'una octava",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.8)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 0.8)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)((2 * y) - (int)(margeY * 0.8)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[10];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany31coma5Hz;

vectorEqualitzacio[1] = VG.guany63Hz;

vectorEqualitzacio[2] = VG.guany125Hz;

vectorEqualitzacio[3] = VG.guany250Hz;

vectorEqualitzacio[4] = VG.guany500Hz;

vectorEqualitzacio[5] = VG.guany1000Hz;

vectorEqualitzacio[6] = VG.guany2000Hz;

vectorEqualitzacio[7] = VG.guany4000Hz;

vectorEqualitzacio[8] = VG.guany8000Hz;

Page 226: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

226

vectorEqualitzacio[9] = VG.guany16000Hz;

//Representació en pantalla de l'equalització de la senyal.

//Color de línea blava. Escala eix Y dB. Escala eix X octaves (Hz).

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany31coma5Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 9; n++)

{

xPunt0 = margeX + (int)(marcX * 0.1 * n);

xPunt1 = margeX + (int)(marcX * 0.1 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

//Ressaltar l'eix d'abscises.

Page 227: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

227

g.DrawLine(llapisNegreN4, margeX, (y + margeY + (int)(marcY * 0.3)),

(margeX + marcX), (y + margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el de terç d'octava...

if (VG.equalitzador == 2)

{

//La variable "y" val la meitat de l'alçada de l'àrea de pictureBox1,

//en píxels.

int y = (int)((pictureBox1.Height) / 2);

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 14); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en

Page 228: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

228

píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y + margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de un pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

Page 229: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

229

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y + margeY;

xPuntB = xPuntA;

yPuntB = y + margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

Page 230: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

230

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = y + margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de les variables locals.

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y + margeY - 8;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY

Page 231: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

231

+ 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = y + margeY + marcY + 12;

g.DrawString(" 31,5", font, Brushes.Black, margeXX + (int)(0.8 * marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.8 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.8 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.8 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX + (int)(4.8 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.8 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.8 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.8 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.8 * marcXX), margeYY);

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.8 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents l'equalització de la senyal.

g.DrawString("Equalització de terç d'octava",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX),

Page 232: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

232

(int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[30];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany20Hz;

vectorEqualitzacio[1] = VG.guany25Hz;

vectorEqualitzacio[2] = VG.guany31coma5Hz;

vectorEqualitzacio[3] = VG.guany40Hz;

vectorEqualitzacio[4] = VG.guany50Hz;

vectorEqualitzacio[5] = VG.guany63Hz;

vectorEqualitzacio[6] = VG.guany80Hz;

vectorEqualitzacio[7] = VG.guany100Hz;

Page 233: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

233

vectorEqualitzacio[8] = VG.guany125Hz;

vectorEqualitzacio[9] = VG.guany160Hz;

vectorEqualitzacio[10] = VG.guany200Hz;

vectorEqualitzacio[11] = VG.guany250Hz;

vectorEqualitzacio[12] = VG.guany315Hz;

vectorEqualitzacio[13] = VG.guany400Hz;

vectorEqualitzacio[14] = VG.guany500Hz;

vectorEqualitzacio[15] = VG.guany630Hz;

vectorEqualitzacio[16] = VG.guany800Hz;

vectorEqualitzacio[17] = VG.guany1000Hz;

vectorEqualitzacio[18] = VG.guany1250Hz;

vectorEqualitzacio[19] = VG.guany1600Hz;

vectorEqualitzacio[20] = VG.guany2000Hz;

vectorEqualitzacio[21] = VG.guany2500Hz;

vectorEqualitzacio[22] = VG.guany3150Hz;

vectorEqualitzacio[23] = VG.guany4000Hz;

vectorEqualitzacio[24] = VG.guany5000Hz;

vectorEqualitzacio[25] = VG.guany6300Hz;

vectorEqualitzacio[26] = VG.guany8000Hz;

vectorEqualitzacio[27] = VG.guany10000Hz;

vectorEqualitzacio[28] = VG.guany12500Hz;

vectorEqualitzacio[29] = VG.guany16000Hz;

//Representació en pantalla de l'equalització de la senyal.

//Color de línea blau. Escala eix Y dB. Escala eix X octaves (Hz).

Page 234: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

234

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany20Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 29; n++)

{

xPunt0 = margeX + (int)(marcX * 0.03333333333 * n);

xPunt1 = margeX + (int)(marcX * 0.03333333333 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9666666666667 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = y + margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = y + margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (y + margeY + (int)(marcY * 0.3)),

(margeX + marcX), (y + margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

Page 235: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

235

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el paramètric...

if (VG.equalitzador == 3)

{

//La variable "y" val la meitat de l'alçada de l'àrea de pictureBox1,

//en píxels.

int y = (int)((pictureBox1.Height) / 2);

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

margeY = (int)((pictureBox1.Height) / 16); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

marcX = 8 * margeX; //Amplada del marc en píxels.

marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, y, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

Page 236: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

236

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de un pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = y + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Lo mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = y + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

Page 237: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

237

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = y;

xPuntB = xPuntA;

yPuntB = y + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = y + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de un píxel.

Page 238: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

238

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = y + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Actualització de les variables locals.

marcXX = (int)(marcX / 10);

marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = y - 8;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure la freqüència (en Hz) en l'escala de l'eix X.

Page 239: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

239

Escala logarítmica.

margeXX = margeX - 20;

margeYY = y + marcY + 12;

g.DrawString(" 20", font, Brushes.Black, margeXX, margeYY);

g.DrawString(" 40", font, Brushes.Black, margeXX + (int)(1 * marcXX), margeYY);

g.DrawString(" 80", font, Brushes.Black, margeXX + (int)(2 * marcXX), margeYY);

g.DrawString(" 160", font, Brushes.Black, margeXX + (int)(3 * marcXX), margeYY);

g.DrawString(" 320", font, Brushes.Black, margeXX + (int)(4 * marcXX), margeYY);

g.DrawString(" 640", font, Brushes.Black, margeXX + (int)(5 * marcXX), margeYY);

g.DrawString("1280", font, Brushes.Black, margeXX + (int)(6 * marcXX), margeYY);

g.DrawString("2560", font, Brushes.Black, margeXX + (int)(7 * marcXX), margeYY);

g.DrawString("5120", font, Brushes.Black, margeXX + (int)(8 * marcXX), margeYY);

g.DrawString("10240", font, Brushes.Black, margeXX + (int)(9 * marcXX), margeYY);

g.DrawString("20480 [Hz]", font, Brushes.Black, margeXX + (int)(10 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització de la senyal.

g.DrawString("Equalització paramètrica",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)((2 * y) - (int)(margeY * 3)));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 2.4)));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

Page 240: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

240

font, Brushes.Black, (int)(4.2 * margeX), (int)((2 * y) - (int)(margeY * 2.4)));

g.DrawString("Freq Baixa LF = " + freqBaixa_LF + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta LF = " + freqAlta_LF + " Hz ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa MLF = " + freqBaixa_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta MLF = " + freqAlta_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa MHF = " + freqBaixa_MHF + " Hz ",

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta MHF = " + freqAlta_MHF + " Hz ",

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Freq Baixa HF = " + freqBaixa_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 1.8)));

g.DrawString("Freq Alta HF = " + freqAlta_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 1.2)));

g.DrawString("Guany LF = " + VG.guany_LF + " dB ",

font, Brushes.Black, margeX, (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Guany MLF = " + VG.guany_MLF + " dB ",

font, Brushes.Black, (int)(3.0 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

g.DrawString("Guany MHF = " + VG.guany_MHF + " dB ",

font, Brushes.Black, (int)(5.2 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

Page 241: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

241

g.DrawString("Guany HF = " + VG.guany_HF + " dB ",

font, Brushes.Black, (int)(7.4 * margeX), (int)((2 * y) - (int)(margeY * 0.6)));

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (y + (int)(marcY * 0.3)),

(margeX + marcX), (y + (int)(marcY * 0.3)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio1.

//Equalitzacio2, Equalitzacio3 i Equalitzacio4.

GraphicsPath Equalitzacio1 = new GraphicsPath();

GraphicsPath Equalitzacio2 = new GraphicsPath();

GraphicsPath Equalitzacio3 = new GraphicsPath();

GraphicsPath Equalitzacio4 = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2, xPunt3;

int yPunt0, yPunt1, yPunt2, yPunt3;

double x0, x1;

//Representació en pantalla de l'equalització deguda al filtre LF.

//Color de línea vermella. Escala eix Y dB. Escala eix X logarítmica [Hz].

//Mateix càlcul per la coordenada x d'un píxel que al filtre LF

x0 = ((Math.Log10(freqBaixa_LF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_LF) - Math.Log10(20)) * marcX) / 3.010299957;

Page 242: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

242

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_LF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio1.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio1.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio1.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre LF,

//en vermell, línia gruixuda de 4 píxels.

g.DrawPath(llapisVermellN4, Equalitzacio1);

//Representació en pantalla de l'equalització deguda al filtre MLF.

//Color de línea verda. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MLF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MLF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_MLF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio2.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio2.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Page 243: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

243

Equalitzacio2.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MLF,

//en verd, línia gruixuda de 4 píxels.

g.DrawPath(llapisVerdN4, Equalitzacio2);

//Representació en pantalla de l'equalització deguda al filtre MHF.

//Color de línea blava. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_MHF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio3.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio3.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio3.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MHF,

//en blau, línia gruixuda de 4 píxels.

g.DrawPath(llapisBlauN4, Equalitzacio3);

//Representació en pantalla de l'equalització deguda al filtre HF.

//Color de línea Marró. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

Page 244: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

244

x0 = ((Math.Log10(freqBaixa_HF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_HF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = y + (int)(marcY * 0.3);

yPunt1 = y + (int)(marcY * 0.3) - (int)((2 * VG.guany_HF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio4.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio4.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio4.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre HF,

//en marró, línia gruixuda de 4 píxels.

g.DrawPath(llapisMarroN4, Equalitzacio4);

}

//Dibuix ja acabat.

dibuixAcabat = true;

break;

}

}

//L'usuari escull no representar l'espectre en pantalla, i únicament

//vol representar l'equalització a la senyal d'audio. Això implica un

//estalvi de temps de processament.

if (representarEspectre == false)

{

//Si l'equalitzador és el d'una octava...

if (VG.equalitzador == 1)

{

Page 245: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

245

//Dibuixar el marc de l'instrument amb llapis negre de gruix 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

int margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

int margeY = (int)((pictureBox1.Height) / 7); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

int marcX = 8 * margeX; //Amplada del marc en píxels.

int marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

int xPuntA;

int yPuntA;

int xPuntB;

int yPuntB;

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

Page 246: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

246

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = margeY;

xPuntB = xPuntA;

yPuntB = margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

Page 247: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

247

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Variables locals per a escriure les escales dels eixos.

int margeXX;

int margeYY;

int marcXX = (int)(marcX / 10);

int marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

Page 248: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

248

margeXX = margeX - 80;

margeYY = margeY - 12;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString("31,5", font, Brushes.Black, margeXX + (int)(0.5 * marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.5 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.5 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.5 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX + (int)(4.5 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.5 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.5 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.5 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.5 * marcXX), margeYY);

Page 249: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

249

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.5 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització de la senyal.

g.DrawString("Equalització d'una octava",

font, Brushes.Black, margeX, (int)(6.0 * margeY));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)(6.0 * margeY));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)(6.0 * margeY));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[10];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany31coma5Hz;

vectorEqualitzacio[1] = VG.guany63Hz;

vectorEqualitzacio[2] = VG.guany125Hz;

vectorEqualitzacio[3] = VG.guany250Hz;

vectorEqualitzacio[4] = VG.guany500Hz;

Page 250: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

250

vectorEqualitzacio[5] = VG.guany1000Hz;

vectorEqualitzacio[6] = VG.guany2000Hz;

vectorEqualitzacio[7] = VG.guany4000Hz;

vectorEqualitzacio[8] = VG.guany8000Hz;

vectorEqualitzacio[9] = VG.guany16000Hz;

//Representació en pantalla de l'equalització de la senyal.

//Color de línea blava. Escala eix Y dB. Escala eix X octaves (Hz).

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany31coma5Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 9; n++)

{

xPunt0 = margeX + (int)(marcX * 0.1 * n);

xPunt1 = margeX + (int)(marcX * 0.1 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Page 251: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

251

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (margeY + (int)(marcY * 0.3)),

(margeX + marcX), (margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el de terç d'octava...

if (VG.equalitzador == 2)

{

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

int margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

int margeY = (int)((pictureBox1.Height) / 7); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

int marcX = 8 * margeX; //Amplada del marc en píxels.

int marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

Page 252: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

252

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

int xPuntA;

int yPuntA;

int xPuntB;

int yPuntB;

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues

Page 253: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

253

incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = margeY;

xPuntB = xPuntA;

yPuntB = margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

Page 254: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

254

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Variables locals per a escriure les escales dels eixos.

int margeXX;

int margeYY;

int marcXX = (int)(marcX / 10);

int marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = margeY - 12;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure les freqüències centrals de les octaves (en Hz), en l'escala de l'eix X.

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString(" 31,5", font, Brushes.Black, margeXX + (int)(0.8 *

Page 255: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

255

marcXX), margeYY);

g.DrawString(" 63", font, Brushes.Black, margeXX + (int)(1.8 * marcXX), margeYY);

g.DrawString(" 125", font, Brushes.Black, margeXX + (int)(2.8 * marcXX), margeYY);

g.DrawString(" 250", font, Brushes.Black, margeXX + (int)(3.8 * marcXX), margeYY);

g.DrawString(" 500", font, Brushes.Black, margeXX + (int)(4.8 * marcXX), margeYY);

g.DrawString(" 1k", font, Brushes.Black, margeXX + (int)(5.8 * marcXX), margeYY);

g.DrawString(" 2k", font, Brushes.Black, margeXX + (int)(6.8 * marcXX), margeYY);

g.DrawString(" 4k", font, Brushes.Black, margeXX + (int)(7.8 * marcXX), margeYY);

g.DrawString(" 8k", font, Brushes.Black, margeXX + (int)(8.8 * marcXX), margeYY);

g.DrawString(" 16k [Hz]", font, Brushes.Black, margeXX + (int)(9.8 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització de la senyal.

g.DrawString("Equalització de terç d'octava",

font, Brushes.Black, margeX, (int)(5.8 * margeY));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)(5.8 * margeY));

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)(5.8 * margeY));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)(6.2 * margeY));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

font, Brushes.Black, (int)(4.2 * margeX), (int)(6.2 * margeY));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

Page 256: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

256

//S'obté l'objecte de tipus GraphicsPath Equalitzacio.

GraphicsPath Equalitzacio = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2;

int yPunt0, yPunt1, yPunt2;

//Crear el vector Equalització.

vectorEqualitzacio = new double[30];

//Omplir el vector Equalització.

vectorEqualitzacio[0] = VG.guany20Hz;

vectorEqualitzacio[1] = VG.guany25Hz;

vectorEqualitzacio[2] = VG.guany31coma5Hz;

vectorEqualitzacio[3] = VG.guany40Hz;

vectorEqualitzacio[4] = VG.guany50Hz;

vectorEqualitzacio[5] = VG.guany63Hz;

vectorEqualitzacio[6] = VG.guany80Hz;

vectorEqualitzacio[7] = VG.guany100Hz;

vectorEqualitzacio[8] = VG.guany125Hz;

vectorEqualitzacio[9] = VG.guany160Hz;

vectorEqualitzacio[10] = VG.guany200Hz;

vectorEqualitzacio[11] = VG.guany250Hz;

vectorEqualitzacio[12] = VG.guany315Hz;

vectorEqualitzacio[13] = VG.guany400Hz;

vectorEqualitzacio[14] = VG.guany500Hz;

vectorEqualitzacio[15] = VG.guany630Hz;

vectorEqualitzacio[16] = VG.guany800Hz;

Page 257: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

257

vectorEqualitzacio[17] = VG.guany1000Hz;

vectorEqualitzacio[18] = VG.guany1250Hz;

vectorEqualitzacio[19] = VG.guany1600Hz;

vectorEqualitzacio[20] = VG.guany2000Hz;

vectorEqualitzacio[21] = VG.guany2500Hz;

vectorEqualitzacio[22] = VG.guany3150Hz;

vectorEqualitzacio[23] = VG.guany4000Hz;

vectorEqualitzacio[24] = VG.guany5000Hz;

vectorEqualitzacio[25] = VG.guany6300Hz;

vectorEqualitzacio[26] = VG.guany8000Hz;

vectorEqualitzacio[27] = VG.guany10000Hz;

vectorEqualitzacio[28] = VG.guany12500Hz;

vectorEqualitzacio[29] = VG.guany16000Hz;

//Representació en pantalla de l'equalització de la senyal.

//Color de línea blava. Escala eix Y dB. Escala eix X octaves (Hz).

xPunt0 = margeX;

xPunt1 = margeX;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany20Hz * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

for (int n = 0; n < 29; n++)

{

xPunt0 = margeX + (int)(marcX * 0.03333333333 * n);

xPunt1 = margeX + (int)(marcX * 0.03333333333 * (n + 1));

xPunt2 = xPunt1;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((2 * vectorEqualitzacio[n] * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = margeY + (int)(marcY * 0.3) - (int)((2 *

Page 258: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

258

vectorEqualitzacio[n + 1] * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

}

xPunt0 = margeX + (int)(0.9666666666667 * marcX);

xPunt1 = margeX + marcX;

xPunt2 = xPunt1;

yPunt0 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany16000Hz * marcY) / 100);

yPunt1 = yPunt0;

yPunt2 = margeY + (int)(marcY * 0.3) - (int)((-70 * marcY) / 100);

Equalitzacio.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (margeY + (int)(marcY * 0.3)),

(margeX + marcX), (margeY + (int)(marcY * 0.3)));

//Dibuixar l'equalització de la senyal.

g.DrawPath(llapisBlauN4, Equalitzacio);

}

//Si l'equalitzador és el paramètric...

if (VG.equalitzador == 3)

{

//Dibuixar el marc de l'instrument amb llapis negre de 1 pixel.

//Es deixen uns marges simètrics resepecte de l'àrea de pictureBox1.

int margeX = (int)((pictureBox1.Width) / 10); //Distància X en píxels,

//del marc respecte de

//les verticals esquerra

//i dreta de l'àrea de

//pictureBox1.

Page 259: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

259

int margeY = (int)((pictureBox1.Height) / 8); //Distància Y en píxels,

//del marc respecte de

//les horitzontals alta

//i baixa de l' àrea de

//pictureBox1.

int marcX = 8 * margeX; //Amplada del marc en píxels.

int marcY = (int)(4.0 * margeY); //Alçada del marc en píxels.

rect = new Rectangle(margeX, margeY, marcX, marcY);

g.DrawRectangle(llapisNegreN1, rect);

//Dibuixar les marques divisories horitzontals de l'aresta vertical

//esquerra del marc, en llapis negre de 1 pixel. Cada marca

//mesurarà una centèssima part de l'ample del marc. Hi han 50 divisions

//equiespaiades a l'instrument en l'eix Y o eix d'amplituds (voltatges).

//Les línies horitzontals divisories ven de la "0" a la "50".

int xPuntA;

int yPuntA;

int xPuntB;

int yPuntB;

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX - (int)(marcX / 100);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//El mateix que abans, però ara per l'aresta vertical dreta del marc.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 100;

Page 260: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

260

marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + marcX;

yPuntA = margeY + (int)(marcaHoritzontal * marcY) / 100;

xPuntB = margeX + marcX + (int)(marcX / 100);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Dibuixar les línies verticals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix X

//o eix de freqüències. Les línies verticals divisories van de la

//"0" a la "10". Les línies "0" i "10" són proporcionades pel propi

//marc de l'instrument, i no s'han de redibuixar. S'han de

//dibuixar les línies verticals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaVertical = 1; liniaVertical <= 9; liniaVertical++)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10);

yPuntA = margeY;

xPuntB = xPuntA;

yPuntB = margeY + marcY;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

//Subdividir cada línia vertical en 50 parts equiespaiades.

for (int marcaHoritzontal = 0; marcaHoritzontal <= 99; marcaHoritzontal = marcaHoritzontal + 2)

{

xPuntA = margeX + (int)((liniaVertical * marcX) / 10) - (int)(marcX / 200);

yPuntA = margeY + (int)((marcaHoritzontal * marcY) / 100);

xPuntB = margeX + (int)((liniaVertical * marcX) / 10) + (int)(marcX / 200);

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

}

Page 261: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

261

//Dibuixar les línies horitzontals de l'instrument.

//Hi han 10 divisions equiespaiades a l'instrument en l'eix Y

//o eix d'amplituds (voltatges en Vp, Vef, o dBV). Les línies

//horitzontals divisories van de la "0" a la "10". Les línies

//"0" i "10" són proporcionades pel propi marc de l'instrument,

//i no s'han de redibuixar. S'han de dibuixar les línies

//horitzontals de la "1" a la "9", ambdues incloses.

//Es dibuixen en llapis negre de 1 píxel.

for (int liniaHoritzontal = 1; liniaHoritzontal <= 9; liniaHoritzontal++)

{

xPuntA = margeX;

yPuntA = margeY + (int)((liniaHoritzontal * marcY) / 10);

xPuntB = margeX + marcX;

yPuntB = yPuntA;

g.DrawLine(llapisNegreN1, xPuntA, yPuntA, xPuntB, yPuntB);

}

//Variables locals per a escriure les escales dels eixos.

int margeXX;

int margeYY;

int marcXX = (int)(marcX / 10);

int marcYY = (int)(marcY / 10);

//Escriure els dB de guany o atenuació en l'escala de l'eix Y.

margeXX = margeX - 80;

margeYY = margeY - 12;

g.DrawString("+15 dB", font, Brushes.Black, margeXX, margeYY);

g.DrawString("+10 dB", font, Brushes.Black, margeXX, margeYY + marcYY);

g.DrawString(" +5 dB", font, Brushes.Black, margeXX, margeYY + 2 * marcYY);

g.DrawString(" 0 dB", font, Brushes.Black, margeXX, margeYY + 3 * marcYY);

g.DrawString(" -5 dB", font, Brushes.Black, margeXX, margeYY + 4 * marcYY);

g.DrawString("-10 dB", font, Brushes.Black, margeXX, margeYY + 5 * marcYY);

Page 262: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

262

g.DrawString("-15 dB", font, Brushes.Black, margeXX, margeYY + 6 * marcYY);

g.DrawString("-20 dB", font, Brushes.Black, margeXX, margeYY + 7 * marcYY);

g.DrawString("-25 dB", font, Brushes.Black, margeXX, margeYY + 8 * marcYY);

g.DrawString("-30 dB", font, Brushes.Black, margeXX, margeYY + 9 * marcYY);

g.DrawString("-35 dB", font, Brushes.Black, margeXX, margeYY + 10 * marcYY);

//Escriure la freqüència (en Hz) en l'escala de l'eix X. Escala logarítmica.

margeXX = margeX - 20;

margeYY = margeY + marcY + 12;

g.DrawString(" 20", font, Brushes.Black, margeXX, margeYY);

g.DrawString(" 40", font, Brushes.Black, margeXX + (int)(1 * marcXX), margeYY);

g.DrawString(" 80", font, Brushes.Black, margeXX + (int)(2 * marcXX), margeYY);

g.DrawString(" 160", font, Brushes.Black, margeXX + (int)(3 * marcXX), margeYY);

g.DrawString(" 320", font, Brushes.Black, margeXX + (int)(4 * marcXX), margeYY);

g.DrawString(" 640", font, Brushes.Black, margeXX + (int)(5 * marcXX), margeYY);

g.DrawString("1280", font, Brushes.Black, margeXX + (int)(6 * marcXX), margeYY);

g.DrawString("2560", font, Brushes.Black, margeXX + (int)(7 * marcXX), margeYY);

g.DrawString("5120", font, Brushes.Black, margeXX + (int)(8 * marcXX), margeYY);

g.DrawString("10240", font, Brushes.Black, margeXX + (int)(9 * marcXX), margeYY);

g.DrawString("20480 [Hz]", font, Brushes.Black, margeXX + (int)(10 * marcXX), margeYY);

//Escriure anotacions en pantalla, referents a l'equalització de la senyal.

g.DrawString("Equalització paramètrica",

font, Brushes.Black, margeX, (int)(5.8 * margeY));

g.DrawString("Guany Global = " + VG.guanyGlobal + " dB ",

font, Brushes.Black, (int)(4.2 * margeX), (int)(5.8 * margeY));

Page 263: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

263

g.DrawString("Limitació = " + VG.limitador + " dBV ",

font, Brushes.Black, (int)(7.7 * margeX), (int)(5.8 * margeY));

g.DrawString("Freqüència Low Cut = " + VG.lowCut + " Hz ",

font, Brushes.Black, margeX, (int)(6.2 * margeY));

g.DrawString("Freqüència High Cut = " + VG.highCut + " Hz ",

font, Brushes.Black, (int)(4.2 * margeX), (int)(6.2 * margeY));

g.DrawString("Freq Baixa LF = " + freqBaixa_LF + " Hz ",

font, Brushes.Black, margeX, (int)(6.8 * margeY));

g.DrawString("Freq Alta LF = " + freqAlta_LF + " Hz ",

font, Brushes.Black, margeX, (int)(7.2 * margeY));

g.DrawString("Freq Baixa MLF = " + freqBaixa_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)(6.8 * margeY));

g.DrawString("Freq Alta MLF = " + freqAlta_MLF + " Hz ",

font, Brushes.Black, (int)(3.0 * margeX), (int)(7.2 * margeY));

g.DrawString("Freq Baixa MHF = " + freqBaixa_MHF + " Hz ",

font, Brushes.Black, (int)(5.2 * margeX), (int)(6.8 * margeY));

g.DrawString("Freq Alta MHF = " + freqAlta_MHF + " Hz ",

font, Brushes.Black, (int)(5.2 * margeX), (int)(7.2 * margeY));

g.DrawString("Freq Baixa HF = " + freqBaixa_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)(6.8 * margeY));

g.DrawString("Freq Alta HF = " + freqAlta_HF + " Hz ",

font, Brushes.Black, (int)(7.4 * margeX), (int)(7.2 * margeY));

g.DrawString("Guany LF = " + VG.guany_LF + " dB ",

font, Brushes.Black, margeX, (int)(7.6 * margeY));

Page 264: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

264

g.DrawString("Guany MLF = " + VG.guany_MLF + " dB ",

font, Brushes.Black, (int)(3.0 * margeX), (int)(7.6 * margeY));

g.DrawString("Guany MHF = " + VG.guany_MHF + " dB ",

font, Brushes.Black, (int)(5.2 * margeX), (int)(7.6 * margeY));

g.DrawString("Guany HF = " + VG.guany_HF + " dB ",

font, Brushes.Black, (int)(7.4 * margeX), (int)(7.6 * margeY));

//Ressaltar l'eix d'abscises.

g.DrawLine(llapisNegreN4, margeX, (margeY + (int)(marcY * 0.3)),

(margeX + marcX), (margeY + (int)(marcY * 0.3)));

/****************************************

* *

* Dibuixar l'equalització *

* *

****************************************/

//S'obté l'objecte de tipus GraphicsPath Equalitzacio1.

//Equalitzacio2, Equalitzacio3 i Equalitzacio4.

GraphicsPath Equalitzacio1 = new GraphicsPath();

GraphicsPath Equalitzacio2 = new GraphicsPath();

GraphicsPath Equalitzacio3 = new GraphicsPath();

GraphicsPath Equalitzacio4 = new GraphicsPath();

//Declaració de les variables locals.

int xPunt0, xPunt1, xPunt2, xPunt3;

int yPunt0, yPunt1, yPunt2, yPunt3;

double x0, x1;

//Representació en pantalla de l'equalització deguda al filtre LF.

//Color de línea vermella. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix càlcul per a la coordenada x d'un punt en píxels

Page 265: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

265

//que al filtre LF.

//Coordenada x d'un punt en píxels:

//marge X + x

x0 = ((Math.Log10(freqBaixa_LF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_LF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = margeY + (int)(marcY * 0.3);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany_LF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio1.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio1.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio1.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre LF,

//en vermell, línia gruixuda de 4 píxels

g.DrawPath(llapisVermellN4, Equalitzacio1);

//Representació en pantalla de l'equalització deguda al filtre MLF.

//Color de línea verda. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MLF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MLF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

Page 266: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

266

xPunt3 = xPunt2;

yPunt0 = margeY + (int)(marcY * 0.3);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany_MLF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio2.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio2.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio2.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MLF,

//en verd, línia gruixuda de 4 píxels.

g.DrawPath(llapisVerdN4, Equalitzacio2);

//Representació en pantalla de l'equalització deguda al filtre MHF.

//Color de línea blava. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_MHF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = margeY + (int)(marcY * 0.3);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany_MHF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio3.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio3.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio3.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre MHF,

//en blau, línia gruixuda de 4 píxels.

Page 267: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

267

g.DrawPath(llapisBlauN4, Equalitzacio3);

//Representació en pantalla de l'equalització deguda al filtre HF.

//Color de línea Marró. Escala eix Y dB. Escala eix X logarítmica [Hz].

//El mateix que al filtre LF.

x0 = ((Math.Log10(freqBaixa_HF) - Math.Log10(20)) * marcX) / 3.010299957;

x1 = ((Math.Log10(freqAlta_HF) - Math.Log10(20)) * marcX) / 3.010299957;

xPunt0 = (int)(margeX + x0);

xPunt1 = xPunt0;

xPunt2 = (int)(margeX + x1);

xPunt3 = xPunt2;

yPunt0 = margeY + (int)(marcY * 0.3);

yPunt1 = margeY + (int)(marcY * 0.3) - (int)((2 * VG.guany_HF * marcY) / 100);

yPunt2 = yPunt1;

yPunt3 = yPunt0;

Equalitzacio4.AddLine(xPunt0, yPunt0, xPunt1, yPunt1);

Equalitzacio4.AddLine(xPunt1, yPunt1, xPunt2, yPunt2);

Equalitzacio4.AddLine(xPunt2, yPunt2, xPunt3, yPunt3);

//Dibuixar l'equalització deguda al filtre HF,

//en marró, línia gruixuda de 4 píxels.

g.DrawPath(llapisMarroN4, Equalitzacio4);

}

}//Fi if (representarEspectre == false)

}//Fi pictureBox1_Paint()

/**************************************************************

* Funció que redibuixa i redimensiona el formulari quan aquest

* canvia de tamany.

**************************************************************/

private void Form1_SizeChanged(object sender, EventArgs e)

Page 268: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

268

{

ActiveForm.Invalidate();

pictureBox1.Invalidate();

}

/**************************************************************

* Quan es tanca el formulari s'atura el fil secundari.

**************************************************************/

private void Form1_FormClosing(object sender, FormClosingEventArgs e)

{

PararFilSecundari();

}

/**************************************************************

* Funció utilitzada pel fil principal per a parar l'execució

* del fil secundari.

*

* Nota: els treballs amb els fils secundaris i principals han

* sigut extrets de la mateixa forma que es treballava al

* projecte [24]

**************************************************************/

private bool PararFilSecundari()

{

if (filSecundari == null || !filSecundari.IsAlive)

return false;

//Canviar l'estat del següent controlador d'espera a senyalitzat per a

//informar al fil secundari de que ha de parar.

controladorPararFilSecundari.Set();

//Esperar a que el fil secundari informi de que ha parat.

while (filSecundari.IsAlive)

{

//MOLT IMPORTANT:

//Aquí no es pot utilitzar una espera indefinida perque el fil

//secundari fa crides síncrones al fil principal, i això podria

Page 269: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

269

//causar interbloquejos. Per aquesta raó, s'espera

//per controladorFilSecundariParat (un temps apropiat i de passada

//donem temps al fil secundari) i es permet processar altres events.

//Aquests events poden incloure crides Invoke.

WaitHandle.WaitAll((new ManualResetEvent[] { controladorFilSecundariParat }), 100, false);

//Processar altres events.

Application.DoEvents();

}

filSecundari = null;

return true;

}

/**************************************************************

* Funció que calcula les mostres en paquets de 31 mostres

* que s'han d'adquirir. M és el número de mostres a adquirir

*

* Nota:Per a la USB-1208FS s'adquireix el múltiple de 31

* mostres més proper per excès a la potencia de 2 desitjada.

* Les mostres sobrants no seràn processades.

* Per a la USB-1208FS Plus s'adquireixen les dades en blocs

* de 32 mostres (potència de 2). Per tant s'adquireix la

* potència de 2 mostres que sigui necessària.

**************************************************************/

private void CalcularM()

{

//Si la tarjeta és la USB-1208FS...

if (usb1208FS == true)

{

switch (N)

{

case 128: //128:31 = 4,12903226

M = 155; //31*5 = 155 155-128 = 27

break;

case 256: //256:31 = 8,25806452

M = 279; //31*9 = 279 279-256 = 23

break;

Page 270: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

270

case 512: //512:31 = 16,516129

M = 527; //31*17 = 512 527-512 = 15

break;

case 1024: //1024:31 = 33,03225806

M = 1054; //31*34 = 1054 1054-1024 = 30

break;

case 2048: //2048:31 = 66,06451613

M = 2077; //31*67 = 2077 2077-2048 = 29

break;

case 4096: //4096:31 = 132,1290323

M = 4123; //31*133 = 4123 4123-4096 = 27

break;

case 8192: //8192:31 = 264,2580645

M = 8215; //31*265 = 8215 8215-8192 = 23

break;

}

}

//Si la tarjeta és la USB-1208FS Plus...

else

{

M = N;

}

}

/**************************************************************

* Funció que crea un buffer1 de memòria de windows per a

* dipositar les mostres capturades per l'ADC de tamany M

**************************************************************/

private void CrearBuffer1()

{

memHandle1 = MccDaq.MccService.WinBufAllocEx(M);

}

/**************************************************************

* Funció que crea un buffer2 de memòria de windows per a

* dipositar les dades que el DAC a de convertir a voltages

* de sortida.

*

* Nota: Si es fa servir la USB-1208FS la freqüència de coversió

Page 271: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

271

* màxima del DAC és de 10 kHz, per tant, nomès es podran treure

* components espectrals de freqüència menor o igual a 5 kHz.

* Llavors per la USB-1208FS s'envien una de cada quatre mostre

* al DAC en el cas que la freqüència de mostreix del ADC hagi

* sigut 40000 mostres/s

* Si la tarjeta és la USB-1208FS Plus, la freqüència de

* conversió màxima del DAC es de 50000 mostres/s, per tant, es

* podran treure tot el rang d'audio freqüències (20 Hz - 20 kHz)

**************************************************************/

private void CrearBuffer2()

{

if (usb1208FS == true)

{

//Si la freqüència de mostreig de l'ADC és

//40000 mostres/s i la del DAC 10000 mostres/s,

//s'envia al DAC un de cada quatre valors.Llavors el

//tamany del buffer ha de ser N / 4, (múltiple

//de 32). El DAC de la USB-1208FS envia blocs de

//dades de tamany múltiple de 32.

memHandle2 = MccDaq.MccService.WinBufAllocEx(N / 4);

}

//Si la tarjeta és la USB-1208FS Plus, s'envien

//N valors al DAC, on N és múltiple de 32.

//El DAC de la USB-1208FS Plus envia blocs de dades

//de tamany múltiple de 32.

else

{

memHandle2 = MccDaq.MccService.WinBufAllocEx(N);

}

}

/**************************************************************

* Funció que crea el vector de tipus ushort que contindrá

* les dades mostrejades de l'ADC de tamany M.

**************************************************************/

private void CrearVectorUShort1()

{

Page 272: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

272

DadesAD = new ushort[M];

}

/**************************************************************

* Funció que crea el vector de tipus ushort que contindrá

* les dades a enviar al DAC.

*

* Nota:Si la tarjeta és la USB-1208FS, s'ha d'enviar un de

* cada 4 valors, per tant el tamany del vector ha de ser

* N/4 tal i com està explicar en la funció crearBuffer2().

* Si la tarjeta es la USB-1208FS Plus s'envien íntegrament

* el N valors

**************************************************************/

private void CrearVectorUShort2()

{

//Si la tarjeta és la USB-1208FS...

if (usb1208FS == true)

{

DadesDA = new ushort[N / 4];

}

//Si la tarjeta és la USB-1208FS Plus...

else

{

DadesDA = new ushort[N];

}

}

/**************************************************************

* Funció que crea els vectors vectorDadesReal[] i

* vectorDades[]

**************************************************************/

private void CrearVectorsReIm()

{

vectorDadesReal = new double[N];

vectorDadesIm = new double[N];

}

Page 273: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

273

/**************************************************************

* Funció que captura M mostres consecutives de l'ADC i les

* diposita en un buffer de Windows creat per WinBufAllocEx()

* El punter manejador del buffer de Windows es memHandle1

**************************************************************/

private void CapturarDades()

{

ULStat = DaqBoard.AInScan(canalBaixADC, canalAltADC, M,

ref mostresPerSegon,

rang1, memHandle1, opcions1);

}

/**************************************************************

* Funció que envia N o N/4 dades pel DAC pel canal de sortida

* 0. Aquestes dades estaven prèviament dipositades en un

* buffer de Windows manejat pel punter memHandle2.

*

* Nota: Tota l'estona s'estan fent servir els subíndex 1 i 2.

* El subíndex 1 fa referencia a les funcions i paràmetres

* que controlen la captura de dades (ADC), i el subíndex 2, les

* referents a la sortida (DAC).

**************************************************************/

private void EnviarDades()

{

//Si la tarjeta és la USB-1208FS, el DAC ha d'enviar N / 4 dades.

if (usb1208FS == true)

{

ULStat = DaqBoard.AOutScan(canalBaixDAC, canalAltDAC, (N / 4),

ref enviamentsPerSegon,

rang2, memHandle2, opcions2);

}

//Si la tarjeta és la USB-1208FS Plus, el DAC ha d'enviar N dades.

else

{

ULStat = DaqBoard.AOutScan(canalBaixDAC, canalAltDAC, N,

ref enviamentsPerSegon,

rang2, memHandle2, opcions2);

}

Page 274: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

274

}

/**************************************************************

* Funció passa les M mostres capturades i dipositades en el

* buffer de Windows al vector DadesAD[]

**************************************************************/

private void DeBufferAVector()

{

ULStat = MccDaq.MccService.WinBufToArray(memHandle1, DadesAD,

primerPunt1, M);

}

/**************************************************************

* Funció passa les mostres cantingudes en el vector DadesAD[]

* al buffer2 de windows

**************************************************************/

private void DeVectorABuffer()

{

//Si la tarjeta és la USB-1208FS, el DAC ha d'enviar N / 4 dades.

if (usb1208FS == true)

{

ULStat = MccDaq.MccService.WinArrayToBuf(DadesDA, memHandle2,

primerPunt2, (N / 4));

}

//Si la tarjeta és la USB-1208FS Plus, el DAC ha d'enviar N dades.

else

{

ULStat = MccDaq.MccService.WinArrayToBuf(DadesDA, memHandle2,

primerPunt2, N);

}

}

/**************************************************************

* Funció que posa els 4 bits alts de la paraula de 16 bits a 0.

*

* Nota: nomès els 12 bits baixos de la paraula de 16 bits

* contenen la informació dels voltatges mostrejats. La tarjeta

Page 275: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

275

* captura 12 bits, pero el port USB es de 16 bits.

* El fabricant no especifica en el manual que passa amb aquets

* 4 bits alts. Per precaució e posaran a 0.

**************************************************************/

private void QuatreBitsAltsAZero()

{

for (int n = 0; n < M; n++)

{

DadesAD[n] = (ushort)(DadesAD[n] & 0x0FFF);

}

}

/**************************************************************

* Funció que omplirá els vectors VectorDadesReal[] i

* vectorDadesIm[] escalats amb el fons d'escala escollit per

* l'usuari.

*

* Nota: l convertidor A/D de la tarjeta USB-1208FS té la següent

* corba ideal de transferència:

*

* A +FS dóna una lectura de 4095

* A 0 dóna una lectura de 2048

* A -FS dóna una lectura de 0

*

* On FS és el fons d'escala del convertidor A/D i pot tenir

* els següents valors:

* FS: 10, 5, 4, 2.5, 2, 1.25, 1 [en volts]

*

* Si a la lectura li restem 2048 tenim les següents noves lectures:

*

* A +FS volts la nova lectura és 4095-2048 = 2047

* A 0 volts la nova lectura és 0

* A -FS volts la nova lectura és 0-2048 = -2048

*

* Per calcular el voltatge i dipositar-lo a la posició corresponent

* del vector vectorDadesReal[], es calcula novaLectura, i després

* s'aplica la següent regla de tres:

*

* 2047--------------->FS volts

* novaLectura--------> x volts

*

Page 276: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

276

* x volts = (novaLectura * FS volts) / 2047

*

* (novaLectura = LecturaAntiga - 2048)

**************************************************************/

private void LecturaAVolts()

{

double novaLectura;

switch (fonsEscalaADC)

{

case 7: //+/- 10 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 10.0) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 6: //+/- 5 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 5.0) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 5: //+/- 4 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 4.0) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 4: //+/- 2,5 V

Page 277: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

277

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 2.5) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 3: //+/- 2 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 2.0) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 2: //+/- 1,25 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 1.25) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

case 1: //+/- 1 V

for (int n = 0; n < N; n++)

{

novaLectura = (double)((double)(DadesAD[n]) - 2048.0);

vectorDadesReal[n] = (double)(((novaLectura) * 1.0) / 2047.0);

vectorDadesIm[n] = 0.0;

}

break;

}

}

/**************************************************************

Page 278: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

278

* Funció que canvia l'escala abans d'enviar les dades al DAC,

* per tal que les dades estiguin compreses dins del rang de

* sortida.

*

* Nota: el DAC de la USB-1208FS te un rang de sortida entre 0

* i 4 V nominals (0 i 4,095 V reals). Llavors serà necessari

* realitzar un trasllat de nivell de +2,048 V, per tal que la

* senyal de sortida compresa entre -2/+2 V es representi en

* una senyal compresa entre 0 i 4 V.

*

* El DAC de la USB-1208FS Plus te un rang de sortida entre 0 i

* 5 V. En aquest cas serà necessari fer un canvi d'escala per

* a que la senyal de sortida estigui compresa entre -2,5 i 2,5 V

*

* S'ha de garantir que la senyal de sortida no sigui retallada

* pel DAC, i que ocupi equidistanment el máxom de la ressolució

* dels 12 bits del DAC.

**************************************************************/

private void CanviarEscala()

{

double limitacioEnVolts; //Màxima amplitud en Vp (volts de pic),

//determinada per la posició del fadder

//limitació escollida per l'usuari.

double amplificacio; //Amplificació (o atenuació) a aplicar a

//la senyal de sortida.

//Passar els dBV de la limitació de la senyal de sortida

//a Vp (volts de pic).

//

// voltatge[Vp] = 10 ^ (voltatge[dBV] / 20)

//

limitacioEnVolts = Math.Pow(10.0, VG.limitador / 20.0);

//Si la tarjeta és la USB-1208FS...

//La senyal de sortida està limitada en amplitud per la variable global

//VG.limitador, de valor escollit per l'usuari.

if (usb1208FS == true)

Page 279: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

279

{

amplificacio = 2.0 / limitacioEnVolts;

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = vectorDadesReal[n] * amplificacio;

}

}

//Si la tarjeta és la USB-1208FS Plus...

//La senyal de sortida està limitada en amplitud per la variable global

//VG.limitador, de valor escollit per l'usuari.

else

{

amplificacio = 2.5 / limitacioEnVolts;

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = vectorDadesReal[n] * amplificacio;

}

}

}

/**************************************************************

* Funció que omple els vector DadesDA[] amb els valors ushort

* a enviar al DAC.

*

* Nota: Si la tarjeta és la USB-1208FS s'ha d'enviar un de cada

* 4 valors del vectorDadesReal[]. Sabent que el DAC és de 12

* bits i el seu rang es de 4 a 4,095 V (unipolars), es fa que

* el valor -2,047 tingui el codi 0; zero volts es correspongui

* al codi 2048, i que el valor 2,047 V tingui el codi 4095.

*

* Si la tarjeta es la USB-1208FS Plus el seu rang ès de 0 a 5 V

* (unipolar). En aquest cas es fa que el valor -2,5 V contingui

* el codi 0; el valor 0 V li correspondrà el codi 2048 i

* al valor +2,5 V tindrà el codi 4095

**************************************************************/

private void OmplirVectorDadesDA()

{

Page 280: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

280

//Si la tarjeta és la USB-1208FS...

if (usb1208FS == true)

{

for (int n = 0; n < N; n = n + 4)

{

//Limitar el senyal a valors compresos entre -2 i +2 V

//per assegurar que no tenim un desbordament del DAC.

if (vectorDadesReal[n] > 2)

{

vectorDadesReal[n] = 2;

}

if (vectorDadesReal[n] < -2)

{

vectorDadesReal[n] = -2;

}

//Assignar a DadesDA[] el codi a enviar al DAC en funció

//del voltatge contingut en la posició corresponent del

//vector vectorDadesReal[].

DadesDA[n / 4] = (ushort)(2048 + (1000 * vectorDadesReal[n]));

}

}

//Si la tarjeta és la USB-1208FS Plus...

else

{

for (int n = 0; n < N; n++)

{

//Limitar el senyal a valors compresos entre -2,499 i

//+2,499 V per assegurar que no tenim un desbordament

//del DAC.

if (vectorDadesReal[n] > 2.499)

{

vectorDadesReal[n] = 2.499;

}

Page 281: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

281

if (vectorDadesReal[n] < -2.499)

{

vectorDadesReal[n] = -2.499;

}

//Assignar a DadesDA[] el codi a enviar al DAC en funció

//del voltatge contingut en la posició corresponent del

//vector vectorDadesReal[].

DadesDA[n] = (ushort)(2048 + (819 * vectorDadesReal[n]));

}

}

}

/**************************************************************

* Funció que deslliura la memòria dels dos buffers de Windows.

**************************************************************/

private void DeslliurarMemoria()

{

ULStat = MccDaq.MccService.WinBufFreeEx(memHandle1);

memHandle1 = IntPtr.Zero;

ULStat = MccDaq.MccService.WinBufFreeEx(memHandle2);

memHandle2 = IntPtr.Zero;

}

/**************************************************************

* Funció que calcula tots els harmònics de la funció

* matemàtica creada, per realitzar les diferents proves sense

* la tarjeta

*

* Nota: es crea una funció sinusoidal per els valors de FFT

* de N igual a 128, 256 i 512. Per a una FFT d N valors, la

* senyal sinusoidal realment conté N/2 harmònics. Per tant,

* es calculen per a la N de 128, 64 harmònics; per la N 256,

* 128 harmònic; per la N 512 256 harmnònics.

*

* Per a valors de N superiors a 512 no es calculen tots els

* harmònocs, nomès s'agafaran els 256 primers punts referents

* a les bandes de freqüències greus.

**************************************************************/

Page 282: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

282

private void CalcularFuncio()

{

if (N == 128)

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = -1 +

1 * Math.Sin(1 * ((2 * PI * n) / N)) +

1 * Math.Sin(2 * ((2 * PI * n) / N)) +

1 * Math.Sin(3 * ((2 * PI * n) / N)) +

1 * Math.Sin(4 * ((2 * PI * n) / N)) +

1 * Math.Sin(5 * ((2 * PI * n) / N)) +

1 * Math.Sin(6 * ((2 * PI * n) / N)) +

1 * Math.Sin(7 * ((2 * PI * n) / N)) +

1 * Math.Sin(8 * ((2 * PI * n) / N)) +

1 * Math.Sin(9 * ((2 * PI * n) / N)) +

1 * Math.Sin(10 * ((2 * PI * n) / N)) +

1 * Math.Sin(11 * ((2 * PI * n) / N)) +

1 * Math.Sin(12 * ((2 * PI * n) / N)) +

1 * Math.Sin(13 * ((2 * PI * n) / N)) +

1 * Math.Sin(14 * ((2 * PI * n) / N)) +

1 * Math.Sin(15 * ((2 * PI * n) / N)) +

1 * Math.Sin(16 * ((2 * PI * n) / N)) +

1 * Math.Sin(17 * ((2 * PI * n) / N)) +

1 * Math.Sin(18 * ((2 * PI * n) / N)) +

1 * Math.Sin(19 * ((2 * PI * n) / N)) +

1 * Math.Sin(20 * ((2 * PI * n) / N)) +

1 * Math.Sin(21 * ((2 * PI * n) / N)) +

1 * Math.Sin(22 * ((2 * PI * n) / N)) +

1 * Math.Sin(23 * ((2 * PI * n) / N)) +

1 * Math.Sin(24 * ((2 * PI * n) / N)) +

1 * Math.Sin(25 * ((2 * PI * n) / N)) +

1 * Math.Sin(26 * ((2 * PI * n) / N)) +

1 * Math.Sin(27 * ((2 * PI * n) / N)) +

1 * Math.Sin(28 * ((2 * PI * n) / N)) +

1 * Math.Sin(29 * ((2 * PI * n) / N)) +

1 * Math.Sin(30 * ((2 * PI * n) / N)) +

1 * Math.Sin(31 * ((2 * PI * n) / N)) +

1 * Math.Sin(32 * ((2 * PI * n) / N)) +

1 * Math.Sin(33 * ((2 * PI * n) / N)) +

1 * Math.Sin(34 * ((2 * PI * n) / N)) +

Page 283: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

283

1 * Math.Sin(35 * ((2 * PI * n) / N)) +

1 * Math.Sin(36 * ((2 * PI * n) / N)) +

1 * Math.Sin(37 * ((2 * PI * n) / N)) +

1 * Math.Sin(38 * ((2 * PI * n) / N)) +

1 * Math.Sin(39 * ((2 * PI * n) / N)) +

1 * Math.Sin(40 * ((2 * PI * n) / N)) +

1 * Math.Sin(41 * ((2 * PI * n) / N)) +

1 * Math.Sin(42 * ((2 * PI * n) / N)) +

1 * Math.Sin(43 * ((2 * PI * n) / N)) +

1 * Math.Sin(44 * ((2 * PI * n) / N)) +

1 * Math.Sin(45 * ((2 * PI * n) / N)) +

1 * Math.Sin(46 * ((2 * PI * n) / N)) +

1 * Math.Sin(47 * ((2 * PI * n) / N)) +

1 * Math.Sin(48 * ((2 * PI * n) / N)) +

1 * Math.Sin(49 * ((2 * PI * n) / N)) +

1 * Math.Sin(50 * ((2 * PI * n) / N)) +

1 * Math.Sin(51 * ((2 * PI * n) / N)) +

1 * Math.Sin(52 * ((2 * PI * n) / N)) +

1 * Math.Sin(53 * ((2 * PI * n) / N)) +

1 * Math.Sin(54 * ((2 * PI * n) / N)) +

1 * Math.Sin(55 * ((2 * PI * n) / N)) +

1 * Math.Sin(56 * ((2 * PI * n) / N)) +

1 * Math.Sin(57 * ((2 * PI * n) / N)) +

1 * Math.Sin(58 * ((2 * PI * n) / N)) +

1 * Math.Sin(59 * ((2 * PI * n) / N)) +

1 * Math.Sin(60 * ((2 * PI * n) / N)) +

1 * Math.Sin(61 * ((2 * PI * n) / N)) +

1 * Math.Sin(62 * ((2 * PI * n) / N)) +

1 * Math.Sin(63 * ((2 * PI * n) / N)) +

1 * Math.Sin(64 * ((2 * PI * n) / N));

vectorDadesIm[n] = 0;

}//Fi for()

}//Fi if (N == 128)

if (N == 256)

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = -1 +

1 * Math.Sin(1 * ((2 * PI * n) / N)) +

1 * Math.Sin(2 * ((2 * PI * n) / N)) +

Page 284: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

284

1 * Math.Sin(3 * ((2 * PI * n) / N)) +

1 * Math.Sin(4 * ((2 * PI * n) / N)) +

1 * Math.Sin(5 * ((2 * PI * n) / N)) +

1 * Math.Sin(6 * ((2 * PI * n) / N)) +

1 * Math.Sin(7 * ((2 * PI * n) / N)) +

1 * Math.Sin(8 * ((2 * PI * n) / N)) +

1 * Math.Sin(9 * ((2 * PI * n) / N)) +

1 * Math.Sin(10 * ((2 * PI * n) / N)) +

1 * Math.Sin(11 * ((2 * PI * n) / N)) +

1 * Math.Sin(12 * ((2 * PI * n) / N)) +

1 * Math.Sin(13 * ((2 * PI * n) / N)) +

1 * Math.Sin(14 * ((2 * PI * n) / N)) +

1 * Math.Sin(15 * ((2 * PI * n) / N)) +

1 * Math.Sin(16 * ((2 * PI * n) / N)) +

1 * Math.Sin(17 * ((2 * PI * n) / N)) +

1 * Math.Sin(18 * ((2 * PI * n) / N)) +

1 * Math.Sin(19 * ((2 * PI * n) / N)) +

1 * Math.Sin(20 * ((2 * PI * n) / N)) +

1 * Math.Sin(21 * ((2 * PI * n) / N)) +

1 * Math.Sin(22 * ((2 * PI * n) / N)) +

1 * Math.Sin(23 * ((2 * PI * n) / N)) +

1 * Math.Sin(24 * ((2 * PI * n) / N)) +

1 * Math.Sin(25 * ((2 * PI * n) / N)) +

1 * Math.Sin(26 * ((2 * PI * n) / N)) +

1 * Math.Sin(27 * ((2 * PI * n) / N)) +

1 * Math.Sin(28 * ((2 * PI * n) / N)) +

1 * Math.Sin(29 * ((2 * PI * n) / N)) +

1 * Math.Sin(30 * ((2 * PI * n) / N)) +

1 * Math.Sin(31 * ((2 * PI * n) / N)) +

1 * Math.Sin(32 * ((2 * PI * n) / N)) +

1 * Math.Sin(33 * ((2 * PI * n) / N)) +

1 * Math.Sin(34 * ((2 * PI * n) / N)) +

1 * Math.Sin(35 * ((2 * PI * n) / N)) +

1 * Math.Sin(36 * ((2 * PI * n) / N)) +

1 * Math.Sin(37 * ((2 * PI * n) / N)) +

1 * Math.Sin(38 * ((2 * PI * n) / N)) +

1 * Math.Sin(39 * ((2 * PI * n) / N)) +

1 * Math.Sin(40 * ((2 * PI * n) / N)) +

1 * Math.Sin(41 * ((2 * PI * n) / N)) +

1 * Math.Sin(42 * ((2 * PI * n) / N)) +

1 * Math.Sin(43 * ((2 * PI * n) / N)) +

1 * Math.Sin(44 * ((2 * PI * n) / N)) +

Page 285: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

285

1 * Math.Sin(45 * ((2 * PI * n) / N)) +

1 * Math.Sin(46 * ((2 * PI * n) / N)) +

1 * Math.Sin(47 * ((2 * PI * n) / N)) +

1 * Math.Sin(48 * ((2 * PI * n) / N)) +

1 * Math.Sin(49 * ((2 * PI * n) / N)) +

1 * Math.Sin(50 * ((2 * PI * n) / N)) +

1 * Math.Sin(51 * ((2 * PI * n) / N)) +

1 * Math.Sin(52 * ((2 * PI * n) / N)) +

1 * Math.Sin(53 * ((2 * PI * n) / N)) +

1 * Math.Sin(54 * ((2 * PI * n) / N)) +

1 * Math.Sin(55 * ((2 * PI * n) / N)) +

1 * Math.Sin(56 * ((2 * PI * n) / N)) +

1 * Math.Sin(57 * ((2 * PI * n) / N)) +

1 * Math.Sin(58 * ((2 * PI * n) / N)) +

1 * Math.Sin(59 * ((2 * PI * n) / N)) +

1 * Math.Sin(60 * ((2 * PI * n) / N)) +

1 * Math.Sin(61 * ((2 * PI * n) / N)) +

1 * Math.Sin(62 * ((2 * PI * n) / N)) +

1 * Math.Sin(63 * ((2 * PI * n) / N)) +

1 * Math.Sin(64 * ((2 * PI * n) / N)) +

1 * Math.Sin(65 * ((2 * PI * n) / N)) +

1 * Math.Sin(66 * ((2 * PI * n) / N)) +

1 * Math.Sin(67 * ((2 * PI * n) / N)) +

1 * Math.Sin(68 * ((2 * PI * n) / N)) +

1 * Math.Sin(69 * ((2 * PI * n) / N)) +

1 * Math.Sin(70 * ((2 * PI * n) / N)) +

1 * Math.Sin(71 * ((2 * PI * n) / N)) +

1 * Math.Sin(72 * ((2 * PI * n) / N)) +

1 * Math.Sin(73 * ((2 * PI * n) / N)) +

1 * Math.Sin(74 * ((2 * PI * n) / N)) +

1 * Math.Sin(75 * ((2 * PI * n) / N)) +

1 * Math.Sin(76 * ((2 * PI * n) / N)) +

1 * Math.Sin(77 * ((2 * PI * n) / N)) +

1 * Math.Sin(78 * ((2 * PI * n) / N)) +

1 * Math.Sin(79 * ((2 * PI * n) / N)) +

1 * Math.Sin(80 * ((2 * PI * n) / N)) +

1 * Math.Sin(81 * ((2 * PI * n) / N)) +

1 * Math.Sin(82 * ((2 * PI * n) / N)) +

1 * Math.Sin(83 * ((2 * PI * n) / N)) +

1 * Math.Sin(84 * ((2 * PI * n) / N)) +

1 * Math.Sin(85 * ((2 * PI * n) / N)) +

1 * Math.Sin(86 * ((2 * PI * n) / N)) +

Page 286: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

286

1 * Math.Sin(87 * ((2 * PI * n) / N)) +

1 * Math.Sin(88 * ((2 * PI * n) / N)) +

1 * Math.Sin(89 * ((2 * PI * n) / N)) +

1 * Math.Sin(90 * ((2 * PI * n) / N)) +

1 * Math.Sin(91 * ((2 * PI * n) / N)) +

1 * Math.Sin(92 * ((2 * PI * n) / N)) +

1 * Math.Sin(93 * ((2 * PI * n) / N)) +

1 * Math.Sin(94 * ((2 * PI * n) / N)) +

1 * Math.Sin(95 * ((2 * PI * n) / N)) +

1 * Math.Sin(96 * ((2 * PI * n) / N)) +

1 * Math.Sin(97 * ((2 * PI * n) / N)) +

1 * Math.Sin(98 * ((2 * PI * n) / N)) +

1 * Math.Sin(99 * ((2 * PI * n) / N)) +

1 * Math.Sin(100 * ((2 * PI * n) / N)) +

1 * Math.Sin(101 * ((2 * PI * n) / N)) +

1 * Math.Sin(102 * ((2 * PI * n) / N)) +

1 * Math.Sin(103 * ((2 * PI * n) / N)) +

1 * Math.Sin(104 * ((2 * PI * n) / N)) +

1 * Math.Sin(105 * ((2 * PI * n) / N)) +

1 * Math.Sin(106 * ((2 * PI * n) / N)) +

1 * Math.Sin(107 * ((2 * PI * n) / N)) +

1 * Math.Sin(108 * ((2 * PI * n) / N)) +

1 * Math.Sin(109 * ((2 * PI * n) / N)) +

1 * Math.Sin(110 * ((2 * PI * n) / N)) +

1 * Math.Sin(111 * ((2 * PI * n) / N)) +

1 * Math.Sin(112 * ((2 * PI * n) / N)) +

1 * Math.Sin(113 * ((2 * PI * n) / N)) +

1 * Math.Sin(114 * ((2 * PI * n) / N)) +

1 * Math.Sin(115 * ((2 * PI * n) / N)) +

1 * Math.Sin(116 * ((2 * PI * n) / N)) +

1 * Math.Sin(117 * ((2 * PI * n) / N)) +

1 * Math.Sin(118 * ((2 * PI * n) / N)) +

1 * Math.Sin(119 * ((2 * PI * n) / N)) +

1 * Math.Sin(120 * ((2 * PI * n) / N)) +

1 * Math.Sin(121 * ((2 * PI * n) / N)) +

1 * Math.Sin(122 * ((2 * PI * n) / N)) +

1 * Math.Sin(123 * ((2 * PI * n) / N)) +

1 * Math.Sin(124 * ((2 * PI * n) / N)) +

1 * Math.Sin(125 * ((2 * PI * n) / N)) +

1 * Math.Sin(126 * ((2 * PI * n) / N)) +

1 * Math.Sin(127 * ((2 * PI * n) / N)) +

1 * Math.Sin(128 * ((2 * PI * n) / N));

Page 287: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

287

vectorDadesIm[n] = 0;

}//Fi for()

}//Fi if (N == 256)

if (N >= 512)

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = -1 +

1 * Math.Sin(1 * ((2 * PI * n) / N)) +

1 * Math.Sin(2 * ((2 * PI * n) / N)) +

1 * Math.Sin(3 * ((2 * PI * n) / N)) +

1 * Math.Sin(4 * ((2 * PI * n) / N)) +

1 * Math.Sin(5 * ((2 * PI * n) / N)) +

1 * Math.Sin(6 * ((2 * PI * n) / N)) +

1 * Math.Sin(7 * ((2 * PI * n) / N)) +

1 * Math.Sin(8 * ((2 * PI * n) / N)) +

1 * Math.Sin(9 * ((2 * PI * n) / N)) +

1 * Math.Sin(10 * ((2 * PI * n) / N)) +

1 * Math.Sin(11 * ((2 * PI * n) / N)) +

1 * Math.Sin(12 * ((2 * PI * n) / N)) +

1 * Math.Sin(13 * ((2 * PI * n) / N)) +

1 * Math.Sin(14 * ((2 * PI * n) / N)) +

1 * Math.Sin(15 * ((2 * PI * n) / N)) +

1 * Math.Sin(16 * ((2 * PI * n) / N)) +

1 * Math.Sin(17 * ((2 * PI * n) / N)) +

1 * Math.Sin(18 * ((2 * PI * n) / N)) +

1 * Math.Sin(19 * ((2 * PI * n) / N)) +

1 * Math.Sin(20 * ((2 * PI * n) / N)) +

1 * Math.Sin(21 * ((2 * PI * n) / N)) +

1 * Math.Sin(22 * ((2 * PI * n) / N)) +

1 * Math.Sin(23 * ((2 * PI * n) / N)) +

1 * Math.Sin(24 * ((2 * PI * n) / N)) +

1 * Math.Sin(25 * ((2 * PI * n) / N)) +

1 * Math.Sin(26 * ((2 * PI * n) / N)) +

1 * Math.Sin(27 * ((2 * PI * n) / N)) +

1 * Math.Sin(28 * ((2 * PI * n) / N)) +

1 * Math.Sin(29 * ((2 * PI * n) / N)) +

1 * Math.Sin(30 * ((2 * PI * n) / N)) +

1 * Math.Sin(31 * ((2 * PI * n) / N)) +

1 * Math.Sin(32 * ((2 * PI * n) / N)) +

Page 288: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

288

1 * Math.Sin(33 * ((2 * PI * n) / N)) +

1 * Math.Sin(34 * ((2 * PI * n) / N)) +

1 * Math.Sin(35 * ((2 * PI * n) / N)) +

1 * Math.Sin(36 * ((2 * PI * n) / N)) +

1 * Math.Sin(37 * ((2 * PI * n) / N)) +

1 * Math.Sin(38 * ((2 * PI * n) / N)) +

1 * Math.Sin(39 * ((2 * PI * n) / N)) +

1 * Math.Sin(40 * ((2 * PI * n) / N)) +

1 * Math.Sin(41 * ((2 * PI * n) / N)) +

1 * Math.Sin(42 * ((2 * PI * n) / N)) +

1 * Math.Sin(43 * ((2 * PI * n) / N)) +

1 * Math.Sin(44 * ((2 * PI * n) / N)) +

1 * Math.Sin(45 * ((2 * PI * n) / N)) +

1 * Math.Sin(46 * ((2 * PI * n) / N)) +

1 * Math.Sin(47 * ((2 * PI * n) / N)) +

1 * Math.Sin(48 * ((2 * PI * n) / N)) +

1 * Math.Sin(49 * ((2 * PI * n) / N)) +

1 * Math.Sin(50 * ((2 * PI * n) / N)) +

1 * Math.Sin(51 * ((2 * PI * n) / N)) +

1 * Math.Sin(52 * ((2 * PI * n) / N)) +

1 * Math.Sin(53 * ((2 * PI * n) / N)) +

1 * Math.Sin(54 * ((2 * PI * n) / N)) +

1 * Math.Sin(55 * ((2 * PI * n) / N)) +

1 * Math.Sin(56 * ((2 * PI * n) / N)) +

1 * Math.Sin(57 * ((2 * PI * n) / N)) +

1 * Math.Sin(58 * ((2 * PI * n) / N)) +

1 * Math.Sin(59 * ((2 * PI * n) / N)) +

1 * Math.Sin(60 * ((2 * PI * n) / N)) +

1 * Math.Sin(61 * ((2 * PI * n) / N)) +

1 * Math.Sin(62 * ((2 * PI * n) / N)) +

1 * Math.Sin(63 * ((2 * PI * n) / N)) +

1 * Math.Sin(64 * ((2 * PI * n) / N)) +

1 * Math.Sin(65 * ((2 * PI * n) / N)) +

1 * Math.Sin(66 * ((2 * PI * n) / N)) +

1 * Math.Sin(67 * ((2 * PI * n) / N)) +

1 * Math.Sin(68 * ((2 * PI * n) / N)) +

1 * Math.Sin(69 * ((2 * PI * n) / N)) +

1 * Math.Sin(70 * ((2 * PI * n) / N)) +

1 * Math.Sin(71 * ((2 * PI * n) / N)) +

1 * Math.Sin(72 * ((2 * PI * n) / N)) +

1 * Math.Sin(73 * ((2 * PI * n) / N)) +

1 * Math.Sin(74 * ((2 * PI * n) / N)) +

Page 289: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

289

1 * Math.Sin(75 * ((2 * PI * n) / N)) +

1 * Math.Sin(76 * ((2 * PI * n) / N)) +

1 * Math.Sin(77 * ((2 * PI * n) / N)) +

1 * Math.Sin(78 * ((2 * PI * n) / N)) +

1 * Math.Sin(79 * ((2 * PI * n) / N)) +

1 * Math.Sin(80 * ((2 * PI * n) / N)) +

1 * Math.Sin(81 * ((2 * PI * n) / N)) +

1 * Math.Sin(82 * ((2 * PI * n) / N)) +

1 * Math.Sin(83 * ((2 * PI * n) / N)) +

1 * Math.Sin(84 * ((2 * PI * n) / N)) +

1 * Math.Sin(85 * ((2 * PI * n) / N)) +

1 * Math.Sin(86 * ((2 * PI * n) / N)) +

1 * Math.Sin(87 * ((2 * PI * n) / N)) +

1 * Math.Sin(88 * ((2 * PI * n) / N)) +

1 * Math.Sin(89 * ((2 * PI * n) / N)) +

1 * Math.Sin(90 * ((2 * PI * n) / N)) +

1 * Math.Sin(91 * ((2 * PI * n) / N)) +

1 * Math.Sin(92 * ((2 * PI * n) / N)) +

1 * Math.Sin(93 * ((2 * PI * n) / N)) +

1 * Math.Sin(94 * ((2 * PI * n) / N)) +

1 * Math.Sin(95 * ((2 * PI * n) / N)) +

1 * Math.Sin(96 * ((2 * PI * n) / N)) +

1 * Math.Sin(97 * ((2 * PI * n) / N)) +

1 * Math.Sin(98 * ((2 * PI * n) / N)) +

1 * Math.Sin(99 * ((2 * PI * n) / N)) +

1 * Math.Sin(100 * ((2 * PI * n) / N)) +

1 * Math.Sin(101 * ((2 * PI * n) / N)) +

1 * Math.Sin(102 * ((2 * PI * n) / N)) +

1 * Math.Sin(103 * ((2 * PI * n) / N)) +

1 * Math.Sin(104 * ((2 * PI * n) / N)) +

1 * Math.Sin(105 * ((2 * PI * n) / N)) +

1 * Math.Sin(106 * ((2 * PI * n) / N)) +

1 * Math.Sin(107 * ((2 * PI * n) / N)) +

1 * Math.Sin(108 * ((2 * PI * n) / N)) +

1 * Math.Sin(109 * ((2 * PI * n) / N)) +

1 * Math.Sin(110 * ((2 * PI * n) / N)) +

1 * Math.Sin(111 * ((2 * PI * n) / N)) +

1 * Math.Sin(112 * ((2 * PI * n) / N)) +

1 * Math.Sin(113 * ((2 * PI * n) / N)) +

1 * Math.Sin(114 * ((2 * PI * n) / N)) +

1 * Math.Sin(115 * ((2 * PI * n) / N)) +

1 * Math.Sin(116 * ((2 * PI * n) / N)) +

Page 290: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

290

1 * Math.Sin(117 * ((2 * PI * n) / N)) +

1 * Math.Sin(118 * ((2 * PI * n) / N)) +

1 * Math.Sin(119 * ((2 * PI * n) / N)) +

1 * Math.Sin(120 * ((2 * PI * n) / N)) +

1 * Math.Sin(121 * ((2 * PI * n) / N)) +

1 * Math.Sin(122 * ((2 * PI * n) / N)) +

1 * Math.Sin(123 * ((2 * PI * n) / N)) +

1 * Math.Sin(124 * ((2 * PI * n) / N)) +

1 * Math.Sin(125 * ((2 * PI * n) / N)) +

1 * Math.Sin(126 * ((2 * PI * n) / N)) +

1 * Math.Sin(127 * ((2 * PI * n) / N)) +

1 * Math.Sin(128 * ((2 * PI * n) / N)) +

1 * Math.Sin(129 * ((2 * PI * n) / N)) +

1 * Math.Sin(130 * ((2 * PI * n) / N)) +

1 * Math.Sin(131 * ((2 * PI * n) / N)) +

1 * Math.Sin(132 * ((2 * PI * n) / N)) +

1 * Math.Sin(133 * ((2 * PI * n) / N)) +

1 * Math.Sin(134 * ((2 * PI * n) / N)) +

1 * Math.Sin(135 * ((2 * PI * n) / N)) +

1 * Math.Sin(136 * ((2 * PI * n) / N)) +

1 * Math.Sin(137 * ((2 * PI * n) / N)) +

1 * Math.Sin(138 * ((2 * PI * n) / N)) +

1 * Math.Sin(139 * ((2 * PI * n) / N)) +

1 * Math.Sin(140 * ((2 * PI * n) / N)) +

1 * Math.Sin(141 * ((2 * PI * n) / N)) +

1 * Math.Sin(142 * ((2 * PI * n) / N)) +

1 * Math.Sin(143 * ((2 * PI * n) / N)) +

1 * Math.Sin(144 * ((2 * PI * n) / N)) +

1 * Math.Sin(145 * ((2 * PI * n) / N)) +

1 * Math.Sin(146 * ((2 * PI * n) / N)) +

1 * Math.Sin(147 * ((2 * PI * n) / N)) +

1 * Math.Sin(148 * ((2 * PI * n) / N)) +

1 * Math.Sin(149 * ((2 * PI * n) / N)) +

1 * Math.Sin(150 * ((2 * PI * n) / N)) +

1 * Math.Sin(151 * ((2 * PI * n) / N)) +

1 * Math.Sin(152 * ((2 * PI * n) / N)) +

1 * Math.Sin(153 * ((2 * PI * n) / N)) +

1 * Math.Sin(154 * ((2 * PI * n) / N)) +

1 * Math.Sin(155 * ((2 * PI * n) / N)) +

1 * Math.Sin(156 * ((2 * PI * n) / N)) +

1 * Math.Sin(157 * ((2 * PI * n) / N)) +

1 * Math.Sin(158 * ((2 * PI * n) / N)) +

Page 291: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

291

1 * Math.Sin(159 * ((2 * PI * n) / N)) +

1 * Math.Sin(160 * ((2 * PI * n) / N)) +

1 * Math.Sin(161 * ((2 * PI * n) / N)) +

1 * Math.Sin(162 * ((2 * PI * n) / N)) +

1 * Math.Sin(163 * ((2 * PI * n) / N)) +

1 * Math.Sin(164 * ((2 * PI * n) / N)) +

1 * Math.Sin(165 * ((2 * PI * n) / N)) +

1 * Math.Sin(166 * ((2 * PI * n) / N)) +

1 * Math.Sin(167 * ((2 * PI * n) / N)) +

1 * Math.Sin(168 * ((2 * PI * n) / N)) +

1 * Math.Sin(169 * ((2 * PI * n) / N)) +

1 * Math.Sin(170 * ((2 * PI * n) / N)) +

1 * Math.Sin(171 * ((2 * PI * n) / N)) +

1 * Math.Sin(172 * ((2 * PI * n) / N)) +

1 * Math.Sin(173 * ((2 * PI * n) / N)) +

1 * Math.Sin(174 * ((2 * PI * n) / N)) +

1 * Math.Sin(175 * ((2 * PI * n) / N)) +

1 * Math.Sin(176 * ((2 * PI * n) / N)) +

1 * Math.Sin(177 * ((2 * PI * n) / N)) +

1 * Math.Sin(178 * ((2 * PI * n) / N)) +

1 * Math.Sin(179 * ((2 * PI * n) / N)) +

1 * Math.Sin(180 * ((2 * PI * n) / N)) +

1 * Math.Sin(181 * ((2 * PI * n) / N)) +

1 * Math.Sin(182 * ((2 * PI * n) / N)) +

1 * Math.Sin(183 * ((2 * PI * n) / N)) +

1 * Math.Sin(184 * ((2 * PI * n) / N)) +

1 * Math.Sin(185 * ((2 * PI * n) / N)) +

1 * Math.Sin(186 * ((2 * PI * n) / N)) +

1 * Math.Sin(187 * ((2 * PI * n) / N)) +

1 * Math.Sin(188 * ((2 * PI * n) / N)) +

1 * Math.Sin(189 * ((2 * PI * n) / N)) +

1 * Math.Sin(190 * ((2 * PI * n) / N)) +

1 * Math.Sin(191 * ((2 * PI * n) / N)) +

1 * Math.Sin(192 * ((2 * PI * n) / N)) +

1 * Math.Sin(193 * ((2 * PI * n) / N)) +

1 * Math.Sin(194 * ((2 * PI * n) / N)) +

1 * Math.Sin(195 * ((2 * PI * n) / N)) +

1 * Math.Sin(196 * ((2 * PI * n) / N)) +

1 * Math.Sin(197 * ((2 * PI * n) / N)) +

1 * Math.Sin(198 * ((2 * PI * n) / N)) +

1 * Math.Sin(199 * ((2 * PI * n) / N)) +

1 * Math.Sin(200 * ((2 * PI * n) / N)) +

Page 292: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

292

1 * Math.Sin(201 * ((2 * PI * n) / N)) +

1 * Math.Sin(202 * ((2 * PI * n) / N)) +

1 * Math.Sin(203 * ((2 * PI * n) / N)) +

1 * Math.Sin(204 * ((2 * PI * n) / N)) +

1 * Math.Sin(205 * ((2 * PI * n) / N)) +

1 * Math.Sin(206 * ((2 * PI * n) / N)) +

1 * Math.Sin(207 * ((2 * PI * n) / N)) +

1 * Math.Sin(208 * ((2 * PI * n) / N)) +

1 * Math.Sin(209 * ((2 * PI * n) / N)) +

1 * Math.Sin(210 * ((2 * PI * n) / N)) +

1 * Math.Sin(211 * ((2 * PI * n) / N)) +

1 * Math.Sin(212 * ((2 * PI * n) / N)) +

1 * Math.Sin(213 * ((2 * PI * n) / N)) +

1 * Math.Sin(214 * ((2 * PI * n) / N)) +

1 * Math.Sin(215 * ((2 * PI * n) / N)) +

1 * Math.Sin(216 * ((2 * PI * n) / N)) +

1 * Math.Sin(217 * ((2 * PI * n) / N)) +

1 * Math.Sin(218 * ((2 * PI * n) / N)) +

1 * Math.Sin(219 * ((2 * PI * n) / N)) +

1 * Math.Sin(220 * ((2 * PI * n) / N)) +

1 * Math.Sin(221 * ((2 * PI * n) / N)) +

1 * Math.Sin(222 * ((2 * PI * n) / N)) +

1 * Math.Sin(223 * ((2 * PI * n) / N)) +

1 * Math.Sin(224 * ((2 * PI * n) / N)) +

1 * Math.Sin(225 * ((2 * PI * n) / N)) +

1 * Math.Sin(226 * ((2 * PI * n) / N)) +

1 * Math.Sin(227 * ((2 * PI * n) / N)) +

1 * Math.Sin(228 * ((2 * PI * n) / N)) +

1 * Math.Sin(229 * ((2 * PI * n) / N)) +

1 * Math.Sin(230 * ((2 * PI * n) / N)) +

1 * Math.Sin(231 * ((2 * PI * n) / N)) +

1 * Math.Sin(232 * ((2 * PI * n) / N)) +

1 * Math.Sin(233 * ((2 * PI * n) / N)) +

1 * Math.Sin(234 * ((2 * PI * n) / N)) +

1 * Math.Sin(235 * ((2 * PI * n) / N)) +

1 * Math.Sin(236 * ((2 * PI * n) / N)) +

1 * Math.Sin(237 * ((2 * PI * n) / N)) +

1 * Math.Sin(238 * ((2 * PI * n) / N)) +

1 * Math.Sin(239 * ((2 * PI * n) / N)) +

1 * Math.Sin(240 * ((2 * PI * n) / N)) +

1 * Math.Sin(241 * ((2 * PI * n) / N)) +

1 * Math.Sin(242 * ((2 * PI * n) / N)) +

Page 293: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

293

1 * Math.Sin(243 * ((2 * PI * n) / N)) +

1 * Math.Sin(244 * ((2 * PI * n) / N)) +

1 * Math.Sin(245 * ((2 * PI * n) / N)) +

1 * Math.Sin(246 * ((2 * PI * n) / N)) +

1 * Math.Sin(247 * ((2 * PI * n) / N)) +

1 * Math.Sin(248 * ((2 * PI * n) / N)) +

1 * Math.Sin(249 * ((2 * PI * n) / N)) +

1 * Math.Sin(250 * ((2 * PI * n) / N)) +

1 * Math.Sin(251 * ((2 * PI * n) / N)) +

1 * Math.Sin(252 * ((2 * PI * n) / N)) +

1 * Math.Sin(253 * ((2 * PI * n) / N)) +

1 * Math.Sin(254 * ((2 * PI * n) / N)) +

1 * Math.Sin(255 * ((2 * PI * n) / N)) +

1 * Math.Sin(256 * ((2 * PI * n) / N));

vectorDadesIm[n] = 0;

}//Fi for()

}//Fi if (N >= 512)

}//Fi CalcularFuncio()

/**************************************************************

* La funció Prova2() serveix per comprovar el correcte

* funcionament de la IFFT.

*

* Nota: Es crea una senyal matemàtica on es coneixen el seus

* valors en el domini del temps i la freqüència. Es realitzen

* tots els processos que retornen la senyal en el domini

* freqüencial al domini del temps i es comparen els valors

* obtinguts amb els matemàticament esperants.

**************************************************************/

private void Prova2()

{

//Guardar valors de les variables en variables locals auxiliars.

int guardarN = N;

int guardarlogN = logN;

//Posar les variables a valors convenients per a la prova2.

//Nomès es proven els valors matemàtics dels primers 32

//harmònics.

N = 32;

Page 294: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

294

logN = 5;

//Calcular els factors de gir.

CalcularFactorsDeGir();

//Crear vectors.

CrearVectorsReIm();

CalcularFuncio_Prova2();

OmplirVectorDades_Prova2();

Calcular_IFFT();

//Es diposita la senyal calculada en el domini

//temporal en les varibles globals.

//VG.p0t significa Variable Global

//punt 0 temporal.

VG.p0t = vectorDadesTemporals[0];

VG.p1t = vectorDadesTemporals[1];

VG.p2t = vectorDadesTemporals[2];

VG.p3t = vectorDadesTemporals[3];

VG.p4t = vectorDadesTemporals[4];

VG.p5t = vectorDadesTemporals[5];

VG.p6t = vectorDadesTemporals[6];

VG.p7t = vectorDadesTemporals[7];

VG.p8t = vectorDadesTemporals[8];

VG.p9t = vectorDadesTemporals[9];

VG.p10t = vectorDadesTemporals[10];

VG.p11t = vectorDadesTemporals[11];

VG.p12t = vectorDadesTemporals[12];

VG.p13t = vectorDadesTemporals[13];

VG.p14t = vectorDadesTemporals[14];

VG.p15t = vectorDadesTemporals[15];

VG.p16t = vectorDadesTemporals[16];

VG.p17t = vectorDadesTemporals[17];

VG.p18t = vectorDadesTemporals[18];

VG.p19t = vectorDadesTemporals[19];

Page 295: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

295

VG.p20t = vectorDadesTemporals[20];

VG.p21t = vectorDadesTemporals[21];

VG.p22t = vectorDadesTemporals[22];

VG.p23t = vectorDadesTemporals[23];

VG.p24t = vectorDadesTemporals[24];

VG.p25t = vectorDadesTemporals[25];

VG.p26t = vectorDadesTemporals[26];

VG.p27t = vectorDadesTemporals[27];

VG.p28t = vectorDadesTemporals[28];

VG.p29t = vectorDadesTemporals[29];

VG.p30t = vectorDadesTemporals[30];

VG.p31t = vectorDadesTemporals[31];

//Es diposita la senyal temporal expressada

//en el domini freqüencial, i després passada al

//domini del temps mitjançant la IFFT, en les

//variables globals pertinents.

//VG.p0f significa Variable Global

//punt 0 freqüencial.

VG.p0f = vectorDadesReal[0];

VG.p1f = vectorDadesReal[1];

VG.p2f = vectorDadesReal[2];

VG.p3f = vectorDadesReal[3];

VG.p4f = vectorDadesReal[4];

VG.p5f = vectorDadesReal[5];

VG.p6f = vectorDadesReal[6];

VG.p7f = vectorDadesReal[7];

VG.p8f = vectorDadesReal[8];

VG.p9f = vectorDadesReal[9];

VG.p10f = vectorDadesReal[10];

VG.p11f = vectorDadesReal[11];

VG.p12f = vectorDadesReal[12];

VG.p13f = vectorDadesReal[13];

VG.p14f = vectorDadesReal[14];

VG.p15f = vectorDadesReal[15];

VG.p16f = vectorDadesReal[16];

VG.p17f = vectorDadesReal[17];

Page 296: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

296

VG.p18f = vectorDadesReal[18];

VG.p19f = vectorDadesReal[19];

VG.p20f = vectorDadesReal[20];

VG.p21f = vectorDadesReal[21];

VG.p22f = vectorDadesReal[22];

VG.p23f = vectorDadesReal[23];

VG.p24f = vectorDadesReal[24];

VG.p25f = vectorDadesReal[25];

VG.p26f = vectorDadesReal[26];

VG.p27f = vectorDadesReal[27];

VG.p28f = vectorDadesReal[28];

VG.p29f = vectorDadesReal[29];

VG.p30f = vectorDadesReal[30];

VG.p31f = vectorDadesReal[31];

//Restaurar els valors de les variables.

N = guardarN;

logN = guardarlogN;

//Es crea una nova instància del formulari fill

//FormFill_Prova2, anomenada frm.

FormFill_Prova2 frm = new FormFill_Prova2();

//Es mostra frm en pantalla. A partir d'aquest moment,

//frm pren el control del programa.

frm.Show();

}

/**************************************************************

* Funció que omple els vectors vectorDadesReal[] i

* vectorDadesIm[] amb els valors pertinets de la prova2.

**************************************************************/

private void OmplirVectorDades_Prova2()

{

vectorDadesReal = new double[N];

vectorDadesIm = new double[N];

Page 297: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

297

//S'inicialitzen a 0 els dos vectors

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = 0;

vectorDadesIm[n] = 0;

}

//vectorDadesReal[] i vectorDadesIm[]

//ara contenen la senyal en el domini

//de la freqüència. Sempre es considera

//que l'angle de fase dels armònics és

//zero.

//Component continua

vectorDadesReal[0] = 12.55;

//Amplitud 1r harmònic i harmònic a la freqüència

//de Nyquist. L'amplitud es la meitat

//del valor calculat en CalcularFuncio_Prova2()

vectorDadesReal[1] = 0.5;

vectorDadesReal[N - 1] = 0.5;

//La resta de harmònics sempre s'han de calcular en

//parelles. En la funció CalcularFuncio_Prova2()

//es fica un 5è harmòni, per tant, es necessari

//dipositar les amplituds del 5è i N-5 harmònics

vectorDadesReal[5] = 1.25;

vectorDadesReal[N - 5] = 1.25;

}

/**************************************************************

* La funció CalcularFuncio_prova2() fa que el

* vectorDadesTemporals[] contingui els valors en el domini del

* temps de l'expressió matemàtica introduïda.

**************************************************************/

private void CalcularFuncio_Prova2()

Page 298: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

298

{

vectorDadesTemporals = new double[N];

for (int n = 0; n < N; n++)

{

vectorDadesTemporals[n] = 12.55 +

1 * Math.Cos(1 * ((2 * PI * n) / N)) +

2.5 * Math.Cos(5 * ((2 * PI * n) / N));

}

}

/**************************************************************

* La funció Prova3() comprova el correcte funcionament del

* programa a partir d'una senyal matemàtica coneguda.

*

* Nota: Es prova la el correcte funcionament matemàtic

* de tot el processament de la senyal sense tindre en compte

* l'equalització ni les etapes ADC o DAC.

**************************************************************/

private void Prova3()

{

//Guardar els valors de les variables en variables

//locals auxiliars.

int guardarN = N;

int guardarlogN = logN;

//Posar les variables als valors convenients per a

//la prova3.

N = 32;

logN = 5;

/**********************************

* Processament de senyal.

*********************************/

//Calcular les finestres i els factors de gir.

CalcularFinestra();

CalcularInversFinestra();

Page 299: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

299

CalcularFactorsDeGir();

//Crear vector necessaris.

CrearVectorsReIm();

CrearVectorsAmplituds();

CrearVectorFrequencies();

//Calcular la funció de la prova3 a processar, en el

//domini del temps.

CalcularFuncio_Prova3();

//Es diposita la senyal a processar expressada

//en el domini temporal, otinguda prèviament

//per la funció CalcularFuncio_Prova3()

//en les variables globals pertinets.

VG.p0i = vectorDadesReal[0];

VG.p1i = vectorDadesReal[1];

VG.p2i = vectorDadesReal[2];

VG.p3i = vectorDadesReal[3];

VG.p4i = vectorDadesReal[4];

VG.p5i = vectorDadesReal[5];

VG.p6i = vectorDadesReal[6];

VG.p7i = vectorDadesReal[7];

VG.p8i = vectorDadesReal[8];

VG.p9i = vectorDadesReal[9];

VG.p10i = vectorDadesReal[10];

VG.p11i = vectorDadesReal[11];

VG.p12i = vectorDadesReal[12];

VG.p13i = vectorDadesReal[13];

VG.p14i = vectorDadesReal[14];

VG.p15i = vectorDadesReal[15];

VG.p16i = vectorDadesReal[16];

VG.p17i = vectorDadesReal[17];

VG.p18i = vectorDadesReal[18];

VG.p19i = vectorDadesReal[19];

VG.p20i = vectorDadesReal[20];

VG.p21i = vectorDadesReal[21];

Page 300: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

300

VG.p22i = vectorDadesReal[22];

VG.p23i = vectorDadesReal[23];

VG.p24i = vectorDadesReal[24];

VG.p25i = vectorDadesReal[25];

VG.p26i = vectorDadesReal[26];

VG.p27i = vectorDadesReal[27];

VG.p28i = vectorDadesReal[28];

VG.p29i = vectorDadesReal[29];

VG.p30i = vectorDadesReal[30];

VG.p31i = vectorDadesReal[31];

//Processos nessaris per transformar la senyal

//en domini temporal al domini de

//la freqüència.

//Enfinestrar();

CalcularFFT();

CalcularAmplituds();

OmplirVectorsAmplituds();

Convertir_volts_a_dBV();

OmplirVectorFrequencies();

//Processos nessaris per transformar la senyal

//en domini de la freqüència al domini temporal.

Convertir_dBV_a_volts();

ReomplirVectorsReIm();

Calcular_IFFT();

//Desenfinestrar();

//Es diposita la senyal ja processada

//expressada en el domini temporal.

//Ha de ser igual a la senyal sense processar,

//excepte petits erros d'arrodoniment en les

//variables globals pertinents.

VG.p0o = vectorDadesReal[0];

VG.p1o = vectorDadesReal[1];

VG.p2o = vectorDadesReal[2];

VG.p3o = vectorDadesReal[3];

VG.p4o = vectorDadesReal[4];

Page 301: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

301

VG.p5o = vectorDadesReal[5];

VG.p6o = vectorDadesReal[6];

VG.p7o = vectorDadesReal[7];

VG.p8o = vectorDadesReal[8];

VG.p9o = vectorDadesReal[9];

VG.p10o = vectorDadesReal[10];

VG.p11o = vectorDadesReal[11];

VG.p12o = vectorDadesReal[12];

VG.p13o = vectorDadesReal[13];

VG.p14o = vectorDadesReal[14];

VG.p15o = vectorDadesReal[15];

VG.p16o = vectorDadesReal[16];

VG.p17o = vectorDadesReal[17];

VG.p18o = vectorDadesReal[18];

VG.p19o = vectorDadesReal[19];

VG.p20o = vectorDadesReal[20];

VG.p21o = vectorDadesReal[21];

VG.p22o = vectorDadesReal[22];

VG.p23o = vectorDadesReal[23];

VG.p24o = vectorDadesReal[24];

VG.p25o = vectorDadesReal[25];

VG.p26o = vectorDadesReal[26];

VG.p27o = vectorDadesReal[27];

VG.p28o = vectorDadesReal[28];

VG.p29o = vectorDadesReal[29];

VG.p30o = vectorDadesReal[30];

VG.p31o = vectorDadesReal[31];

//Restaurar els valors de les variables.

N = guardarN;

logN = guardarlogN;

//Es crea una nova instància del formulari fill

//FormFill_Prova3, anomenada frm.

FormFill_Prova3 frm = new FormFill_Prova3();

//Es mostra frm en pantalla. A partir d'aquest moment,

Page 302: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

302

//frm pren el control del programa.

frm.Show();

}

/**************************************************************

* Funció que omple els vectors vectorDadesReal[] i

* vectorDadesIm[] de la prova3() amb els valors de la funció

* matemàtica coneguda en la posició pertinent.

**************************************************************/

private void CalcularFuncio_Prova3()

{

for (int n = 0; n < N; n++)

{

vectorDadesReal[n] = 10 +

1 * Math.Cos(1 * ((2 * PI * n) / N)) +

4.2 * Math.Cos(5 * ((2 * PI * n) / N)) +

2.5 * Math.Cos(8 * ((2 * PI * n) / N)) +

4.6 * Math.Cos(16 * ((2 * PI * n) / N));

vectorDadesIm[n] = 0;

}

}

/**************************************************************

* Funció que s'executa en un fil secondari, degut al cost en

* el temps de càlcul i per tal d'impedir el bloqueig de

* l'aplicació

*

* Nota: es fa servir la mateixa filosifia de treball de la

* funció Calculs() del projecte [24]

**************************************************************/

private void Calculs()

{

//Es criden les funcions per a calcular

//les finestres i els factors de fir.

//Únicament cal calcular-los una vegada.

CalcularFinestra();

CalcularInversFinestra();

Page 303: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

303

CalcularFactorsDeGir();

//La següent seqüència de crides de funció, nomès cal

//executar-la una vegada.

//En cas de treballar amb tarjeta, s'executen

//les funcions contingudes en el següent if.

if (treballSenseTarjeta == false)

{

CrearBuffer1();

CrearBuffer2();

CrearVectorUShort1();

CrearVectorUShort2();

}

CalcularM();

CrearVectorsReIm();

CrearVectorsAmplituds();

CrearVectorFrequencies();

//Si l'usuari del programa escull no representar l'espectre

//de la senyal en pantalla, nomès és dibuixarà l'equalització

//escollida per l'usuari.

if (representarEspectre == false)

{

Dibuixar();

}

//Si s'està en mode run...

//Es surt del mode run i es passa al mode stop quan

//l'usuari fa clic sobre menuStop de la barra de menús

while (run == true)

{

//Si es vol representar l'espectre en pantalla,

//a més de processar la senyal i enviar-la una

//vegada processada al DAC...

if (representarEspectre == true)

Page 304: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

304

{

if (dibuixAcabat == true)

{

//Si es treballa amb tarjeta...

if (treballSenseTarjeta == false)

{

CapturarDades();

DeBufferAVector();

QuatreBitsAltsAZero();

LecturaAVolts();

}

//Si es treballa sense tarjeta...

else

{

CalcularFuncio();

}

//Passar la senyal del domini temporal

//al domini de la freqüència.

Enfinestrar();

CalcularFFT();

CalcularAmplituds();

OmplirVectorsAmplituds();

Convertir_volts_a_dBV();

OmplirVectorFrequencies();

//Procès d'equalització.

Equalitzar();

AplicarGuanyGlobal();

//Si l'equalitzador no es el d'una octava

//s'aplica el tall a baixes i altes

//freqüències escollit per l'usuari.

//Recordatori:

//VG.equalitzador = 1: Equalitzador

// d'octava

Page 305: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

305

//VG.equalitzador = 2: Equalitzador

// de terç

// d'octava

//VG.equalitzador = 3; Equalitzador

// paramètric

if (VG.equalitzador > 1)

{

AplicarTallBaixesFreq();

AplicarTallAltesFreq();

}

//Si la tarjeta és la USB-1208FS,

//s'eliminen les components espectrals

//de la senyal de freqüència

//superiors a 5 kHz, per tal que no

//hi hagi aliasing

if (usb1208FS == true)

{

FiltrePassaBaixos5000Hz();

}

//S'aplica la limitació escollida

//per l'usuari

AplicarLimitador();

//Dibuixar els espectres en pantalla

dibuixarEspectre = true;

Dibuixar();

//Passar la senyal processada del

//domini de la freqüència al domini

//temporal.

Convertir_dBV_a_volts();

ReomplirVectorsReIm();

Calcular_IFFT();

Desenfinestrar();

Page 306: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

306

//Enviar la senyal processada al DAC

//convenientment escalada i adaptada.

//Si es treballa amb tarjeta...

if (treballSenseTarjeta == false)

{

CanviarEscala();

OmplirVectorDadesDA();

DeVectorABuffer();

EnviarDades();

}

}//Fi if (dibuixAcabat == true)

//Si el fil principal ha sol.licitat parar:

//WaitOne retornarà true quan l'estat del controlador

//passi a ser el senyalitzat.

if (controladorPararFilSecundari.WaitOne(0, false))

{

//Informar al fil principal que aquest fil secondari

//ha parat, modificant l'estat d'aquest controlador

//d'espera a senyalitzat.

controladorFilSecundariParat.Set();

//Deslliurar la memòria del buffer per a que

//pugui ser utilitzada per altres programes,

//si es treballa amb tarjeta

if (treballSenseTarjeta == false)

{

DeslliurarMemoria();

}

//Sortir de la funció Calculs().

return;

}//Fi if (controladorParar...)

Page 307: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

307

}//Fi if (representarEspectre == true)

//Si no es vol representar l'espectre en pantalla...

if (representarEspectre == false)

{

//Si es treballa amb tarjeta...

if (treballSenseTarjeta == false)

{

CapturarDades();

DeBufferAVector();

QuatreBitsAltsAZero();

LecturaAVolts();

}

//Si es treballa sense tarjeta...

else

{

CalcularFuncio();

}

//Passar la senyal del domini

//temporal al domini de la freqüència.

Enfinestrar();

CalcularFFT();

CalcularAmplituds();

OmplirVectorsAmplituds();

Convertir_volts_a_dBV();

OmplirVectorFrequencies();

//Procès d'equalització.

Equalitzar();

AplicarGuanyGlobal();

//Si l'equalitzador no es el d'una octava

//s'aplica el tall a baixes i altes

//freqüències escollit per l'usuari.

Page 308: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

308

//Recordatori:

//VG.equalitzador = 1: Equalitzador

// d'octava

//VG.equalitzador = 2: Equalitzador

// de terç

// d'octava

//VG.equalitzador = 3; Equalitzador

// paramètric

if (VG.equalitzador > 1)

{

AplicarTallBaixesFreq();

AplicarTallAltesFreq();

}

//Si la tarjeta és la USB-1208FS,

//s'eliminen les components espectrals

//de la senyal de freqüència

//superiors a 5 kHz, per tal que no

//hi hagi aliasing

if (usb1208FS == true)

{

FiltrePassaBaixos5000Hz();

}

//S'aplica la limitació escollida

//per l'usuari

AplicarLimitador();

//Passar la senyal processada del

//domini de la freqüència al domini

//temporal.

Convertir_dBV_a_volts();

ReomplirVectorsReIm();

Calcular_IFFT();

Desenfinestrar();

//Enviar la senyal processada al DAC

Page 309: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

309

//convenientment escalada i adaptada.

//Si es treballa amb tarjeta...

if (treballSenseTarjeta == false)

{

CanviarEscala();

OmplirVectorDadesDA();

DeVectorABuffer();

EnviarDades();

}

//Si el fil principal ha sol.licitat parar,

//WaitOne retornarà true quan l'estat del controlador

//passi a ser el senyalitzat.

if (controladorPararFilSecundari.WaitOne(0, false))

{

//Informar al fil principal que aquest fil secondari

//ha parat, modificant l'estat d'aquest controlador

//d'espera a senyalitzat.

controladorFilSecundariParat.Set();

//Deslliurar la memòria del buffer per a que

//pugui ser utilitzada per altres programes,

//si es treballa amb tarjeta

if (treballSenseTarjeta == false)

{

DeslliurarMemoria();

}

//Sortir de la funció Calculs().

return;

}//Fi if (controladorParar...)

}//Fi if (representarEspectre == false)

}//Fi while (run == true)

Page 310: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

310

//Deslliurar la memòria dels buffers de Windows.

//Si es treballa amb tarjeta.

if (treballSenseTarjeta == false)

{

DeslliurarMemoria();

}

}//Fi Calculs()

}//Fi public partial class FormPare_EqFFT:Form

}//Fi namespace Equalitzador_FFT

Page 311: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

311

/*************************************************************

* Fitxer Form1.Designer.cs

*

* Programa: Equalitzador FFT 1

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class Form1

{

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Clean up any resources being used.

/// </summary>

/// <param name="disposing">true if managed resources

///should be disposed; otherwise, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

Page 312: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

312

/// </summary>

private void InitializeComponent()

{

this.barraMenu = new System.Windows.Forms.MenuStrip();

this.menuGrabar = new System.Windows.Forms.ToolStripMenuItem();

this.menuReproduir = new System.Windows.Forms.ToolStripMenuItem();

this.menuDirecte = new System.Windows.Forms.ToolStripMenuItem();

this.menuEqualitzador = new System.Windows.Forms.ToolStripMenuItem();

this.EqualitzadorUnaOctava = new System.Windows.Forms.ToolStripMenuItem();

this.Equalitzador_1DIV3_Octava = new System.Windows.Forms.ToolStripMenuItem();

this.EqualitzadorParametric = new System.Windows.Forms.ToolStripMenuItem();

this.menuFinestra = new System.Windows.Forms.ToolStripMenuItem();

this.FinestraRectangular = new System.Windows.Forms.ToolStripMenuItem();

this.FinestraHanning = new System.Windows.Forms.ToolStripMenuItem();

this.FinestraKaiserBessel = new System.Windows.Forms.ToolStripMenuItem();

this.FinestraFlatTop = new System.Windows.Forms.ToolStripMenuItem();

this.menuNumPuntsFFT = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT128 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT256 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT512 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT1024 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT2048 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT4096 = new System.Windows.Forms.ToolStripMenuItem();

this.NumPuntsFFT8192 = new System.Windows.Forms.ToolStripMenuItem();

this.menuMostresPerSegon = new System.Windows.Forms.ToolStripMenuItem();

this.MostresPerSegon40000 = new System.Windows.Forms.ToolStripMenuItem();

this.MostresPerSegon50000 = new System.Windows.Forms.ToolStripMenuItem();

this.menuFonsEscalaADC = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_1_volt = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_1coma25_volts = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_2_volts = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_2coma5_volts = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_4_volts = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_5_volts = new System.Windows.Forms.ToolStripMenuItem();

this.FonsEscalaADC_10_volts = new System.Windows.Forms.ToolStripMenuItem();

this.menuTarjeta = new System.Windows.Forms.ToolStripMenuItem();

this.TarjetaUSB1208FS = new System.Windows.Forms.ToolStripMenuItem();

this.TarjetaUSB1208FSPlus = new System.Windows.Forms.ToolStripMenuItem();

this.TarjetaTreballarSenseTarjeta = new System.Windows.Forms.ToolStripMenuItem();

Page 313: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

313

this.TarjetaTreballarSenseTarjetaProva1 = new System.Windows.Forms.ToolStripMenuItem();

this.TarjetaTreballarSenseTarjetaProva2 = new System.Windows.Forms.ToolStripMenuItem();

this.menuVisualitzarEspectre = new System.Windows.Forms.ToolStripMenuItem();

this.VisualitzarEspectreSi = new System.Windows.Forms.ToolStripMenuItem();

this.VisualitzarEspectreNo = new System.Windows.Forms.ToolStripMenuItem();

this.menuEspectre = new System.Windows.Forms.ToolStripMenuItem();

this.EspectreEixXEscalaLineal = new System.Windows.Forms.ToolStripMenuItem();

this.EspectreEixXEscalaLog = new System.Windows.Forms.ToolStripMenuItem();

this.menuFitxersWav = new System.Windows.Forms.ToolStripMenuItem();

this.FitxersWavProduirFitxerWav = new System.Windows.Forms.ToolStripMenuItem();

this.FitxersWavEscoltarFitxerWav = new System.Windows.Forms.ToolStripMenuItem();

this.menuPausa = new System.Windows.Forms.ToolStripMenuItem();

this.menuContinuar = new System.Windows.Forms.ToolStripMenuItem();

this.menuParar = new System.Windows.Forms.ToolStripMenuItem();

this.statusStrip1 = new System.Windows.Forms.StatusStrip();

this.etActivitat = new System.Windows.Forms.ToolStripStatusLabel();

this.etEqualitzador = new System.Windows.Forms.ToolStripStatusLabel();

this.etFinestra = new System.Windows.Forms.ToolStripStatusLabel();

this.etNumPuntsFFT = new System.Windows.Forms.ToolStripStatusLabel();

this.etMostresPerSegon = new System.Windows.Forms.ToolStripStatusLabel();

this.etFonsEscalaADC = new System.Windows.Forms.ToolStripStatusLabel();

this.etTarjeta = new System.Windows.Forms.ToolStripStatusLabel();

this.etVisualitzarEspectre = new System.Windows.Forms.ToolStripStatusLabel();

this.etEspectre = new System.Windows.Forms.ToolStripStatusLabel();

this.pictureBox1 = new System.Windows.Forms.PictureBox();

this.TarjetaTreballarSenseTarjetaProva3 = new System.Windows.Forms.ToolStripMenuItem();

this.barraMenu.SuspendLayout();

this.statusStrip1.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();

this.SuspendLayout();

//

// barraMenu

//

this.barraMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.menuGrabar,

this.menuReproduir,

this.menuDirecte,

Page 314: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

314

this.menuEqualitzador,

this.menuFinestra,

this.menuNumPuntsFFT,

this.menuMostresPerSegon,

this.menuFonsEscalaADC,

this.menuTarjeta,

this.menuVisualitzarEspectre,

this.menuEspectre,

this.menuFitxersWav,

this.menuPausa,

this.menuContinuar,

this.menuParar});

this.barraMenu.Location = new System.Drawing.Point(0, 0);

this.barraMenu.Name = "barraMenu";

this.barraMenu.Size = new System.Drawing.Size(1165, 24);

this.barraMenu.TabIndex = 1;

this.barraMenu.Text = "barraMenu";

//

// menuGrabar

//

this.menuGrabar.Name = "menuGrabar";

this.menuGrabar.Size = new System.Drawing.Size(54, 20);

this.menuGrabar.Text = "Grabar";

this.menuGrabar.Click += new System.EventHandler(this.menuGrabar_Click);

//

// menuReproduir

//

this.menuReproduir.Name = "menuReproduir";

this.menuReproduir.Size = new System.Drawing.Size(71, 20);

this.menuReproduir.Text = "Reproduïr";

this.menuReproduir.Click += new System.EventHandler(this.menuReproduir_Click);

//

// menuDirecte

//

this.menuDirecte.Name = "menuDirecte";

this.menuDirecte.Size = new System.Drawing.Size(56, 20);

this.menuDirecte.Text = "Directe";

this.menuDirecte.Click += new System.EventHandler(this.menuDirecte_Click);

//

// menuEqualitzador

//

Page 315: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

315

this.menuEqualitzador.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.EqualitzadorUnaOctava,

this.Equalitzador_1DIV3_Octava,

this.EqualitzadorParametric});

this.menuEqualitzador.Name = "menuEqualitzador";

this.menuEqualitzador.Size = new System.Drawing.Size(84, 20);

this.menuEqualitzador.Text = "Equalitzador";

//

// EqualitzadorUnaOctava

//

this.EqualitzadorUnaOctava.Checked = true;

this.EqualitzadorUnaOctava.CheckState = System.Windows.Forms.CheckState.Checked;

this.EqualitzadorUnaOctava.Name = "EqualitzadorUnaOctava";

this.EqualitzadorUnaOctava.Size = new System.Drawing.Size(147, 22);

this.EqualitzadorUnaOctava.Text = "Eq 1 octava";

this.EqualitzadorUnaOctava.Click += new System.EventHandler(this.EqualitzadorUnaOctava_Click);

//

// Equalitzador_1DIV3_Octava

//

this.Equalitzador_1DIV3_Octava.Name = "Equalitzador_1DIV3_Octava";

this.Equalitzador_1DIV3_Octava.Size = new System.Drawing.Size(147, 22);

this.Equalitzador_1DIV3_Octava.Text = "Eq 1/3 octava";

this.Equalitzador_1DIV3_Octava.Click += new System.EventHandler(this.Equalitzador_1DIV3_Octava_Click);

//

// EqualitzadorParametric

//

this.EqualitzadorParametric.Name = "EqualitzadorParametric";

this.EqualitzadorParametric.Size = new System.Drawing.Size(147, 22);

this.EqualitzadorParametric.Text = "Eq Paramètric";

this.EqualitzadorParametric.Click += new System.EventHandler(this.EqualitzadorParametric_Click);

//

// menuFinestra

//

this.menuFinestra.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.FinestraRectangular,

this.FinestraHanning,

this.FinestraKaiserBessel,

this.FinestraFlatTop});

Page 316: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

316

this.menuFinestra.Name = "menuFinestra";

this.menuFinestra.Size = new System.Drawing.Size(60, 20);

this.menuFinestra.Text = "Finestra";

//

// FinestraRectangular

//

this.FinestraRectangular.Name = "FinestraRectangular";

this.FinestraRectangular.Size = new System.Drawing.Size(142, 22);

this.FinestraRectangular.Text = "Rectangular";

this.FinestraRectangular.Click += new System.EventHandler(this.FinestraRectangular_Click);

//

// FinestraHanning

//

this.FinestraHanning.Checked = true;

this.FinestraHanning.CheckState = System.Windows.Forms.CheckState.Checked;

this.FinestraHanning.Name = "FinestraHanning";

this.FinestraHanning.Size = new System.Drawing.Size(142, 22);

this.FinestraHanning.Text = "Hanning";

this.FinestraHanning.Click += new System.EventHandler(this.FinestraHanning_Click);

//

// FinestraKaiserBessel

//

this.FinestraKaiserBessel.Name = "FinestraKaiserBessel";

this.FinestraKaiserBessel.Size = new System.Drawing.Size(142, 22);

this.FinestraKaiserBessel.Text = "Kaiser-Bessel";

this.FinestraKaiserBessel.Click += new System.EventHandler(this.FinestraKaiserBessel_Click);

//

// FinestraFlatTop

//

this.FinestraFlatTop.Name = "FinestraFlatTop";

this.FinestraFlatTop.Size = new System.Drawing.Size(142, 22);

this.FinestraFlatTop.Text = "Flat top";

this.FinestraFlatTop.Click += new System.EventHandler(this.FinestraFlatTop_Click);

//

// menuNumPuntsFFT

//

this.menuNumPuntsFFT.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.NumPuntsFFT128,

this.NumPuntsFFT256,

Page 317: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

317

this.NumPuntsFFT512,

this.NumPuntsFFT1024,

this.NumPuntsFFT2048,

this.NumPuntsFFT4096,

this.NumPuntsFFT8192});

this.menuNumPuntsFFT.Name = "menuNumPuntsFFT";

this.menuNumPuntsFFT.Size = new System.Drawing.Size(105, 20);

this.menuNumPuntsFFT.Text = "Num_Punts_FFT";

//

// NumPuntsFFT128

//

this.NumPuntsFFT128.Name = "NumPuntsFFT128";

this.NumPuntsFFT128.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT128.Text = "128";

this.NumPuntsFFT128.Click += new System.EventHandler(this.NumPuntsFFT128_Click);

//

// NumPuntsFFT256

//

this.NumPuntsFFT256.Name = "NumPuntsFFT256";

this.NumPuntsFFT256.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT256.Text = "256";

this.NumPuntsFFT256.Click += new System.EventHandler(this.NumPuntsFFT256_Click);

//

// NumPuntsFFT512

//

this.NumPuntsFFT512.Name = "NumPuntsFFT512";

this.NumPuntsFFT512.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT512.Text = "512";

this.NumPuntsFFT512.Click += new System.EventHandler(this.NumPuntsFFT512_Click);

//

// NumPuntsFFT1024

//

this.NumPuntsFFT1024.Checked = true;

this.NumPuntsFFT1024.CheckState = System.Windows.Forms.CheckState.Checked;

this.NumPuntsFFT1024.Name = "NumPuntsFFT1024";

this.NumPuntsFFT1024.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT1024.Text = "1024";

this.NumPuntsFFT1024.Click += new System.EventHandler(this.NumPuntsFFT1024_Click);

//

Page 318: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

318

// NumPuntsFFT2048

//

this.NumPuntsFFT2048.Name = "NumPuntsFFT2048";

this.NumPuntsFFT2048.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT2048.Text = "2048";

this.NumPuntsFFT2048.Click += new System.EventHandler(this.NumPuntsFFT2048_Click);

//

// NumPuntsFFT4096

//

this.NumPuntsFFT4096.Name = "NumPuntsFFT4096";

this.NumPuntsFFT4096.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT4096.Text = "4096";

this.NumPuntsFFT4096.Click += new System.EventHandler(this.NumPuntsFFT4096_Click);

//

// NumPuntsFFT8192

//

this.NumPuntsFFT8192.Name = "NumPuntsFFT8192";

this.NumPuntsFFT8192.Size = new System.Drawing.Size(98, 22);

this.NumPuntsFFT8192.Text = "8192";

this.NumPuntsFFT8192.Click += new System.EventHandler(this.NumPuntsFFT8192_Click);

//

// menuMostresPerSegon

//

this.menuMostresPerSegon.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.MostresPerSegon40000,

this.MostresPerSegon50000});

this.menuMostresPerSegon.Name = "menuMostresPerSegon";

this.menuMostresPerSegon.Size = new System.Drawing.Size(105, 20);

this.menuMostresPerSegon.Text = "Mostres / Segon";

//

// MostresPerSegon40000

//

this.MostresPerSegon40000.Checked = true;

this.MostresPerSegon40000.CheckState = System.Windows.Forms.CheckState.Checked;

this.MostresPerSegon40000.Name = "MostresPerSegon40000";

this.MostresPerSegon40000.Size = new System.Drawing.Size(104, 22);

this.MostresPerSegon40000.Text = "40000";

this.MostresPerSegon40000.Click += new System.EventHandler(this.MostresPerSegon40000_Click);

Page 319: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

319

//

// MostresPerSegon50000

//

this.MostresPerSegon50000.Name = "MostresPerSegon50000";

this.MostresPerSegon50000.Size = new System.Drawing.Size(104, 22);

this.MostresPerSegon50000.Text = "50000";

this.MostresPerSegon50000.Click += new System.EventHandler(this.MostresPerSegon50000_Click);

//

// menuFonsEscalaADC

//

this.menuFonsEscalaADC.CheckOnClick = true;

this.menuFonsEscalaADC.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.FonsEscalaADC_1_volt,

this.FonsEscalaADC_1coma25_volts,

this.FonsEscalaADC_2_volts,

this.FonsEscalaADC_2coma5_volts,

this.FonsEscalaADC_4_volts,

this.FonsEscalaADC_5_volts,

this.FonsEscalaADC_10_volts});

this.menuFonsEscalaADC.Name = "menuFonsEscalaADC";

this.menuFonsEscalaADC.Size = new System.Drawing.Size(116, 20);

this.menuFonsEscalaADC.Text = "Fons d\'escala ADC";

//

// FonsEscalaADC_1_volt

//

this.FonsEscalaADC_1_volt.Name = "FonsEscalaADC_1_volt";

this.FonsEscalaADC_1_volt.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_1_volt.Text = "+/- 1 volt";

this.FonsEscalaADC_1_volt.Click += new System.EventHandler(this.FonsEscalaADC_1_volt_Click);

//

// FonsEscalaADC_1coma25_volts

//

this.FonsEscalaADC_1coma25_volts.Name = "FonsEscalaADC_1coma25_volts";

this.FonsEscalaADC_1coma25_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_1coma25_volts.Text = "+/- 1,25 volts";

this.FonsEscalaADC_1coma25_volts.Click += new System.EventHandler(this.FonsEscalaADC_1coma25_volts_Click);

//

// FonsEscalaADC_2_volts

//

Page 320: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

320

this.FonsEscalaADC_2_volts.Name = "FonsEscalaADC_2_volts";

this.FonsEscalaADC_2_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_2_volts.Text = "+/- 2 volts";

this.FonsEscalaADC_2_volts.Click += new System.EventHandler(this.FonsEscalaADC_2_volts_Click);

//

// FonsEscalaADC_2coma5_volts

//

this.FonsEscalaADC_2coma5_volts.Name = "FonsEscalaADC_2coma5_volts";

this.FonsEscalaADC_2coma5_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_2coma5_volts.Text = "+/- 2,5 volts";

this.FonsEscalaADC_2coma5_volts.Click += new System.EventHandler(this.FonsEscalaADC_2coma5_volts_Click);

//

// FonsEscalaADC_4_volts

//

this.FonsEscalaADC_4_volts.Name = "FonsEscalaADC_4_volts";

this.FonsEscalaADC_4_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_4_volts.Text = "+/- 4 volts";

this.FonsEscalaADC_4_volts.Click += new System.EventHandler(this.FonsEscalaADC_4_volts_Click);

//

// FonsEscalaADC_5_volts

//

this.FonsEscalaADC_5_volts.Name = "FonsEscalaADC_5_volts";

this.FonsEscalaADC_5_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_5_volts.Text = "+/- 5 volts";

this.FonsEscalaADC_5_volts.Click += new System.EventHandler(this.FonsEscalaADC_5_volts_Click);

//

// FonsEscalaADC_10_volts

//

this.FonsEscalaADC_10_volts.Checked = true;

this.FonsEscalaADC_10_volts.CheckState = System.Windows.Forms.CheckState.Checked;

this.FonsEscalaADC_10_volts.Name = "FonsEscalaADC_10_volts";

this.FonsEscalaADC_10_volts.Size = new System.Drawing.Size(144, 22);

this.FonsEscalaADC_10_volts.Text = "+/- 10 volts";

this.FonsEscalaADC_10_volts.Click += new System.EventHandler(this.FonsEscalaADC_10_volts_Click);

//

// menuTarjeta

//

this.menuTarjeta.DropDownItems.AddRange(new

Page 321: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

321

System.Windows.Forms.ToolStripItem[] {

this.TarjetaUSB1208FS,

this.TarjetaUSB1208FSPlus,

this.TarjetaTreballarSenseTarjeta});

this.menuTarjeta.Name = "menuTarjeta";

this.menuTarjeta.Size = new System.Drawing.Size(55, 20);

this.menuTarjeta.Text = "Tarjeta";

//

// TarjetaUSB1208FS

//

this.TarjetaUSB1208FS.Name = "TarjetaUSB1208FS";

this.TarjetaUSB1208FS.Size = new System.Drawing.Size(188, 22);

this.TarjetaUSB1208FS.Text = "USB-1208FS";

this.TarjetaUSB1208FS.Click += new System.EventHandler(this.TarjetaUSB1208FS_Click);

//

// TarjetaUSB1208FSPlus

//

this.TarjetaUSB1208FSPlus.Name = "TarjetaUSB1208FSPlus";

this.TarjetaUSB1208FSPlus.Size = new System.Drawing.Size(188, 22);

this.TarjetaUSB1208FSPlus.Text = "USB-1208FS Plus";

this.TarjetaUSB1208FSPlus.Click += new System.EventHandler(this.TarjetaUSB1208FSPlus_Click);

//

// TarjetaTreballarSenseTarjeta

//

this.TarjetaTreballarSenseTarjeta.Checked = true;

this.TarjetaTreballarSenseTarjeta.CheckState = System.Windows.Forms.CheckState.Checked;

this.TarjetaTreballarSenseTarjeta.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.TarjetaTreballarSenseTarjetaProva1,

this.TarjetaTreballarSenseTarjetaProva2,

this.TarjetaTreballarSenseTarjetaProva3});

this.TarjetaTreballarSenseTarjeta.Name = "TarjetaTreballarSenseTarjeta";

this.TarjetaTreballarSenseTarjeta.Size = new System.Drawing.Size(188, 22);

this.TarjetaTreballarSenseTarjeta.Text = "Treballar sense tarjeta";

//

// TarjetaTreballarSenseTarjetaProva1

//

this.TarjetaTreballarSenseTarjetaProva1.Checked = true;

this.TarjetaTreballarSenseTarjetaProva1.CheckState = System.Windows.Forms.CheckState.Checked;

this.TarjetaTreballarSenseTarjetaProva1.Name =

Page 322: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

322

"TarjetaTreballarSenseTarjetaProva1";

this.TarjetaTreballarSenseTarjetaProva1.Size = new System.Drawing.Size(152, 22);

this.TarjetaTreballarSenseTarjetaProva1.Text = "Prova 1";

this.TarjetaTreballarSenseTarjetaProva1.Click += new System.EventHandler(this.TarjetaTreballarSenseTarjetaProva1_Click);

//

// TarjetaTreballarSenseTarjetaProva2

//

this.TarjetaTreballarSenseTarjetaProva2.Name = "TarjetaTreballarSenseTarjetaProva2";

this.TarjetaTreballarSenseTarjetaProva2.Size = new System.Drawing.Size(152, 22);

this.TarjetaTreballarSenseTarjetaProva2.Text = "Prova 2";

this.TarjetaTreballarSenseTarjetaProva2.Click += new System.EventHandler(this.TarjetaTreballarSenseTarjetaProva2_Click);

//

// menuVisualitzarEspectre

//

this.menuVisualitzarEspectre.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.menuVisualitzarEspectre.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.VisualitzarEspectreSi,

this.VisualitzarEspectreNo});

this.menuVisualitzarEspectre.Name = "menuVisualitzarEspectre";

this.menuVisualitzarEspectre.Size = new System.Drawing.Size(121, 20);

this.menuVisualitzarEspectre.Text = "Visualitzar_Espectre";

//

// VisualitzarEspectreSi

//

this.VisualitzarEspectreSi.Name = "VisualitzarEspectreSi";

this.VisualitzarEspectreSi.Size = new System.Drawing.Size(92, 22);

this.VisualitzarEspectreSi.Text = "SÍ";

this.VisualitzarEspectreSi.Click += new System.EventHandler(this.VisualitzarEspectreSi_Click);

//

// VisualitzarEspectreNo

//

this.VisualitzarEspectreNo.Checked = true;

this.VisualitzarEspectreNo.CheckState = System.Windows.Forms.CheckState.Checked;

this.VisualitzarEspectreNo.Name = "VisualitzarEspectreNo";

this.VisualitzarEspectreNo.Size = new System.Drawing.Size(92, 22);

this.VisualitzarEspectreNo.Text = "NO";

Page 323: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

323

this.VisualitzarEspectreNo.Click += new System.EventHandler(this.VisualitzarEspectreNo_Click);

//

// menuEspectre

//

this.menuEspectre.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.EspectreEixXEscalaLineal,

this.EspectreEixXEscalaLog});

this.menuEspectre.Name = "menuEspectre";

this.menuEspectre.Size = new System.Drawing.Size(63, 20);

this.menuEspectre.Text = "Espectre";

//

// EspectreEixXEscalaLineal

//

this.EspectreEixXEscalaLineal.Name = "EspectreEixXEscalaLineal";

this.EspectreEixXEscalaLineal.Size = new System.Drawing.Size(164, 22);

this.EspectreEixXEscalaLineal.Text = "Eix X escala lineal";

this.EspectreEixXEscalaLineal.Click += new System.EventHandler(this.EspectreEixXEscalaLineal_Click);

//

// EspectreEixXEscalaLog

//

this.EspectreEixXEscalaLog.Checked = true;

this.EspectreEixXEscalaLog.CheckState = System.Windows.Forms.CheckState.Checked;

this.EspectreEixXEscalaLog.Name = "EspectreEixXEscalaLog";

this.EspectreEixXEscalaLog.Size = new System.Drawing.Size(164, 22);

this.EspectreEixXEscalaLog.Text = "Eix X escala log";

this.EspectreEixXEscalaLog.Click += new System.EventHandler(this.EspectreEixXEscalaLog_Click);

//

// menuFitxersWav

//

this.menuFitxersWav.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.FitxersWavProduirFitxerWav,

this.FitxersWavEscoltarFitxerWav});

this.menuFitxersWav.Name = "menuFitxersWav";

this.menuFitxersWav.Size = new System.Drawing.Size(78, 20);

this.menuFitxersWav.Text = "Fitxers_wav";

//

// FitxersWavProduirFitxerWav

//

Page 324: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

324

this.FitxersWavProduirFitxerWav.Name = "FitxersWavProduirFitxerWav";

this.FitxersWavProduirFitxerWav.Size = new System.Drawing.Size(170, 22);

this.FitxersWavProduirFitxerWav.Text = "Produïr Fitxer wav";

this.FitxersWavProduirFitxerWav.Click += new System.EventHandler(this.FitxersWavProduirFitxerWav_Click);

//

// FitxersWavEscoltarFitxerWav

//

this.FitxersWavEscoltarFitxerWav.Name = "FitxersWavEscoltarFitxerWav";

this.FitxersWavEscoltarFitxerWav.Size = new System.Drawing.Size(170, 22);

this.FitxersWavEscoltarFitxerWav.Text = "Escoltar Fitxer wav";

this.FitxersWavEscoltarFitxerWav.Click += new System.EventHandler(this.FitxersWavEscoltarFitxerWav_Click);

//

// menuPausa

//

this.menuPausa.Name = "menuPausa";

this.menuPausa.Size = new System.Drawing.Size(50, 20);

this.menuPausa.Text = "Pausa";

this.menuPausa.Click += new System.EventHandler(this.menuPausa_Click);

//

// menuContinuar

//

this.menuContinuar.Name = "menuContinuar";

this.menuContinuar.Size = new System.Drawing.Size(72, 20);

this.menuContinuar.Text = "Continuar";

this.menuContinuar.Click += new System.EventHandler(this.menuContinuar_Click);

//

// menuParar

//

this.menuParar.Name = "menuParar";

this.menuParar.Size = new System.Drawing.Size(46, 20);

this.menuParar.Text = "Parar";

this.menuParar.Click += new System.EventHandler(this.menuParar_Click);

//

// statusStrip1

//

this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.etActivitat,

this.etEqualitzador,

this.etFinestra,

this.etNumPuntsFFT,

Page 325: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

325

this.etMostresPerSegon,

this.etFonsEscalaADC,

this.etTarjeta,

this.etVisualitzarEspectre,

this.etEspectre});

this.statusStrip1.Location = new System.Drawing.Point(0, 444);

this.statusStrip1.Name = "statusStrip1";

this.statusStrip1.Size = new System.Drawing.Size(1165, 22);

this.statusStrip1.TabIndex = 2;

this.statusStrip1.Text = "statusStrip1";

//

// etActivitat

//

this.etActivitat.Name = "etActivitat";

this.etActivitat.Size = new System.Drawing.Size(42, 17);

this.etActivitat.Text = "Repòs ";

//

// etEqualitzador

//

this.etEqualitzador.Name = "etEqualitzador";

this.etEqualitzador.Size = new System.Drawing.Size(73, 17);

this.etEqualitzador.Text = " Eq 1 octava ";

//

// etFinestra

//

this.etFinestra.Name = "etFinestra";

this.etFinestra.Size = new System.Drawing.Size(59, 17);

this.etFinestra.Text = " Hanning ";

//

// etNumPuntsFFT

//

this.etNumPuntsFFT.Name = "etNumPuntsFFT";

this.etNumPuntsFFT.Size = new System.Drawing.Size(92, 17);

this.etNumPuntsFFT.Text = " FFT 1024 punts ";

//

// etMostresPerSegon

//

this.etMostresPerSegon.Name = "etMostresPerSegon";

this.etMostresPerSegon.Size = new System.Drawing.Size(111, 17);

this.etMostresPerSegon.Text = " 40000 mostres/seg ";

this.etMostresPerSegon.TextAlign = System.Drawing.ContentAlignment.MiddleRight;

Page 326: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

326

//

// etFonsEscalaADC

//

this.etFonsEscalaADC.Name = "etFonsEscalaADC";

this.etFonsEscalaADC.Size = new System.Drawing.Size(113, 17);

this.etFonsEscalaADC.Text = " Rang ADC +/- 10 V ";

this.etFonsEscalaADC.TextAlign = System.Drawing.ContentAlignment.MiddleRight;

//

// etTarjeta

//

this.etTarjeta.Name = "etTarjeta";

this.etTarjeta.Size = new System.Drawing.Size(127, 17);

this.etTarjeta.Text = " Treballar sense tarjeta ";

//

// etVisualitzarEspectre

//

this.etVisualitzarEspectre.Name = "etVisualitzarEspectre";

this.etVisualitzarEspectre.Size = new System.Drawing.Size(131, 17);

this.etVisualitzarEspectre.Text = " No visualitzar espectre ";

//

// etEspectre

//

this.etEspectre.Name = "etEspectre";

this.etEspectre.Size = new System.Drawing.Size(95, 17);

this.etEspectre.Text = " Eix X escala log ";

//

// pictureBox1

//

this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

| System.Windows.Forms.AnchorStyles.Left)

| System.Windows.Forms.AnchorStyles.Right)));

this.pictureBox1.Location = new System.Drawing.Point(34, 45);

this.pictureBox1.Name = "pictureBox1";

this.pictureBox1.Size = new System.Drawing.Size(1090, 373);

this.pictureBox1.TabIndex = 4;

this.pictureBox1.TabStop = false;

this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);

//

// TarjetaTreballarSenseTarjetaProva3

Page 327: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

327

//

this.TarjetaTreballarSenseTarjetaProva3.Name = "TarjetaTreballarSenseTarjetaProva3";

this.TarjetaTreballarSenseTarjetaProva3.Size = new System.Drawing.Size(152, 22);

this.TarjetaTreballarSenseTarjetaProva3.Text = "Prova 3";

this.TarjetaTreballarSenseTarjetaProva3.Click += new System.EventHandler(TarjetaTreballarSenseTarjetaProva3_Click);

//

// Form1

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(1165, 466);

this.Controls.Add(this.pictureBox1);

this.Controls.Add(this.statusStrip1);

this.Controls.Add(this.barraMenu);

this.IsMdiContainer = true;

this.MainMenuStrip = this.barraMenu;

this.Name = "Form1";

this.Text = "Equalitzador FFT 1";

this.Activated += new System.EventHandler(this.Form1_Activated);

this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);

this.Load += new System.EventHandler(this.Form1_Load);

this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

this.barraMenu.ResumeLayout(false);

this.barraMenu.PerformLayout();

this.statusStrip1.ResumeLayout(false);

this.statusStrip1.PerformLayout();

((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.MenuStrip barraMenu;

private System.Windows.Forms.ToolStripMenuItem menuGrabar;

private System.Windows.Forms.ToolStripMenuItem menuReproduir;

private System.Windows.Forms.ToolStripMenuItem menuDirecte;

private System.Windows.Forms.ToolStripMenuItem menuEqualitzador;

Page 328: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

328

private System.Windows.Forms.ToolStripMenuItem EqualitzadorUnaOctava;

private System.Windows.Forms.ToolStripMenuItem Equalitzador_1DIV3_Octava;

private System.Windows.Forms.ToolStripMenuItem EqualitzadorParametric;

private System.Windows.Forms.ToolStripMenuItem menuNumPuntsFFT;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT128;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT256;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT512;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT1024;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT2048;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT4096;

private System.Windows.Forms.ToolStripMenuItem NumPuntsFFT8192;

private System.Windows.Forms.ToolStripMenuItem menuMostresPerSegon;

private System.Windows.Forms.ToolStripMenuItem MostresPerSegon40000;

private System.Windows.Forms.ToolStripMenuItem MostresPerSegon50000;

private System.Windows.Forms.StatusStrip statusStrip1;

private System.Windows.Forms.ToolStripMenuItem menuFonsEscalaADC;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_1_volt;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_1coma25_volts;

private System.Windows.Forms.ToolStripMenuItem menuTarjeta;

private System.Windows.Forms.ToolStripMenuItem TarjetaUSB1208FS;

private System.Windows.Forms.ToolStripMenuItem TarjetaUSB1208FSPlus;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_2_volts;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_2coma5_volts;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_4_volts;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_5_volts;

private System.Windows.Forms.ToolStripMenuItem FonsEscalaADC_10_volts;

private System.Windows.Forms.ToolStripStatusLabel etActivitat;

private System.Windows.Forms.ToolStripStatusLabel etEqualitzador;

private System.Windows.Forms.ToolStripStatusLabel etFinestra;

private System.Windows.Forms.ToolStripStatusLabel etNumPuntsFFT;

private System.Windows.Forms.ToolStripStatusLabel etMostresPerSegon;

private System.Windows.Forms.ToolStripStatusLabel etFonsEscalaADC;

private System.Windows.Forms.ToolStripStatusLabel etTarjeta;

private System.Windows.Forms.ToolStripMenuItem menuVisualitzarEspectre;

private System.Windows.Forms.ToolStripMenuItem VisualitzarEspectreSi;

private System.Windows.Forms.ToolStripMenuItem VisualitzarEspectreNo;

private System.Windows.Forms.ToolStripMenuItem menuEspectre;

private System.Windows.Forms.ToolStripMenuItem EspectreEixXEscalaLineal;

private System.Windows.Forms.ToolStripMenuItem EspectreEixXEscalaLog;

private System.Windows.Forms.ToolStripMenuItem menuFitxersWav;

private System.Windows.Forms.ToolStripMenuItem FitxersWavProduirFitxerWav;

private System.Windows.Forms.ToolStripMenuItem FitxersWavEscoltarFitxerWav;

Page 329: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

329

private System.Windows.Forms.ToolStripStatusLabel etVisualitzarEspectre;

private System.Windows.Forms.ToolStripMenuItem menuPausa;

private System.Windows.Forms.ToolStripMenuItem menuContinuar;

private System.Windows.Forms.ToolStripMenuItem menuParar;

private System.Windows.Forms.ToolStripStatusLabel etEspectre;

private System.Windows.Forms.ToolStripMenuItem TarjetaTreballarSenseTarjeta;

private System.Windows.Forms.ToolStripMenuItem menuFinestra;

private System.Windows.Forms.ToolStripMenuItem FinestraRectangular;

private System.Windows.Forms.ToolStripMenuItem FinestraHanning;

private System.Windows.Forms.ToolStripMenuItem FinestraKaiserBessel;

private System.Windows.Forms.ToolStripMenuItem FinestraFlatTop;

private System.Windows.Forms.PictureBox pictureBox1;

private System.Windows.Forms.ToolStripMenuItem TarjetaTreballarSenseTarjetaProva1;

private System.Windows.Forms.ToolStripMenuItem TarjetaTreballarSenseTarjetaProva2;

private System.Windows.Forms.ToolStripMenuItem TarjetaTreballarSenseTarjetaProva3;

}

}

Page 330: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

330

/*************************************************************

* Fitxer FormFill_EqUnaOCtava.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

namespace Equalitzador_FFT_1

{

public partial class FormFill_EqUnaOctava : Form

{

//Declaració de les variables locals auxiliars, per guardar

//els valors de les variables globals, en el moment

//de carregar el formulari de l'equalitzador.

private double guanyGlobal;

private double limitador;

private double lowCut;

private double highCut;

private double guany20Hz;

private double guany25Hz;

private double guany31coma5Hz;

Page 331: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

331

private double guany40Hz;

private double guany50Hz;

private double guany63Hz;

private double guany80Hz;

private double guany100Hz;

private double guany125Hz;

private double guany160Hz;

private double guany200Hz;

private double guany250Hz;

private double guany315Hz;

private double guany400Hz;

private double guany500Hz;

private double guany630Hz;

private double guany800Hz;

private double guany1000Hz;

private double guany1250Hz;

private double guany1600Hz;

private double guany2000Hz;

private double guany2500Hz;

private double guany3150Hz;

private double guany4000Hz;

private double guany5000Hz;

private double guany6300Hz;

private double guany8000Hz;

private double guany10000Hz;

private double guany12500Hz;

Page 332: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

332

private double guany16000Hz;

private double guany_LF;

private double guany_MLF;

private double guany_MHF;

private double guany_HF;

private double freqCentral_LF;

private double freqCentral_MLF;

private double freqCentral_MHF;

private double freqCentral_HF;

private double bW_LF;

private double bW_MLF;

private double bW_MHF;

private double bW_HF;

private int equalitzador;

//Rutes a les carpetes del programa

private string ElsMeusDocuments;

private string carpetaProjecte;

private string subCarpeta1;

private string nomArxiu; // ruta del arxiu incial EqOctava.eq1

private string nouArxiu; // ruta del nou arxiu EqOctava#.eq1

//Fi de la declaració de les variables auxiliars locals.

public FormFill_EqUnaOctava()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* FormFill_EqUnaOctava

****************************************************************/

private void FormFill_EqUnaOctava_Load(object sender, EventArgs e)

Page 333: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

333

{

//El formulari es repintarà mitjançant la tècnica

//del doble buffer per a evitar parpadejos i

//inestabilitats de la imatge tal i com es feia al projecte [24]

DoubleBuffered = true;

//Es guarden el valor de les variables global en les

//variables locals auxiliars

guanyGlobal = VG.guanyGlobal;

limitador = VG.limitador;

lowCut = VG.lowCut;

highCut = VG.highCut;

guany20Hz = VG.guany20Hz;

guany25Hz = VG.guany25Hz;

guany31coma5Hz = VG.guany31coma5Hz;

guany40Hz = VG.guany40Hz;

guany50Hz = VG.guany50Hz;

guany63Hz = VG.guany63Hz;

guany80Hz = VG.guany80Hz;

guany100Hz = VG.guany100Hz;

guany125Hz = VG.guany125Hz;

guany160Hz = VG.guany160Hz;

guany200Hz = VG.guany200Hz;

guany250Hz = VG.guany250Hz;

guany315Hz = VG.guany315Hz;

guany400Hz = VG.guany400Hz;

guany500Hz = VG.guany500Hz;

guany630Hz = VG.guany630Hz;

guany800Hz = VG.guany800Hz;

Page 334: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

334

guany1000Hz = VG.guany1000Hz;

guany1250Hz = VG.guany1250Hz;

guany1600Hz = VG.guany1600Hz;

guany2000Hz = VG.guany2000Hz;

guany2500Hz = VG.guany2500Hz;

guany3150Hz = VG.guany3150Hz;

guany4000Hz = VG.guany4000Hz;

guany5000Hz = VG.guany5000Hz;

guany6300Hz = VG.guany6300Hz;

guany8000Hz = VG.guany8000Hz;

guany10000Hz = VG.guany10000Hz;

guany12500Hz = VG.guany12500Hz;

guany16000Hz = VG.guany16000Hz;

guany_LF = VG.guany_LF;

guany_MLF = VG.guany_MLF;

guany_MHF = VG.guany_MHF;

guany_HF = VG.guany_HF;

freqCentral_LF = VG.freqCentral_LF;

freqCentral_MLF = VG.freqCentral_MLF;

freqCentral_MHF = VG.freqCentral_MHF;

freqCentral_HF = VG.freqCentral_HF;

bW_LF = VG.bW_LF;

bW_MLF = VG.bW_MLF;

bW_MHF = VG.bW_MHF;

bW_HF = VG.bW_HF;

equalitzador = VG.equalitzador;

/****************************************************************

* Inicialització de les variables globals declarades dins de

Page 335: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

335

* la classe VG.cs.

****************************************************************/

//S'inicialitza l'equalitzador d'Octava "1"

VG.equalitzador = 1;

//S'inicialitza a 0 dB del guanyGlobal.

VG.guanyGlobal = 0;

//S'inicialitzaa +20 dBV (+10 V), el valor

//de limitació.

VG.limitador = 20;

//S'inicialitza a 20 Hz lowCut

VG.lowCut = 20;

//S'inicialitza a 20 kHz highCut

VG.highCut = 20000;

//S'inicialitzen a 0 dBs els guanys de cada fadder

//de l'equalitzador d'una octava i d'un terç d'octava.

VG.guany20Hz = 0;

VG.guany25Hz = 0;

VG.guany31coma5Hz = 0;

VG.guany40Hz = 0;

VG.guany50Hz = 0;

VG.guany63Hz = 0;

VG.guany80Hz = 0;

VG.guany100Hz = 0;

VG.guany125Hz = 0;

Page 336: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

336

VG.guany160Hz = 0;

VG.guany200Hz = 0;

VG.guany250Hz = 0;

VG.guany315Hz = 0;

VG.guany400Hz = 0;

VG.guany500Hz = 0;

VG.guany630Hz = 0;

VG.guany800Hz = 0;

VG.guany1000Hz = 0;

VG.guany1250Hz = 0;

VG.guany1600Hz = 0;

VG.guany2000Hz = 0;

VG.guany2500Hz = 0;

VG.guany3150Hz = 0;

VG.guany4000Hz = 0;

VG.guany5000Hz = 0;

VG.guany6300Hz = 0;

VG.guany8000Hz = 0;

VG.guany10000Hz = 0;

VG.guany12500Hz = 0;

VG.guany16000Hz = 0;

//S'inicialitzen les Variables utilitzades per

//l'equalitzador paramètric.

//S'inicialitzen a 0 dBs els guanys de cada fadder

//de l'equalitzador paramètric.

Page 337: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

337

VG.guany_LF = 0;

VG.guany_MLF = 0;

VG.guany_MHF = 0;

VG.guany_HF = 0;

//S'inicialitzen les freqüències centrals de

//cada banda, a la freqüència més baixa de

//cada banda. En Hz

VG.freqCentral_LF = 20;

VG.freqCentral_MLF = 250;

VG.freqCentral_MHF = 2000;

VG.freqCentral_HF = 4000;

//S'inicialitzen els amples de banda (BW) de cada

//banda a 0.

VG.bW_LF = 0;

VG.bW_MLF = 0;

VG.bW_MHF = 0;

VG.bW_HF = 0;

//Obtenció de la ruta de la carpeta els meus documents

ElsMeusDocuments = Environment.GetFolderPath

(Environment.SpecialFolder.MyDocuments);

//Creació la la ruta de la carpeta del projecte dins la carpeta

//de els meus documents

carpetaProjecte = Path.Combine(ElsMeusDocuments,

"EqualitzadorFFT");

//Es crea la ruta a la subcarpeta "Eq Octava"

//subCarpeta 1 contindrá els arxius .eq1

subCarpeta1 = Path.Combine(carpetaProjecte, "Eq Octava");

nomArxiu = string.Empty;

nouArxiu = string.Empty;

}

Page 338: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

338

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del GuanyGlobal

****************************************************************/

private void tbGuanyGlobal_Scroll(object sender, EventArgs e)

{

//Actualització del guanyGlobal

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

//Actualització de l'etiqueta guanyGlobal

etGuanyGlobal.Text = "G = " + VG.guanyGlobal + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del limitador

****************************************************************/

private void tbLimitador_Scroll(object sender, EventArgs e)

{

//Actualització del limitador

VG.limitador = (double)tbLimitador.Value;

//Actualització de l'etiqueta limitació

etLimitador.Text = "L = " + VG.limitador + " dB";

}

/****************************************************************

* Funcións que es criden quan s'actualitzen cada un dels fadders

* de l'equalitzador d'una

****************************************************************/

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 31,5 Hz

****************************************************************/

private void tb31coma5Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

Page 339: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

339

VG.guany31coma5Hz = (double)tb31coma5Hz.Value;

//Actualització de l'etiqueta guany

etGuany31coma5Hz.Text = "G = " + VG.guany31coma5Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 63 Hz

****************************************************************/

private void tb63Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany63Hz = (double)tb63Hz.Value;

//Actualització de l'etiqueta guany

etGuany63Hz.Text = "G = " + VG.guany63Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 125 Hz

****************************************************************/

private void tb125Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany125Hz = (double)tb125Hz.Value;

//Actualització de l'etiqueta guany

etGuany125Hz.Text = "G = " + VG.guany125Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 250 Hz

****************************************************************/

private void tb250Hz_Scroll(object sender, EventArgs e)

Page 340: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

340

{

//Actualització del guany corresponent

VG.guany250Hz = (double)tb250Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany250Hz.Text = "G = " + VG.guany250Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 500 Hz

****************************************************************/

private void tb500Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany500Hz = (double)tb500Hz.Value;

//Actualització de l'etiqueta guany

etGuany500Hz.Text = "G = " + VG.guany500Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 1 kHz

****************************************************************/

private void tb1kHz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany1000Hz = (double)tb1kHz.Value;

//Actualització de l'etiqueta guany

etGuany1kHz.Text = "G = " + VG.guany1000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 2 kHz

Page 341: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

341

****************************************************************/

private void tb2kHz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany2000Hz = (double)tb2kHz.Value;

//Actualització de l'etiqueta guany

etGuany2kHz.Text = "G = " + VG.guany2000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 4 kHz

****************************************************************/

private void tb4kHz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany4000Hz = (double)tb4kHz.Value;

//Actualització de l'etiqueta guany

etGuany4kHz.Text = "G = " + VG.guany4000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 8 kHz

****************************************************************/

private void tb8kHz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany8000Hz = (double)tb8kHz.Value;

//Actualització de l'etiqueta guany

etGuany8kHz.Text = "G = " + VG.guany8000Hz + " dB";

}

Page 342: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

342

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 16 kHz

****************************************************************/

private void tb16kHz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany16000Hz = (double)tb16kHz.Value;

//Actualització de l'etiqueta guany

etGuany16kHz.Text = "G = " + VG.guany16000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó carregarEq

****************************************************************/

private void btCarregarEq_Click(object sender, EventArgs e)

{

subCarpeta1 = "";

subCarpeta1 = Path.Combine(carpetaProjecte, "Eq Octava");

//Mostrar el quadre de dialeg obrir

OpenFileDialog DlgObrir = new OpenFileDialog();

DlgObrir.InitialDirectory = subCarpeta1;

DlgObrir.Filter = "fitxers equalització 1 octava " +

" (*eq1)|*.eq1";

if (DlgObrir.ShowDialog() == DialogResult.OK)

{

//Obtenir ruta del fitxer

subCarpeta1 = DlgObrir.FileName;

using (FileStream stream = new FileStream(subCarpeta1,

FileMode.Open, FileAccess.Read))

{

using (BinaryReader llegir = new BinaryReader(stream))

{

//Es comprova la 1ra posició de l'arxiu guardat

Page 343: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

343

//Si es tracta del Eq d'octava, si el valor no es 1,

//es mostra quadre de error i es cancela l'operació.

Int32 EQ = llegir.ReadInt32();

if (EQ == 1)

{

//S'ha de tindre en compte el format de

//cada valor a guardar per llegir-ho correctament.

tbLimitador.Value = llegir.ReadInt32();

VG.limitador = (double)tbLimitador.Value;

tbGuanyGlobal.Value = llegir.ReadInt32();

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

tb31coma5Hz.Value = llegir.ReadInt32();

VG.guany31coma5Hz = (double)tb31coma5Hz.Value;

tb63Hz.Value = llegir.ReadInt32();

VG.guany63Hz = (double)tb63Hz.Value;

tb125Hz.Value = llegir.ReadInt32();

VG.guany125Hz = (double)tb125Hz.Value;

tb250Hz.Value = llegir.ReadInt32();

VG.guany250Hz = (double)tb250Hz.Value;

tb500Hz.Value = llegir.ReadInt32();

VG.guany500Hz = (double)tb500Hz.Value;

tb1kHz.Value = llegir.ReadInt32();

VG.guany1000Hz = (double)tb1kHz.Value;

tb2kHz.Value = llegir.ReadInt32();

VG.guany2000Hz = (double)tb2kHz.Value;

tb4kHz.Value = llegir.ReadInt32();

VG.guany4000Hz = (double)tb4kHz.Value;

tb8kHz.Value = llegir.ReadInt32();

VG.guany8000Hz = (double)tb8kHz.Value;

tb16kHz.Value = llegir.ReadInt32();

VG.guany16000Hz = (double)tb16kHz.Value;

llegir.Close();

}//Fi if (EQ == 1)

else //sino estem al Eq d'octava, missatge d'error

{

MessageBox.Show(" S'ha carregat una equalització que " +

"no correspon " +

Page 344: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

344

"a l'equalizador d'una Octava.", "Error " +

"en l'arxiu.", MessageBoxButtons.OK,

MessageBoxIcon.Error);

llegir.Close();

}//Fi else

}//Fi using (BinaryReader)

}//Fi uusing (FileStream)

}//Fi if (DlgObrir.ShowDialog())

}//Fi btCarregar_click

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó GuardarEq

*

* Nota: quan es fa clic sobre el botó guardar equalització,

* l'equalització triada per l'usuari mitjançant els

* fadders, serà guardada en un fitxer d'equalització.

* de la següent manera:

*

* 1ra posició - tipus d'equalitzador

* 2na pisició - valor de la limitació

* 3ra posició - valor del guanyGlobal

* 4rt,5ena...valors d'equalització

****************************************************************/

private void btGuardarEq_Click(object sender, EventArgs e)

{

//Es mostra el Dialeg Guardar on s'haura d'escriure el

//nom del fitxer a guardar. S'ha de escollir la ruta de guardar,

//per defecte ve donada //C://..//Mis documentos

//L'extensió del format a guardar serà .eq1

//La variable conta contindrá el valor

//del index de repetició de l'arxiu.

int conta = 1;

//nomArxiu conté la ruta C://.../Eq Octava//EqOctava

//sense extensió.

subCarpeta1 = "";

Page 345: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

345

subCarpeta1 = Path.Combine(carpetaProjecte, "Eq Octava");

nomArxiu = "";

nouArxiu = "";

nomArxiu = Path.Combine(subCarpeta1, "EqOctava");

//Extensió dels arxius eq1

string extensio = ".eq1";

//Creació de la nova instancia SaveFileDialog com DlgGuardar.

SaveFileDialog DlgGuardar = new SaveFileDialog();

//Si existeix l'arxiu EqOctava.eq1 es crea un nou nom

//on la variable conta portara el número d'arxius EqOctava

//que hi han al directori. Si existeix EqOctava.eq1 es crea

//EqOctava1.eq1, si aquets també existeix es crea EqOctava2.eq1

//i així successivament

if (File.Exists(nomArxiu + extensio))

{

nouArxiu = nomArxiu + conta;

//Es comprova que el nou nom no exiteix.

//Si existeix, s'incrementa la conta

//i es guarda altre vegada en la variable

//nouArxiu.

while (File.Exists(nouArxiu + extensio))

{

conta++;

nouArxiu = nomArxiu + conta;

}

//Aparició per defecte del nom a guardar al quadre

//de dialeg. L'usuari pot modificar aquest nom manualment,

//però per defecte, tindrá l'opció automatica de guardar

//amb el nom consecutivament disponible

DlgGuardar.FileName = nouArxiu;

}

Page 346: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

346

//Si l'arxiu EqOctava.eq1 no existeix, apareixerá per defecte

//l'opció d'aquest nom al usuari.

else

{

DlgGuardar.FileName = nomArxiu;

}

//Directori inicial del quadre de dialeg

DlgGuardar.InitialDirectory = subCarpeta1;

//Es filtra l'extensió a guardar

DlgGuardar.Filter = "(*.eq1)|*.eq1";

DlgGuardar.Title = "Guardar fitxers d'equalització d'una octava";

//Si s'ha fet clic al botó guardar del quadre de dialeg...

if (DlgGuardar.ShowDialog() == DialogResult.OK)

{

//S'obté el nom de l'artxiu per guardar a la ruta de la subcarpeta

//corresponent.

subCarpeta1 = DlgGuardar.FileName;

//S'utilitza la funció FileStream per crear l'artxiu binary

using (FileStream stream = new FileStream

(subCarpeta1, FileMode.Create))

{

using (BinaryWriter escriu = new BinaryWriter(stream))

{

//S'escriu cada valor consecutivament.

//BinaryWriter apunta automàticament a la

//següent posició.

//Guardar els valors dels fadders

escriu.Write(1);

Page 347: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

347

escriu.Write(tbLimitador.Value);

escriu.Write(tbGuanyGlobal.Value);

escriu.Write(tb31coma5Hz.Value);

escriu.Write(tb63Hz.Value);

escriu.Write(tb125Hz.Value);

escriu.Write(tb250Hz.Value);

escriu.Write(tb500Hz.Value);

escriu.Write(tb1kHz.Value);

escriu.Write(tb2kHz.Value);

escriu.Write(tb4kHz.Value);

escriu.Write(tb8kHz.Value);

escriu.Write(tb16kHz.Value);

escriu.Close();

}

}

}//Fi if (DlgGuardar.ShowDialog())

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó EqOK

*

* Nota: l'equalització que hi ha en els fadders en el moment

* de fer clic en el botó EqOK, es guarda en les variables globals

* corresponents per dur a terme l'equalització i es surt de

* l'equalitzador

****************************************************************/

private void btEqOK_Click(object sender, EventArgs e)

{

//Simplement cal tancar el formulari de l'equalitzador,

//tornant al formulari pare.

this.Close();

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó Cancelar

*

* Nota: quan es fa clic, se surt del formulari de l'equalitzador

* i es restaurel els valors de les variables globals als que

* hi havien abans de carregar el formulari de l'equalitzador.

Page 348: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

348

****************************************************************/

private void btCancelar_Click(object sender, EventArgs e)

{

//Restaurar valors de les variables globals als que

//hi havien abans de carregar el formulari de

//l'equalitzador.

VG.guanyGlobal = guanyGlobal;

VG.limitador = limitador;

VG.lowCut = lowCut;

VG.highCut = highCut;

VG.guany20Hz = guany20Hz;

VG.guany25Hz = guany25Hz;

VG.guany31coma5Hz = guany31coma5Hz;

VG.guany40Hz = guany40Hz;

VG.guany50Hz = guany50Hz;

VG.guany63Hz = guany63Hz;

VG.guany80Hz = guany80Hz;

VG.guany100Hz = guany100Hz;

VG.guany125Hz = guany125Hz;

VG.guany160Hz = guany160Hz;

VG.guany200Hz = guany200Hz;

VG.guany250Hz = guany250Hz;

VG.guany315Hz = guany315Hz;

VG.guany400Hz = guany400Hz;

VG.guany500Hz = guany500Hz;

VG.guany630Hz = guany630Hz;

VG.guany800Hz = guany800Hz;

VG.guany1000Hz = guany1000Hz;

Page 349: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

349

VG.guany1250Hz = guany1250Hz;

VG.guany1600Hz = guany1600Hz;

VG.guany2000Hz = guany2000Hz;

VG.guany2500Hz = guany2500Hz;

VG.guany3150Hz = guany3150Hz;

VG.guany4000Hz = guany4000Hz;

VG.guany5000Hz = guany5000Hz;

VG.guany6300Hz = guany6300Hz;

VG.guany8000Hz = guany8000Hz;

VG.guany10000Hz = guany10000Hz;

VG.guany12500Hz = guany12500Hz;

VG.guany16000Hz = guany16000Hz;

VG.guany_LF = guany_LF;

VG.guany_MLF = guany_MLF;

VG.guany_MHF = guany_MHF;

VG.guany_HF = guany_HF;

VG.freqCentral_LF = freqCentral_LF;

VG.freqCentral_MLF = freqCentral_MLF;

VG.freqCentral_MHF = freqCentral_MHF;

VG.freqCentral_HF = freqCentral_HF;

VG.bW_LF = bW_LF;

VG.bW_MLF = bW_MLF;

VG.bW_MHF = bW_MHF;

VG.bW_HF = bW_HF;

VG.equalitzador = equalitzador;

//Tancar el formulari fill de l'equalitzador,

//i tornar el control al formulari pare.are.

this.Close();

Page 350: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

350

}//Fi btCancelar_Click

}//Fi partial class FormFill_EqUnaOctava

}//Fi namespace Equalitzador_FFT_1

Page 351: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

351

/*************************************************************

* Fitxer FormFill_EqUnaOCtava.Designer.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class FormFill_EqUnaOctava

{

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

/// <param name="disposing">true si los recursos administrados se

///deben eliminar; false en caso contrario, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido del método con el editor de código.

Page 352: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

352

/// </summary>

private void InitializeComponent()

{

this.tb31coma5Hz = new System.Windows.Forms.TrackBar();

this.etMes12dBesq = new System.Windows.Forms.Label();

this.etMenys12dBesq = new System.Windows.Forms.Label();

this.etFreqCentral31coma5Hz = new System.Windows.Forms.Label();

this.etGuany31coma5Hz = new System.Windows.Forms.Label();

this.et0dBesq = new System.Windows.Forms.Label();

this.tb63Hz = new System.Windows.Forms.TrackBar();

this.tb125Hz = new System.Windows.Forms.TrackBar();

this.tb250Hz = new System.Windows.Forms.TrackBar();

this.tb500Hz = new System.Windows.Forms.TrackBar();

this.tb1kHz = new System.Windows.Forms.TrackBar();

this.tb2kHz = new System.Windows.Forms.TrackBar();

this.tb4kHz = new System.Windows.Forms.TrackBar();

this.tb8kHz = new System.Windows.Forms.TrackBar();

this.tb16kHz = new System.Windows.Forms.TrackBar();

this.tbGuanyGlobal = new System.Windows.Forms.TrackBar();

this.tbLimitador = new System.Windows.Forms.TrackBar();

this.etGuany63Hz = new System.Windows.Forms.Label();

this.etGuany125Hz = new System.Windows.Forms.Label();

this.etGuany250Hz = new System.Windows.Forms.Label();

this.etGuany500Hz = new System.Windows.Forms.Label();

this.etGuany1kHz = new System.Windows.Forms.Label();

this.etGuany2kHz = new System.Windows.Forms.Label();

this.etGuany4kHz = new System.Windows.Forms.Label();

this.etGuany8kHz = new System.Windows.Forms.Label();

this.etGuany16kHz = new System.Windows.Forms.Label();

this.etMes12dBdreta = new System.Windows.Forms.Label();

this.et0dBdreta = new System.Windows.Forms.Label();

this.etMenys12dBdreta = new System.Windows.Forms.Label();

this.etFreqCentral63Hz = new System.Windows.Forms.Label();

this.etFreqCentral125Hz = new System.Windows.Forms.Label();

this.etFreqCentral250Hz = new System.Windows.Forms.Label();

this.etFreqCentral500Hz = new System.Windows.Forms.Label();

this.etFreqCentral1kHz = new System.Windows.Forms.Label();

this.etFreqCentral2kHz = new System.Windows.Forms.Label();

this.etFreqCentral4kHz = new System.Windows.Forms.Label();

this.etFreqCentral8kHz = new System.Windows.Forms.Label();

this.etFreqCentral16kHz = new System.Windows.Forms.Label();

this.etGuany = new System.Windows.Forms.Label();

Page 353: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

353

this.etLimitacioTextFixe = new System.Windows.Forms.Label();

this.etGuanyGlobal = new System.Windows.Forms.Label();

this.etLimitador = new System.Windows.Forms.Label();

this.etMes15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMes20dBLimitador = new System.Windows.Forms.Label();

this.etMenys15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMenys80dBLimitador = new System.Windows.Forms.Label();

this.et0dBGuanyGlobal = new System.Windows.Forms.Label();

this.et0dBLimitador = new System.Windows.Forms.Label();

this.btCarregarEq = new System.Windows.Forms.Button();

this.btGuardarEq = new System.Windows.Forms.Button();

this.btEqOK = new System.Windows.Forms.Button();

this.btCancelar = new System.Windows.Forms.Button();

((System.ComponentModel.ISupportInitialize)(this.tb31coma5Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb63Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb125Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb250Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb500Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb1kHz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb2kHz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb4kHz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb8kHz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb16kHz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).BeginInit();

this.SuspendLayout();

//

// tb31coma5Hz

//

this.tb31coma5Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb31coma5Hz.Location = new System.Drawing.Point(292, 86);

this.tb31coma5Hz.Maximum = 12;

this.tb31coma5Hz.Minimum = -12;

this.tb31coma5Hz.Name = "tb31coma5Hz";

this.tb31coma5Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb31coma5Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb31coma5Hz.Size = new System.Drawing.Size(45, 267);

this.tb31coma5Hz.TabIndex = 0;

this.tb31coma5Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb31coma5Hz.Scroll += new System.EventHandler(this.tb31coma5Hz_Scroll);

//

Page 354: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

354

// etMes12dBesq

//

this.etMes12dBesq.AutoSize = true;

this.etMes12dBesq.Location = new System.Drawing.Point(245, 86);

this.etMes12dBesq.Name = "etMes12dBesq";

this.etMes12dBesq.Size = new System.Drawing.Size(41, 13);

this.etMes12dBesq.TabIndex = 2;

this.etMes12dBesq.Text = "+12 dB";

//

// etMenys12dBesq

//

this.etMenys12dBesq.AutoSize = true;

this.etMenys12dBesq.Location = new System.Drawing.Point(248, 340);

this.etMenys12dBesq.Name = "etMenys12dBesq";

this.etMenys12dBesq.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBesq.TabIndex = 3;

this.etMenys12dBesq.Text = "-12 dB";

//

// etFreqCentral31coma5Hz

//

this.etFreqCentral31coma5Hz.AutoSize = true;

this.etFreqCentral31coma5Hz.Location = new System.Drawing.Point(289, 372);

this.etFreqCentral31coma5Hz.Name = "etFreqCentral31coma5Hz";

this.etFreqCentral31coma5Hz.Size = new System.Drawing.Size(44, 13);

this.etFreqCentral31coma5Hz.TabIndex = 4;

this.etFreqCentral31coma5Hz.Text = "31,5 Hz";

//

// etGuany31coma5Hz

//

this.etGuany31coma5Hz.AutoSize = true;

this.etGuany31coma5Hz.Location = new System.Drawing.Point(288, 60);

this.etGuany31coma5Hz.Name = "etGuany31coma5Hz";

this.etGuany31coma5Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany31coma5Hz.TabIndex = 5;

this.etGuany31coma5Hz.Text = "G = 0 dB";

//

// et0dBesq

//

this.et0dBesq.AutoSize = true;

this.et0dBesq.Location = new System.Drawing.Point(257, 212);

this.et0dBesq.Name = "et0dBesq";

this.et0dBesq.Size = new System.Drawing.Size(29, 13);

Page 355: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

355

this.et0dBesq.TabIndex = 6;

this.et0dBesq.Text = "0 dB";

//

// tb63Hz

//

this.tb63Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb63Hz.Location = new System.Drawing.Point(352, 86);

this.tb63Hz.Maximum = 12;

this.tb63Hz.Minimum = -12;

this.tb63Hz.Name = "tb63Hz";

this.tb63Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb63Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb63Hz.Size = new System.Drawing.Size(45, 267);

this.tb63Hz.TabIndex = 7;

this.tb63Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb63Hz.Scroll += new System.EventHandler(this.tb63Hz_Scroll);

//

// tb125Hz

//

this.tb125Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb125Hz.Location = new System.Drawing.Point(412, 86);

this.tb125Hz.Maximum = 12;

this.tb125Hz.Minimum = -12;

this.tb125Hz.Name = "tb125Hz";

this.tb125Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb125Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb125Hz.Size = new System.Drawing.Size(45, 267);

this.tb125Hz.TabIndex = 8;

this.tb125Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb125Hz.Scroll += new System.EventHandler(this.tb125Hz_Scroll);

//

// tb250Hz

//

this.tb250Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb250Hz.Location = new System.Drawing.Point(472, 86);

this.tb250Hz.Maximum = 12;

this.tb250Hz.Minimum = -12;

this.tb250Hz.Name = "tb250Hz";

this.tb250Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb250Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb250Hz.Size = new System.Drawing.Size(45, 267);

this.tb250Hz.TabIndex = 9;

Page 356: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

356

this.tb250Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb250Hz.Scroll += new System.EventHandler(this.tb250Hz_Scroll);

//

// tb500Hz

//

this.tb500Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb500Hz.Location = new System.Drawing.Point(532, 86);

this.tb500Hz.Maximum = 12;

this.tb500Hz.Minimum = -12;

this.tb500Hz.Name = "tb500Hz";

this.tb500Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb500Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb500Hz.Size = new System.Drawing.Size(45, 267);

this.tb500Hz.TabIndex = 10;

this.tb500Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb500Hz.Scroll += new System.EventHandler(this.tb500Hz_Scroll);

//

// tb1kHz

//

this.tb1kHz.BackColor = System.Drawing.Color.LightYellow;

this.tb1kHz.Location = new System.Drawing.Point(592, 86);

this.tb1kHz.Maximum = 12;

this.tb1kHz.Minimum = -12;

this.tb1kHz.Name = "tb1kHz";

this.tb1kHz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb1kHz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb1kHz.Size = new System.Drawing.Size(45, 267);

this.tb1kHz.TabIndex = 11;

this.tb1kHz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb1kHz.Scroll += new System.EventHandler(this.tb1kHz_Scroll);

//

// tb2kHz

//

this.tb2kHz.BackColor = System.Drawing.Color.LightYellow;

this.tb2kHz.Location = new System.Drawing.Point(652, 86);

this.tb2kHz.Maximum = 12;

this.tb2kHz.Minimum = -12;

this.tb2kHz.Name = "tb2kHz";

this.tb2kHz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb2kHz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb2kHz.Size = new System.Drawing.Size(45, 267);

this.tb2kHz.TabIndex = 12;

Page 357: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

357

this.tb2kHz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb2kHz.Scroll += new System.EventHandler(this.tb2kHz_Scroll);

//

// tb4kHz

//

this.tb4kHz.BackColor = System.Drawing.Color.LightYellow;

this.tb4kHz.Location = new System.Drawing.Point(712, 86);

this.tb4kHz.Maximum = 12;

this.tb4kHz.Minimum = -12;

this.tb4kHz.Name = "tb4kHz";

this.tb4kHz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb4kHz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb4kHz.Size = new System.Drawing.Size(45, 267);

this.tb4kHz.TabIndex = 13;

this.tb4kHz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb4kHz.Scroll += new System.EventHandler(this.tb4kHz_Scroll);

//

// tb8kHz

//

this.tb8kHz.BackColor = System.Drawing.Color.LightYellow;

this.tb8kHz.Location = new System.Drawing.Point(773, 86);

this.tb8kHz.Maximum = 12;

this.tb8kHz.Minimum = -12;

this.tb8kHz.Name = "tb8kHz";

this.tb8kHz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb8kHz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb8kHz.Size = new System.Drawing.Size(45, 267);

this.tb8kHz.TabIndex = 14;

this.tb8kHz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb8kHz.Scroll += new System.EventHandler(this.tb8kHz_Scroll);

//

// tb16kHz

//

this.tb16kHz.BackColor = System.Drawing.Color.LightYellow;

this.tb16kHz.Location = new System.Drawing.Point(833, 86);

this.tb16kHz.Maximum = 12;

this.tb16kHz.Minimum = -12;

this.tb16kHz.Name = "tb16kHz";

this.tb16kHz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb16kHz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb16kHz.Size = new System.Drawing.Size(45, 267);

this.tb16kHz.TabIndex = 15;

Page 358: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

358

this.tb16kHz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb16kHz.Scroll += new System.EventHandler(this.tb16kHz_Scroll);

//

// tbGuanyGlobal

//

this.tbGuanyGlobal.BackColor = System.Drawing.Color.LightYellow;

this.tbGuanyGlobal.Location = new System.Drawing.Point(154, 86);

this.tbGuanyGlobal.Maximum = 15;

this.tbGuanyGlobal.Minimum = -15;

this.tbGuanyGlobal.Name = "tbGuanyGlobal";

this.tbGuanyGlobal.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuanyGlobal.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuanyGlobal.Size = new System.Drawing.Size(45, 267);

this.tbGuanyGlobal.TabIndex = 16;

this.tbGuanyGlobal.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuanyGlobal.Scroll += new System.EventHandler(this.tbGuanyGlobal_Scroll);

//

// tbLimitador

//

this.tbLimitador.BackColor = System.Drawing.Color.LightYellow;

this.tbLimitador.Location = new System.Drawing.Point(54, 86);

this.tbLimitador.Maximum = 20;

this.tbLimitador.Minimum = -80;

this.tbLimitador.Name = "tbLimitador";

this.tbLimitador.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbLimitador.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbLimitador.Size = new System.Drawing.Size(45, 267);

this.tbLimitador.TabIndex = 17;

this.tbLimitador.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbLimitador.Value = 20;

this.tbLimitador.Scroll += new System.EventHandler(this.tbLimitador_Scroll);

//

// etGuany63Hz

//

this.etGuany63Hz.AutoSize = true;

this.etGuany63Hz.Location = new System.Drawing.Point(349, 60);

this.etGuany63Hz.Name = "etGuany63Hz";

this.etGuany63Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany63Hz.TabIndex = 18;

this.etGuany63Hz.Text = "G = 0 dB";

//

Page 359: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

359

// etGuany125Hz

//

this.etGuany125Hz.AutoSize = true;

this.etGuany125Hz.Location = new System.Drawing.Point(409, 60);

this.etGuany125Hz.Name = "etGuany125Hz";

this.etGuany125Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany125Hz.TabIndex = 19;

this.etGuany125Hz.Text = "G = 0 dB";

//

// etGuany250Hz

//

this.etGuany250Hz.AutoSize = true;

this.etGuany250Hz.Location = new System.Drawing.Point(469, 60);

this.etGuany250Hz.Name = "etGuany250Hz";

this.etGuany250Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany250Hz.TabIndex = 20;

this.etGuany250Hz.Text = "G = 0 dB";

//

// etGuany500Hz

//

this.etGuany500Hz.AutoSize = true;

this.etGuany500Hz.Location = new System.Drawing.Point(528, 60);

this.etGuany500Hz.Name = "etGuany500Hz";

this.etGuany500Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany500Hz.TabIndex = 21;

this.etGuany500Hz.Text = "G = 0 dB";

//

// etGuany1kHz

//

this.etGuany1kHz.AutoSize = true;

this.etGuany1kHz.Location = new System.Drawing.Point(588, 60);

this.etGuany1kHz.Name = "etGuany1kHz";

this.etGuany1kHz.Size = new System.Drawing.Size(49, 13);

this.etGuany1kHz.TabIndex = 22;

this.etGuany1kHz.Text = "G = 0 dB";

//

// etGuany2kHz

//

this.etGuany2kHz.AutoSize = true;

this.etGuany2kHz.Location = new System.Drawing.Point(649, 60);

this.etGuany2kHz.Name = "etGuany2kHz";

this.etGuany2kHz.Size = new System.Drawing.Size(49, 13);

Page 360: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

360

this.etGuany2kHz.TabIndex = 23;

this.etGuany2kHz.Text = "G = 0 dB";

//

// etGuany4kHz

//

this.etGuany4kHz.AutoSize = true;

this.etGuany4kHz.Location = new System.Drawing.Point(708, 60);

this.etGuany4kHz.Name = "etGuany4kHz";

this.etGuany4kHz.Size = new System.Drawing.Size(49, 13);

this.etGuany4kHz.TabIndex = 24;

this.etGuany4kHz.Text = "G = 0 dB";

//

// etGuany8kHz

//

this.etGuany8kHz.AutoSize = true;

this.etGuany8kHz.Location = new System.Drawing.Point(769, 60);

this.etGuany8kHz.Name = "etGuany8kHz";

this.etGuany8kHz.Size = new System.Drawing.Size(49, 13);

this.etGuany8kHz.TabIndex = 25;

this.etGuany8kHz.Text = "G = 0 dB";

//

// etGuany16kHz

//

this.etGuany16kHz.AutoSize = true;

this.etGuany16kHz.Location = new System.Drawing.Point(830, 60);

this.etGuany16kHz.Name = "etGuany16kHz";

this.etGuany16kHz.Size = new System.Drawing.Size(49, 13);

this.etGuany16kHz.TabIndex = 26;

this.etGuany16kHz.Text = "G = 0 dB";

//

// etMes12dBdreta

//

this.etMes12dBdreta.AutoSize = true;

this.etMes12dBdreta.Location = new System.Drawing.Point(884, 86);

this.etMes12dBdreta.Name = "etMes12dBdreta";

this.etMes12dBdreta.Size = new System.Drawing.Size(41, 13);

this.etMes12dBdreta.TabIndex = 27;

this.etMes12dBdreta.Text = "+12 dB";

//

// et0dBdreta

//

this.et0dBdreta.AutoSize = true;

Page 361: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

361

this.et0dBdreta.Location = new System.Drawing.Point(884, 212);

this.et0dBdreta.Name = "et0dBdreta";

this.et0dBdreta.Size = new System.Drawing.Size(29, 13);

this.et0dBdreta.TabIndex = 28;

this.et0dBdreta.Text = "0 dB";

//

// etMenys12dBdreta

//

this.etMenys12dBdreta.AutoSize = true;

this.etMenys12dBdreta.Location = new System.Drawing.Point(884, 340);

this.etMenys12dBdreta.Name = "etMenys12dBdreta";

this.etMenys12dBdreta.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBdreta.TabIndex = 29;

this.etMenys12dBdreta.Text = "-12 dB";

//

// etFreqCentral63Hz

//

this.etFreqCentral63Hz.AutoSize = true;

this.etFreqCentral63Hz.Location = new System.Drawing.Point(349, 372);

this.etFreqCentral63Hz.Name = "etFreqCentral63Hz";

this.etFreqCentral63Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral63Hz.TabIndex = 30;

this.etFreqCentral63Hz.Text = "63 Hz";

//

// etFreqCentral125Hz

//

this.etFreqCentral125Hz.AutoSize = true;

this.etFreqCentral125Hz.Location = new System.Drawing.Point(409, 372);

this.etFreqCentral125Hz.Name = "etFreqCentral125Hz";

this.etFreqCentral125Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral125Hz.TabIndex = 31;

this.etFreqCentral125Hz.Text = "125 Hz";

//

// etFreqCentral250Hz

//

this.etFreqCentral250Hz.AutoSize = true;

this.etFreqCentral250Hz.Location = new System.Drawing.Point(469, 372);

this.etFreqCentral250Hz.Name = "etFreqCentral250Hz";

this.etFreqCentral250Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral250Hz.TabIndex = 32;

this.etFreqCentral250Hz.Text = "250 Hz";

//

Page 362: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

362

// etFreqCentral500Hz

//

this.etFreqCentral500Hz.AutoSize = true;

this.etFreqCentral500Hz.Location = new System.Drawing.Point(528, 372);

this.etFreqCentral500Hz.Name = "etFreqCentral500Hz";

this.etFreqCentral500Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral500Hz.TabIndex = 33;

this.etFreqCentral500Hz.Text = "500 Hz";

//

// etFreqCentral1kHz

//

this.etFreqCentral1kHz.AutoSize = true;

this.etFreqCentral1kHz.Location = new System.Drawing.Point(589, 372);

this.etFreqCentral1kHz.Name = "etFreqCentral1kHz";

this.etFreqCentral1kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral1kHz.TabIndex = 34;

this.etFreqCentral1kHz.Text = "1 kHz";

//

// etFreqCentral2kHz

//

this.etFreqCentral2kHz.AutoSize = true;

this.etFreqCentral2kHz.Location = new System.Drawing.Point(649, 372);

this.etFreqCentral2kHz.Name = "etFreqCentral2kHz";

this.etFreqCentral2kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral2kHz.TabIndex = 35;

this.etFreqCentral2kHz.Text = "2 kHz";

//

// etFreqCentral4kHz

//

this.etFreqCentral4kHz.AutoSize = true;

this.etFreqCentral4kHz.Location = new System.Drawing.Point(708, 372);

this.etFreqCentral4kHz.Name = "etFreqCentral4kHz";

this.etFreqCentral4kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral4kHz.TabIndex = 36;

this.etFreqCentral4kHz.Text = "4 kHz";

//

// etFreqCentral8kHz

//

this.etFreqCentral8kHz.AutoSize = true;

this.etFreqCentral8kHz.Location = new System.Drawing.Point(769, 372);

this.etFreqCentral8kHz.Name = "etFreqCentral8kHz";

this.etFreqCentral8kHz.Size = new System.Drawing.Size(35, 13);

Page 363: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

363

this.etFreqCentral8kHz.TabIndex = 37;

this.etFreqCentral8kHz.Text = "8 kHz";

//

// etFreqCentral16kHz

//

this.etFreqCentral16kHz.AutoSize = true;

this.etFreqCentral16kHz.Location = new System.Drawing.Point(830, 372);

this.etFreqCentral16kHz.Name = "etFreqCentral16kHz";

this.etFreqCentral16kHz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral16kHz.TabIndex = 38;

this.etFreqCentral16kHz.Text = "16 kHz";

//

// etGuany

//

this.etGuany.AutoSize = true;

this.etGuany.Location = new System.Drawing.Point(151, 372);

this.etGuany.Name = "etGuany";

this.etGuany.Size = new System.Drawing.Size(45, 13);

this.etGuany.TabIndex = 39;

this.etGuany.Text = "GUANY";

//

// etLimitacioTextFixe

//

this.etLimitacioTextFixe.AutoSize = true;

this.etLimitacioTextFixe.Location = new System.Drawing.Point(51, 372);

this.etLimitacioTextFixe.Name = "etLimitacioTextFixe";

this.etLimitacioTextFixe.Size = new System.Drawing.Size(60, 13);

this.etLimitacioTextFixe.TabIndex = 40;

this.etLimitacioTextFixe.Text = "LIMITACIÓ";

//

// etGuanyGlobal

//

this.etGuanyGlobal.AutoSize = true;

this.etGuanyGlobal.Location = new System.Drawing.Point(151, 60);

this.etGuanyGlobal.Name = "etGuanyGlobal";

this.etGuanyGlobal.Size = new System.Drawing.Size(49, 13);

this.etGuanyGlobal.TabIndex = 41;

this.etGuanyGlobal.Text = "G = 0 dB";

//

// etLimitador

//

this.etLimitador.AutoSize = true;

Page 364: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

364

this.etLimitador.Location = new System.Drawing.Point(51, 60);

this.etLimitador.Name = "etLimitador";

this.etLimitador.Size = new System.Drawing.Size(53, 13);

this.etLimitador.TabIndex = 42;

this.etLimitador.Text = "L = 20 dB";

//

// etMes15dBGuanyGlobal

//

this.etMes15dBGuanyGlobal.AutoSize = true;

this.etMes15dBGuanyGlobal.Location = new System.Drawing.Point(107, 86);

this.etMes15dBGuanyGlobal.Name = "etMes15dBGuanyGlobal";

this.etMes15dBGuanyGlobal.Size = new System.Drawing.Size(41, 13);

this.etMes15dBGuanyGlobal.TabIndex = 43;

this.etMes15dBGuanyGlobal.Text = "+15 dB";

//

// etMes20dBLimitador

//

this.etMes20dBLimitador.AutoSize = true;

this.etMes20dBLimitador.Location = new System.Drawing.Point(7, 86);

this.etMes20dBLimitador.Name = "etMes20dBLimitador";

this.etMes20dBLimitador.Size = new System.Drawing.Size(41, 13);

this.etMes20dBLimitador.TabIndex = 44;

this.etMes20dBLimitador.Text = "+20 dB";

//

// etMenys15dBGuanyGlobal

//

this.etMenys15dBGuanyGlobal.AutoSize = true;

this.etMenys15dBGuanyGlobal.Location = new System.Drawing.Point(107, 340);

this.etMenys15dBGuanyGlobal.Name = "etMenys15dBGuanyGlobal";

this.etMenys15dBGuanyGlobal.Size = new System.Drawing.Size(38, 13);

this.etMenys15dBGuanyGlobal.TabIndex = 45;

this.etMenys15dBGuanyGlobal.Text = "-15 dB";

//

// etMenys80dBLimitador

//

this.etMenys80dBLimitador.AutoSize = true;

this.etMenys80dBLimitador.Location = new System.Drawing.Point(7, 340);

this.etMenys80dBLimitador.Name = "etMenys80dBLimitador";

this.etMenys80dBLimitador.Size = new System.Drawing.Size(38, 13);

this.etMenys80dBLimitador.TabIndex = 46;

this.etMenys80dBLimitador.Text = "-80 dB";

//

Page 365: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

365

// et0dBGuanyGlobal

//

this.et0dBGuanyGlobal.AutoSize = true;

this.et0dBGuanyGlobal.Location = new System.Drawing.Point(116, 212);

this.et0dBGuanyGlobal.Name = "et0dBGuanyGlobal";

this.et0dBGuanyGlobal.Size = new System.Drawing.Size(29, 13);

this.et0dBGuanyGlobal.TabIndex = 47;

this.et0dBGuanyGlobal.Text = "0 dB";

//

// et0dBLimitador

//

this.et0dBLimitador.AutoSize = true;

this.et0dBLimitador.Location = new System.Drawing.Point(19, 140);

this.et0dBLimitador.Name = "et0dBLimitador";

this.et0dBLimitador.Size = new System.Drawing.Size(29, 13);

this.et0dBLimitador.TabIndex = 48;

this.et0dBLimitador.Text = "0 dB";

//

// btCarregarEq

//

this.btCarregarEq.Location = new System.Drawing.Point(54, 454);

this.btCarregarEq.Name = "btCarregarEq";

this.btCarregarEq.Size = new System.Drawing.Size(94, 23);

this.btCarregarEq.TabIndex = 49;

this.btCarregarEq.Text = "CARREGAR EQ";

this.btCarregarEq.UseVisualStyleBackColor = true;

this.btCarregarEq.Click += new System.EventHandler(this.btCarregarEq_Click);

//

// btGuardarEq

//

this.btGuardarEq.Location = new System.Drawing.Point(291, 454);

this.btGuardarEq.Name = "btGuardarEq";

this.btGuardarEq.Size = new System.Drawing.Size(90, 23);

this.btGuardarEq.TabIndex = 50;

this.btGuardarEq.Text = "GUARDAR EQ";

this.btGuardarEq.UseVisualStyleBackColor = true;

this.btGuardarEq.Click += new System.EventHandler(this.btGuardarEq_Click);

//

// btEqOK

//

this.btEqOK.Location = new System.Drawing.Point(532, 454);

this.btEqOK.Name = "btEqOK";

Page 366: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

366

this.btEqOK.Size = new System.Drawing.Size(75, 23);

this.btEqOK.TabIndex = 51;

this.btEqOK.Text = "EQ OK";

this.btEqOK.UseVisualStyleBackColor = true;

this.btEqOK.Click += new System.EventHandler(this.btEqOK_Click);

//

// btCancelar

//

this.btCancelar.Location = new System.Drawing.Point(773, 454);

this.btCancelar.Name = "btCancelar";

this.btCancelar.Size = new System.Drawing.Size(98, 23);

this.btCancelar.TabIndex = 52;

this.btCancelar.Text = "CANCEL.LAR";

this.btCancelar.UseVisualStyleBackColor = true;

this.btCancelar.Click += new System.EventHandler(this.btCancelar_Click);

//

// FormFill_EqUnaOctava

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(966, 522);

this.Controls.Add(this.btCancelar);

this.Controls.Add(this.btEqOK);

this.Controls.Add(this.btGuardarEq);

this.Controls.Add(this.btCarregarEq);

this.Controls.Add(this.et0dBLimitador);

this.Controls.Add(this.et0dBGuanyGlobal);

this.Controls.Add(this.etMenys80dBLimitador);

this.Controls.Add(this.etMenys15dBGuanyGlobal);

this.Controls.Add(this.etMes20dBLimitador);

this.Controls.Add(this.etMes15dBGuanyGlobal);

this.Controls.Add(this.etLimitador);

this.Controls.Add(this.etGuanyGlobal);

this.Controls.Add(this.etLimitacioTextFixe);

this.Controls.Add(this.etGuany);

this.Controls.Add(this.etFreqCentral16kHz);

this.Controls.Add(this.etFreqCentral8kHz);

this.Controls.Add(this.etFreqCentral4kHz);

this.Controls.Add(this.etFreqCentral2kHz);

this.Controls.Add(this.etFreqCentral1kHz);

this.Controls.Add(this.etFreqCentral500Hz);

this.Controls.Add(this.etFreqCentral250Hz);

Page 367: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

367

this.Controls.Add(this.etFreqCentral125Hz);

this.Controls.Add(this.etFreqCentral63Hz);

this.Controls.Add(this.etMenys12dBdreta);

this.Controls.Add(this.et0dBdreta);

this.Controls.Add(this.etMes12dBdreta);

this.Controls.Add(this.etGuany16kHz);

this.Controls.Add(this.etGuany8kHz);

this.Controls.Add(this.etGuany4kHz);

this.Controls.Add(this.etGuany2kHz);

this.Controls.Add(this.etGuany1kHz);

this.Controls.Add(this.etGuany500Hz);

this.Controls.Add(this.etGuany250Hz);

this.Controls.Add(this.etGuany125Hz);

this.Controls.Add(this.etGuany63Hz);

this.Controls.Add(this.tbLimitador);

this.Controls.Add(this.tbGuanyGlobal);

this.Controls.Add(this.tb16kHz);

this.Controls.Add(this.tb8kHz);

this.Controls.Add(this.tb4kHz);

this.Controls.Add(this.tb2kHz);

this.Controls.Add(this.tb1kHz);

this.Controls.Add(this.tb500Hz);

this.Controls.Add(this.tb250Hz);

this.Controls.Add(this.tb125Hz);

this.Controls.Add(this.tb63Hz);

this.Controls.Add(this.et0dBesq);

this.Controls.Add(this.etGuany31coma5Hz);

this.Controls.Add(this.etFreqCentral31coma5Hz);

this.Controls.Add(this.etMenys12dBesq);

this.Controls.Add(this.etMes12dBesq);

this.Controls.Add(this.tb31coma5Hz);

this.Name = "FormFill_EqUnaOctava";

this.Text = "Equalitzador d\'una octava";

this.Load += new System.EventHandler(this.FormFill_EqUnaOctava_Load);

((System.ComponentModel.ISupportInitialize)(this.tb31coma5Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb63Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb125Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb250Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb500Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb1kHz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb2kHz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb4kHz)).EndInit();

Page 368: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

368

((System.ComponentModel.ISupportInitialize)(this.tb8kHz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb16kHz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.TrackBar tb31coma5Hz;

private System.Windows.Forms.Label etMes12dBesq;

private System.Windows.Forms.Label etMenys12dBesq;

private System.Windows.Forms.Label etFreqCentral31coma5Hz;

private System.Windows.Forms.Label etGuany31coma5Hz;

private System.Windows.Forms.Label et0dBesq;

private System.Windows.Forms.TrackBar tb63Hz;

private System.Windows.Forms.TrackBar tb125Hz;

private System.Windows.Forms.TrackBar tb250Hz;

private System.Windows.Forms.TrackBar tb500Hz;

private System.Windows.Forms.TrackBar tb1kHz;

private System.Windows.Forms.TrackBar tb2kHz;

private System.Windows.Forms.TrackBar tb4kHz;

private System.Windows.Forms.TrackBar tb8kHz;

private System.Windows.Forms.TrackBar tb16kHz;

private System.Windows.Forms.TrackBar tbGuanyGlobal;

private System.Windows.Forms.TrackBar tbLimitador;

private System.Windows.Forms.Label etGuany63Hz;

private System.Windows.Forms.Label etGuany125Hz;

private System.Windows.Forms.Label etGuany250Hz;

private System.Windows.Forms.Label etGuany500Hz;

private System.Windows.Forms.Label etGuany1kHz;

private System.Windows.Forms.Label etGuany2kHz;

private System.Windows.Forms.Label etGuany4kHz;

private System.Windows.Forms.Label etGuany8kHz;

private System.Windows.Forms.Label etGuany16kHz;

private System.Windows.Forms.Label etMes12dBdreta;

private System.Windows.Forms.Label et0dBdreta;

private System.Windows.Forms.Label etMenys12dBdreta;

private System.Windows.Forms.Label etFreqCentral63Hz;

private System.Windows.Forms.Label etFreqCentral125Hz;

Page 369: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

369

private System.Windows.Forms.Label etFreqCentral250Hz;

private System.Windows.Forms.Label etFreqCentral500Hz;

private System.Windows.Forms.Label etFreqCentral1kHz;

private System.Windows.Forms.Label etFreqCentral2kHz;

private System.Windows.Forms.Label etFreqCentral4kHz;

private System.Windows.Forms.Label etFreqCentral8kHz;

private System.Windows.Forms.Label etFreqCentral16kHz;

private System.Windows.Forms.Label etGuany;

private System.Windows.Forms.Label etLimitacioTextFixe;

private System.Windows.Forms.Label etGuanyGlobal;

private System.Windows.Forms.Label etLimitador;

private System.Windows.Forms.Label etMes15dBGuanyGlobal;

private System.Windows.Forms.Label etMes20dBLimitador;

private System.Windows.Forms.Label etMenys15dBGuanyGlobal;

private System.Windows.Forms.Label etMenys80dBLimitador;

private System.Windows.Forms.Label et0dBGuanyGlobal;

private System.Windows.Forms.Label et0dBLimitador;

private System.Windows.Forms.Button btCarregarEq;

private System.Windows.Forms.Button btGuardarEq;

private System.Windows.Forms.Button btEqOK;

private System.Windows.Forms.Button btCancelar;

}

}

Page 370: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

370

/*************************************************************

* Fitxer FormFill_Eq_1DIV3_Octava.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

namespace Equalitzador_FFT_1

{

public partial class FormFill_Eq_1DIV3_Octava : Form

{

//Declaració de les variables locals auxiliars, per guardar

//els valors de les variables globals, en el moment

//de carregar el formulari de l'equalitzador.

private double guanyGlobal;

private double limitador;

private double lowCut;

private double highCut;

private double guany20Hz;

private double guany25Hz;

private double guany31coma5Hz;

Page 371: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

371

private double guany40Hz;

private double guany50Hz;

private double guany63Hz;

private double guany80Hz;

private double guany100Hz;

private double guany125Hz;

private double guany160Hz;

private double guany200Hz;

private double guany250Hz;

private double guany315Hz;

private double guany400Hz;

private double guany500Hz;

private double guany630Hz;

private double guany800Hz;

private double guany1000Hz;

private double guany1250Hz;

private double guany1600Hz;

private double guany2000Hz;

private double guany2500Hz;

private double guany3150Hz;

private double guany4000Hz;

private double guany5000Hz;

private double guany6300Hz;

private double guany8000Hz;

private double guany10000Hz;

private double guany12500Hz;

Page 372: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

372

private double guany16000Hz;

private double guany_LF;

private double guany_MLF;

private double guany_MHF;

private double guany_HF;

private double freqCentral_LF;

private double freqCentral_MLF;

private double freqCentral_MHF;

private double freqCentral_HF;

private double bW_LF;

private double bW_MLF;

private double bW_MHF;

private double bW_HF;

private int equalitzador;

//Rutes a les carpetes del programa

private string ElsMeusDocuments;

private string carpetaProjecte;

private string subCarpeta2;

private string nomArxiu; // ruta del arxiu incial EqTerçOctava.eq2

private string nouArxiu; // ruta del nou arxiu EqTerçOctava#.eq2

//Fi de la declaració de les variables auxiliars locals.

public FormFill_Eq_1DIV3_Octava()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* FormFill_Eq_1DIV3_Octava

****************************************************************/

Page 373: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

373

private void FormFill_Eq_1DIV3_Octava_Load(object sender, EventArgs e)

{

//El formulari es repintarà mitjançant la tècnica

//del doble buffer per a evitar parpadejos i

//inestabilitats de la imatge tal i com es feia al projecte [24]

DoubleBuffered = true;

//Es guarden el valor de les variables global en les

//variables locals auxiliars

guanyGlobal = VG.guanyGlobal;

limitador = VG.limitador;

lowCut = VG.lowCut;

highCut = VG.highCut;

guany20Hz = VG.guany20Hz;

guany25Hz = VG.guany25Hz;

guany31coma5Hz = VG.guany31coma5Hz;

guany40Hz = VG.guany40Hz;

guany50Hz = VG.guany50Hz;

guany63Hz = VG.guany63Hz;

guany80Hz = VG.guany80Hz;

guany100Hz = VG.guany100Hz;

guany125Hz = VG.guany125Hz;

guany160Hz = VG.guany160Hz;

guany200Hz = VG.guany200Hz;

guany250Hz = VG.guany250Hz;

guany315Hz = VG.guany315Hz;

guany400Hz = VG.guany400Hz;

guany500Hz = VG.guany500Hz;

Page 374: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

374

guany630Hz = VG.guany630Hz;

guany800Hz = VG.guany800Hz;

guany1000Hz = VG.guany1000Hz;

guany1250Hz = VG.guany1250Hz;

guany1600Hz = VG.guany1600Hz;

guany2000Hz = VG.guany2000Hz;

guany2500Hz = VG.guany2500Hz;

guany3150Hz = VG.guany3150Hz;

guany4000Hz = VG.guany4000Hz;

guany5000Hz = VG.guany5000Hz;

guany6300Hz = VG.guany6300Hz;

guany8000Hz = VG.guany8000Hz;

guany10000Hz = VG.guany10000Hz;

guany12500Hz = VG.guany12500Hz;

guany16000Hz = VG.guany16000Hz;

guany_LF = VG.guany_LF;

guany_MLF = VG.guany_MLF;

guany_MHF = VG.guany_MHF;

guany_HF = VG.guany_HF;

freqCentral_LF = VG.freqCentral_LF;

freqCentral_MLF = VG.freqCentral_MLF;

freqCentral_MHF = VG.freqCentral_MHF;

freqCentral_HF = VG.freqCentral_HF;

bW_LF = VG.bW_LF;

bW_MLF = VG.bW_MLF;

bW_MHF = VG.bW_MHF;

bW_HF = VG.bW_HF;

equalitzador = VG.equalitzador;

Page 375: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

375

/****************************************************************

* Inicialització de les variables globals declarades dins de

* la classe VG.cs.

****************************************************************/

//S'inicialitza l'equalitzador de terç d'octava "2"

VG.equalitzador = 2;

//S'inicialitza a 0 dB del guanyGlobal.

VG.guanyGlobal = 0;

//S'inicialitzaa +20 dBV (+10 V), el valor

//de limitació.

VG.limitador = 20;

//S'inicialitza a 20 Hz lowCut

VG.lowCut = 20;

//S'inicialitza a 20 kHz highCut

VG.highCut = 20000;

//S'inicialitzen a 0 dBs els guanys de cada fadder

//de l'equalitzador d'una octava i d'un terç d'octava.

VG.guany20Hz = 0;

VG.guany25Hz = 0;

VG.guany31coma5Hz = 0;

VG.guany40Hz = 0;

VG.guany50Hz = 0;

VG.guany63Hz = 0;

VG.guany80Hz = 0;

VG.guany100Hz = 0;

Page 376: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

376

VG.guany125Hz = 0;

VG.guany160Hz = 0;

VG.guany200Hz = 0;

VG.guany250Hz = 0;

VG.guany315Hz = 0;

VG.guany400Hz = 0;

VG.guany500Hz = 0;

VG.guany630Hz = 0;

VG.guany800Hz = 0;

VG.guany1000Hz = 0;

VG.guany1250Hz = 0;

VG.guany1600Hz = 0;

VG.guany2000Hz = 0;

VG.guany2500Hz = 0;

VG.guany3150Hz = 0;

VG.guany4000Hz = 0;

VG.guany5000Hz = 0;

VG.guany6300Hz = 0;

VG.guany8000Hz = 0;

VG.guany10000Hz = 0;

VG.guany12500Hz = 0;

VG.guany16000Hz = 0;

//S'inicialitzen les Variables utilitzades per

//l'equalitzador paramètric.

//S'inicialitzen a 0 dBs els guanys de cada fadder

Page 377: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

377

//de l'equalitzador paramètric.

VG.guany_LF = 0;

VG.guany_MLF = 0;

VG.guany_MHF = 0;

VG.guany_HF = 0;

//S'inicialitzen les freqüències centrals de

//cada banda, a la freqüència més baixa de

//cada banda. En Hz

VG.freqCentral_LF = 20;

VG.freqCentral_MLF = 250;

VG.freqCentral_MHF = 2000;

VG.freqCentral_HF = 4000;

//S'inicialitzen els amples de banda (BW) de cada

//banda a 0.

VG.bW_LF = 0;

VG.bW_MLF = 0;

VG.bW_MHF = 0;

VG.bW_HF = 0;

//Obtenció de la ruta de la carpeta els meus documents

ElsMeusDocuments = Environment.GetFolderPath

(Environment.SpecialFolder.MyDocuments);

//Creació la la ruta de la carpeta del projecte dins la carpeta

//de els meus documents

carpetaProjecte = Path.Combine(ElsMeusDocuments,

"EqualitzadorFFT");

//Es crea la ruta a la subcarpeta "Eq Octava"

//subCarpeta 2 contindrá els arxius .eq2

subCarpeta2 = Path.Combine(carpetaProjecte, "Eq terç d'Octava");

nomArxiu = string.Empty;

nouArxiu = string.Empty;

Page 378: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

378

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del GuanyGlobal

****************************************************************/

private void tbGuanyGlobal_Scroll(object sender, EventArgs e)

{

//Actualització del guanyGlobal

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

//Actualització de l'etiqueta guanyGlobal del fadder

etGuanyGlobal.Text = "G = " + VG.guanyGlobal + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del limitador

****************************************************************/

private void tbLimitador_Scroll(object sender, EventArgs e)

{

//Actualització del limitador

VG.limitador = (double)tbLimitador.Value;

//Actualització de l'etiqueta limitació

etLimitador.Text = "L = " + VG.limitador + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder lowCut

****************************************************************/

private void tbLowCut_Scroll(object sender, EventArgs e)

{

//Actualització del lowCut

VG.lowCut = (double)tbLowCut.Value;

Page 379: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

379

//Actualització de l'etiqueta freqüència del lowCut

etFreqLowCut.Text = "LC = " + VG.lowCut + " Hz";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder HighCut

****************************************************************/

private void tbHighCut_Scroll(object sender, EventArgs e)

{

//Actualització del high cut

VG.highCut = (double)tbHighCut.Value;

//Actualització de l'etiqueta freqüència del highCut

etFreqHighCut.Text = "HC = " + VG.highCut + " Hz";

}

/****************************************************************

* Funcións que es criden quan s'actualitzen cada un dels fadders

* de l'equalitzador de terç d'octava

****************************************************************/

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 20 Hz

****************************************************************/

private void tb20Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany20Hz = (double)tb20Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany20Hz.Text = "G = " + VG.guany20Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 25 Hz

****************************************************************/

private void tb25Hz_Scroll(object sender, EventArgs e)

Page 380: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

380

{

//Actualització del guany corresponent

VG.guany25Hz = (double)tb25Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany25Hz.Text = "G = " + VG.guany25Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 31,5 Hz

****************************************************************/

private void tb31coma5Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany31coma5Hz = (double)tb31coma5Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany31coma5Hz.Text = "G = " + VG.guany31coma5Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 40 Hz

****************************************************************/

private void tb40Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany40Hz = (double)tb40Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany40Hz.Text = "G = " + VG.guany40Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 50 Hz

****************************************************************/

private void tb50Hz_Scroll(object sender, EventArgs e)

Page 381: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

381

{

//Actualització del guany corresponent

VG.guany50Hz = (double)tb50Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany50Hz.Text = "G = " + VG.guany50Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 63 Hz

****************************************************************/

private void tb63Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany63Hz = (double)tb63Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany63Hz.Text = "G = " + VG.guany63Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 80 Hz

****************************************************************/

private void tb80Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany80Hz = (double)tb80Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany80Hz.Text = "G = " + VG.guany80Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 100 Hz

****************************************************************/

private void tb100Hz_Scroll(object sender, EventArgs e)

Page 382: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

382

{

//Actualització del guany corresponent

VG.guany100Hz = (double)tb100Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany100Hz.Text = "G = " + VG.guany100Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 125 Hz

****************************************************************/

private void tb125Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany125Hz = (double)tb125Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany125Hz.Text = "G = " + VG.guany125Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 160 Hz

****************************************************************/

private void tb160Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany160Hz = (double)tb160Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany160Hz.Text = "G = " + VG.guany160Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 200 Hz

****************************************************************/

private void tb200Hz_Scroll(object sender, EventArgs e)

Page 383: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

383

{

//Actualització del guany corresponent

VG.guany200Hz = (double)tb200Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany200Hz.Text = "G = " + VG.guany200Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 250 Hz

****************************************************************/

private void tb250Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany250Hz = (double)tb250Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany250Hz.Text = "G = " + VG.guany250Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 315 Hz

****************************************************************/

private void tb315Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany315Hz = (double)tb315Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany315Hz.Text = "G = " + VG.guany315Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 400 Hz

****************************************************************/

private void tb400Hz_Scroll(object sender, EventArgs e)

Page 384: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

384

{

//Actualització del guany corresponent

VG.guany400Hz = (double)tb400Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany400Hz.Text = "G = " + VG.guany400Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 500 Hz

****************************************************************/

private void tb500Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany500Hz = (double)tb500Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany500Hz.Text = "G = " + VG.guany500Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 630 Hz

****************************************************************/

private void tb630Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany630Hz = (double)tb630Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany630Hz.Text = "G = " + VG.guany630Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 800 Hz

****************************************************************/

private void tb800Hz_Scroll(object sender, EventArgs e)

Page 385: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

385

{

//Actualització del guany corresponent

VG.guany800Hz = (double)tb800Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany800Hz.Text = "G = " + VG.guany800Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 1 kHz

****************************************************************/

private void tb1000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany1000Hz = (double)tb1000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany1000Hz.Text = "G = " + VG.guany1000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 1250 Hz

****************************************************************/

private void tb1250Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany1250Hz = (double)tb1250Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany1250Hz.Text = "G = " + VG.guany1250Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 1600 Hz

****************************************************************/

private void tb1600Hz_Scroll(object sender, EventArgs e)

Page 386: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

386

{

//Actualització del guany corresponent

VG.guany1600Hz = (double)tb1600Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany1600Hz.Text = "G = " + VG.guany1600Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 2 kHz

****************************************************************/

private void tb2000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany2000Hz = (double)tb2000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany2000Hz.Text = "G = " + VG.guany2000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 2500 Hz

****************************************************************/

private void tb2500Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany2500Hz = (double)tb2500Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany2500Hz.Text = "G = " + VG.guany2500Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 3150 Hz

****************************************************************/

private void tb3150Hz_Scroll(object sender, EventArgs e)

Page 387: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

387

{

//Actualització del guany corresponent

VG.guany3150Hz = (double)tb3150Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany3150Hz.Text = "G = " + VG.guany3150Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 4 kHz

****************************************************************/

private void tb4000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany4000Hz = (double)tb4000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany4000Hz.Text = "G = " + VG.guany4000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 5 kHz

****************************************************************/

private void tb5000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany5000Hz = (double)tb5000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany5000Hz.Text = "G = " + VG.guany5000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 6300 Hz

****************************************************************/

private void tb6300Hz_Scroll(object sender, EventArgs e)

Page 388: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

388

{

//Actualització del guany corresponent

VG.guany6300Hz = (double)tb6300Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany6300Hz.Text = "G = " + VG.guany6300Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 8 kHz

****************************************************************/

private void tb8000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany8000Hz = (double)tb8000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany8000Hz.Text = "G = " + VG.guany8000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 10 kHz

****************************************************************/

private void tb10000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany10000Hz = (double)tb10000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany10000Hz.Text = "G = " + VG.guany10000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 12500 Hz

****************************************************************/

private void tb12500Hz_Scroll(object sender, EventArgs e)

Page 389: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

389

{

//Actualització del guany corresponent

VG.guany12500Hz = (double)tb12500Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany12500Hz.Text = "G = " + VG.guany12500Hz + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de 16 kHz

****************************************************************/

private void tb16000Hz_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany16000Hz = (double)tb16000Hz.Value;

//Actualització de l'etiqueta guany del fadder

etGuany16000Hz.Text = "G = " + VG.guany16000Hz + " dB";

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó carregarEq

****************************************************************/

private void btCarregarEq_Click(object sender, EventArgs e)

{

subCarpeta2 = "";

subCarpeta2 = Path.Combine(carpetaProjecte, "Eq terç Octava");

//Mostrar el quadre de dialeg obrir

OpenFileDialog DlgObrir = new OpenFileDialog();

DlgObrir.InitialDirectory = subCarpeta2;

DlgObrir.Filter = "fitxers equalització 1/3 octava " +

"(*eq2)|*.eq2";

if (DlgObrir.ShowDialog() == DialogResult.OK)

{

//Obtenir ruta del fitxer

Page 390: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

390

subCarpeta2 = DlgObrir.FileName;

using (FileStream stream = new FileStream

(subCarpeta2, FileMode.Open, FileAccess.Read))

{

using (BinaryReader llegir = new BinaryReader(stream))

{

//Es comprova la 1ra posició de l'arxiu guardat

//es tracta del Eq terç d'octava, i si el valor no

//es 1, es mostra el quadre d'error i es cancela

//l'operació.

Int32 EQ = llegir.ReadInt32();

if (EQ == 2)

{

//S'ha de tindre en compte el format de

//cada valor a guardar per llegir-ho correctament.

tbLimitador.Value = llegir.ReadInt32();

VG.limitador = (double)tbLimitador.Value;

tbGuanyGlobal.Value = llegir.ReadInt32();

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

tbLowCut.Value = llegir.ReadInt32();

VG.lowCut = (double)tbLowCut.Value;

tbHighCut.Value = llegir.ReadInt32();

VG.highCut = (double)tbHighCut.Value;

tb20Hz.Value = llegir.ReadInt32();

VG.guany20Hz = (double)tb20Hz.Value;

tb25Hz.Value = llegir.ReadInt32();

VG.guany25Hz = (double)tb25Hz.Value;

tb31coma5Hz.Value = llegir.ReadInt32();

VG.guany31coma5Hz = (double)tb31coma5Hz.Value;

tb40Hz.Value = llegir.ReadInt32();

VG.guany40Hz = (double)tb40Hz.Value;

tb50Hz.Value = llegir.ReadInt32();

VG.guany50Hz = (double)tb50Hz.Value;

tb63Hz.Value = llegir.ReadInt32();

VG.guany63Hz = (double)tb63Hz.Value;

tb80Hz.Value = llegir.ReadInt32();

VG.guany80Hz = (double)tb80Hz.Value;

tb100Hz.Value = llegir.ReadInt32();

Page 391: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

391

VG.guany100Hz = (double)tb100Hz.Value;

tb125Hz.Value = llegir.ReadInt32();

VG.guany125Hz = (double)tb125Hz.Value;

tb160Hz.Value = llegir.ReadInt32();

VG.guany160Hz = (double)tb160Hz.Value;

tb200Hz.Value = llegir.ReadInt32();

VG.guany200Hz = (double)tb200Hz.Value;

tb250Hz.Value = llegir.ReadInt32();

VG.guany250Hz = (double)tb250Hz.Value;

tb315Hz.Value = llegir.ReadInt32();

VG.guany315Hz = (double)tb315Hz.Value;

tb400Hz.Value = llegir.ReadInt32();

VG.guany400Hz = (double)tb400Hz.Value;

tb500Hz.Value = llegir.ReadInt32();

VG.guany500Hz = (double)tb500Hz.Value;

tb630Hz.Value = llegir.ReadInt32();

VG.guany630Hz = (double)tb630Hz.Value;

tb800Hz.Value = llegir.ReadInt32();

VG.guany800Hz = (double)tb800Hz.Value;

tb1000Hz.Value = llegir.ReadInt32();

VG.guany1000Hz = (double)tb1000Hz.Value;

tb1250Hz.Value = llegir.ReadInt32();

VG.guany1250Hz = (double)tb1250Hz.Value;

tb1600Hz.Value = llegir.ReadInt32();

VG.guany1600Hz = (double)tb1600Hz.Value;

tb2000Hz.Value = llegir.ReadInt32();

VG.guany2000Hz = (double)tb2000Hz.Value;

tb2500Hz.Value = llegir.ReadInt32();

VG.guany2500Hz = (double)tb2500Hz.Value;

tb3150Hz.Value = llegir.ReadInt32();

VG.guany3150Hz = (double)tb3150Hz.Value;

tb4000Hz.Value = llegir.ReadInt32();

VG.guany4000Hz = (double)tb4000Hz.Value;

tb5000Hz.Value = llegir.ReadInt32();

VG.guany5000Hz = (double)tb5000Hz.Value;

tb6300Hz.Value = llegir.ReadInt32();

VG.guany6300Hz = (double)tb6300Hz.Value;

tb8000Hz.Value = llegir.ReadInt32();

VG.guany8000Hz = (double)tb8000Hz.Value;

tb10000Hz.Value = llegir.ReadInt32();

VG.guany10000Hz = (double)tb10000Hz.Value;

tb12500Hz.Value = llegir.ReadInt32();

Page 392: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

392

VG.guany12500Hz = (double)tb12500Hz.Value;

tb16000Hz.Value = llegir.ReadInt32();

VG.guany16000Hz = (double)tb16000Hz.Value;

llegir.Close();

}//Fi if (EQ == 2)

else //sino estem al Eq terç d'octava, missatge d'error

{

MessageBox.Show(" S'ha carregat una " +

"equalització que no correspon " +

"a l'equalizador de terç d'octava.",

"Error en l'arxiu.", MessageBoxButtons.OK,

MessageBoxIcon.Error);

llegir.Close();

}

}//Fi using (BinaryReader)

}//Fi using (FileStream)

}//Fi if (DlgObrir.ShowDialog())

}//Fi btCarregar_click

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó GuardarEq

*

* Nota: quan es fa clic sobre el botó guardar equalització,

* l'equalització triada per l'usuari mitjançant els

* fadders, serà guardada en un fitxer d'equalització

* EqTerçOctava.eq2.

****************************************************************/

private void btGuardarEq_Click(object sender, EventArgs e)

{

//Es mostra el Dialeg Guardar on s'haura d'escriure el

//nom del fitxer a guardar. S'ha de escollir la ruta de guardar,

//per defecte ve donada //C://..//Mis documentos

//L'extensió del format a guardar serà .eq2

//La variable conta contindrá el valor

//del index de repetició de l'arxiu.

Page 393: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

393

int conta = 1;

//nomArxiu conté la ruta C://.../Eq terç Octava//EqTerçOctava

//sense extensió.

subCarpeta2 = "";

subCarpeta2 = Path.Combine(carpetaProjecte, "Eq terç Octava");

nomArxiu = "";

nouArxiu = "";

nomArxiu = Path.Combine(subCarpeta2, "EqTerçOctava");

//Extensió dels arxius eq2

string extensio = ".eq2";

//Creació de la nova instancia SaveFileDialog com DlgGuardar

SaveFileDialog DlgGuardar = new SaveFileDialog();

//Si existeix l'arxiu EqTerçOctava.eq2 es crea un nou nom

//on la variable conta portara el número d'arxius EqTerçOctava

//que hi han al directori. Si existeix EqOctava.eq1 es crea

//EqTerçOctava1.eq2, si aquets també existeix es crea EqTerçOctava2.eq2

//i així successivament

if (File.Exists(nomArxiu + extensio))

{

nouArxiu = nomArxiu + conta;

//Es comprova que el nou nom no exiteix.

//Si existeix, s'incrementa la conta

//i es guarda altre vegada en la variable

//nouArxiu.

while (File.Exists(nouArxiu + extensio))

{

conta++;

nouArxiu = nomArxiu + conta;

}

Page 394: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

394

//Aparició per defecte del nom a guardar al quadre

//de dialeg. L'usuari pot modificar aquest nom manualment,

//però per defecte, tindrá l'opció automatica de guardar

//amb el nom consecutivament disponible

DlgGuardar.FileName = nouArxiu;

}

//Si l'arxiu EqOctava.eq1 no existeix, apareixerá per defecte

//l'opció d'aquest nom al usuari.

else

{

DlgGuardar.FileName = nomArxiu;

}

//Directori inicial del quadre de dialeg

DlgGuardar.InitialDirectory = subCarpeta2;

//Es filtra l'extensió a guardar

DlgGuardar.Filter = "(*.eq2)|*.eq2";

DlgGuardar.Title = "Guardar fitxers d'equalització de terç d'octava";

//Si s'ha fet clic al botó guardar del quadre de dialeg...

if (DlgGuardar.ShowDialog() == DialogResult.OK)

{

//S'obté el nom de l'artxiu per guardar a la ruta de la subcarpeta

//corresponent.

subCarpeta2 = DlgGuardar.FileName;

//S'utilitza la funció FileStream per crear l'artxiu binary

using (FileStream stream = new FileStream(subCarpeta2, FileMode.Create))

{

using (BinaryWriter escriu = new BinaryWriter(stream))

{

//S'escriu cada valor consecutivament.

Page 395: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

395

//BinaryWriter apunta automàticament a la

//següent posició.

//Guardar els valors dels fadders

escriu.Write(2);

escriu.Write(tbLimitador.Value);

escriu.Write(tbGuanyGlobal.Value);

escriu.Write(tbLowCut.Value);

escriu.Write(tbHighCut.Value);

escriu.Write(tb20Hz.Value);

escriu.Write(tb25Hz.Value);

escriu.Write(tb31coma5Hz.Value);

escriu.Write(tb40Hz.Value);

escriu.Write(tb50Hz.Value);

escriu.Write(tb63Hz.Value);

escriu.Write(tb80Hz.Value);

escriu.Write(tb100Hz.Value);

escriu.Write(tb125Hz.Value);

escriu.Write(tb160Hz.Value);

escriu.Write(tb200Hz.Value);

escriu.Write(tb250Hz.Value);

escriu.Write(tb315Hz.Value);

escriu.Write(tb400Hz.Value);

escriu.Write(tb500Hz.Value);

escriu.Write(tb630Hz.Value);

escriu.Write(tb800Hz.Value);

escriu.Write(tb1000Hz.Value);

escriu.Write(tb1250Hz.Value);

escriu.Write(tb1600Hz.Value);

escriu.Write(tb2000Hz.Value);

escriu.Write(tb2500Hz.Value);

escriu.Write(tb3150Hz.Value);

escriu.Write(tb4000Hz.Value);

escriu.Write(tb5000Hz.Value);

escriu.Write(tb6300Hz.Value);

escriu.Write(tb8000Hz.Value);

escriu.Write(tb10000Hz.Value);

escriu.Write(tb12500Hz.Value);

escriu.Write(tb16000Hz.Value);

escriu.Close();

}

Page 396: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

396

}

}//Fi if (DlgGuardar.ShowDialog())

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó EqOK

*

* Nota: l'equalització que hi ha en els fadders en el moment

* de fer clic en el botó EqOK, es guarda en les variables globals

* corresponents per dur a terme l'equalització i es surt de

* l'equalitzador

****************************************************************/

private void btEqOK_Click(object sender, EventArgs e)

{

//Simplement cal tancar el formulari de l'equalitzador,

//tornant al formulari pare.

this.Close();

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó Cancelar

*

* Nota: quan es fa clic, se surt del formulari de l'equalitzador

* i es restaurel els valors de les variables globals als que

* hi havien abans de carregar el formulari de l'equalitzador.

****************************************************************/

private void btCancelar_Click(object sender, EventArgs e)

{

//Restaurar valors de les variables globals als que

//hi havien abans de carregar el formulari de

//l'equalitzador.

VG.guanyGlobal = guanyGlobal;

VG.limitador = limitador;

VG.lowCut = lowCut;

VG.highCut = highCut;

VG.guany20Hz = guany20Hz;

VG.guany25Hz = guany25Hz;

Page 397: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

397

VG.guany31coma5Hz = guany31coma5Hz;

VG.guany40Hz = guany40Hz;

VG.guany50Hz = guany50Hz;

VG.guany63Hz = guany63Hz;

VG.guany80Hz = guany80Hz;

VG.guany100Hz = guany100Hz;

VG.guany125Hz = guany125Hz;

VG.guany160Hz = guany160Hz;

VG.guany200Hz = guany200Hz;

VG.guany250Hz = guany250Hz;

VG.guany315Hz = guany315Hz;

VG.guany400Hz = guany400Hz;

VG.guany500Hz = guany500Hz;

VG.guany630Hz = guany630Hz;

VG.guany800Hz = guany800Hz;

VG.guany1000Hz = guany1000Hz;

VG.guany1250Hz = guany1250Hz;

VG.guany1600Hz = guany1600Hz;

VG.guany2000Hz = guany2000Hz;

VG.guany2500Hz = guany2500Hz;

VG.guany3150Hz = guany3150Hz;

VG.guany4000Hz = guany4000Hz;

VG.guany5000Hz = guany5000Hz;

VG.guany6300Hz = guany6300Hz;

VG.guany8000Hz = guany8000Hz;

Page 398: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

398

VG.guany10000Hz = guany10000Hz;

VG.guany12500Hz = guany12500Hz;

VG.guany16000Hz = guany16000Hz;

VG.guany_LF = guany_LF;

VG.guany_MLF = guany_MLF;

VG.guany_MHF = guany_MHF;

VG.guany_HF = guany_HF;

VG.freqCentral_LF = freqCentral_LF;

VG.freqCentral_MLF = freqCentral_MLF;

VG.freqCentral_MHF = freqCentral_MHF;

VG.freqCentral_HF = freqCentral_HF;

VG.bW_LF = bW_LF;

VG.bW_MLF = bW_MLF;

VG.bW_MHF = bW_MHF;

VG.bW_HF = bW_HF;

VG.equalitzador = equalitzador;

//Tancar el formulari fill de l'equalitzador,

//i tornar el control al formulari pare.

this.Close();

}//Fi btCancelar_Click

private void btEqReset_Click(object sender, EventArgs e)

{

//Resetejar els fadders

tbLimitador.Value = 20;

tbGuanyGlobal.Value = 0;

tbLowCut.Value = 20;

tbHighCut.Value = 20000;

tb20Hz.Value = 0;

tb25Hz.Value = 0;

tb31coma5Hz.Value = 0;

tb40Hz.Value = 0;

tb50Hz.Value = 0;

tb63Hz.Value = 0;

Page 399: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

399

tb80Hz.Value = 0;

tb100Hz.Value = 0;

tb125Hz.Value = 0;

tb160Hz.Value = 0;

tb200Hz.Value = 0;

tb250Hz.Value = 0;

tb315Hz.Value = 0;

tb400Hz.Value = 0;

tb500Hz.Value = 0;

tb630Hz.Value = 0;

tb800Hz.Value = 0;

tb1000Hz.Value = 0;

tb1250Hz.Value = 0;

tb1600Hz.Value = 0;

tb2000Hz.Value = 0;

tb2500Hz.Value = 0;

tb3150Hz.Value = 0;

tb4000Hz.Value = 0;

tb5000Hz.Value = 0;

tb6300Hz.Value = 0;

tb8000Hz.Value = 0;

tb10000Hz.Value = 0;

tb12500Hz.Value = 0;

tb16000Hz.Value = 0;

//Resetajar les variables globals

VG.guanyGlobal = 0;

VG.limitador = 20;

VG.lowCut = 20;

VG.highCut = 20000;

VG.guany20Hz = 0;

VG.guany25Hz = 0;

VG.guany31coma5Hz = 0;

VG.guany40Hz = 0;

VG.guany50Hz = 0;

VG.guany63Hz = 0;

VG.guany80Hz = 0;

VG.guany100Hz = 0;

VG.guany125Hz = 0;

VG.guany160Hz = 0;

VG.guany200Hz = 0;

Page 400: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

400

VG.guany250Hz = 0;

VG.guany315Hz = 0;

VG.guany400Hz = 0;

VG.guany500Hz = 0;

VG.guany630Hz = 0;

VG.guany800Hz = 0;

VG.guany1000Hz = 0;

VG.guany1250Hz = 0;

VG.guany1600Hz = 0;

VG.guany2000Hz = 0;

VG.guany2500Hz = 0;

VG.guany3150Hz = 0;

VG.guany4000Hz = 0;

VG.guany5000Hz = 0;

VG.guany6300Hz = 0;

VG.guany8000Hz = 0;

VG.guany10000Hz = 0;

VG.guany12500Hz = 0;

VG.guany16000Hz = 0;

//Resetejar etiquetes

etGuanyGlobal.Text = "G = " + VG.guanyGlobal + " dB";

etLimitador.Text = "L = " + VG.limitador + " dB";

etFreqLowCut.Text = "LC = " + VG.lowCut + " Hz";

etFreqHighCut.Text = "HC = " + VG.highCut + " Hz";

etGuany20Hz.Text = "G = " + VG.guany20Hz + " dB";

etGuany25Hz.Text = "G = " + VG.guany25Hz + " dB";

etGuany31coma5Hz.Text = "G = " + VG.guany31coma5Hz + " dB";

etGuany40Hz.Text = "G = " + VG.guany40Hz + " dB";

etGuany50Hz.Text = "G = " + VG.guany50Hz + " dB";

etGuany63Hz.Text = "G = " + VG.guany63Hz + " dB";

etGuany80Hz.Text = "G = " + VG.guany80Hz + " dB";

etGuany100Hz.Text = "G = " + VG.guany100Hz + " dB";

etGuany125Hz.Text = "G = " + VG.guany125Hz + " dB";

etGuany160Hz.Text = "G = " + VG.guany160Hz + " dB";

etGuany200Hz.Text = "G = " + VG.guany200Hz + " dB";

etGuany250Hz.Text = "G = " + VG.guany250Hz + " dB";

etGuany315Hz.Text = "G = " + VG.guany315Hz + " dB";

etGuany400Hz.Text = "G = " + VG.guany400Hz + " dB";

etGuany500Hz.Text = "G = " + VG.guany500Hz + " dB";

etGuany630Hz.Text = "G = " + VG.guany630Hz + " dB";

Page 401: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

401

etGuany800Hz.Text = "G = " + VG.guany800Hz + " dB";

etGuany1000Hz.Text = "G = " + VG.guany1000Hz + " dB";

etGuany1250Hz.Text = "G = " + VG.guany1250Hz + " dB";

etGuany1600Hz.Text = "G = " + VG.guany1600Hz + " dB";

etGuany2000Hz.Text = "G = " + VG.guany2000Hz + " dB";

etGuany2500Hz.Text = "G = " + VG.guany2500Hz + " dB";

etGuany3150Hz.Text = "G = " + VG.guany3150Hz + " dB";

etGuany4000Hz.Text = "G = " + VG.guany4000Hz + " dB";

etGuany5000Hz.Text = "G = " + VG.guany5000Hz + " dB";

etGuany6300Hz.Text = "G = " + VG.guany6300Hz + " dB";

etGuany8000Hz.Text = "G = " + VG.guany8000Hz + " dB";

etGuany10000Hz.Text = "G = " + VG.guany10000Hz + " dB";

etGuany12500Hz.Text = "G = " + VG.guany12500Hz + " dB";

etGuany16000Hz.Text = "G = " + VG.guany16000Hz + " dB";

}//Fi btEqReset_Click

}//Fi partial class FormFill_Eq_1DIV3_Octava

}//Fi namespace Equalitzador_FFT_1

Page 402: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

402

/*************************************************************

* Fitxer FormFill_Eq_1DIV3_Octava.Designer.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class FormFill_Eq_1DIV3_Octava

{

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

/// <param name="disposing">true si los recursos administrados se

///deben eliminar; false en caso contrario, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido del método con el editor de código.

Page 403: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

403

/// </summary>

private void InitializeComponent()

{

this.tb20Hz = new System.Windows.Forms.TrackBar();

this.etMes12dBEsqFila1 = new System.Windows.Forms.Label();

this.etMenys12dBEsqFila1 = new System.Windows.Forms.Label();

this.etFreqCentral20Hz = new System.Windows.Forms.Label();

this.etGuany20Hz = new System.Windows.Forms.Label();

this.et0dBEsqFila1 = new System.Windows.Forms.Label();

this.tb25Hz = new System.Windows.Forms.TrackBar();

this.tb31coma5Hz = new System.Windows.Forms.TrackBar();

this.tb40Hz = new System.Windows.Forms.TrackBar();

this.tb50Hz = new System.Windows.Forms.TrackBar();

this.tb63Hz = new System.Windows.Forms.TrackBar();

this.tb80Hz = new System.Windows.Forms.TrackBar();

this.tb100Hz = new System.Windows.Forms.TrackBar();

this.tb125Hz = new System.Windows.Forms.TrackBar();

this.tb160Hz = new System.Windows.Forms.TrackBar();

this.tbGuanyGlobal = new System.Windows.Forms.TrackBar();

this.tbLimitador = new System.Windows.Forms.TrackBar();

this.etGuany25Hz = new System.Windows.Forms.Label();

this.etGuany31coma5Hz = new System.Windows.Forms.Label();

this.etGuany40Hz = new System.Windows.Forms.Label();

this.etGuany50Hz = new System.Windows.Forms.Label();

this.etGuany63Hz = new System.Windows.Forms.Label();

this.etGuany80Hz = new System.Windows.Forms.Label();

this.etGuany100Hz = new System.Windows.Forms.Label();

this.etGuany125Hz = new System.Windows.Forms.Label();

this.etGuany160Hz = new System.Windows.Forms.Label();

this.etMes12dBDretaFila1 = new System.Windows.Forms.Label();

this.et0dBDretaFila1 = new System.Windows.Forms.Label();

this.etMenys12dBDretaFila1 = new System.Windows.Forms.Label();

this.etFreqCentral25Hz = new System.Windows.Forms.Label();

this.etFreqCentral31coma5Hz = new System.Windows.Forms.Label();

this.etFreqCentral40Hz = new System.Windows.Forms.Label();

this.etFreqCentral50Hz = new System.Windows.Forms.Label();

this.etFreqCentral63Hz = new System.Windows.Forms.Label();

this.etFreqCentral80Hz = new System.Windows.Forms.Label();

this.etFreqCentral100Hz = new System.Windows.Forms.Label();

this.etFreqCentral125Hz = new System.Windows.Forms.Label();

this.etFreqCentral160Hz = new System.Windows.Forms.Label();

this.etGuany = new System.Windows.Forms.Label();

Page 404: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

404

this.etLimitacioTextFixe = new System.Windows.Forms.Label();

this.etGuanyGlobal = new System.Windows.Forms.Label();

this.etLimitador = new System.Windows.Forms.Label();

this.etMes15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMes20dBLimitador = new System.Windows.Forms.Label();

this.etMenys15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMenys80dBLimitador = new System.Windows.Forms.Label();

this.et0dBGuanyGlobal = new System.Windows.Forms.Label();

this.et0dBLimitador = new System.Windows.Forms.Label();

this.btCarregarEq = new System.Windows.Forms.Button();

this.btGuardarEq = new System.Windows.Forms.Button();

this.btEqOK = new System.Windows.Forms.Button();

this.btCancelar = new System.Windows.Forms.Button();

this.tbHighCut = new System.Windows.Forms.TrackBar();

this.tbLowCut = new System.Windows.Forms.TrackBar();

this.etFreqHighCut = new System.Windows.Forms.Label();

this.etFreqLowCut = new System.Windows.Forms.Label();

this.etHighCut = new System.Windows.Forms.Label();

this.etLowCut = new System.Windows.Forms.Label();

this.etHighCut20kHz = new System.Windows.Forms.Label();

this.etHighCut2500Hz = new System.Windows.Forms.Label();

this.etLowCut20Hz = new System.Windows.Forms.Label();

this.etLowCut400Hz = new System.Windows.Forms.Label();

this.etFreqCentral1600Hz = new System.Windows.Forms.Label();

this.etFreqCentral1250Hz = new System.Windows.Forms.Label();

this.etFreqCentral1kHz = new System.Windows.Forms.Label();

this.etFreqCentral800Hz = new System.Windows.Forms.Label();

this.etFreqCentral630Hz = new System.Windows.Forms.Label();

this.etFreqCentral500Hz = new System.Windows.Forms.Label();

this.etFreqCentral400Hz = new System.Windows.Forms.Label();

this.etFreqCentral315Hz = new System.Windows.Forms.Label();

this.etFreqCentral250Hz = new System.Windows.Forms.Label();

this.etMenys12dBDretaFila2 = new System.Windows.Forms.Label();

this.et0dBDretaFila2 = new System.Windows.Forms.Label();

this.etMes12dBDretaFila2 = new System.Windows.Forms.Label();

this.etGuany1600Hz = new System.Windows.Forms.Label();

this.etGuany1250Hz = new System.Windows.Forms.Label();

this.etGuany1000Hz = new System.Windows.Forms.Label();

this.etGuany800Hz = new System.Windows.Forms.Label();

this.etGuany630Hz = new System.Windows.Forms.Label();

this.etGuany500Hz = new System.Windows.Forms.Label();

this.etGuany400Hz = new System.Windows.Forms.Label();

Page 405: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

405

this.etGuany315Hz = new System.Windows.Forms.Label();

this.etGuany250Hz = new System.Windows.Forms.Label();

this.tb1600Hz = new System.Windows.Forms.TrackBar();

this.tb1250Hz = new System.Windows.Forms.TrackBar();

this.tb1000Hz = new System.Windows.Forms.TrackBar();

this.tb800Hz = new System.Windows.Forms.TrackBar();

this.tb630Hz = new System.Windows.Forms.TrackBar();

this.tb500Hz = new System.Windows.Forms.TrackBar();

this.tb400Hz = new System.Windows.Forms.TrackBar();

this.tb315Hz = new System.Windows.Forms.TrackBar();

this.tb250Hz = new System.Windows.Forms.TrackBar();

this.et0dBEsqFila2 = new System.Windows.Forms.Label();

this.etGuany200Hz = new System.Windows.Forms.Label();

this.etFreqCentral200Hz = new System.Windows.Forms.Label();

this.etMenys12dBEsqFila2 = new System.Windows.Forms.Label();

this.etMes12dBEsqFila2 = new System.Windows.Forms.Label();

this.tb200Hz = new System.Windows.Forms.TrackBar();

this.etFreqCentral16kHz = new System.Windows.Forms.Label();

this.etFreqCentral12500Hz = new System.Windows.Forms.Label();

this.etFreqCentral10kHz = new System.Windows.Forms.Label();

this.etFreqCentral8kHz = new System.Windows.Forms.Label();

this.etFreqCentral6300Hz = new System.Windows.Forms.Label();

this.etFreqCentral5kHz = new System.Windows.Forms.Label();

this.etFreqCentral4kHz = new System.Windows.Forms.Label();

this.etFreqCentral3150Hz = new System.Windows.Forms.Label();

this.etFreqCentral2500Hz = new System.Windows.Forms.Label();

this.etMenys12dBDretaFila3 = new System.Windows.Forms.Label();

this.et0dBDretaFila3 = new System.Windows.Forms.Label();

this.etMes12dBDretaFila3 = new System.Windows.Forms.Label();

this.etGuany16000Hz = new System.Windows.Forms.Label();

this.etGuany12500Hz = new System.Windows.Forms.Label();

this.etGuany10000Hz = new System.Windows.Forms.Label();

this.etGuany8000Hz = new System.Windows.Forms.Label();

this.etGuany6300Hz = new System.Windows.Forms.Label();

this.etGuany5000Hz = new System.Windows.Forms.Label();

this.etGuany4000Hz = new System.Windows.Forms.Label();

this.etGuany3150Hz = new System.Windows.Forms.Label();

this.etGuany2500Hz = new System.Windows.Forms.Label();

this.tb16000Hz = new System.Windows.Forms.TrackBar();

this.tb12500Hz = new System.Windows.Forms.TrackBar();

this.tb10000Hz = new System.Windows.Forms.TrackBar();

this.tb8000Hz = new System.Windows.Forms.TrackBar();

Page 406: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

406

this.tb6300Hz = new System.Windows.Forms.TrackBar();

this.tb5000Hz = new System.Windows.Forms.TrackBar();

this.tb4000Hz = new System.Windows.Forms.TrackBar();

this.tb3150Hz = new System.Windows.Forms.TrackBar();

this.tb2500Hz = new System.Windows.Forms.TrackBar();

this.et0dBEsqFila3 = new System.Windows.Forms.Label();

this.etGuany2000Hz = new System.Windows.Forms.Label();

this.etFreqCentral2kHz = new System.Windows.Forms.Label();

this.etMenys12dBEsqFila3 = new System.Windows.Forms.Label();

this.etMes12dBEsqFila3 = new System.Windows.Forms.Label();

this.tb2000Hz = new System.Windows.Forms.TrackBar();

this.btEqReset = new System.Windows.Forms.Button();

((System.ComponentModel.ISupportInitialize)(this.tb20Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb25Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb31coma5Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb40Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb50Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb63Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb80Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb100Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb125Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb160Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbHighCut)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbLowCut)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb1600Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb1250Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb1000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb800Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb630Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb500Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb400Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb315Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb250Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb200Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb16000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb12500Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb10000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb8000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb6300Hz)).BeginInit();

Page 407: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

407

((System.ComponentModel.ISupportInitialize)(this.tb5000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb4000Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb3150Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb2500Hz)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tb2000Hz)).BeginInit();

this.SuspendLayout();

//

// tb20Hz

//

this.tb20Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb20Hz.Location = new System.Drawing.Point(292, 34);

this.tb20Hz.Maximum = 12;

this.tb20Hz.Minimum = -12;

this.tb20Hz.Name = "tb20Hz";

this.tb20Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb20Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb20Hz.Size = new System.Drawing.Size(45, 97);

this.tb20Hz.TabIndex = 0;

this.tb20Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb20Hz.Scroll += new System.EventHandler(this.tb20Hz_Scroll);

//

// etMes12dBEsqFila1

//

this.etMes12dBEsqFila1.AutoSize = true;

this.etMes12dBEsqFila1.Location = new System.Drawing.Point(245, 34);

this.etMes12dBEsqFila1.Name = "etMes12dBEsqFila1";

this.etMes12dBEsqFila1.Size = new System.Drawing.Size(41, 13);

this.etMes12dBEsqFila1.TabIndex = 2;

this.etMes12dBEsqFila1.Text = "+12 dB";

//

// etMenys12dBEsqFila1

//

this.etMenys12dBEsqFila1.AutoSize = true;

this.etMenys12dBEsqFila1.Location = new System.Drawing.Point(248, 118);

this.etMenys12dBEsqFila1.Name = "etMenys12dBEsqFila1";

this.etMenys12dBEsqFila1.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBEsqFila1.TabIndex = 3;

this.etMenys12dBEsqFila1.Text = "-12 dB";

//

// etFreqCentral20Hz

//

this.etFreqCentral20Hz.AutoSize = true;

Page 408: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

408

this.etFreqCentral20Hz.Location = new System.Drawing.Point(289, 134);

this.etFreqCentral20Hz.Name = "etFreqCentral20Hz";

this.etFreqCentral20Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral20Hz.TabIndex = 4;

this.etFreqCentral20Hz.Text = "20 Hz";

//

// etGuany20Hz

//

this.etGuany20Hz.AutoSize = true;

this.etGuany20Hz.Location = new System.Drawing.Point(289, 18);

this.etGuany20Hz.Name = "etGuany20Hz";

this.etGuany20Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany20Hz.TabIndex = 5;

this.etGuany20Hz.Text = "G = 0 dB";

//

// et0dBEsqFila1

//

this.et0dBEsqFila1.AutoSize = true;

this.et0dBEsqFila1.Location = new System.Drawing.Point(257, 75);

this.et0dBEsqFila1.Name = "et0dBEsqFila1";

this.et0dBEsqFila1.Size = new System.Drawing.Size(29, 13);

this.et0dBEsqFila1.TabIndex = 6;

this.et0dBEsqFila1.Text = "0 dB";

//

// tb25Hz

//

this.tb25Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb25Hz.Location = new System.Drawing.Point(352, 34);

this.tb25Hz.Maximum = 12;

this.tb25Hz.Minimum = -12;

this.tb25Hz.Name = "tb25Hz";

this.tb25Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb25Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb25Hz.Size = new System.Drawing.Size(45, 97);

this.tb25Hz.TabIndex = 7;

this.tb25Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb25Hz.Scroll += new System.EventHandler(this.tb25Hz_Scroll);

//

// tb31coma5Hz

//

this.tb31coma5Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb31coma5Hz.Location = new System.Drawing.Point(411, 34);

Page 409: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

409

this.tb31coma5Hz.Maximum = 12;

this.tb31coma5Hz.Minimum = -12;

this.tb31coma5Hz.Name = "tb31coma5Hz";

this.tb31coma5Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb31coma5Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb31coma5Hz.Size = new System.Drawing.Size(45, 97);

this.tb31coma5Hz.TabIndex = 8;

this.tb31coma5Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb31coma5Hz.Scroll += new System.EventHandler(this.tb31coma5Hz_Scroll);

//

// tb40Hz

//

this.tb40Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb40Hz.Location = new System.Drawing.Point(472, 34);

this.tb40Hz.Maximum = 12;

this.tb40Hz.Minimum = -12;

this.tb40Hz.Name = "tb40Hz";

this.tb40Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb40Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb40Hz.Size = new System.Drawing.Size(45, 97);

this.tb40Hz.TabIndex = 9;

this.tb40Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb40Hz.Scroll += new System.EventHandler(this.tb40Hz_Scroll);

//

// tb50Hz

//

this.tb50Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb50Hz.Location = new System.Drawing.Point(532, 34);

this.tb50Hz.Maximum = 12;

this.tb50Hz.Minimum = -12;

this.tb50Hz.Name = "tb50Hz";

this.tb50Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb50Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb50Hz.Size = new System.Drawing.Size(45, 97);

this.tb50Hz.TabIndex = 10;

this.tb50Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb50Hz.Scroll += new System.EventHandler(this.tb50Hz_Scroll);

//

// tb63Hz

//

this.tb63Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb63Hz.Location = new System.Drawing.Point(592, 34);

Page 410: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

410

this.tb63Hz.Maximum = 12;

this.tb63Hz.Minimum = -12;

this.tb63Hz.Name = "tb63Hz";

this.tb63Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb63Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb63Hz.Size = new System.Drawing.Size(45, 97);

this.tb63Hz.TabIndex = 11;

this.tb63Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb63Hz.Scroll += new System.EventHandler(this.tb63Hz_Scroll);

//

// tb80Hz

//

this.tb80Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb80Hz.Location = new System.Drawing.Point(652, 34);

this.tb80Hz.Maximum = 12;

this.tb80Hz.Minimum = -12;

this.tb80Hz.Name = "tb80Hz";

this.tb80Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb80Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb80Hz.Size = new System.Drawing.Size(45, 97);

this.tb80Hz.TabIndex = 12;

this.tb80Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb80Hz.Scroll += new System.EventHandler(this.tb80Hz_Scroll);

//

// tb100Hz

//

this.tb100Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb100Hz.Location = new System.Drawing.Point(712, 34);

this.tb100Hz.Maximum = 12;

this.tb100Hz.Minimum = -12;

this.tb100Hz.Name = "tb100Hz";

this.tb100Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb100Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb100Hz.Size = new System.Drawing.Size(45, 97);

this.tb100Hz.TabIndex = 13;

this.tb100Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb100Hz.Scroll += new System.EventHandler(this.tb100Hz_Scroll);

//

// tb125Hz

//

this.tb125Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb125Hz.Location = new System.Drawing.Point(772, 34);

Page 411: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

411

this.tb125Hz.Maximum = 12;

this.tb125Hz.Minimum = -12;

this.tb125Hz.Name = "tb125Hz";

this.tb125Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb125Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb125Hz.Size = new System.Drawing.Size(45, 97);

this.tb125Hz.TabIndex = 14;

this.tb125Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb125Hz.Scroll += new System.EventHandler(this.tb125Hz_Scroll);

//

// tb160Hz

//

this.tb160Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb160Hz.Location = new System.Drawing.Point(833, 34);

this.tb160Hz.Maximum = 12;

this.tb160Hz.Minimum = -12;

this.tb160Hz.Name = "tb160Hz";

this.tb160Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb160Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb160Hz.Size = new System.Drawing.Size(45, 97);

this.tb160Hz.TabIndex = 15;

this.tb160Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb160Hz.Scroll += new System.EventHandler(this.tb160Hz_Scroll);

//

// tbGuanyGlobal

//

this.tbGuanyGlobal.BackColor = System.Drawing.Color.LightYellow;

this.tbGuanyGlobal.Location = new System.Drawing.Point(154, 44);

this.tbGuanyGlobal.Maximum = 15;

this.tbGuanyGlobal.Minimum = -15;

this.tbGuanyGlobal.Name = "tbGuanyGlobal";

this.tbGuanyGlobal.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuanyGlobal.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuanyGlobal.Size = new System.Drawing.Size(45, 137);

this.tbGuanyGlobal.TabIndex = 16;

this.tbGuanyGlobal.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuanyGlobal.Scroll += new System.EventHandler(this.tbGuanyGlobal_Scroll);

//

// tbLimitador

//

this.tbLimitador.BackColor = System.Drawing.Color.LightYellow;

Page 412: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

412

this.tbLimitador.Location = new System.Drawing.Point(54, 44);

this.tbLimitador.Maximum = 20;

this.tbLimitador.Minimum = -80;

this.tbLimitador.Name = "tbLimitador";

this.tbLimitador.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbLimitador.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbLimitador.Size = new System.Drawing.Size(45, 137);

this.tbLimitador.TabIndex = 17;

this.tbLimitador.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbLimitador.Value = 20;

this.tbLimitador.Scroll += new System.EventHandler(this.tbLimitador_Scroll);

//

// etGuany25Hz

//

this.etGuany25Hz.AutoSize = true;

this.etGuany25Hz.Location = new System.Drawing.Point(349, 18);

this.etGuany25Hz.Name = "etGuany25Hz";

this.etGuany25Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany25Hz.TabIndex = 18;

this.etGuany25Hz.Text = "G = 0 dB";

//

// etGuany31coma5Hz

//

this.etGuany31coma5Hz.AutoSize = true;

this.etGuany31coma5Hz.Location = new System.Drawing.Point(408, 18);

this.etGuany31coma5Hz.Name = "etGuany31coma5Hz";

this.etGuany31coma5Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany31coma5Hz.TabIndex = 19;

this.etGuany31coma5Hz.Text = "G = 0 dB";

//

// etGuany40Hz

//

this.etGuany40Hz.AutoSize = true;

this.etGuany40Hz.Location = new System.Drawing.Point(468, 18);

this.etGuany40Hz.Name = "etGuany40Hz";

this.etGuany40Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany40Hz.TabIndex = 20;

this.etGuany40Hz.Text = "G = 0 dB";

//

// etGuany50Hz

//

this.etGuany50Hz.AutoSize = true;

Page 413: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

413

this.etGuany50Hz.Location = new System.Drawing.Point(528, 18);

this.etGuany50Hz.Name = "etGuany50Hz";

this.etGuany50Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany50Hz.TabIndex = 21;

this.etGuany50Hz.Text = "G = 0 dB";

//

// etGuany63Hz

//

this.etGuany63Hz.AutoSize = true;

this.etGuany63Hz.Location = new System.Drawing.Point(588, 18);

this.etGuany63Hz.Name = "etGuany63Hz";

this.etGuany63Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany63Hz.TabIndex = 22;

this.etGuany63Hz.Text = "G = 0 dB";

//

// etGuany80Hz

//

this.etGuany80Hz.AutoSize = true;

this.etGuany80Hz.Location = new System.Drawing.Point(648, 18);

this.etGuany80Hz.Name = "etGuany80Hz";

this.etGuany80Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany80Hz.TabIndex = 23;

this.etGuany80Hz.Text = "G = 0 dB";

//

// etGuany100Hz

//

this.etGuany100Hz.AutoSize = true;

this.etGuany100Hz.Location = new System.Drawing.Point(708, 18);

this.etGuany100Hz.Name = "etGuany100Hz";

this.etGuany100Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany100Hz.TabIndex = 24;

this.etGuany100Hz.Text = "G = 0 dB";

//

// etGuany125Hz

//

this.etGuany125Hz.AutoSize = true;

this.etGuany125Hz.Location = new System.Drawing.Point(768, 18);

this.etGuany125Hz.Name = "etGuany125Hz";

this.etGuany125Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany125Hz.TabIndex = 25;

this.etGuany125Hz.Text = "G = 0 dB";

//

Page 414: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

414

// etGuany160Hz

//

this.etGuany160Hz.AutoSize = true;

this.etGuany160Hz.Location = new System.Drawing.Point(829, 18);

this.etGuany160Hz.Name = "etGuany160Hz";

this.etGuany160Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany160Hz.TabIndex = 26;

this.etGuany160Hz.Text = "G = 0 dB";

//

// etMes12dBDretaFila1

//

this.etMes12dBDretaFila1.AutoSize = true;

this.etMes12dBDretaFila1.Location = new System.Drawing.Point(884, 34);

this.etMes12dBDretaFila1.Name = "etMes12dBDretaFila1";

this.etMes12dBDretaFila1.Size = new System.Drawing.Size(41, 13);

this.etMes12dBDretaFila1.TabIndex = 27;

this.etMes12dBDretaFila1.Text = "+12 dB";

//

// et0dBDretaFila1

//

this.et0dBDretaFila1.AutoSize = true;

this.et0dBDretaFila1.Location = new System.Drawing.Point(884, 75);

this.et0dBDretaFila1.Name = "et0dBDretaFila1";

this.et0dBDretaFila1.Size = new System.Drawing.Size(29, 13);

this.et0dBDretaFila1.TabIndex = 28;

this.et0dBDretaFila1.Text = "0 dB";

//

// etMenys12dBDretaFila1

//

this.etMenys12dBDretaFila1.AutoSize = true;

this.etMenys12dBDretaFila1.Location = new System.Drawing.Point(884, 118);

this.etMenys12dBDretaFila1.Name = "etMenys12dBDretaFila1";

this.etMenys12dBDretaFila1.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBDretaFila1.TabIndex = 29;

this.etMenys12dBDretaFila1.Text = "-12 dB";

//

// etFreqCentral25Hz

//

this.etFreqCentral25Hz.AutoSize = true;

this.etFreqCentral25Hz.Location = new System.Drawing.Point(349, 134);

this.etFreqCentral25Hz.Name = "etFreqCentral25Hz";

this.etFreqCentral25Hz.Size = new System.Drawing.Size(35, 13);

Page 415: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

415

this.etFreqCentral25Hz.TabIndex = 30;

this.etFreqCentral25Hz.Text = "25 Hz";

//

// etFreqCentral31coma5Hz

//

this.etFreqCentral31coma5Hz.AutoSize = true;

this.etFreqCentral31coma5Hz.Location = new System.Drawing.Point(408, 134);

this.etFreqCentral31coma5Hz.Name = "etFreqCentral31coma5Hz";

this.etFreqCentral31coma5Hz.Size = new System.Drawing.Size(44, 13);

this.etFreqCentral31coma5Hz.TabIndex = 31;

this.etFreqCentral31coma5Hz.Text = "31,5 Hz";

//

// etFreqCentral40Hz

//

this.etFreqCentral40Hz.AutoSize = true;

this.etFreqCentral40Hz.Location = new System.Drawing.Point(468, 134);

this.etFreqCentral40Hz.Name = "etFreqCentral40Hz";

this.etFreqCentral40Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral40Hz.TabIndex = 32;

this.etFreqCentral40Hz.Text = "40 Hz";

//

// etFreqCentral50Hz

//

this.etFreqCentral50Hz.AutoSize = true;

this.etFreqCentral50Hz.Location = new System.Drawing.Point(528, 134);

this.etFreqCentral50Hz.Name = "etFreqCentral50Hz";

this.etFreqCentral50Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral50Hz.TabIndex = 33;

this.etFreqCentral50Hz.Text = "50 Hz";

//

// etFreqCentral63Hz

//

this.etFreqCentral63Hz.AutoSize = true;

this.etFreqCentral63Hz.Location = new System.Drawing.Point(589, 134);

this.etFreqCentral63Hz.Name = "etFreqCentral63Hz";

this.etFreqCentral63Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral63Hz.TabIndex = 34;

this.etFreqCentral63Hz.Text = "63 Hz";

//

// etFreqCentral80Hz

//

this.etFreqCentral80Hz.AutoSize = true;

Page 416: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

416

this.etFreqCentral80Hz.Location = new System.Drawing.Point(649, 134);

this.etFreqCentral80Hz.Name = "etFreqCentral80Hz";

this.etFreqCentral80Hz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral80Hz.TabIndex = 35;

this.etFreqCentral80Hz.Text = "80 Hz";

//

// etFreqCentral100Hz

//

this.etFreqCentral100Hz.AutoSize = true;

this.etFreqCentral100Hz.Location = new System.Drawing.Point(708, 134);

this.etFreqCentral100Hz.Name = "etFreqCentral100Hz";

this.etFreqCentral100Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral100Hz.TabIndex = 36;

this.etFreqCentral100Hz.Text = "100 Hz";

//

// etFreqCentral125Hz

//

this.etFreqCentral125Hz.AutoSize = true;

this.etFreqCentral125Hz.Location = new System.Drawing.Point(770, 134);

this.etFreqCentral125Hz.Name = "etFreqCentral125Hz";

this.etFreqCentral125Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral125Hz.TabIndex = 37;

this.etFreqCentral125Hz.Text = "125 Hz";

//

// etFreqCentral160Hz

//

this.etFreqCentral160Hz.AutoSize = true;

this.etFreqCentral160Hz.Location = new System.Drawing.Point(830, 134);

this.etFreqCentral160Hz.Name = "etFreqCentral160Hz";

this.etFreqCentral160Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral160Hz.TabIndex = 38;

this.etFreqCentral160Hz.Text = "160 Hz";

//

// etGuany

//

this.etGuany.AutoSize = true;

this.etGuany.Location = new System.Drawing.Point(151, 194);

this.etGuany.Name = "etGuany";

this.etGuany.Size = new System.Drawing.Size(45, 13);

this.etGuany.TabIndex = 39;

this.etGuany.Text = "GUANY";

//

Page 417: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

417

// etLimitacioTextFixe

//

this.etLimitacioTextFixe.AutoSize = true;

this.etLimitacioTextFixe.Location = new System.Drawing.Point(44, 194);

this.etLimitacioTextFixe.Name = "etLimitacioTextFixe";

this.etLimitacioTextFixe.Size = new System.Drawing.Size(60, 13);

this.etLimitacioTextFixe.TabIndex = 40;

this.etLimitacioTextFixe.Text = "LIMITACIÓ";

//

// etGuanyGlobal

//

this.etGuanyGlobal.AutoSize = true;

this.etGuanyGlobal.Location = new System.Drawing.Point(150, 19);

this.etGuanyGlobal.Name = "etGuanyGlobal";

this.etGuanyGlobal.Size = new System.Drawing.Size(49, 13);

this.etGuanyGlobal.TabIndex = 41;

this.etGuanyGlobal.Text = "G = 0 dB";

//

// etLimitador

//

this.etLimitador.AutoSize = true;

this.etLimitador.Location = new System.Drawing.Point(51, 19);

this.etLimitador.Name = "etLimitador";

this.etLimitador.Size = new System.Drawing.Size(53, 13);

this.etLimitador.TabIndex = 42;

this.etLimitador.Text = "L = 20 dB";

//

// etMes15dBGuanyGlobal

//

this.etMes15dBGuanyGlobal.AutoSize = true;

this.etMes15dBGuanyGlobal.Location = new System.Drawing.Point(107, 44);

this.etMes15dBGuanyGlobal.Name = "etMes15dBGuanyGlobal";

this.etMes15dBGuanyGlobal.Size = new System.Drawing.Size(41, 13);

this.etMes15dBGuanyGlobal.TabIndex = 43;

this.etMes15dBGuanyGlobal.Text = "+15 dB";

//

// etMes20dBLimitador

//

this.etMes20dBLimitador.AutoSize = true;

this.etMes20dBLimitador.Location = new System.Drawing.Point(7, 44);

this.etMes20dBLimitador.Name = "etMes20dBLimitador";

this.etMes20dBLimitador.Size = new System.Drawing.Size(41, 13);

Page 418: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

418

this.etMes20dBLimitador.TabIndex = 44;

this.etMes20dBLimitador.Text = "+20 dB";

//

// etMenys15dBGuanyGlobal

//

this.etMenys15dBGuanyGlobal.AutoSize = true;

this.etMenys15dBGuanyGlobal.Location = new System.Drawing.Point(110, 168);

this.etMenys15dBGuanyGlobal.Name = "etMenys15dBGuanyGlobal";

this.etMenys15dBGuanyGlobal.Size = new System.Drawing.Size(38, 13);

this.etMenys15dBGuanyGlobal.TabIndex = 45;

this.etMenys15dBGuanyGlobal.Text = "-15 dB";

//

// etMenys80dBLimitador

//

this.etMenys80dBLimitador.AutoSize = true;

this.etMenys80dBLimitador.Location = new System.Drawing.Point(10, 168);

this.etMenys80dBLimitador.Name = "etMenys80dBLimitador";

this.etMenys80dBLimitador.Size = new System.Drawing.Size(38, 13);

this.etMenys80dBLimitador.TabIndex = 46;

this.etMenys80dBLimitador.Text = "-80 dB";

//

// et0dBGuanyGlobal

//

this.et0dBGuanyGlobal.AutoSize = true;

this.et0dBGuanyGlobal.Location = new System.Drawing.Point(119, 106);

this.et0dBGuanyGlobal.Name = "et0dBGuanyGlobal";

this.et0dBGuanyGlobal.Size = new System.Drawing.Size(29, 13);

this.et0dBGuanyGlobal.TabIndex = 47;

this.et0dBGuanyGlobal.Text = "0 dB";

//

// et0dBLimitador

//

this.et0dBLimitador.AutoSize = true;

this.et0dBLimitador.Location = new System.Drawing.Point(19, 70);

this.et0dBLimitador.Name = "et0dBLimitador";

this.et0dBLimitador.Size = new System.Drawing.Size(29, 13);

this.et0dBLimitador.TabIndex = 48;

this.et0dBLimitador.Text = "0 dB";

//

// btCarregarEq

//

this.btCarregarEq.Location = new System.Drawing.Point(54, 474);

Page 419: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

419

this.btCarregarEq.Name = "btCarregarEq";

this.btCarregarEq.Size = new System.Drawing.Size(94, 23);

this.btCarregarEq.TabIndex = 49;

this.btCarregarEq.Text = "CARREGAR EQ";

this.btCarregarEq.UseVisualStyleBackColor = true;

this.btCarregarEq.Click += new System.EventHandler(this.btCarregarEq_Click);

//

// btGuardarEq

//

this.btGuardarEq.Location = new System.Drawing.Point(251, 474);

this.btGuardarEq.Name = "btGuardarEq";

this.btGuardarEq.Size = new System.Drawing.Size(90, 23);

this.btGuardarEq.TabIndex = 50;

this.btGuardarEq.Text = "GUARDAR EQ";

this.btGuardarEq.UseVisualStyleBackColor = true;

this.btGuardarEq.Click += new System.EventHandler(this.btGuardarEq_Click);

//

// btEqOK

//

this.btEqOK.Location = new System.Drawing.Point(652, 474);

this.btEqOK.Name = "btEqOK";

this.btEqOK.Size = new System.Drawing.Size(75, 23);

this.btEqOK.TabIndex = 51;

this.btEqOK.Text = "EQ OK";

this.btEqOK.UseVisualStyleBackColor = true;

this.btEqOK.Click += new System.EventHandler(this.btEqOK_Click);

//

// btCancelar

//

this.btCancelar.Location = new System.Drawing.Point(823, 474);

this.btCancelar.Name = "btCancelar";

this.btCancelar.Size = new System.Drawing.Size(98, 23);

this.btCancelar.TabIndex = 52;

this.btCancelar.Text = "CANCEL.LAR";

this.btCancelar.UseVisualStyleBackColor = true;

this.btCancelar.Click += new System.EventHandler(this.btCancelar_Click);

//

// tbHighCut

//

this.tbHighCut.BackColor = System.Drawing.Color.LightYellow;

this.tbHighCut.Location = new System.Drawing.Point(154, 284);

this.tbHighCut.Maximum = 20000;

Page 420: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

420

this.tbHighCut.Minimum = 2500;

this.tbHighCut.Name = "tbHighCut";

this.tbHighCut.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbHighCut.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbHighCut.Size = new System.Drawing.Size(45, 137);

this.tbHighCut.TabIndex = 53;

this.tbHighCut.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbHighCut.Value = 20000;

this.tbHighCut.Scroll += new System.EventHandler(this.tbHighCut_Scroll);

//

// tbLowCut

//

this.tbLowCut.BackColor = System.Drawing.Color.LightYellow;

this.tbLowCut.Location = new System.Drawing.Point(54, 284);

this.tbLowCut.Maximum = 400;

this.tbLowCut.Minimum = 20;

this.tbLowCut.Name = "tbLowCut";

this.tbLowCut.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbLowCut.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbLowCut.Size = new System.Drawing.Size(45, 137);

this.tbLowCut.TabIndex = 54;

this.tbLowCut.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbLowCut.Value = 20;

this.tbLowCut.Scroll += new System.EventHandler(this.tbLowCut_Scroll);

//

// etFreqHighCut

//

this.etFreqHighCut.AutoSize = true;

this.etFreqHighCut.Location = new System.Drawing.Point(151, 259);

this.etFreqHighCut.Name = "etFreqHighCut";

this.etFreqHighCut.Size = new System.Drawing.Size(80, 13);

this.etFreqHighCut.TabIndex = 55;

this.etFreqHighCut.Text = "HC = 20000 Hz";

//

// etFreqLowCut

//

this.etFreqLowCut.AutoSize = true;

this.etFreqLowCut.Location = new System.Drawing.Point(55, 259);

this.etFreqLowCut.Name = "etFreqLowCut";

this.etFreqLowCut.Size = new System.Drawing.Size(60, 13);

this.etFreqLowCut.TabIndex = 56;

this.etFreqLowCut.Text = "LC = 20 Hz";

Page 421: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

421

//

// etHighCut

//

this.etHighCut.AutoSize = true;

this.etHighCut.Location = new System.Drawing.Point(151, 433);

this.etHighCut.Name = "etHighCut";

this.etHighCut.Size = new System.Drawing.Size(59, 13);

this.etHighCut.TabIndex = 57;

this.etHighCut.Text = "HIGH CUT";

//

// etLowCut

//

this.etLowCut.AutoSize = true;

this.etLowCut.Location = new System.Drawing.Point(51, 433);

this.etLowCut.Name = "etLowCut";

this.etLowCut.Size = new System.Drawing.Size(57, 13);

this.etLowCut.TabIndex = 58;

this.etLowCut.Text = "LOW CUT";

//

// etHighCut20kHz

//

this.etHighCut20kHz.AutoSize = true;

this.etHighCut20kHz.Location = new System.Drawing.Point(110, 284);

this.etHighCut20kHz.Name = "etHighCut20kHz";

this.etHighCut20kHz.Size = new System.Drawing.Size(41, 13);

this.etHighCut20kHz.TabIndex = 59;

this.etHighCut20kHz.Text = "20 kHz";

//

// etHighCut2500Hz

//

this.etHighCut2500Hz.AutoSize = true;

this.etHighCut2500Hz.Location = new System.Drawing.Point(110, 399);

this.etHighCut2500Hz.Name = "etHighCut2500Hz";

this.etHighCut2500Hz.Size = new System.Drawing.Size(44, 13);

this.etHighCut2500Hz.TabIndex = 60;

this.etHighCut2500Hz.Text = "2,5 kHz";

//

// etLowCut20Hz

//

this.etLowCut20Hz.AutoSize = true;

this.etLowCut20Hz.Location = new System.Drawing.Point(12, 399);

this.etLowCut20Hz.Name = "etLowCut20Hz";

Page 422: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

422

this.etLowCut20Hz.Size = new System.Drawing.Size(35, 13);

this.etLowCut20Hz.TabIndex = 61;

this.etLowCut20Hz.Text = "20 Hz";

//

// etLowCut400Hz

//

this.etLowCut400Hz.AutoSize = true;

this.etLowCut400Hz.Location = new System.Drawing.Point(12, 284);

this.etLowCut400Hz.Name = "etLowCut400Hz";

this.etLowCut400Hz.Size = new System.Drawing.Size(41, 13);

this.etLowCut400Hz.TabIndex = 62;

this.etLowCut400Hz.Text = "400 Hz";

//

// etFreqCentral1600Hz

//

this.etFreqCentral1600Hz.AutoSize = true;

this.etFreqCentral1600Hz.Location = new System.Drawing.Point(829, 284);

this.etFreqCentral1600Hz.Name = "etFreqCentral1600Hz";

this.etFreqCentral1600Hz.Size = new System.Drawing.Size(44, 13);

this.etFreqCentral1600Hz.TabIndex = 98;

this.etFreqCentral1600Hz.Text = "1,6 kHz";

//

// etFreqCentral1250Hz

//

this.etFreqCentral1250Hz.AutoSize = true;

this.etFreqCentral1250Hz.Location = new System.Drawing.Point(769, 284);

this.etFreqCentral1250Hz.Name = "etFreqCentral1250Hz";

this.etFreqCentral1250Hz.Size = new System.Drawing.Size(50, 13);

this.etFreqCentral1250Hz.TabIndex = 97;

this.etFreqCentral1250Hz.Text = "1,25 kHz";

//

// etFreqCentral1kHz

//

this.etFreqCentral1kHz.AutoSize = true;

this.etFreqCentral1kHz.Location = new System.Drawing.Point(707, 284);

this.etFreqCentral1kHz.Name = "etFreqCentral1kHz";

this.etFreqCentral1kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral1kHz.TabIndex = 96;

this.etFreqCentral1kHz.Text = "1 kHz";

//

// etFreqCentral800Hz

//

Page 423: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

423

this.etFreqCentral800Hz.AutoSize = true;

this.etFreqCentral800Hz.Location = new System.Drawing.Point(648, 284);

this.etFreqCentral800Hz.Name = "etFreqCentral800Hz";

this.etFreqCentral800Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral800Hz.TabIndex = 95;

this.etFreqCentral800Hz.Text = "800 Hz";

//

// etFreqCentral630Hz

//

this.etFreqCentral630Hz.AutoSize = true;

this.etFreqCentral630Hz.Location = new System.Drawing.Point(588, 284);

this.etFreqCentral630Hz.Name = "etFreqCentral630Hz";

this.etFreqCentral630Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral630Hz.TabIndex = 94;

this.etFreqCentral630Hz.Text = "630 Hz";

//

// etFreqCentral500Hz

//

this.etFreqCentral500Hz.AutoSize = true;

this.etFreqCentral500Hz.Location = new System.Drawing.Point(527, 284);

this.etFreqCentral500Hz.Name = "etFreqCentral500Hz";

this.etFreqCentral500Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral500Hz.TabIndex = 93;

this.etFreqCentral500Hz.Text = "500 Hz";

//

// etFreqCentral400Hz

//

this.etFreqCentral400Hz.AutoSize = true;

this.etFreqCentral400Hz.Location = new System.Drawing.Point(467, 284);

this.etFreqCentral400Hz.Name = "etFreqCentral400Hz";

this.etFreqCentral400Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral400Hz.TabIndex = 92;

this.etFreqCentral400Hz.Text = "400 Hz";

//

// etFreqCentral315Hz

//

this.etFreqCentral315Hz.AutoSize = true;

this.etFreqCentral315Hz.Location = new System.Drawing.Point(407, 284);

this.etFreqCentral315Hz.Name = "etFreqCentral315Hz";

this.etFreqCentral315Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral315Hz.TabIndex = 91;

this.etFreqCentral315Hz.Text = "315 Hz";

Page 424: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

424

//

// etFreqCentral250Hz

//

this.etFreqCentral250Hz.AutoSize = true;

this.etFreqCentral250Hz.Location = new System.Drawing.Point(348, 284);

this.etFreqCentral250Hz.Name = "etFreqCentral250Hz";

this.etFreqCentral250Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral250Hz.TabIndex = 90;

this.etFreqCentral250Hz.Text = "250 Hz";

//

// etMenys12dBDretaFila2

//

this.etMenys12dBDretaFila2.AutoSize = true;

this.etMenys12dBDretaFila2.Location = new System.Drawing.Point(883, 268);

this.etMenys12dBDretaFila2.Name = "etMenys12dBDretaFila2";

this.etMenys12dBDretaFila2.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBDretaFila2.TabIndex = 89;

this.etMenys12dBDretaFila2.Text = "-12 dB";

//

// et0dBDretaFila2

//

this.et0dBDretaFila2.AutoSize = true;

this.et0dBDretaFila2.Location = new System.Drawing.Point(883, 225);

this.et0dBDretaFila2.Name = "et0dBDretaFila2";

this.et0dBDretaFila2.Size = new System.Drawing.Size(29, 13);

this.et0dBDretaFila2.TabIndex = 88;

this.et0dBDretaFila2.Text = "0 dB";

//

// etMes12dBDretaFila2

//

this.etMes12dBDretaFila2.AutoSize = true;

this.etMes12dBDretaFila2.Location = new System.Drawing.Point(883, 184);

this.etMes12dBDretaFila2.Name = "etMes12dBDretaFila2";

this.etMes12dBDretaFila2.Size = new System.Drawing.Size(41, 13);

this.etMes12dBDretaFila2.TabIndex = 87;

this.etMes12dBDretaFila2.Text = "+12 dB";

//

// etGuany1600Hz

//

this.etGuany1600Hz.AutoSize = true;

this.etGuany1600Hz.Location = new System.Drawing.Point(828, 168);

this.etGuany1600Hz.Name = "etGuany1600Hz";

Page 425: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

425

this.etGuany1600Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany1600Hz.TabIndex = 86;

this.etGuany1600Hz.Text = "G = 0 dB";

//

// etGuany1250Hz

//

this.etGuany1250Hz.AutoSize = true;

this.etGuany1250Hz.Location = new System.Drawing.Point(767, 168);

this.etGuany1250Hz.Name = "etGuany1250Hz";

this.etGuany1250Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany1250Hz.TabIndex = 85;

this.etGuany1250Hz.Text = "G = 0 dB";

//

// etGuany1000Hz

//

this.etGuany1000Hz.AutoSize = true;

this.etGuany1000Hz.Location = new System.Drawing.Point(707, 168);

this.etGuany1000Hz.Name = "etGuany1000Hz";

this.etGuany1000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany1000Hz.TabIndex = 84;

this.etGuany1000Hz.Text = "G = 0 dB";

//

// etGuany800Hz

//

this.etGuany800Hz.AutoSize = true;

this.etGuany800Hz.Location = new System.Drawing.Point(647, 168);

this.etGuany800Hz.Name = "etGuany800Hz";

this.etGuany800Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany800Hz.TabIndex = 83;

this.etGuany800Hz.Text = "G = 0 dB";

//

// etGuany630Hz

//

this.etGuany630Hz.AutoSize = true;

this.etGuany630Hz.Location = new System.Drawing.Point(587, 168);

this.etGuany630Hz.Name = "etGuany630Hz";

this.etGuany630Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany630Hz.TabIndex = 82;

this.etGuany630Hz.Text = "G = 0 dB";

//

// etGuany500Hz

//

Page 426: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

426

this.etGuany500Hz.AutoSize = true;

this.etGuany500Hz.Location = new System.Drawing.Point(527, 168);

this.etGuany500Hz.Name = "etGuany500Hz";

this.etGuany500Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany500Hz.TabIndex = 81;

this.etGuany500Hz.Text = "G = 0 dB";

//

// etGuany400Hz

//

this.etGuany400Hz.AutoSize = true;

this.etGuany400Hz.Location = new System.Drawing.Point(467, 168);

this.etGuany400Hz.Name = "etGuany400Hz";

this.etGuany400Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany400Hz.TabIndex = 80;

this.etGuany400Hz.Text = "G = 0 dB";

//

// etGuany315Hz

//

this.etGuany315Hz.AutoSize = true;

this.etGuany315Hz.Location = new System.Drawing.Point(407, 168);

this.etGuany315Hz.Name = "etGuany315Hz";

this.etGuany315Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany315Hz.TabIndex = 79;

this.etGuany315Hz.Text = "G = 0 dB";

//

// etGuany250Hz

//

this.etGuany250Hz.AutoSize = true;

this.etGuany250Hz.Location = new System.Drawing.Point(348, 168);

this.etGuany250Hz.Name = "etGuany250Hz";

this.etGuany250Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany250Hz.TabIndex = 78;

this.etGuany250Hz.Text = "G = 0 dB";

//

// tb1600Hz

//

this.tb1600Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb1600Hz.Location = new System.Drawing.Point(832, 184);

this.tb1600Hz.Maximum = 12;

this.tb1600Hz.Minimum = -12;

this.tb1600Hz.Name = "tb1600Hz";

this.tb1600Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 427: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

427

this.tb1600Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb1600Hz.Size = new System.Drawing.Size(45, 97);

this.tb1600Hz.TabIndex = 77;

this.tb1600Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb1600Hz.Scroll += new System.EventHandler(this.tb1600Hz_Scroll);

//

// tb1250Hz

//

this.tb1250Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb1250Hz.Location = new System.Drawing.Point(771, 184);

this.tb1250Hz.Maximum = 12;

this.tb1250Hz.Minimum = -12;

this.tb1250Hz.Name = "tb1250Hz";

this.tb1250Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb1250Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb1250Hz.Size = new System.Drawing.Size(45, 97);

this.tb1250Hz.TabIndex = 76;

this.tb1250Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb1250Hz.Scroll += new System.EventHandler(this.tb1250Hz_Scroll);

//

// tb1000Hz

//

this.tb1000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb1000Hz.Location = new System.Drawing.Point(711, 184);

this.tb1000Hz.Maximum = 12;

this.tb1000Hz.Minimum = -12;

this.tb1000Hz.Name = "tb1000Hz";

this.tb1000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb1000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb1000Hz.Size = new System.Drawing.Size(45, 97);

this.tb1000Hz.TabIndex = 75;

this.tb1000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb1000Hz.Scroll += new System.EventHandler(this.tb1000Hz_Scroll);

//

// tb800Hz

//

this.tb800Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb800Hz.Location = new System.Drawing.Point(651, 184);

this.tb800Hz.Maximum = 12;

this.tb800Hz.Minimum = -12;

this.tb800Hz.Name = "tb800Hz";

this.tb800Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 428: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

428

this.tb800Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb800Hz.Size = new System.Drawing.Size(45, 97);

this.tb800Hz.TabIndex = 74;

this.tb800Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb800Hz.Scroll += new System.EventHandler(this.tb800Hz_Scroll);

//

// tb630Hz

//

this.tb630Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb630Hz.Location = new System.Drawing.Point(591, 184);

this.tb630Hz.Maximum = 12;

this.tb630Hz.Minimum = -12;

this.tb630Hz.Name = "tb630Hz";

this.tb630Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb630Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb630Hz.Size = new System.Drawing.Size(45, 97);

this.tb630Hz.TabIndex = 73;

this.tb630Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb630Hz.Scroll += new System.EventHandler(this.tb630Hz_Scroll);

//

// tb500Hz

//

this.tb500Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb500Hz.Location = new System.Drawing.Point(531, 184);

this.tb500Hz.Maximum = 12;

this.tb500Hz.Minimum = -12;

this.tb500Hz.Name = "tb500Hz";

this.tb500Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb500Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb500Hz.Size = new System.Drawing.Size(45, 97);

this.tb500Hz.TabIndex = 72;

this.tb500Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb500Hz.Scroll += new System.EventHandler(this.tb500Hz_Scroll);

//

// tb400Hz

//

this.tb400Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb400Hz.Location = new System.Drawing.Point(471, 184);

this.tb400Hz.Maximum = 12;

this.tb400Hz.Minimum = -12;

this.tb400Hz.Name = "tb400Hz";

this.tb400Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 429: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

429

this.tb400Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb400Hz.Size = new System.Drawing.Size(45, 97);

this.tb400Hz.TabIndex = 71;

this.tb400Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb400Hz.Scroll += new System.EventHandler(this.tb400Hz_Scroll);

//

// tb315Hz

//

this.tb315Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb315Hz.Location = new System.Drawing.Point(410, 184);

this.tb315Hz.Maximum = 12;

this.tb315Hz.Minimum = -12;

this.tb315Hz.Name = "tb315Hz";

this.tb315Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb315Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb315Hz.Size = new System.Drawing.Size(45, 97);

this.tb315Hz.TabIndex = 70;

this.tb315Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb315Hz.Scroll += new System.EventHandler(this.tb315Hz_Scroll);

//

// tb250Hz

//

this.tb250Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb250Hz.Location = new System.Drawing.Point(351, 184);

this.tb250Hz.Maximum = 12;

this.tb250Hz.Minimum = -12;

this.tb250Hz.Name = "tb250Hz";

this.tb250Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb250Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb250Hz.Size = new System.Drawing.Size(45, 97);

this.tb250Hz.TabIndex = 69;

this.tb250Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb250Hz.Scroll += new System.EventHandler(this.tb250Hz_Scroll);

//

// et0dBEsqFila2

//

this.et0dBEsqFila2.AutoSize = true;

this.et0dBEsqFila2.Location = new System.Drawing.Point(256, 225);

this.et0dBEsqFila2.Name = "et0dBEsqFila2";

this.et0dBEsqFila2.Size = new System.Drawing.Size(29, 13);

this.et0dBEsqFila2.TabIndex = 68;

this.et0dBEsqFila2.Text = "0 dB";

Page 430: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

430

//

// etGuany200Hz

//

this.etGuany200Hz.AutoSize = true;

this.etGuany200Hz.Location = new System.Drawing.Point(289, 168);

this.etGuany200Hz.Name = "etGuany200Hz";

this.etGuany200Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany200Hz.TabIndex = 67;

this.etGuany200Hz.Text = "G = 0 dB";

//

// etFreqCentral200Hz

//

this.etFreqCentral200Hz.AutoSize = true;

this.etFreqCentral200Hz.Location = new System.Drawing.Point(289, 284);

this.etFreqCentral200Hz.Name = "etFreqCentral200Hz";

this.etFreqCentral200Hz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral200Hz.TabIndex = 66;

this.etFreqCentral200Hz.Text = "200 Hz";

//

// etMenys12dBEsqFila2

//

this.etMenys12dBEsqFila2.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.etMenys12dBEsqFila2.AutoSize = true;

this.etMenys12dBEsqFila2.Location = new System.Drawing.Point(248, 268);

this.etMenys12dBEsqFila2.Name = "etMenys12dBEsqFila2";

this.etMenys12dBEsqFila2.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBEsqFila2.TabIndex = 65;

this.etMenys12dBEsqFila2.Text = "-12 dB";

//

// etMes12dBEsqFila2

//

this.etMes12dBEsqFila2.AutoSize = true;

this.etMes12dBEsqFila2.Location = new System.Drawing.Point(245, 184);

this.etMes12dBEsqFila2.Name = "etMes12dBEsqFila2";

this.etMes12dBEsqFila2.Size = new System.Drawing.Size(41, 13);

this.etMes12dBEsqFila2.TabIndex = 64;

this.etMes12dBEsqFila2.Text = "+12 dB";

//

// tb200Hz

//

this.tb200Hz.BackColor = System.Drawing.Color.LightYellow;

Page 431: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

431

this.tb200Hz.Location = new System.Drawing.Point(291, 184);

this.tb200Hz.Maximum = 12;

this.tb200Hz.Minimum = -12;

this.tb200Hz.Name = "tb200Hz";

this.tb200Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb200Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb200Hz.Size = new System.Drawing.Size(45, 97);

this.tb200Hz.TabIndex = 63;

this.tb200Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb200Hz.Scroll += new System.EventHandler(this.tb200Hz_Scroll);

//

// etFreqCentral16kHz

//

this.etFreqCentral16kHz.AutoSize = true;

this.etFreqCentral16kHz.Location = new System.Drawing.Point(828, 433);

this.etFreqCentral16kHz.Name = "etFreqCentral16kHz";

this.etFreqCentral16kHz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral16kHz.TabIndex = 134;

this.etFreqCentral16kHz.Text = "16 kHz";

//

// etFreqCentral12500Hz

//

this.etFreqCentral12500Hz.AutoSize = true;

this.etFreqCentral12500Hz.Location = new System.Drawing.Point(768, 433);

this.etFreqCentral12500Hz.Name = "etFreqCentral12500Hz";

this.etFreqCentral12500Hz.Size = new System.Drawing.Size(50, 13);

this.etFreqCentral12500Hz.TabIndex = 133;

this.etFreqCentral12500Hz.Text = "12,5 kHz";

//

// etFreqCentral10kHz

//

this.etFreqCentral10kHz.AutoSize = true;

this.etFreqCentral10kHz.Location = new System.Drawing.Point(706, 433);

this.etFreqCentral10kHz.Name = "etFreqCentral10kHz";

this.etFreqCentral10kHz.Size = new System.Drawing.Size(41, 13);

this.etFreqCentral10kHz.TabIndex = 132;

this.etFreqCentral10kHz.Text = "10 kHz";

//

// etFreqCentral8kHz

//

this.etFreqCentral8kHz.AutoSize = true;

this.etFreqCentral8kHz.Location = new System.Drawing.Point(647, 433);

Page 432: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

432

this.etFreqCentral8kHz.Name = "etFreqCentral8kHz";

this.etFreqCentral8kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral8kHz.TabIndex = 131;

this.etFreqCentral8kHz.Text = "8 kHz";

//

// etFreqCentral6300Hz

//

this.etFreqCentral6300Hz.AutoSize = true;

this.etFreqCentral6300Hz.Location = new System.Drawing.Point(587, 433);

this.etFreqCentral6300Hz.Name = "etFreqCentral6300Hz";

this.etFreqCentral6300Hz.Size = new System.Drawing.Size(44, 13);

this.etFreqCentral6300Hz.TabIndex = 130;

this.etFreqCentral6300Hz.Text = "6,3 kHz";

//

// etFreqCentral5kHz

//

this.etFreqCentral5kHz.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.etFreqCentral5kHz.AutoSize = true;

this.etFreqCentral5kHz.Location = new System.Drawing.Point(526, 433);

this.etFreqCentral5kHz.Name = "etFreqCentral5kHz";

this.etFreqCentral5kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral5kHz.TabIndex = 129;

this.etFreqCentral5kHz.Text = "5 kHz";

//

// etFreqCentral4kHz

//

this.etFreqCentral4kHz.AutoSize = true;

this.etFreqCentral4kHz.Location = new System.Drawing.Point(466, 433);

this.etFreqCentral4kHz.Name = "etFreqCentral4kHz";

this.etFreqCentral4kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral4kHz.TabIndex = 128;

this.etFreqCentral4kHz.Text = "4 kHz";

//

// etFreqCentral3150Hz

//

this.etFreqCentral3150Hz.AutoSize = true;

this.etFreqCentral3150Hz.Location = new System.Drawing.Point(406, 433);

this.etFreqCentral3150Hz.Name = "etFreqCentral3150Hz";

this.etFreqCentral3150Hz.Size = new System.Drawing.Size(50, 13);

this.etFreqCentral3150Hz.TabIndex = 127;

this.etFreqCentral3150Hz.Text = "3,15 kHz";

Page 433: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

433

//

// etFreqCentral2500Hz

//

this.etFreqCentral2500Hz.AutoSize = true;

this.etFreqCentral2500Hz.Location = new System.Drawing.Point(347, 433);

this.etFreqCentral2500Hz.Name = "etFreqCentral2500Hz";

this.etFreqCentral2500Hz.Size = new System.Drawing.Size(44, 13);

this.etFreqCentral2500Hz.TabIndex = 126;

this.etFreqCentral2500Hz.Text = "2,5 kHz";

//

// etMenys12dBDretaFila3

//

this.etMenys12dBDretaFila3.AutoSize = true;

this.etMenys12dBDretaFila3.Location = new System.Drawing.Point(882, 417);

this.etMenys12dBDretaFila3.Name = "etMenys12dBDretaFila3";

this.etMenys12dBDretaFila3.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBDretaFila3.TabIndex = 125;

this.etMenys12dBDretaFila3.Text = "-12 dB";

//

// et0dBDretaFila3

//

this.et0dBDretaFila3.AutoSize = true;

this.et0dBDretaFila3.Location = new System.Drawing.Point(882, 374);

this.et0dBDretaFila3.Name = "et0dBDretaFila3";

this.et0dBDretaFila3.Size = new System.Drawing.Size(29, 13);

this.et0dBDretaFila3.TabIndex = 124;

this.et0dBDretaFila3.Text = "0 dB";

//

// etMes12dBDretaFila3

//

this.etMes12dBDretaFila3.AutoSize = true;

this.etMes12dBDretaFila3.Location = new System.Drawing.Point(882, 333);

this.etMes12dBDretaFila3.Name = "etMes12dBDretaFila3";

this.etMes12dBDretaFila3.Size = new System.Drawing.Size(41, 13);

this.etMes12dBDretaFila3.TabIndex = 123;

this.etMes12dBDretaFila3.Text = "+12 dB";

//

// etGuany16000Hz

//

this.etGuany16000Hz.AutoSize = true;

this.etGuany16000Hz.Location = new System.Drawing.Point(827, 317);

this.etGuany16000Hz.Name = "etGuany16000Hz";

Page 434: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

434

this.etGuany16000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany16000Hz.TabIndex = 122;

this.etGuany16000Hz.Text = "G = 0 dB";

//

// etGuany12500Hz

//

this.etGuany12500Hz.AutoSize = true;

this.etGuany12500Hz.Location = new System.Drawing.Point(766, 317);

this.etGuany12500Hz.Name = "etGuany12500Hz";

this.etGuany12500Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany12500Hz.TabIndex = 121;

this.etGuany12500Hz.Text = "G = 0 dB";

//

// etGuany10000Hz

//

this.etGuany10000Hz.AutoSize = true;

this.etGuany10000Hz.Location = new System.Drawing.Point(706, 317);

this.etGuany10000Hz.Name = "etGuany10000Hz";

this.etGuany10000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany10000Hz.TabIndex = 120;

this.etGuany10000Hz.Text = "G = 0 dB";

//

// etGuany8000Hz

//

this.etGuany8000Hz.AutoSize = true;

this.etGuany8000Hz.Location = new System.Drawing.Point(646, 317);

this.etGuany8000Hz.Name = "etGuany8000Hz";

this.etGuany8000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany8000Hz.TabIndex = 119;

this.etGuany8000Hz.Text = "G = 0 dB";

//

// etGuany6300Hz

//

this.etGuany6300Hz.AutoSize = true;

this.etGuany6300Hz.Location = new System.Drawing.Point(586, 317);

this.etGuany6300Hz.Name = "etGuany6300Hz";

this.etGuany6300Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany6300Hz.TabIndex = 118;

this.etGuany6300Hz.Text = "G = 0 dB";

//

// etGuany5000Hz

//

Page 435: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

435

this.etGuany5000Hz.AutoSize = true;

this.etGuany5000Hz.Location = new System.Drawing.Point(526, 317);

this.etGuany5000Hz.Name = "etGuany5000Hz";

this.etGuany5000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany5000Hz.TabIndex = 117;

this.etGuany5000Hz.Text = "G = 0 dB";

//

// etGuany4000Hz

//

this.etGuany4000Hz.AutoSize = true;

this.etGuany4000Hz.Location = new System.Drawing.Point(466, 317);

this.etGuany4000Hz.Name = "etGuany4000Hz";

this.etGuany4000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany4000Hz.TabIndex = 116;

this.etGuany4000Hz.Text = "G = 0 dB";

//

// etGuany3150Hz

//

this.etGuany3150Hz.AutoSize = true;

this.etGuany3150Hz.Location = new System.Drawing.Point(406, 317);

this.etGuany3150Hz.Name = "etGuany3150Hz";

this.etGuany3150Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany3150Hz.TabIndex = 115;

this.etGuany3150Hz.Text = "G = 0 dB";

//

// etGuany2500Hz

//

this.etGuany2500Hz.AutoSize = true;

this.etGuany2500Hz.Location = new System.Drawing.Point(347, 317);

this.etGuany2500Hz.Name = "etGuany2500Hz";

this.etGuany2500Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany2500Hz.TabIndex = 114;

this.etGuany2500Hz.Text = "G = 0 dB";

//

// tb16000Hz

//

this.tb16000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb16000Hz.Location = new System.Drawing.Point(831, 333);

this.tb16000Hz.Maximum = 12;

this.tb16000Hz.Minimum = -12;

this.tb16000Hz.Name = "tb16000Hz";

this.tb16000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 436: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

436

this.tb16000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb16000Hz.Size = new System.Drawing.Size(45, 97);

this.tb16000Hz.TabIndex = 113;

this.tb16000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb16000Hz.Scroll += new System.EventHandler(this.tb16000Hz_Scroll);

//

// tb12500Hz

//

this.tb12500Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb12500Hz.Location = new System.Drawing.Point(770, 333);

this.tb12500Hz.Maximum = 12;

this.tb12500Hz.Minimum = -12;

this.tb12500Hz.Name = "tb12500Hz";

this.tb12500Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb12500Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb12500Hz.Size = new System.Drawing.Size(45, 97);

this.tb12500Hz.TabIndex = 112;

this.tb12500Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb12500Hz.Scroll += new System.EventHandler(this.tb12500Hz_Scroll);

//

// tb10000Hz

//

this.tb10000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb10000Hz.Location = new System.Drawing.Point(710, 333);

this.tb10000Hz.Maximum = 12;

this.tb10000Hz.Minimum = -12;

this.tb10000Hz.Name = "tb10000Hz";

this.tb10000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb10000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb10000Hz.Size = new System.Drawing.Size(45, 97);

this.tb10000Hz.TabIndex = 111;

this.tb10000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb10000Hz.Scroll += new System.EventHandler(this.tb10000Hz_Scroll);

//

// tb8000Hz

//

this.tb8000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb8000Hz.Location = new System.Drawing.Point(650, 333);

this.tb8000Hz.Maximum = 12;

this.tb8000Hz.Minimum = -12;

this.tb8000Hz.Name = "tb8000Hz";

this.tb8000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 437: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

437

this.tb8000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb8000Hz.Size = new System.Drawing.Size(45, 97);

this.tb8000Hz.TabIndex = 110;

this.tb8000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb8000Hz.Scroll += new System.EventHandler(this.tb8000Hz_Scroll);

//

// tb6300Hz

//

this.tb6300Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb6300Hz.Location = new System.Drawing.Point(590, 333);

this.tb6300Hz.Maximum = 12;

this.tb6300Hz.Minimum = -12;

this.tb6300Hz.Name = "tb6300Hz";

this.tb6300Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb6300Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb6300Hz.Size = new System.Drawing.Size(45, 97);

this.tb6300Hz.TabIndex = 109;

this.tb6300Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb6300Hz.Scroll += new System.EventHandler(this.tb6300Hz_Scroll);

//

// tb5000Hz

//

this.tb5000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb5000Hz.Location = new System.Drawing.Point(530, 333);

this.tb5000Hz.Maximum = 12;

this.tb5000Hz.Minimum = -12;

this.tb5000Hz.Name = "tb5000Hz";

this.tb5000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb5000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb5000Hz.Size = new System.Drawing.Size(45, 97);

this.tb5000Hz.TabIndex = 108;

this.tb5000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb5000Hz.Scroll += new System.EventHandler(this.tb5000Hz_Scroll);

//

// tb4000Hz

//

this.tb4000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb4000Hz.Location = new System.Drawing.Point(470, 333);

this.tb4000Hz.Maximum = 12;

this.tb4000Hz.Minimum = -12;

this.tb4000Hz.Name = "tb4000Hz";

this.tb4000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

Page 438: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

438

this.tb4000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb4000Hz.Size = new System.Drawing.Size(45, 97);

this.tb4000Hz.TabIndex = 107;

this.tb4000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb4000Hz.Scroll += new System.EventHandler(this.tb4000Hz_Scroll);

//

// tb3150Hz

//

this.tb3150Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb3150Hz.Location = new System.Drawing.Point(409, 333);

this.tb3150Hz.Maximum = 12;

this.tb3150Hz.Minimum = -12;

this.tb3150Hz.Name = "tb3150Hz";

this.tb3150Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb3150Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb3150Hz.Size = new System.Drawing.Size(45, 97);

this.tb3150Hz.TabIndex = 106;

this.tb3150Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb3150Hz.Scroll += new System.EventHandler(this.tb3150Hz_Scroll);

//

// tb2500Hz

//

this.tb2500Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb2500Hz.Location = new System.Drawing.Point(350, 333);

this.tb2500Hz.Maximum = 12;

this.tb2500Hz.Minimum = -12;

this.tb2500Hz.Name = "tb2500Hz";

this.tb2500Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb2500Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb2500Hz.Size = new System.Drawing.Size(45, 97);

this.tb2500Hz.TabIndex = 105;

this.tb2500Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb2500Hz.Scroll += new System.EventHandler(this.tb2500Hz_Scroll);

//

// et0dBEsqFila3

//

this.et0dBEsqFila3.AutoSize = true;

this.et0dBEsqFila3.Location = new System.Drawing.Point(255, 374);

this.et0dBEsqFila3.Name = "et0dBEsqFila3";

this.et0dBEsqFila3.Size = new System.Drawing.Size(29, 13);

this.et0dBEsqFila3.TabIndex = 104;

this.et0dBEsqFila3.Text = "0 dB";

Page 439: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

439

//

// etGuany2000Hz

//

this.etGuany2000Hz.AutoSize = true;

this.etGuany2000Hz.Location = new System.Drawing.Point(287, 317);

this.etGuany2000Hz.Name = "etGuany2000Hz";

this.etGuany2000Hz.Size = new System.Drawing.Size(49, 13);

this.etGuany2000Hz.TabIndex = 103;

this.etGuany2000Hz.Text = "G = 0 dB";

//

// etFreqCentral2kHz

//

this.etFreqCentral2kHz.AutoSize = true;

this.etFreqCentral2kHz.Location = new System.Drawing.Point(287, 433);

this.etFreqCentral2kHz.Name = "etFreqCentral2kHz";

this.etFreqCentral2kHz.Size = new System.Drawing.Size(35, 13);

this.etFreqCentral2kHz.TabIndex = 102;

this.etFreqCentral2kHz.Text = "2 kHz";

//

// etMenys12dBEsqFila3

//

this.etMenys12dBEsqFila3.AutoSize = true;

this.etMenys12dBEsqFila3.Location = new System.Drawing.Point(246, 417);

this.etMenys12dBEsqFila3.Name = "etMenys12dBEsqFila3";

this.etMenys12dBEsqFila3.Size = new System.Drawing.Size(38, 13);

this.etMenys12dBEsqFila3.TabIndex = 101;

this.etMenys12dBEsqFila3.Text = "-12 dB";

//

// etMes12dBEsqFila3

//

this.etMes12dBEsqFila3.AutoSize = true;

this.etMes12dBEsqFila3.Location = new System.Drawing.Point(243, 333);

this.etMes12dBEsqFila3.Name = "etMes12dBEsqFila3";

this.etMes12dBEsqFila3.Size = new System.Drawing.Size(41, 13);

this.etMes12dBEsqFila3.TabIndex = 100;

this.etMes12dBEsqFila3.Text = "+12 dB";

//

// tb2000Hz

//

this.tb2000Hz.BackColor = System.Drawing.Color.LightYellow;

this.tb2000Hz.Location = new System.Drawing.Point(290, 333);

this.tb2000Hz.Maximum = 12;

Page 440: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

440

this.tb2000Hz.Minimum = -12;

this.tb2000Hz.Name = "tb2000Hz";

this.tb2000Hz.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tb2000Hz.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tb2000Hz.Size = new System.Drawing.Size(45, 97);

this.tb2000Hz.TabIndex = 99;

this.tb2000Hz.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tb2000Hz.Scroll += new System.EventHandler(this.tb2000Hz_Scroll);

//

// btEqReset

//

this.btEqReset.Location = new System.Drawing.Point(452, 474);

this.btEqReset.Name = "btEqReset";

this.btEqReset.Size = new System.Drawing.Size(75, 23);

this.btEqReset.TabIndex = 135;

this.btEqReset.Text = "RESET";

this.btEqReset.UseVisualStyleBackColor = true;

this.btEqReset.Click += new System.EventHandler(this.btEqReset_Click);

//

// FormFill_Eq_1DIV3_Octava

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(966, 522);

this.Controls.Add(this.btEqReset);

this.Controls.Add(this.etFreqCentral16kHz);

this.Controls.Add(this.etFreqCentral12500Hz);

this.Controls.Add(this.etFreqCentral10kHz);

this.Controls.Add(this.etFreqCentral8kHz);

this.Controls.Add(this.etFreqCentral6300Hz);

this.Controls.Add(this.etFreqCentral5kHz);

this.Controls.Add(this.etFreqCentral4kHz);

this.Controls.Add(this.etFreqCentral3150Hz);

this.Controls.Add(this.etFreqCentral2500Hz);

this.Controls.Add(this.etMenys12dBDretaFila3);

this.Controls.Add(this.et0dBDretaFila3);

this.Controls.Add(this.etMes12dBDretaFila3);

this.Controls.Add(this.etGuany16000Hz);

this.Controls.Add(this.etGuany12500Hz);

this.Controls.Add(this.etGuany10000Hz);

this.Controls.Add(this.etGuany8000Hz);

this.Controls.Add(this.etGuany6300Hz);

Page 441: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

441

this.Controls.Add(this.etGuany5000Hz);

this.Controls.Add(this.etGuany4000Hz);

this.Controls.Add(this.etGuany3150Hz);

this.Controls.Add(this.etGuany2500Hz);

this.Controls.Add(this.tb16000Hz);

this.Controls.Add(this.tb12500Hz);

this.Controls.Add(this.tb10000Hz);

this.Controls.Add(this.tb8000Hz);

this.Controls.Add(this.tb6300Hz);

this.Controls.Add(this.tb5000Hz);

this.Controls.Add(this.tb4000Hz);

this.Controls.Add(this.tb3150Hz);

this.Controls.Add(this.tb2500Hz);

this.Controls.Add(this.et0dBEsqFila3);

this.Controls.Add(this.etGuany2000Hz);

this.Controls.Add(this.etFreqCentral2kHz);

this.Controls.Add(this.etMenys12dBEsqFila3);

this.Controls.Add(this.etMes12dBEsqFila3);

this.Controls.Add(this.tb2000Hz);

this.Controls.Add(this.etFreqCentral1600Hz);

this.Controls.Add(this.etFreqCentral1250Hz);

this.Controls.Add(this.etFreqCentral1kHz);

this.Controls.Add(this.etFreqCentral800Hz);

this.Controls.Add(this.etFreqCentral630Hz);

this.Controls.Add(this.etFreqCentral500Hz);

this.Controls.Add(this.etFreqCentral400Hz);

this.Controls.Add(this.etFreqCentral315Hz);

this.Controls.Add(this.etFreqCentral250Hz);

this.Controls.Add(this.etMenys12dBDretaFila2);

this.Controls.Add(this.et0dBDretaFila2);

this.Controls.Add(this.etMes12dBDretaFila2);

this.Controls.Add(this.etGuany1600Hz);

this.Controls.Add(this.etGuany1250Hz);

this.Controls.Add(this.etGuany1000Hz);

this.Controls.Add(this.etGuany800Hz);

this.Controls.Add(this.etGuany630Hz);

this.Controls.Add(this.etGuany500Hz);

this.Controls.Add(this.etGuany400Hz);

this.Controls.Add(this.etGuany315Hz);

this.Controls.Add(this.etGuany250Hz);

this.Controls.Add(this.tb1600Hz);

this.Controls.Add(this.tb1250Hz);

Page 442: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

442

this.Controls.Add(this.tb1000Hz);

this.Controls.Add(this.tb800Hz);

this.Controls.Add(this.tb630Hz);

this.Controls.Add(this.tb500Hz);

this.Controls.Add(this.tb400Hz);

this.Controls.Add(this.tb315Hz);

this.Controls.Add(this.tb250Hz);

this.Controls.Add(this.et0dBEsqFila2);

this.Controls.Add(this.etGuany200Hz);

this.Controls.Add(this.etFreqCentral200Hz);

this.Controls.Add(this.etMenys12dBEsqFila2);

this.Controls.Add(this.etMes12dBEsqFila2);

this.Controls.Add(this.tb200Hz);

this.Controls.Add(this.etLowCut400Hz);

this.Controls.Add(this.etLowCut20Hz);

this.Controls.Add(this.etHighCut2500Hz);

this.Controls.Add(this.etHighCut20kHz);

this.Controls.Add(this.etLowCut);

this.Controls.Add(this.etHighCut);

this.Controls.Add(this.etFreqLowCut);

this.Controls.Add(this.etFreqHighCut);

this.Controls.Add(this.tbLowCut);

this.Controls.Add(this.tbHighCut);

this.Controls.Add(this.btCancelar);

this.Controls.Add(this.btEqOK);

this.Controls.Add(this.btGuardarEq);

this.Controls.Add(this.btCarregarEq);

this.Controls.Add(this.et0dBLimitador);

this.Controls.Add(this.et0dBGuanyGlobal);

this.Controls.Add(this.etMenys80dBLimitador);

this.Controls.Add(this.etMenys15dBGuanyGlobal);

this.Controls.Add(this.etMes20dBLimitador);

this.Controls.Add(this.etMes15dBGuanyGlobal);

this.Controls.Add(this.etLimitador);

this.Controls.Add(this.etGuanyGlobal);

this.Controls.Add(this.etLimitacioTextFixe);

this.Controls.Add(this.etGuany);

this.Controls.Add(this.etFreqCentral160Hz);

this.Controls.Add(this.etFreqCentral125Hz);

this.Controls.Add(this.etFreqCentral100Hz);

this.Controls.Add(this.etFreqCentral80Hz);

this.Controls.Add(this.etFreqCentral63Hz);

Page 443: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

443

this.Controls.Add(this.etFreqCentral50Hz);

this.Controls.Add(this.etFreqCentral40Hz);

this.Controls.Add(this.etFreqCentral31coma5Hz);

this.Controls.Add(this.etFreqCentral25Hz);

this.Controls.Add(this.etMenys12dBDretaFila1);

this.Controls.Add(this.et0dBDretaFila1);

this.Controls.Add(this.etMes12dBDretaFila1);

this.Controls.Add(this.etGuany160Hz);

this.Controls.Add(this.etGuany125Hz);

this.Controls.Add(this.etGuany100Hz);

this.Controls.Add(this.etGuany80Hz);

this.Controls.Add(this.etGuany63Hz);

this.Controls.Add(this.etGuany50Hz);

this.Controls.Add(this.etGuany40Hz);

this.Controls.Add(this.etGuany31coma5Hz);

this.Controls.Add(this.etGuany25Hz);

this.Controls.Add(this.tbLimitador);

this.Controls.Add(this.tbGuanyGlobal);

this.Controls.Add(this.tb160Hz);

this.Controls.Add(this.tb125Hz);

this.Controls.Add(this.tb100Hz);

this.Controls.Add(this.tb80Hz);

this.Controls.Add(this.tb63Hz);

this.Controls.Add(this.tb50Hz);

this.Controls.Add(this.tb40Hz);

this.Controls.Add(this.tb31coma5Hz);

this.Controls.Add(this.tb25Hz);

this.Controls.Add(this.et0dBEsqFila1);

this.Controls.Add(this.etGuany20Hz);

this.Controls.Add(this.etFreqCentral20Hz);

this.Controls.Add(this.etMenys12dBEsqFila1);

this.Controls.Add(this.etMes12dBEsqFila1);

this.Controls.Add(this.tb20Hz);

this.Name = "FormFill_Eq_1DIV3_Octava";

this.Text = "Equalitzador de terç d\'octava";

this.Load += new System.EventHandler(this.FormFill_Eq_1DIV3_Octava_Load);

((System.ComponentModel.ISupportInitialize)(this.tb20Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb25Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb31coma5Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb40Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb50Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb63Hz)).EndInit();

Page 444: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

444

((System.ComponentModel.ISupportInitialize)(this.tb80Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb100Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb125Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb160Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbHighCut)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbLowCut)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb1600Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb1250Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb1000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb800Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb630Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb500Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb400Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb315Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb250Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb200Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb16000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb12500Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb10000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb8000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb6300Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb5000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb4000Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb3150Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb2500Hz)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tb2000Hz)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.TrackBar tb20Hz;

private System.Windows.Forms.Label etMes12dBEsqFila1;

private System.Windows.Forms.Label etMenys12dBEsqFila1;

private System.Windows.Forms.Label etFreqCentral20Hz;

private System.Windows.Forms.Label etGuany20Hz;

private System.Windows.Forms.Label et0dBEsqFila1;

private System.Windows.Forms.TrackBar tb25Hz;

Page 445: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

445

private System.Windows.Forms.TrackBar tb31coma5Hz;

private System.Windows.Forms.TrackBar tb40Hz;

private System.Windows.Forms.TrackBar tb50Hz;

private System.Windows.Forms.TrackBar tb63Hz;

private System.Windows.Forms.TrackBar tb80Hz;

private System.Windows.Forms.TrackBar tb100Hz;

private System.Windows.Forms.TrackBar tb125Hz;

private System.Windows.Forms.TrackBar tb160Hz;

private System.Windows.Forms.TrackBar tbGuanyGlobal;

private System.Windows.Forms.TrackBar tbLimitador;

private System.Windows.Forms.Label etGuany25Hz;

private System.Windows.Forms.Label etGuany31coma5Hz;

private System.Windows.Forms.Label etGuany40Hz;

private System.Windows.Forms.Label etGuany50Hz;

private System.Windows.Forms.Label etGuany63Hz;

private System.Windows.Forms.Label etGuany80Hz;

private System.Windows.Forms.Label etGuany100Hz;

private System.Windows.Forms.Label etGuany125Hz;

private System.Windows.Forms.Label etGuany160Hz;

private System.Windows.Forms.Label etMes12dBDretaFila1;

private System.Windows.Forms.Label et0dBDretaFila1;

private System.Windows.Forms.Label etMenys12dBDretaFila1;

private System.Windows.Forms.Label etFreqCentral25Hz;

private System.Windows.Forms.Label etFreqCentral31coma5Hz;

private System.Windows.Forms.Label etFreqCentral40Hz;

private System.Windows.Forms.Label etFreqCentral50Hz;

private System.Windows.Forms.Label etFreqCentral63Hz;

private System.Windows.Forms.Label etFreqCentral80Hz;

private System.Windows.Forms.Label etFreqCentral100Hz;

private System.Windows.Forms.Label etFreqCentral125Hz;

private System.Windows.Forms.Label etFreqCentral160Hz;

private System.Windows.Forms.Label etGuany;

private System.Windows.Forms.Label etLimitacioTextFixe;

private System.Windows.Forms.Label etGuanyGlobal;

private System.Windows.Forms.Label etLimitador;

private System.Windows.Forms.Label etMes15dBGuanyGlobal;

private System.Windows.Forms.Label etMes20dBLimitador;

private System.Windows.Forms.Label etMenys15dBGuanyGlobal;

private System.Windows.Forms.Label etMenys80dBLimitador;

private System.Windows.Forms.Label et0dBGuanyGlobal;

private System.Windows.Forms.Label et0dBLimitador;

private System.Windows.Forms.Button btCarregarEq;

Page 446: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

446

private System.Windows.Forms.Button btGuardarEq;

private System.Windows.Forms.Button btEqOK;

private System.Windows.Forms.Button btCancelar;

private System.Windows.Forms.TrackBar tbHighCut;

private System.Windows.Forms.TrackBar tbLowCut;

private System.Windows.Forms.Label etFreqHighCut;

private System.Windows.Forms.Label etFreqLowCut;

private System.Windows.Forms.Label etHighCut;

private System.Windows.Forms.Label etLowCut;

private System.Windows.Forms.Label etHighCut20kHz;

private System.Windows.Forms.Label etHighCut2500Hz;

private System.Windows.Forms.Label etLowCut20Hz;

private System.Windows.Forms.Label etLowCut400Hz;

private System.Windows.Forms.Label etFreqCentral1600Hz;

private System.Windows.Forms.Label etFreqCentral1250Hz;

private System.Windows.Forms.Label etFreqCentral1kHz;

private System.Windows.Forms.Label etFreqCentral800Hz;

private System.Windows.Forms.Label etFreqCentral630Hz;

private System.Windows.Forms.Label etFreqCentral500Hz;

private System.Windows.Forms.Label etFreqCentral400Hz;

private System.Windows.Forms.Label etFreqCentral315Hz;

private System.Windows.Forms.Label etFreqCentral250Hz;

private System.Windows.Forms.Label etMenys12dBDretaFila2;

private System.Windows.Forms.Label et0dBDretaFila2;

private System.Windows.Forms.Label etMes12dBDretaFila2;

private System.Windows.Forms.Label etGuany1600Hz;

private System.Windows.Forms.Label etGuany1250Hz;

private System.Windows.Forms.Label etGuany1000Hz;

private System.Windows.Forms.Label etGuany800Hz;

private System.Windows.Forms.Label etGuany630Hz;

private System.Windows.Forms.Label etGuany500Hz;

private System.Windows.Forms.Label etGuany400Hz;

private System.Windows.Forms.Label etGuany315Hz;

private System.Windows.Forms.Label etGuany250Hz;

private System.Windows.Forms.TrackBar tb1600Hz;

private System.Windows.Forms.TrackBar tb1250Hz;

private System.Windows.Forms.TrackBar tb1000Hz;

private System.Windows.Forms.TrackBar tb800Hz;

private System.Windows.Forms.TrackBar tb630Hz;

private System.Windows.Forms.TrackBar tb500Hz;

private System.Windows.Forms.TrackBar tb400Hz;

private System.Windows.Forms.TrackBar tb315Hz;

Page 447: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

447

private System.Windows.Forms.TrackBar tb250Hz;

private System.Windows.Forms.Label et0dBEsqFila2;

private System.Windows.Forms.Label etGuany200Hz;

private System.Windows.Forms.Label etFreqCentral200Hz;

private System.Windows.Forms.Label etMenys12dBEsqFila2;

private System.Windows.Forms.Label etMes12dBEsqFila2;

private System.Windows.Forms.TrackBar tb200Hz;

private System.Windows.Forms.Label etFreqCentral16kHz;

private System.Windows.Forms.Label etFreqCentral12500Hz;

private System.Windows.Forms.Label etFreqCentral10kHz;

private System.Windows.Forms.Label etFreqCentral8kHz;

private System.Windows.Forms.Label etFreqCentral6300Hz;

private System.Windows.Forms.Label etFreqCentral5kHz;

private System.Windows.Forms.Label etFreqCentral4kHz;

private System.Windows.Forms.Label etFreqCentral3150Hz;

private System.Windows.Forms.Label etFreqCentral2500Hz;

private System.Windows.Forms.Label etMenys12dBDretaFila3;

private System.Windows.Forms.Label et0dBDretaFila3;

private System.Windows.Forms.Label etMes12dBDretaFila3;

private System.Windows.Forms.Label etGuany16000Hz;

private System.Windows.Forms.Label etGuany12500Hz;

private System.Windows.Forms.Label etGuany10000Hz;

private System.Windows.Forms.Label etGuany8000Hz;

private System.Windows.Forms.Label etGuany6300Hz;

private System.Windows.Forms.Label etGuany5000Hz;

private System.Windows.Forms.Label etGuany4000Hz;

private System.Windows.Forms.Label etGuany3150Hz;

private System.Windows.Forms.Label etGuany2500Hz;

private System.Windows.Forms.TrackBar tb16000Hz;

private System.Windows.Forms.TrackBar tb12500Hz;

private System.Windows.Forms.TrackBar tb10000Hz;

private System.Windows.Forms.TrackBar tb8000Hz;

private System.Windows.Forms.TrackBar tb6300Hz;

private System.Windows.Forms.TrackBar tb5000Hz;

private System.Windows.Forms.TrackBar tb4000Hz;

private System.Windows.Forms.TrackBar tb3150Hz;

private System.Windows.Forms.TrackBar tb2500Hz;

private System.Windows.Forms.Label et0dBEsqFila3;

private System.Windows.Forms.Label etGuany2000Hz;

private System.Windows.Forms.Label etFreqCentral2kHz;

private System.Windows.Forms.Label etMenys12dBEsqFila3;

private System.Windows.Forms.Label etMes12dBEsqFila3;

Page 448: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

448

private System.Windows.Forms.TrackBar tb2000Hz;

private System.Windows.Forms.Button btEqReset;

}

}

Page 449: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

449

/*************************************************************

* Fitxer FormFill_Eq_Parametric.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

namespace Equalitzador_FFT_1

{

public partial class FormFill_Eq_Parametric : Form

{

//Declaració de les variables locals auxiliars, per guardar

//els valors de les variables globals, en el moment

//de carregar el formulari de l'equalitzador.

private double guanyGlobal;

private double limitador;

private double lowCut;

private double highCut;

private double guany20Hz;

private double guany25Hz;

private double guany31coma5Hz;

Page 450: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

450

private double guany40Hz;

private double guany50Hz;

private double guany63Hz;

private double guany80Hz;

private double guany100Hz;

private double guany125Hz;

private double guany160Hz;

private double guany200Hz;

private double guany250Hz;

private double guany315Hz;

private double guany400Hz;

private double guany500Hz;

private double guany630Hz;

private double guany800Hz;

private double guany1000Hz;

private double guany1250Hz;

private double guany1600Hz;

private double guany2000Hz;

private double guany2500Hz;

private double guany3150Hz;

private double guany4000Hz;

private double guany5000Hz;

private double guany6300Hz;

private double guany8000Hz;

private double guany10000Hz;

private double guany12500Hz;

Page 451: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

451

private double guany16000Hz;

private double guany_LF;

private double guany_MLF;

private double guany_MHF;

private double guany_HF;

private double freqCentral_LF;

private double freqCentral_MLF;

private double freqCentral_MHF;

private double freqCentral_HF;

private double bW_LF;

private double bW_MLF;

private double bW_MHF;

private double bW_HF;

private int equalitzador;

//Rutes a les carpetes del programa

private string ElsMeusDocuments;

private string carpetaProjecte;

private string subCarpeta3;

private string nomArxiu; // ruta del arxiu incial EqParametric.eq3

private string nouArxiu; // ruta del nou arxiu EqParametric#.eq3

//Fi de la declaració de les variables auxiliars locals.

public FormFill_Eq_Parametric()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* FormFill_Eq_Parametric

****************************************************************/

private void FormFill_Eq_Parametric_Load(object sender, EventArgs e)

Page 452: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

452

{

//El formulari es repintarà mitjançant la tècnica

//del doble buffer per a evitar parpadejos i

//inestabilitats de la imatge tal i com es feia al projecte [24]

DoubleBuffered = true;

//Es guarden el valor de les variables global en les

//variables locals auxiliars

guanyGlobal = VG.guanyGlobal;

limitador = VG.limitador;

lowCut = VG.lowCut;

highCut = VG.highCut;

guany20Hz = VG.guany20Hz;

guany25Hz = VG.guany25Hz;

guany31coma5Hz = VG.guany31coma5Hz;

guany40Hz = VG.guany40Hz;

guany50Hz = VG.guany50Hz;

guany63Hz = VG.guany63Hz;

guany80Hz = VG.guany80Hz;

guany100Hz = VG.guany100Hz;

guany125Hz = VG.guany125Hz;

guany160Hz = VG.guany160Hz;

guany200Hz = VG.guany200Hz;

guany250Hz = VG.guany250Hz;

guany315Hz = VG.guany315Hz;

guany400Hz = VG.guany400Hz;

guany500Hz = VG.guany500Hz;

guany630Hz = VG.guany630Hz;

guany800Hz = VG.guany800Hz;

Page 453: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

453

guany1000Hz = VG.guany1000Hz;

guany1250Hz = VG.guany1250Hz;

guany1600Hz = VG.guany1600Hz;

guany2000Hz = VG.guany2000Hz;

guany2500Hz = VG.guany2500Hz;

guany3150Hz = VG.guany3150Hz;

guany4000Hz = VG.guany4000Hz;

guany5000Hz = VG.guany5000Hz;

guany6300Hz = VG.guany6300Hz;

guany8000Hz = VG.guany8000Hz;

guany10000Hz = VG.guany10000Hz;

guany12500Hz = VG.guany12500Hz;

guany16000Hz = VG.guany16000Hz;

guany_LF = VG.guany_LF;

guany_MLF = VG.guany_MLF;

guany_MHF = VG.guany_MHF;

guany_HF = VG.guany_HF;

freqCentral_LF = VG.freqCentral_LF;

freqCentral_MLF = VG.freqCentral_MLF;

freqCentral_MHF = VG.freqCentral_MHF;

freqCentral_HF = VG.freqCentral_HF;

bW_LF = VG.bW_LF;

bW_MLF = VG.bW_MLF;

bW_MHF = VG.bW_MHF;

bW_HF = VG.bW_HF;

equalitzador = VG.equalitzador;

/****************************************************************

* Inicialització de les variables globals declarades dins de

Page 454: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

454

* la classe VG.cs.

****************************************************************/

//S'inicialitza l'equalitzador de terç d'octava "3"

VG.equalitzador = 3;

//S'inicialitza a 0 dB del guanyGlobal.

VG.guanyGlobal = 0;

//S'inicialitzaa +20 dBV (+10 V), el valor

//de limitació.

VG.limitador = 20;

//S'inicialitza a 20 Hz lowCut

VG.lowCut = 20;

//S'inicialitza a 20 kHz highCut

VG.highCut = 20000;

//S'inicialitzen a 0 dBs els guanys de cada fadder

//de l'equalitzador d'una octava i d'un terç d'octava.

VG.guany20Hz = 0;

VG.guany25Hz = 0;

VG.guany31coma5Hz = 0;

VG.guany40Hz = 0;

VG.guany50Hz = 0;

VG.guany63Hz = 0;

VG.guany80Hz = 0;

VG.guany100Hz = 0;

VG.guany125Hz = 0;

Page 455: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

455

VG.guany160Hz = 0;

VG.guany200Hz = 0;

VG.guany250Hz = 0;

VG.guany315Hz = 0;

VG.guany400Hz = 0;

VG.guany500Hz = 0;

VG.guany630Hz = 0;

VG.guany800Hz = 0;

VG.guany1000Hz = 0;

VG.guany1250Hz = 0;

VG.guany1600Hz = 0;

VG.guany2000Hz = 0;

VG.guany2500Hz = 0;

VG.guany3150Hz = 0;

VG.guany4000Hz = 0;

VG.guany5000Hz = 0;

VG.guany6300Hz = 0;

VG.guany8000Hz = 0;

VG.guany10000Hz = 0;

VG.guany12500Hz = 0;

VG.guany16000Hz = 0;

//S'inicialitzen les Variables utilitzades per

//l'equalitzador paramètric.

//S'inicialitzen a 0 dBs els guanys de cada fadder

//de l'equalitzador paramètric.

Page 456: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

456

VG.guany_LF = 0;

VG.guany_MLF = 0;

VG.guany_MHF = 0;

VG.guany_HF = 0;

//S'inicialitzen les freqüències centrals de

//cada banda, a la freqüència més baixa de

//cada banda. En Hz

VG.freqCentral_LF = 20;

VG.freqCentral_MLF = 250;

VG.freqCentral_MHF = 2000;

VG.freqCentral_HF = 4000;

//S'inicialitzen els amples de banda (BW) de cada

//banda a 0.

VG.bW_LF = 0;

VG.bW_MLF = 0;

VG.bW_MHF = 0;

VG.bW_HF = 0;

//Obtenció de la ruta de la carpeta els meus documents

ElsMeusDocuments = Environment.GetFolderPath

(Environment.SpecialFolder.MyDocuments);

//Creació la la ruta de la carpeta del projecte dins la carpeta

//els meus documents

carpetaProjecte = Path.Combine(ElsMeusDocuments, "EqualitzadorFFT");

//Creació de la ruta a la subcarpeta "Eq Parametric"

//subCarpeta3 contindrá els arxius .eq3

subCarpeta3 = Path.Combine(carpetaProjecte, "Eq parametric");

nomArxiu = string.Empty;

nouArxiu = string.Empty;

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del GuanyGlobal

Page 457: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

457

****************************************************************/

private void tbGuanyGlobal_Scroll(object sender, EventArgs e)

{

//Actualització del guanGlobal

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

//Actualització de l'etiqueta guanGlobal

etGuanyGlobal.Text = "G = " + VG.guanyGlobal + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del limitador

****************************************************************/

private void tbLimitador_Scroll(object sender, EventArgs e)

{

//Actualització del limitador

VG.limitador = (double)tbLimitador.Value;

//Actualització de l'etiqueta limitació

etLimitador.Text = "L = " + VG.limitador + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder lowCut

****************************************************************/

private void tbLowCut_Scroll(object sender, EventArgs e)

{

//Actualització del lowCut

VG.lowCut = (double)tbLowCut.Value;

//Actualització de l'etiqueta freqüència del lowCut

etFreqLowCut.Text = "LC = " + VG.lowCut + " Hz";

}

Page 458: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

458

/****************************************************************

* Funció que es crida quan s'actualitza el fadder HighCut

****************************************************************/

private void tbHighCut_Scroll(object sender, EventArgs e)

{

//Actualització del highCut

VG.highCut = (double)tbHighCut.Value;

//Actualització de l'etiqueta freqüència del highCut

etFreqHighCut.Text = "HC = " + VG.highCut + " Hz";

}

/****************************************************************

* Funcions que es criden qua s'actualitzen cada un del tres

* fadders de la banda LF

****************************************************************/

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del guany de

* la banda LF

****************************************************************/

private void tbGuany_LF_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany_LF = (double)tbGuany_LF.Value;

//Actualització de l'etiqueta guany

etGuany_LF.Text = "G = " + VG.guany_LF + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de la freq.

* central de la banda LF

****************************************************************/

private void tbFreqCentral_LF_Scroll(object sender, EventArgs e)

Page 459: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

459

{

//Actualització de la freqüència central de la banda LF

VG.freqCentral_LF = (double)tbFreqCentral_LF.Value;

//Actualització de l'etiqueta freqüència central

etFreqCentral_LF.Text = "FC = " + VG.freqCentral_LF + " Hz";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de l'ample de

* banda (BW) de la banda LF

****************************************************************/

private void tbBW_LF_Scroll(object sender, EventArgs e)

{

//Actualització de l'ample de banda de la banda LF

VG.bW_LF = (double)tbBW_LF.Value;

//Actualització de l'etiqueta ample de banda

etBW_LF.Text = "BW = " + VG.bW_LF + " Hz";

}

/****************************************************************

* Funcions que es criden qua s'actualitzen cada un del tres

* fadders de la banda MLF

****************************************************************/

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del guany de

* la banda MLF

****************************************************************/

private void tbGuany_MLF_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany_MLF = (double)tbGuany_MLF.Value;

Page 460: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

460

//Actualització de l'etiqueta guany

etGuany_MLF.Text = "G = " + VG.guany_MLF + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de la freq.

* central de la banda MLF

****************************************************************/

private void tbFreqCentral_MLF_Scroll(object sender, EventArgs e)

{

//Actualització de la freqüència central de la banda MLF

VG.freqCentral_MLF = (double)tbFreqCentral_MLF.Value;

//Actualització de l'etiqueta freqüència central

etFreqCentral_MLF.Text = "FC = " + VG.freqCentral_MLF + " Hz";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de l'ample de

* banda (BW) de la banda MLF

****************************************************************/

private void tbBW_MLF_Scroll(object sender, EventArgs e)

{

//Actualització de l'ample de banda de la banda MLF

VG.bW_MLF = (double)tbBW_MLF.Value;

//Actualització de l'etiqueta ample de banda

etBW_MLF.Text = "BW = " + VG.bW_MLF + " Hz";

}

/****************************************************************

* Funcions que es criden qua s'actualitzen cada un del tres

* fadders de la banda MHF

****************************************************************/

Page 461: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

461

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del guany de

* la banda MHF

****************************************************************/

private void tbGuany_MHF_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany_MHF = (double)tbGuany_MHF.Value;

//Actualització de l'etiqueta guany

etGuany_MHF.Text = "G = " + VG.guany_MHF + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de la freq.

* central de la banda MHF

****************************************************************/

private void tbFreqCentral_MHF_Scroll(object sender, EventArgs e)

{

//Actualització de la freqüència central de la banda MHF

VG.freqCentral_MHF = (double)tbFreqCentral_MHF.Value;

//Actualització de l'etiqueta freqüència central

etFreqCentral_MHF.Text = "FC = " + VG.freqCentral_MHF + " Hz";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de l'ample de

* banda (BW) de la banda MHF

****************************************************************/

private void tbBW_MHF_Scroll(object sender, EventArgs e)

{

//Actualització de l'ample de banda de la banda MHF

Page 462: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

462

VG.bW_MHF = (double)tbBW_MHF.Value;

//Actualització de l'etiqueta ample de banda del fadder

//corresponent

etBW_MHF.Text = "BW = " + VG.bW_MHF + " Hz";

}

/****************************************************************

* Funcions que es criden qua s'actualitzen cada un del tres

* fadders de la banda HF

****************************************************************/

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del guany de

* la banda HF

****************************************************************/

private void tbGuany_HF_Scroll(object sender, EventArgs e)

{

//Actualització del guany corresponent

VG.guany_HF = (double)tbGuany_HF.Value;

//Actualització de l'etiqueta guany

etGuany_HF.Text = "G = " + VG.guany_HF + " dB";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de la freq.

* central de la banda HF

****************************************************************/

private void tbFreqCentral_HF_Scroll(object sender, EventArgs e)

{

//Actualització de la freqüència central de la banda HF

VG.freqCentral_HF = (double)tbFreqCentral_HF.Value;

//Actualització de l'etiqueta freqüència central del fadder

//corresponent

Page 463: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

463

etFreqCentral_HF.Text = "FC = " + VG.freqCentral_HF + " Hz";

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder de l'ample de

* banda (BW) de la banda HF

****************************************************************/

private void tbBW_HF_Scroll(object sender, EventArgs e)

{

//Actualització de l'ample de banda de la banda HF

VG.bW_HF = (double)tbBW_HF.Value;

//Actualització de l'etiqueta ample de banda

etBW_HF.Text = "BW = " + VG.bW_HF + " Hz";

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó carregarEq

****************************************************************/

private void btCarregarEq_Click(object sender, EventArgs e)

{

subCarpeta3 = "";

subCarpeta3 = Path.Combine(carpetaProjecte, "Eq parametric");

//Mostrar el quadre de dialeg obrir

OpenFileDialog DlgObrir = new OpenFileDialog();

DlgObrir.InitialDirectory = subCarpeta3;

DlgObrir.Filter = "fitxers d'equalització parametrica " +

"(*eq3)|*.eq3";

if (DlgObrir.ShowDialog() == DialogResult.OK)

{

//Obtenir ruta del fitxer

subCarpeta3 = DlgObrir.FileName;

using (FileStream stream = new FileStream(subCarpeta3, FileMode.Open, FileAccess.Read))

Page 464: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

464

{

using (BinaryReader llegir = new BinaryReader(stream))

{

//Es comprova la 1ra posició de l'arxiu guardat

//Si es tracta del Eq d'octava, si el valor no es 3,

//es mostra quadre de error i es cancela l'operació.

Int32 EQ = llegir.ReadInt32();

if (EQ == 3)

{

//S'ha de tindre en compte el format de

//cada valor a guardar per llegir-ho correctament.

tbLimitador.Value = llegir.ReadInt32();

VG.limitador = (double)tbLimitador.Value;

tbGuanyGlobal.Value = llegir.ReadInt32();

VG.guanyGlobal = (double)tbGuanyGlobal.Value;

tbLowCut.Value = llegir.ReadInt32();

VG.lowCut = (double)tbLowCut.Value;

tbHighCut.Value = llegir.ReadInt32();

VG.highCut = (double)tbHighCut.Value;

tbGuany_LF.Value = llegir.ReadInt32();

VG.guany_LF = (double)tbGuany_LF.Value;

tbGuany_MLF.Value = llegir.ReadInt32();

VG.guany_MLF = (double)tbGuany_MLF.Value;

tbGuany_MHF.Value = llegir.ReadInt32();

VG.guany_MHF = (double)tbGuany_MHF.Value;

tbGuany_HF.Value = llegir.ReadInt32();

VG.guany_HF = (double)tbGuany_HF.Value;

tbFreqCentral_LF.Value = llegir.ReadInt32();

VG.freqCentral_LF = (double)tbFreqCentral_LF.Value;

tbFreqCentral_MLF.Value = llegir.ReadInt32();

VG.freqCentral_MLF = (double)tbFreqCentral_MLF.Value;

tbFreqCentral_MHF.Value = llegir.ReadInt32();

VG.freqCentral_MHF = (double)tbFreqCentral_MHF.Value;

tbFreqCentral_HF.Value = llegir.ReadInt32();

VG.freqCentral_HF = (double)tbFreqCentral_HF.Value;

tbBW_LF.Value = llegir.ReadInt32();

VG.bW_LF = (double)tbBW_LF.Value;

tbBW_MLF.Value = llegir.ReadInt32();

VG.bW_MLF = (double)tbBW_MLF.Value;

Page 465: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

465

tbBW_MHF.Value = llegir.ReadInt32();

VG.bW_MHF = (double)tbBW_MHF.Value;

tbBW_HF.Value = llegir.ReadInt32();

VG.bW_HF = (double)tbBW_HF.Value;

llegir.Close();

}//Fi if (EQ == 3)

else //sino estem al Eq Paramètric, missatge d'error

{

MessageBox.Show(" S'ha carregat una equalització " +

"que no correspon " +

"a l'equalitzador.",

"Error en l'arxiu.",

MessageBoxButtons.OK, MessageBoxIcon.Error);

llegir.Close();

}//Fi else

}//Fi using (BinaryReader)

}//Fi using (FileStream)

}//Fi if (DlgObrir.ShowDialog())

}//Fi bt carregar_Click

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó GuardarEq

*

* Nota: quan es fa clic sobre el botó guardar equalització,

* l'equalització triada per l'usuari mitjançant els

* fadders, serà guardada en un fitxer d'equalització.

* EqParametric.eq3.

****************************************************************/

private void btGuardarEq_Click(object sender, EventArgs e)

{

//Es mostra el Dialeg Guardar on s'haura d'escriure el

//nom del fitxer a guardar. S'ha de escollir la ruta de guardar,

//per defecte ve donada //C://..//Mis documentos

//L'extensió del format a guardar serà .eq3

//La variable conta contindrá el valor

Page 466: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

466

//del index de repetició de l'arxiu.

int conta = 1;

//nomArxiu conté la ruta C://.../Eq parametric//EqParametric

//sense extensió.

subCarpeta3 = "";

subCarpeta3 = Path.Combine(carpetaProjecte, "Eq parametric");

nomArxiu = "";

nouArxiu = "";

nomArxiu = Path.Combine(subCarpeta3, "EqParametric");

//Extensió dels arxius eq3

string extensio = ".eq3";

//Creació de la nova instancia SaveFileDialog com DlgGuardar.

SaveFileDialog DlgGuardar = new SaveFileDialog();

//Si existeix l'arxiu EqParametric.eq3 es crea un nou nom

//on la variable conta portara el número d'arxius EqOctava

//que hi han al directori. Si existeix EqParametric.eq3 es crea

//EqParametric1.eq3, si aquets també existeix es crea EqParametric2.eq3

//i així successivament

if (File.Exists(nomArxiu + extensio))

{

nouArxiu = nomArxiu + conta;

//Es comprova que el nou nom no exiteix.

//Si existeix, s'incrementa la conta

//i es guarda altre vegada en la variable

//nouArxiu.

while (File.Exists(nouArxiu + extensio))

{

conta++;

nouArxiu = nomArxiu + conta;

}

Page 467: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

467

//Aparició per defecte del nom a guardar al quadre

//de dialeg. L'usuari pot modificar aquest nom manualment,

//però per defecte, tindrá l'opció automatica de guardar

//amb el nom consecutivament disponible

DlgGuardar.FileName = nouArxiu;

}

//Si l'arxiu EqOctava.eq1 no existeix, apareixerá per defecte

//l'opció d'aquest nom al usuari.

else

{

DlgGuardar.FileName = nomArxiu;

}

//Directori inicial del quadre de dialeg

DlgGuardar.InitialDirectory = subCarpeta3;

//Es filtra l'extensió a guardar

DlgGuardar.Filter = "(*.eq3)|*.eq3";

DlgGuardar.Title = "Guardar fitxers d'equalització paramétrica";

//Si s'ha fet clic al botó guardar del quadre de dialeg...

if (DlgGuardar.ShowDialog() == DialogResult.OK)

{

//S'obté el nom de l'artxiu per guardar a la ruta de la subcarpeta

//corresponent.

subCarpeta3 = DlgGuardar.FileName;

//S'utilitza la funció FileStream per crear l'artxiu binary

using (FileStream stream = new FileStream(subCarpeta3, FileMode.Create))

{

using (BinaryWriter escriu = new BinaryWriter(stream))

{

//S'escriu cada valor consecutivament.

Page 468: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

468

//BinaryWriter apunta automàticament a la

//següent posició.

//Guardar els valors dels fadders

escriu.Write(3);

escriu.Write(tbLimitador.Value);

escriu.Write(tbGuanyGlobal.Value);

escriu.Write(tbLowCut.Value);

escriu.Write(tbHighCut.Value);

escriu.Write(tbGuany_LF.Value);

escriu.Write(tbGuany_MLF.Value);

escriu.Write(tbGuany_MHF.Value);

escriu.Write(tbGuany_HF.Value);

escriu.Write(tbFreqCentral_LF.Value);

escriu.Write(tbFreqCentral_MLF.Value);

escriu.Write(tbFreqCentral_MHF.Value);

escriu.Write(tbFreqCentral_HF.Value);

escriu.Write(tbBW_LF.Value);

escriu.Write(tbBW_MLF.Value);

escriu.Write(tbBW_MHF.Value);

escriu.Write(tbBW_HF.Value);

escriu.Close();

}

}

}//Fi if (DlgGuardar.ShowDialog())

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó EqOK

*

* Nota: l'equalització que hi ha en els fadders en el moment

* de fer clic en el botó EqOK, es guarda en les variables globals

* corresponents per dur a terme l'equalització i es surt de

* l'equalitzador

****************************************************************/

private void btEqOK_Click(object sender, EventArgs e)

{

//Simplement cal tancar el formulari de l'equalitzador,

//tornant al formulari pare.

Page 469: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

469

this.Close();

}

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó Cancelar

*

* Nota: quan es fa clic, se surt del formulari de l'equalitzador

* i es restaurel els valors de les variables globals als que

* hi havien abans de carregar el formulari de l'equalitzador.

****************************************************************/

private void btCancelar_Click(object sender, EventArgs e)

{

//Restaurar valors de les variables globals als que

//hi havien abans de carregar el formulari de

//l'equalitzador.

VG.guanyGlobal = guanyGlobal;

VG.limitador = limitador;

VG.lowCut = lowCut;

VG.highCut = highCut;

VG.guany20Hz = guany20Hz;

VG.guany25Hz = guany25Hz;

VG.guany31coma5Hz = guany31coma5Hz;

VG.guany40Hz = guany40Hz;

VG.guany50Hz = guany50Hz;

VG.guany63Hz = guany63Hz;

VG.guany80Hz = guany80Hz;

VG.guany100Hz = guany100Hz;

VG.guany125Hz = guany125Hz;

VG.guany160Hz = guany160Hz;

VG.guany200Hz = guany200Hz;

VG.guany250Hz = guany250Hz;

Page 470: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

470

VG.guany315Hz = guany315Hz;

VG.guany400Hz = guany400Hz;

VG.guany500Hz = guany500Hz;

VG.guany630Hz = guany630Hz;

VG.guany800Hz = guany800Hz;

VG.guany1000Hz = guany1000Hz;

VG.guany1250Hz = guany1250Hz;

VG.guany1600Hz = guany1600Hz;

VG.guany2000Hz = guany2000Hz;

VG.guany2500Hz = guany2500Hz;

VG.guany3150Hz = guany3150Hz;

VG.guany4000Hz = guany4000Hz;

VG.guany5000Hz = guany5000Hz;

VG.guany6300Hz = guany6300Hz;

VG.guany8000Hz = guany8000Hz;

VG.guany10000Hz = guany10000Hz;

VG.guany12500Hz = guany12500Hz;

VG.guany16000Hz = guany16000Hz;

VG.guany_LF = guany_LF;

VG.guany_MLF = guany_MLF;

VG.guany_MHF = guany_MHF;

VG.guany_HF = guany_HF;

VG.freqCentral_LF = freqCentral_LF;

VG.freqCentral_MLF = freqCentral_MLF;

VG.freqCentral_MHF = freqCentral_MHF;

VG.freqCentral_HF = freqCentral_HF;

VG.bW_LF = bW_LF;

Page 471: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

471

VG.bW_MLF = bW_MLF;

VG.bW_MHF = bW_MHF;

VG.bW_HF = bW_HF;

VG.equalitzador = equalitzador;

//Tancar el formulari fill de l'equalitzador,

//i tornar el control al formulari pare.

this.Close();

}//Fi btCancelar_Click

private void btEqReset_Click(object sender, EventArgs e)

{

//Resetejar els fadders

tbLimitador.Value = 20;

tbGuanyGlobal.Value = 0;

tbLowCut.Value = 20;

tbHighCut.Value = 20000;

tbGuany_LF.Value = 0;

tbGuany_MLF.Value = 0;

tbGuany_MHF.Value = 0;

tbGuany_HF.Value = 0;

tbFreqCentral_LF.Value = 20;

tbFreqCentral_MLF.Value = 250;

tbFreqCentral_MHF.Value = 2000;

tbFreqCentral_HF.Value = 4000;

tbBW_LF.Value = 0;

tbBW_MLF.Value = 0;

tbBW_MHF.Value = 0;

tbBW_HF.Value = 0;

//Resetejar les variables globals

VG.guanyGlobal = 0;

VG.limitador = 20;

VG.lowCut = 20;

VG.highCut = 20000;

VG.guany_LF = 0;

VG.guany_MLF = 0;

VG.guany_MHF = 0;

Page 472: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

472

VG.guany_HF = 0;

VG.freqCentral_LF = 20;

VG.freqCentral_MLF = 250;

VG.freqCentral_MHF = 2000;

VG.freqCentral_HF = 4000;

VG.bW_LF = 0;

VG.bW_MLF = 0;

VG.bW_MHF = 0;

VG.bW_HF = 0;

//Resetejar les etiquetes

etGuanyGlobal.Text = "G = " + VG.guanyGlobal + " dB";

etLimitador.Text = "L = " + VG.limitador + " dB";

etFreqLowCut.Text = "LC = " + VG.lowCut + " Hz";

etFreqHighCut.Text = "HC = " + VG.highCut + " Hz";

etGuany_LF.Text = "G = " + VG.guany_LF + " dB";

etGuany_MLF.Text = "G = " + VG.guany_MLF + " dB";

etGuany_MHF.Text = "G = " + VG.guany_MHF + " dB";

etGuany_HF.Text = "G = " + VG.guany_HF + " dB";

etFreqCentral_LF.Text = "FC = " + VG.freqCentral_LF + " Hz";

etFreqCentral_MLF.Text = "FC = " + VG.freqCentral_MLF + " Hz";

etFreqCentral_MHF.Text = "FC = " + VG.freqCentral_MHF + " Hz";

etFreqCentral_HF.Text = "FC = " + VG.freqCentral_HF + " Hz";

etBW_LF.Text = "BW = " + VG.bW_LF + " Hz";

etBW_MLF.Text = "BW = " + VG.bW_MLF + " Hz";

etBW_MHF.Text = "BW = " + VG.bW_MHF + " Hz";

etBW_HF.Text = "BW = " + VG.bW_HF + " Hz";

}//Fi btEqReset_Click

}//Fi partial class FormFill_Eq_Parametric

}//Fi namespace Equalitzador_FFT_1

Page 473: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

473

/*************************************************************

* Fitxer FormFill_Eq_Parametric.Designer.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class FormFill_Eq_Parametric

{

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

/// <param name="disposing">true si los recursos administrados

///se deben eliminar; false en caso contrario, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido del método con el editor de código.

Page 474: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

474

/// </summary>

private void InitializeComponent()

{

this.tbGuany_LF = new System.Windows.Forms.TrackBar();

this.etMes12dB_LF = new System.Windows.Forms.Label();

this.etMenys12dB_LF = new System.Windows.Forms.Label();

this.et_LF_G = new System.Windows.Forms.Label();

this.etGuany_LF = new System.Windows.Forms.Label();

this.et0dB_LF = new System.Windows.Forms.Label();

this.tbFreqCentral_LF = new System.Windows.Forms.TrackBar();

this.tbBW_LF = new System.Windows.Forms.TrackBar();

this.tbGuanyGlobal = new System.Windows.Forms.TrackBar();

this.tbLimitador = new System.Windows.Forms.TrackBar();

this.etFreqCentral_LF = new System.Windows.Forms.Label();

this.etBW_LF = new System.Windows.Forms.Label();

this.et_LF_FC = new System.Windows.Forms.Label();

this.et_LF_BW = new System.Windows.Forms.Label();

this.etGuany = new System.Windows.Forms.Label();

this.etLimitacioTextFixe = new System.Windows.Forms.Label();

this.etGuanyGlobal = new System.Windows.Forms.Label();

this.etLimitador = new System.Windows.Forms.Label();

this.etMes15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMes20dBLimitador = new System.Windows.Forms.Label();

this.etMenys15dBGuanyGlobal = new System.Windows.Forms.Label();

this.etMenys80dBLimitador = new System.Windows.Forms.Label();

this.et0dBGuanyGlobal = new System.Windows.Forms.Label();

this.et0dBLimitador = new System.Windows.Forms.Label();

this.btCarregarEq = new System.Windows.Forms.Button();

this.btGuardarEq = new System.Windows.Forms.Button();

this.btEqOK = new System.Windows.Forms.Button();

this.btCancelar = new System.Windows.Forms.Button();

this.tbHighCut = new System.Windows.Forms.TrackBar();

this.tbLowCut = new System.Windows.Forms.TrackBar();

this.etFreqHighCut = new System.Windows.Forms.Label();

this.etFreqLowCut = new System.Windows.Forms.Label();

this.etHighCut = new System.Windows.Forms.Label();

this.etLowCut = new System.Windows.Forms.Label();

this.etHighCut20kHz = new System.Windows.Forms.Label();

this.etHighCut2500Hz = new System.Windows.Forms.Label();

this.etLowCut20Hz = new System.Windows.Forms.Label();

this.etLowCut400Hz = new System.Windows.Forms.Label();

this.et250Hz_LF = new System.Windows.Forms.Label();

Page 475: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

475

this.et20Hz_LF = new System.Windows.Forms.Label();

this.et230Hz_LF = new System.Windows.Forms.Label();

this.et0Hz_LF = new System.Windows.Forms.Label();

this.et0Hz_MHF = new System.Windows.Forms.Label();

this.et2000Hz_MHF_BW = new System.Windows.Forms.Label();

this.et2000Hz_MHF_FC = new System.Windows.Forms.Label();

this.et4000Hz_MHF = new System.Windows.Forms.Label();

this.etMHF_BW = new System.Windows.Forms.Label();

this.etMHF_FC = new System.Windows.Forms.Label();

this.etBW_MHF = new System.Windows.Forms.Label();

this.etFreqCentral_MHF = new System.Windows.Forms.Label();

this.tbBW_MHF = new System.Windows.Forms.TrackBar();

this.tbFreqCentral_MHF = new System.Windows.Forms.TrackBar();

this.et0dB_MHF = new System.Windows.Forms.Label();

this.etGuany_MHF = new System.Windows.Forms.Label();

this.etMHF_G = new System.Windows.Forms.Label();

this.etMenys12dB_MHF = new System.Windows.Forms.Label();

this.etMes12dB_MHF = new System.Windows.Forms.Label();

this.tbGuany_MHF = new System.Windows.Forms.TrackBar();

this.et0Hz_MLF = new System.Windows.Forms.Label();

this.et1750Hz_MLF = new System.Windows.Forms.Label();

this.et250Hz_MLF = new System.Windows.Forms.Label();

this.et2000Hz_MLF = new System.Windows.Forms.Label();

this.etMLF_BW = new System.Windows.Forms.Label();

this.etMLF_FC = new System.Windows.Forms.Label();

this.etBW_MLF = new System.Windows.Forms.Label();

this.etFreqCentral_MLF = new System.Windows.Forms.Label();

this.tbBW_MLF = new System.Windows.Forms.TrackBar();

this.tbFreqCentral_MLF = new System.Windows.Forms.TrackBar();

this.et0dB_MLF = new System.Windows.Forms.Label();

this.etGuany_MLF = new System.Windows.Forms.Label();

this.etMLF_G = new System.Windows.Forms.Label();

this.etMenys12dB_MLF = new System.Windows.Forms.Label();

this.etMes12dB_MLF = new System.Windows.Forms.Label();

this.tbGuany_MLF = new System.Windows.Forms.TrackBar();

this.et0Hz_HF = new System.Windows.Forms.Label();

this.et12000Hz_HF = new System.Windows.Forms.Label();

this.et4000Hz_HF = new System.Windows.Forms.Label();

this.et16000Hz_HF = new System.Windows.Forms.Label();

this.etHF_BW = new System.Windows.Forms.Label();

this.etHF_FC = new System.Windows.Forms.Label();

this.etBW_HF = new System.Windows.Forms.Label();

Page 476: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

476

this.etFreqCentral_HF = new System.Windows.Forms.Label();

this.tbBW_HF = new System.Windows.Forms.TrackBar();

this.tbFreqCentral_HF = new System.Windows.Forms.TrackBar();

this.et0dB_HF = new System.Windows.Forms.Label();

this.etGuany_HF = new System.Windows.Forms.Label();

this.etHF_G = new System.Windows.Forms.Label();

this.etMenys12sB_HF = new System.Windows.Forms.Label();

this.etMes12dB_HF = new System.Windows.Forms.Label();

this.tbGuany_HF = new System.Windows.Forms.TrackBar();

this.btEqReset = new System.Windows.Forms.Button();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_LF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_LF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_LF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbHighCut)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbLowCut)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_MHF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_MHF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_MHF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_MLF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_MLF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_MLF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_HF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_HF)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_HF)).BeginInit();

this.SuspendLayout();

//

// tbGuany_LF

//

this.tbGuany_LF.BackColor = System.Drawing.Color.LightYellow;

this.tbGuany_LF.Location = new System.Drawing.Point(308, 44);

this.tbGuany_LF.Maximum = 12;

this.tbGuany_LF.Minimum = -12;

this.tbGuany_LF.Name = "tbGuany_LF";

this.tbGuany_LF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuany_LF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuany_LF.Size = new System.Drawing.Size(45, 137);

this.tbGuany_LF.TabIndex = 0;

Page 477: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

477

this.tbGuany_LF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuany_LF.Scroll += new System.EventHandler(this.tbGuany_LF_Scroll);

//

// etMes12dB_LF

//

this.etMes12dB_LF.AutoSize = true;

this.etMes12dB_LF.Location = new System.Drawing.Point(261, 44);

this.etMes12dB_LF.Name = "etMes12dB_LF";

this.etMes12dB_LF.Size = new System.Drawing.Size(41, 13);

this.etMes12dB_LF.TabIndex = 2;

this.etMes12dB_LF.Text = "+12 dB";

//

// etMenys12dB_LF

//

this.etMenys12dB_LF.AutoSize = true;

this.etMenys12dB_LF.Location = new System.Drawing.Point(264, 168);

this.etMenys12dB_LF.Name = "etMenys12dB_LF";

this.etMenys12dB_LF.Size = new System.Drawing.Size(38, 13);

this.etMenys12dB_LF.TabIndex = 3;

this.etMenys12dB_LF.Text = "-12 dB";

//

// et_LF_G

//

this.et_LF_G.AutoSize = true;

this.et_LF_G.Location = new System.Drawing.Point(305, 194);

this.et_LF_G.Name = "et_LF_G";

this.et_LF_G.Size = new System.Drawing.Size(30, 13);

this.et_LF_G.TabIndex = 4;

this.et_LF_G.Text = "LF G";

//

// etGuany_LF

//

this.etGuany_LF.AutoSize = true;

this.etGuany_LF.Location = new System.Drawing.Point(305, 18);

this.etGuany_LF.Name = "etGuany_LF";

this.etGuany_LF.Size = new System.Drawing.Size(49, 13);

this.etGuany_LF.TabIndex = 5;

this.etGuany_LF.Text = "G = 0 dB";

//

// et0dB_LF

//

this.et0dB_LF.AutoSize = true;

Page 478: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

478

this.et0dB_LF.Location = new System.Drawing.Point(273, 106);

this.et0dB_LF.Name = "et0dB_LF";

this.et0dB_LF.Size = new System.Drawing.Size(29, 13);

this.et0dB_LF.TabIndex = 6;

this.et0dB_LF.Text = "0 dB";

//

// tbFreqCentral_LF

//

this.tbFreqCentral_LF.BackColor = System.Drawing.Color.LightYellow;

this.tbFreqCentral_LF.Location = new System.Drawing.Point(409, 44);

this.tbFreqCentral_LF.Maximum = 250;

this.tbFreqCentral_LF.Minimum = 20;

this.tbFreqCentral_LF.Name = "tbFreqCentral_LF";

this.tbFreqCentral_LF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbFreqCentral_LF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbFreqCentral_LF.Size = new System.Drawing.Size(45, 137);

this.tbFreqCentral_LF.TabIndex = 7;

this.tbFreqCentral_LF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbFreqCentral_LF.Value = 20;

this.tbFreqCentral_LF.Scroll += new System.EventHandler(this.tbFreqCentral_LF_Scroll);

//

// tbBW_LF

//

this.tbBW_LF.BackColor = System.Drawing.Color.LightYellow;

this.tbBW_LF.Location = new System.Drawing.Point(511, 44);

this.tbBW_LF.Maximum = 230;

this.tbBW_LF.Name = "tbBW_LF";

this.tbBW_LF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbBW_LF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbBW_LF.Size = new System.Drawing.Size(45, 137);

this.tbBW_LF.TabIndex = 8;

this.tbBW_LF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbBW_LF.Scroll += new System.EventHandler(this.tbBW_LF_Scroll);

//

// tbGuanyGlobal

//

this.tbGuanyGlobal.BackColor = System.Drawing.Color.LightYellow;

this.tbGuanyGlobal.Location = new System.Drawing.Point(154, 44);

this.tbGuanyGlobal.Maximum = 15;

this.tbGuanyGlobal.Minimum = -15;

this.tbGuanyGlobal.Name = "tbGuanyGlobal";

Page 479: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

479

this.tbGuanyGlobal.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuanyGlobal.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuanyGlobal.Size = new System.Drawing.Size(45, 137);

this.tbGuanyGlobal.TabIndex = 16;

this.tbGuanyGlobal.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuanyGlobal.Scroll += new System.EventHandler(this.tbGuanyGlobal_Scroll);

//

// tbLimitador

//

this.tbLimitador.BackColor = System.Drawing.Color.LightYellow;

this.tbLimitador.Location = new System.Drawing.Point(54, 44);

this.tbLimitador.Maximum = 20;

this.tbLimitador.Minimum = -80;

this.tbLimitador.Name = "tbLimitador";

this.tbLimitador.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbLimitador.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbLimitador.Size = new System.Drawing.Size(45, 137);

this.tbLimitador.TabIndex = 17;

this.tbLimitador.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbLimitador.Value = 20;

this.tbLimitador.Scroll += new System.EventHandler(this.tbLimitador_Scroll);

//

// etFreqCentral_LF

//

this.etFreqCentral_LF.AutoSize = true;

this.etFreqCentral_LF.Location = new System.Drawing.Point(405, 18);

this.etFreqCentral_LF.Name = "etFreqCentral_LF";

this.etFreqCentral_LF.Size = new System.Drawing.Size(60, 13);

this.etFreqCentral_LF.TabIndex = 18;

this.etFreqCentral_LF.Text = "FC = 20 Hz";

//

// etBW_LF

//

this.etBW_LF.AutoSize = true;

this.etBW_LF.Location = new System.Drawing.Point(509, 18);

this.etBW_LF.Name = "etBW_LF";

this.etBW_LF.Size = new System.Drawing.Size(59, 13);

this.etBW_LF.TabIndex = 19;

this.etBW_LF.Text = "BW = 0 Hz";

//

// et_LF_FC

Page 480: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

480

//

this.et_LF_FC.AutoSize = true;

this.et_LF_FC.Location = new System.Drawing.Point(406, 194);

this.et_LF_FC.Name = "et_LF_FC";

this.et_LF_FC.Size = new System.Drawing.Size(35, 13);

this.et_LF_FC.TabIndex = 30;

this.et_LF_FC.Text = "LF FC";

//

// et_LF_BW

//

this.et_LF_BW.AutoSize = true;

this.et_LF_BW.Location = new System.Drawing.Point(509, 194);

this.et_LF_BW.Name = "et_LF_BW";

this.et_LF_BW.Size = new System.Drawing.Size(40, 13);

this.et_LF_BW.TabIndex = 31;

this.et_LF_BW.Text = "LF BW";

//

// etGuany

//

this.etGuany.AutoSize = true;

this.etGuany.Location = new System.Drawing.Point(151, 194);

this.etGuany.Name = "etGuany";

this.etGuany.Size = new System.Drawing.Size(45, 13);

this.etGuany.TabIndex = 39;

this.etGuany.Text = "GUANY";

//

// etLimitacioTextFixe

//

this.etLimitacioTextFixe.AutoSize = true;

this.etLimitacioTextFixe.Location = new System.Drawing.Point(44, 194);

this.etLimitacioTextFixe.Name = "etLimitacioTextFixe";

this.etLimitacioTextFixe.Size = new System.Drawing.Size(60, 13);

this.etLimitacioTextFixe.TabIndex = 40;

this.etLimitacioTextFixe.Text = "LIMITACIÓ";

//

// etGuanyGlobal

//

this.etGuanyGlobal.AutoSize = true;

this.etGuanyGlobal.Location = new System.Drawing.Point(150, 19);

this.etGuanyGlobal.Name = "etGuanyGlobal";

this.etGuanyGlobal.Size = new System.Drawing.Size(49, 13);

this.etGuanyGlobal.TabIndex = 41;

Page 481: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

481

this.etGuanyGlobal.Text = "G = 0 dB";

//

// etLimitador

//

this.etLimitador.AutoSize = true;

this.etLimitador.Location = new System.Drawing.Point(51, 19);

this.etLimitador.Name = "etLimitador";

this.etLimitador.Size = new System.Drawing.Size(53, 13);

this.etLimitador.TabIndex = 42;

this.etLimitador.Text = "L = 20 dB";

//

// etMes15dBGuanyGlobal

//

this.etMes15dBGuanyGlobal.AutoSize = true;

this.etMes15dBGuanyGlobal.Location = new System.Drawing.Point(107, 44);

this.etMes15dBGuanyGlobal.Name = "etMes15dBGuanyGlobal";

this.etMes15dBGuanyGlobal.Size = new System.Drawing.Size(41, 13);

this.etMes15dBGuanyGlobal.TabIndex = 43;

this.etMes15dBGuanyGlobal.Text = "+15 dB";

//

// etMes20dBLimitador

//

this.etMes20dBLimitador.AutoSize = true;

this.etMes20dBLimitador.Location = new System.Drawing.Point(7, 44);

this.etMes20dBLimitador.Name = "etMes20dBLimitador";

this.etMes20dBLimitador.Size = new System.Drawing.Size(41, 13);

this.etMes20dBLimitador.TabIndex = 44;

this.etMes20dBLimitador.Text = "+20 dB";

//

// etMenys15dBGuanyGlobal

//

this.etMenys15dBGuanyGlobal.AutoSize = true;

this.etMenys15dBGuanyGlobal.Location = new System.Drawing.Point(110, 168);

this.etMenys15dBGuanyGlobal.Name = "etMenys15dBGuanyGlobal";

this.etMenys15dBGuanyGlobal.Size = new System.Drawing.Size(38, 13);

this.etMenys15dBGuanyGlobal.TabIndex = 45;

this.etMenys15dBGuanyGlobal.Text = "-15 dB";

//

// etMenys80dBLimitador

//

this.etMenys80dBLimitador.AutoSize = true;

this.etMenys80dBLimitador.Location = new System.Drawing.Point(10, 168);

Page 482: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

482

this.etMenys80dBLimitador.Name = "etMenys80dBLimitador";

this.etMenys80dBLimitador.Size = new System.Drawing.Size(38, 13);

this.etMenys80dBLimitador.TabIndex = 46;

this.etMenys80dBLimitador.Text = "-80 dB";

//

// et0dBGuanyGlobal

//

this.et0dBGuanyGlobal.AutoSize = true;

this.et0dBGuanyGlobal.Location = new System.Drawing.Point(119, 106);

this.et0dBGuanyGlobal.Name = "et0dBGuanyGlobal";

this.et0dBGuanyGlobal.Size = new System.Drawing.Size(29, 13);

this.et0dBGuanyGlobal.TabIndex = 47;

this.et0dBGuanyGlobal.Text = "0 dB";

//

// et0dBLimitador

//

this.et0dBLimitador.AutoSize = true;

this.et0dBLimitador.Location = new System.Drawing.Point(19, 70);

this.et0dBLimitador.Name = "et0dBLimitador";

this.et0dBLimitador.Size = new System.Drawing.Size(29, 13);

this.et0dBLimitador.TabIndex = 48;

this.et0dBLimitador.Text = "0 dB";

//

// btCarregarEq

//

this.btCarregarEq.Location = new System.Drawing.Point(54, 474);

this.btCarregarEq.Name = "btCarregarEq";

this.btCarregarEq.Size = new System.Drawing.Size(94, 23);

this.btCarregarEq.TabIndex = 49;

this.btCarregarEq.Text = "CARREGAR EQ";

this.btCarregarEq.UseVisualStyleBackColor = true;

this.btCarregarEq.Click += new System.EventHandler(this.btCarregarEq_Click);

//

// btGuardarEq

//

this.btGuardarEq.Location = new System.Drawing.Point(233, 474);

this.btGuardarEq.Name = "btGuardarEq";

this.btGuardarEq.Size = new System.Drawing.Size(90, 23);

this.btGuardarEq.TabIndex = 50;

this.btGuardarEq.Text = "GUARDAR EQ";

this.btGuardarEq.UseVisualStyleBackColor = true;

this.btGuardarEq.Click += new System.EventHandler(this.btGuardarEq_Click);

Page 483: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

483

//

// btEqOK

//

this.btEqOK.Location = new System.Drawing.Point(644, 474);

this.btEqOK.Name = "btEqOK";

this.btEqOK.Size = new System.Drawing.Size(75, 23);

this.btEqOK.TabIndex = 51;

this.btEqOK.Text = "EQ OK";

this.btEqOK.UseVisualStyleBackColor = true;

this.btEqOK.Click += new System.EventHandler(this.btEqOK_Click);

//

// btCancelar

//

this.btCancelar.Location = new System.Drawing.Point(838, 473);

this.btCancelar.Name = "btCancelar";

this.btCancelar.Size = new System.Drawing.Size(98, 23);

this.btCancelar.TabIndex = 52;

this.btCancelar.Text = "CANCEL.LAR";

this.btCancelar.UseVisualStyleBackColor = true;

this.btCancelar.Click += new System.EventHandler(this.btCancelar_Click);

//

// tbHighCut

//

this.tbHighCut.BackColor = System.Drawing.Color.LightYellow;

this.tbHighCut.Location = new System.Drawing.Point(154, 284);

this.tbHighCut.Maximum = 20000;

this.tbHighCut.Minimum = 2500;

this.tbHighCut.Name = "tbHighCut";

this.tbHighCut.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbHighCut.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbHighCut.Size = new System.Drawing.Size(45, 137);

this.tbHighCut.TabIndex = 53;

this.tbHighCut.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbHighCut.Value = 20000;

this.tbHighCut.Scroll += new System.EventHandler(this.tbHighCut_Scroll);

//

// tbLowCut

//

this.tbLowCut.BackColor = System.Drawing.Color.LightYellow;

this.tbLowCut.Location = new System.Drawing.Point(54, 284);

this.tbLowCut.Maximum = 400;

this.tbLowCut.Minimum = 20;

Page 484: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

484

this.tbLowCut.Name = "tbLowCut";

this.tbLowCut.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbLowCut.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbLowCut.Size = new System.Drawing.Size(45, 137);

this.tbLowCut.TabIndex = 54;

this.tbLowCut.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbLowCut.Value = 20;

this.tbLowCut.Scroll += new System.EventHandler(this.tbLowCut_Scroll);

//

// etFreqHighCut

//

this.etFreqHighCut.AutoSize = true;

this.etFreqHighCut.Location = new System.Drawing.Point(151, 259);

this.etFreqHighCut.Name = "etFreqHighCut";

this.etFreqHighCut.Size = new System.Drawing.Size(80, 13);

this.etFreqHighCut.TabIndex = 55;

this.etFreqHighCut.Text = "HC = 20000 Hz";

//

// etFreqLowCut

//

this.etFreqLowCut.AutoSize = true;

this.etFreqLowCut.Location = new System.Drawing.Point(55, 259);

this.etFreqLowCut.Name = "etFreqLowCut";

this.etFreqLowCut.Size = new System.Drawing.Size(60, 13);

this.etFreqLowCut.TabIndex = 56;

this.etFreqLowCut.Text = "LC = 20 Hz";

//

// etHighCut

//

this.etHighCut.AutoSize = true;

this.etHighCut.Location = new System.Drawing.Point(151, 433);

this.etHighCut.Name = "etHighCut";

this.etHighCut.Size = new System.Drawing.Size(59, 13);

this.etHighCut.TabIndex = 57;

this.etHighCut.Text = "HIGH CUT";

//

// etLowCut

//

this.etLowCut.AutoSize = true;

this.etLowCut.Location = new System.Drawing.Point(51, 433);

this.etLowCut.Name = "etLowCut";

this.etLowCut.Size = new System.Drawing.Size(57, 13);

Page 485: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

485

this.etLowCut.TabIndex = 58;

this.etLowCut.Text = "LOW CUT";

//

// etHighCut20kHz

//

this.etHighCut20kHz.AutoSize = true;

this.etHighCut20kHz.Location = new System.Drawing.Point(110, 284);

this.etHighCut20kHz.Name = "etHighCut20kHz";

this.etHighCut20kHz.Size = new System.Drawing.Size(41, 13);

this.etHighCut20kHz.TabIndex = 59;

this.etHighCut20kHz.Text = "20 kHz";

//

// etHighCut2500Hz

//

this.etHighCut2500Hz.AutoSize = true;

this.etHighCut2500Hz.Location = new System.Drawing.Point(110, 399);

this.etHighCut2500Hz.Name = "etHighCut2500Hz";

this.etHighCut2500Hz.Size = new System.Drawing.Size(44, 13);

this.etHighCut2500Hz.TabIndex = 60;

this.etHighCut2500Hz.Text = "2,5 kHz";

//

// etLowCut20Hz

//

this.etLowCut20Hz.AutoSize = true;

this.etLowCut20Hz.Location = new System.Drawing.Point(12, 399);

this.etLowCut20Hz.Name = "etLowCut20Hz";

this.etLowCut20Hz.Size = new System.Drawing.Size(35, 13);

this.etLowCut20Hz.TabIndex = 61;

this.etLowCut20Hz.Text = "20 Hz";

//

// etLowCut400Hz

//

this.etLowCut400Hz.AutoSize = true;

this.etLowCut400Hz.Location = new System.Drawing.Point(12, 284);

this.etLowCut400Hz.Name = "etLowCut400Hz";

this.etLowCut400Hz.Size = new System.Drawing.Size(41, 13);

this.etLowCut400Hz.TabIndex = 62;

this.etLowCut400Hz.Text = "400 Hz";

//

// et250Hz_LF

//

this.et250Hz_LF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

Page 486: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

486

this.et250Hz_LF.AutoSize = true;

this.et250Hz_LF.Location = new System.Drawing.Point(362, 44);

this.et250Hz_LF.Name = "et250Hz_LF";

this.et250Hz_LF.Size = new System.Drawing.Size(41, 13);

this.et250Hz_LF.TabIndex = 131;

this.et250Hz_LF.Text = "250 Hz";

//

// et20Hz_LF

//

this.et20Hz_LF.AutoSize = true;

this.et20Hz_LF.Location = new System.Drawing.Point(368, 168);

this.et20Hz_LF.Name = "et20Hz_LF";

this.et20Hz_LF.Size = new System.Drawing.Size(35, 13);

this.et20Hz_LF.TabIndex = 132;

this.et20Hz_LF.Text = "20 Hz";

//

// et230Hz_LF

//

this.et230Hz_LF.AutoSize = true;

this.et230Hz_LF.Location = new System.Drawing.Point(464, 44);

this.et230Hz_LF.Name = "et230Hz_LF";

this.et230Hz_LF.Size = new System.Drawing.Size(41, 13);

this.et230Hz_LF.TabIndex = 133;

this.et230Hz_LF.Text = "230 Hz";

//

// et0Hz_LF

//

this.et0Hz_LF.AutoSize = true;

this.et0Hz_LF.Location = new System.Drawing.Point(470, 168);

this.et0Hz_LF.Name = "et0Hz_LF";

this.et0Hz_LF.Size = new System.Drawing.Size(29, 13);

this.et0Hz_LF.TabIndex = 134;

this.et0Hz_LF.Text = "0 Hz";

//

// et0Hz_MHF

//

this.et0Hz_MHF.AutoSize = true;

this.et0Hz_MHF.Location = new System.Drawing.Point(469, 408);

this.et0Hz_MHF.Name = "et0Hz_MHF";

this.et0Hz_MHF.Size = new System.Drawing.Size(29, 13);

this.et0Hz_MHF.TabIndex = 150;

this.et0Hz_MHF.Text = "0 Hz";

Page 487: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

487

//

// et2000Hz_MHF_BW

//

this.et2000Hz_MHF_BW.AutoSize = true;

this.et2000Hz_MHF_BW.Location = new System.Drawing.Point(463, 284);

this.et2000Hz_MHF_BW.Name = "et2000Hz_MHF_BW";

this.et2000Hz_MHF_BW.Size = new System.Drawing.Size(47, 13);

this.et2000Hz_MHF_BW.TabIndex = 149;

this.et2000Hz_MHF_BW.Text = "2000 Hz";

//

// et2000Hz_MHF_FC

//

this.et2000Hz_MHF_FC.AutoSize = true;

this.et2000Hz_MHF_FC.Location = new System.Drawing.Point(367, 408);

this.et2000Hz_MHF_FC.Name = "et2000Hz_MHF_FC";

this.et2000Hz_MHF_FC.Size = new System.Drawing.Size(47, 13);

this.et2000Hz_MHF_FC.TabIndex = 148;

this.et2000Hz_MHF_FC.Text = "2000 Hz";

//

// et4000Hz_MHF

//

this.et4000Hz_MHF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.et4000Hz_MHF.AutoSize = true;

this.et4000Hz_MHF.Location = new System.Drawing.Point(361, 284);

this.et4000Hz_MHF.Name = "et4000Hz_MHF";

this.et4000Hz_MHF.Size = new System.Drawing.Size(47, 13);

this.et4000Hz_MHF.TabIndex = 147;

this.et4000Hz_MHF.Text = "4000 Hz";

//

// etMHF_BW

//

this.etMHF_BW.AutoSize = true;

this.etMHF_BW.Location = new System.Drawing.Point(508, 434);

this.etMHF_BW.Name = "etMHF_BW";

this.etMHF_BW.Size = new System.Drawing.Size(51, 13);

this.etMHF_BW.TabIndex = 146;

this.etMHF_BW.Text = "MHF BW";

//

// etMHF_FC

//

this.etMHF_FC.AutoSize = true;

this.etMHF_FC.Location = new System.Drawing.Point(405, 434);

Page 488: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

488

this.etMHF_FC.Name = "etMHF_FC";

this.etMHF_FC.Size = new System.Drawing.Size(46, 13);

this.etMHF_FC.TabIndex = 145;

this.etMHF_FC.Text = "MHF FC";

//

// etBW_MHF

//

this.etBW_MHF.AutoSize = true;

this.etBW_MHF.Location = new System.Drawing.Point(508, 258);

this.etBW_MHF.Name = "etBW_MHF";

this.etBW_MHF.Size = new System.Drawing.Size(59, 13);

this.etBW_MHF.TabIndex = 144;

this.etBW_MHF.Text = "BW = 0 Hz";

//

// etFreqCentral_MHF

//

this.etFreqCentral_MHF.AutoSize = true;

this.etFreqCentral_MHF.Location = new System.Drawing.Point(404, 258);

this.etFreqCentral_MHF.Name = "etFreqCentral_MHF";

this.etFreqCentral_MHF.Size = new System.Drawing.Size(72, 13);

this.etFreqCentral_MHF.TabIndex = 143;

this.etFreqCentral_MHF.Text = "FC = 2000 Hz";

//

// tbBW_MHF

//

this.tbBW_MHF.BackColor = System.Drawing.Color.LightYellow;

this.tbBW_MHF.Location = new System.Drawing.Point(510, 284);

this.tbBW_MHF.Maximum = 2000;

this.tbBW_MHF.Name = "tbBW_MHF";

this.tbBW_MHF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbBW_MHF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbBW_MHF.Size = new System.Drawing.Size(45, 137);

this.tbBW_MHF.TabIndex = 142;

this.tbBW_MHF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbBW_MHF.Scroll += new System.EventHandler(this.tbBW_MHF_Scroll);

//

// tbFreqCentral_MHF

//

this.tbFreqCentral_MHF.BackColor = System.Drawing.Color.LightYellow;

this.tbFreqCentral_MHF.Location = new System.Drawing.Point(408, 284);

this.tbFreqCentral_MHF.Maximum = 4000;

this.tbFreqCentral_MHF.Minimum = 2000;

Page 489: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

489

this.tbFreqCentral_MHF.Name = "tbFreqCentral_MHF";

this.tbFreqCentral_MHF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbFreqCentral_MHF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbFreqCentral_MHF.Size = new System.Drawing.Size(45, 137);

this.tbFreqCentral_MHF.TabIndex = 141;

this.tbFreqCentral_MHF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbFreqCentral_MHF.Value = 2000;

this.tbFreqCentral_MHF.Scroll += new System.EventHandler(this.tbFreqCentral_MHF_Scroll);

//

// et0dB_MHF

//

this.et0dB_MHF.AutoSize = true;

this.et0dB_MHF.Location = new System.Drawing.Point(272, 346);

this.et0dB_MHF.Name = "et0dB_MHF";

this.et0dB_MHF.Size = new System.Drawing.Size(29, 13);

this.et0dB_MHF.TabIndex = 140;

this.et0dB_MHF.Text = "0 dB";

//

// etGuany_MHF

//

this.etGuany_MHF.AutoSize = true;

this.etGuany_MHF.Location = new System.Drawing.Point(304, 258);

this.etGuany_MHF.Name = "etGuany_MHF";

this.etGuany_MHF.Size = new System.Drawing.Size(49, 13);

this.etGuany_MHF.TabIndex = 139;

this.etGuany_MHF.Text = "G = 0 dB";

//

// etMHF_G

//

this.etMHF_G.AutoSize = true;

this.etMHF_G.Location = new System.Drawing.Point(304, 434);

this.etMHF_G.Name = "etMHF_G";

this.etMHF_G.Size = new System.Drawing.Size(41, 13);

this.etMHF_G.TabIndex = 138;

this.etMHF_G.Text = "MHF G";

//

// etMenys12dB_MHF

//

this.etMenys12dB_MHF.AutoSize = true;

this.etMenys12dB_MHF.Location = new System.Drawing.Point(263, 408);

this.etMenys12dB_MHF.Name = "etMenys12dB_MHF";

Page 490: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

490

this.etMenys12dB_MHF.Size = new System.Drawing.Size(38, 13);

this.etMenys12dB_MHF.TabIndex = 137;

this.etMenys12dB_MHF.Text = "-12 dB";

//

// etMes12dB_MHF

//

this.etMes12dB_MHF.AutoSize = true;

this.etMes12dB_MHF.Location = new System.Drawing.Point(260, 284);

this.etMes12dB_MHF.Name = "etMes12dB_MHF";

this.etMes12dB_MHF.Size = new System.Drawing.Size(41, 13);

this.etMes12dB_MHF.TabIndex = 136;

this.etMes12dB_MHF.Text = "+12 dB";

//

// tbGuany_MHF

//

this.tbGuany_MHF.BackColor = System.Drawing.Color.LightYellow;

this.tbGuany_MHF.Location = new System.Drawing.Point(307, 284);

this.tbGuany_MHF.Maximum = 12;

this.tbGuany_MHF.Minimum = -12;

this.tbGuany_MHF.Name = "tbGuany_MHF";

this.tbGuany_MHF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuany_MHF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuany_MHF.Size = new System.Drawing.Size(45, 137);

this.tbGuany_MHF.TabIndex = 135;

this.tbGuany_MHF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuany_MHF.Scroll += new System.EventHandler(this.tbGuany_MHF_Scroll);

//

// et0Hz_MLF

//

this.et0Hz_MLF.AutoSize = true;

this.et0Hz_MLF.Location = new System.Drawing.Point(835, 168);

this.et0Hz_MLF.Name = "et0Hz_MLF";

this.et0Hz_MLF.Size = new System.Drawing.Size(29, 13);

this.et0Hz_MLF.TabIndex = 166;

this.et0Hz_MLF.Text = "0 Hz";

//

// et1750Hz_MLF

//

this.et1750Hz_MLF.AutoSize = true;

this.et1750Hz_MLF.Location = new System.Drawing.Point(829, 44);

this.et1750Hz_MLF.Name = "et1750Hz_MLF";

this.et1750Hz_MLF.Size = new System.Drawing.Size(47, 13);

Page 491: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

491

this.et1750Hz_MLF.TabIndex = 165;

this.et1750Hz_MLF.Text = "1750 Hz";

//

// et250Hz_MLF

//

this.et250Hz_MLF.AutoSize = true;

this.et250Hz_MLF.Location = new System.Drawing.Point(733, 168);

this.et250Hz_MLF.Name = "et250Hz_MLF";

this.et250Hz_MLF.Size = new System.Drawing.Size(41, 13);

this.et250Hz_MLF.TabIndex = 164;

this.et250Hz_MLF.Text = "250 Hz";

//

// et2000Hz_MLF

//

this.et2000Hz_MLF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.et2000Hz_MLF.AutoSize = true;

this.et2000Hz_MLF.Location = new System.Drawing.Point(727, 44);

this.et2000Hz_MLF.Name = "et2000Hz_MLF";

this.et2000Hz_MLF.Size = new System.Drawing.Size(47, 13);

this.et2000Hz_MLF.TabIndex = 163;

this.et2000Hz_MLF.Text = "2000 Hz";

//

// etMLF_BW

//

this.etMLF_BW.AutoSize = true;

this.etMLF_BW.Location = new System.Drawing.Point(874, 194);

this.etMLF_BW.Name = "etMLF_BW";

this.etMLF_BW.Size = new System.Drawing.Size(49, 13);

this.etMLF_BW.TabIndex = 162;

this.etMLF_BW.Text = "MLF BW";

//

// etMLF_FC

//

this.etMLF_FC.AutoSize = true;

this.etMLF_FC.Location = new System.Drawing.Point(771, 194);

this.etMLF_FC.Name = "etMLF_FC";

this.etMLF_FC.Size = new System.Drawing.Size(44, 13);

this.etMLF_FC.TabIndex = 161;

this.etMLF_FC.Text = "MLF FC";

//

// etBW_MLF

//

Page 492: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

492

this.etBW_MLF.AutoSize = true;

this.etBW_MLF.Location = new System.Drawing.Point(874, 18);

this.etBW_MLF.Name = "etBW_MLF";

this.etBW_MLF.Size = new System.Drawing.Size(59, 13);

this.etBW_MLF.TabIndex = 160;

this.etBW_MLF.Text = "BW = 0 Hz";

//

// etFreqCentral_MLF

//

this.etFreqCentral_MLF.AutoSize = true;

this.etFreqCentral_MLF.Location = new System.Drawing.Point(770, 18);

this.etFreqCentral_MLF.Name = "etFreqCentral_MLF";

this.etFreqCentral_MLF.Size = new System.Drawing.Size(66, 13);

this.etFreqCentral_MLF.TabIndex = 159;

this.etFreqCentral_MLF.Text = "FC = 250 Hz";

//

// tbBW_MLF

//

this.tbBW_MLF.BackColor = System.Drawing.Color.LightYellow;

this.tbBW_MLF.Location = new System.Drawing.Point(876, 44);

this.tbBW_MLF.Maximum = 1750;

this.tbBW_MLF.Name = "tbBW_MLF";

this.tbBW_MLF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbBW_MLF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbBW_MLF.Size = new System.Drawing.Size(45, 137);

this.tbBW_MLF.TabIndex = 158;

this.tbBW_MLF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbBW_MLF.Scroll += new System.EventHandler(this.tbBW_MLF_Scroll);

//

// tbFreqCentral_MLF

//

this.tbFreqCentral_MLF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.tbFreqCentral_MLF.BackColor = System.Drawing.Color.LightYellow;

this.tbFreqCentral_MLF.Location = new System.Drawing.Point(774, 44);

this.tbFreqCentral_MLF.Maximum = 2000;

this.tbFreqCentral_MLF.Minimum = 250;

this.tbFreqCentral_MLF.Name = "tbFreqCentral_MLF";

this.tbFreqCentral_MLF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbFreqCentral_MLF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbFreqCentral_MLF.Size = new System.Drawing.Size(45, 137);

this.tbFreqCentral_MLF.TabIndex = 157;

Page 493: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

493

this.tbFreqCentral_MLF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbFreqCentral_MLF.Value = 250;

this.tbFreqCentral_MLF.Scroll += new System.EventHandler(this.tbFreqCentral_MLF_Scroll);

//

// et0dB_MLF

//

this.et0dB_MLF.AutoSize = true;

this.et0dB_MLF.Location = new System.Drawing.Point(638, 106);

this.et0dB_MLF.Name = "et0dB_MLF";

this.et0dB_MLF.Size = new System.Drawing.Size(29, 13);

this.et0dB_MLF.TabIndex = 156;

this.et0dB_MLF.Text = "0 dB";

//

// etGuany_MLF

//

this.etGuany_MLF.AutoSize = true;

this.etGuany_MLF.Location = new System.Drawing.Point(670, 18);

this.etGuany_MLF.Name = "etGuany_MLF";

this.etGuany_MLF.Size = new System.Drawing.Size(49, 13);

this.etGuany_MLF.TabIndex = 155;

this.etGuany_MLF.Text = "G = 0 dB";

//

// etMLF_G

//

this.etMLF_G.AutoSize = true;

this.etMLF_G.Location = new System.Drawing.Point(670, 194);

this.etMLF_G.Name = "etMLF_G";

this.etMLF_G.Size = new System.Drawing.Size(39, 13);

this.etMLF_G.TabIndex = 154;

this.etMLF_G.Text = "MLF G";

//

// etMenys12dB_MLF

//

this.etMenys12dB_MLF.AutoSize = true;

this.etMenys12dB_MLF.Location = new System.Drawing.Point(629, 168);

this.etMenys12dB_MLF.Name = "etMenys12dB_MLF";

this.etMenys12dB_MLF.Size = new System.Drawing.Size(38, 13);

this.etMenys12dB_MLF.TabIndex = 153;

this.etMenys12dB_MLF.Text = "-12 dB";

//

// etMes12dB_MLF

Page 494: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

494

//

this.etMes12dB_MLF.AutoSize = true;

this.etMes12dB_MLF.Location = new System.Drawing.Point(626, 44);

this.etMes12dB_MLF.Name = "etMes12dB_MLF";

this.etMes12dB_MLF.Size = new System.Drawing.Size(41, 13);

this.etMes12dB_MLF.TabIndex = 152;

this.etMes12dB_MLF.Text = "+12 dB";

//

// tbGuany_MLF

//

this.tbGuany_MLF.BackColor = System.Drawing.Color.LightYellow;

this.tbGuany_MLF.Location = new System.Drawing.Point(673, 44);

this.tbGuany_MLF.Maximum = 12;

this.tbGuany_MLF.Minimum = -12;

this.tbGuany_MLF.Name = "tbGuany_MLF";

this.tbGuany_MLF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuany_MLF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuany_MLF.Size = new System.Drawing.Size(45, 137);

this.tbGuany_MLF.TabIndex = 151;

this.tbGuany_MLF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuany_MLF.Scroll += new System.EventHandler(this.tbGuany_MLF_Scroll);

//

// et0Hz_HF

//

this.et0Hz_HF.AutoSize = true;

this.et0Hz_HF.Location = new System.Drawing.Point(835, 408);

this.et0Hz_HF.Name = "et0Hz_HF";

this.et0Hz_HF.Size = new System.Drawing.Size(29, 13);

this.et0Hz_HF.TabIndex = 182;

this.et0Hz_HF.Text = "0 Hz";

//

// et12000Hz_HF

//

this.et12000Hz_HF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.et12000Hz_HF.AutoSize = true;

this.et12000Hz_HF.Location = new System.Drawing.Point(829, 284);

this.et12000Hz_HF.Name = "et12000Hz_HF";

this.et12000Hz_HF.Size = new System.Drawing.Size(53, 13);

this.et12000Hz_HF.TabIndex = 181;

this.et12000Hz_HF.Text = "12000 Hz";

//

// et4000Hz_HF

Page 495: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

495

//

this.et4000Hz_HF.AutoSize = true;

this.et4000Hz_HF.Location = new System.Drawing.Point(733, 408);

this.et4000Hz_HF.Name = "et4000Hz_HF";

this.et4000Hz_HF.Size = new System.Drawing.Size(47, 13);

this.et4000Hz_HF.TabIndex = 180;

this.et4000Hz_HF.Text = "4000 Hz";

//

// et16000Hz_HF

//

this.et16000Hz_HF.AccessibleRole = System.Windows.Forms.AccessibleRole.None;

this.et16000Hz_HF.AutoSize = true;

this.et16000Hz_HF.Location = new System.Drawing.Point(727, 284);

this.et16000Hz_HF.Name = "et16000Hz_HF";

this.et16000Hz_HF.Size = new System.Drawing.Size(53, 13);

this.et16000Hz_HF.TabIndex = 179;

this.et16000Hz_HF.Text = "16000 Hz";

//

// etHF_BW

//

this.etHF_BW.AutoSize = true;

this.etHF_BW.Location = new System.Drawing.Point(874, 434);

this.etHF_BW.Name = "etHF_BW";

this.etHF_BW.Size = new System.Drawing.Size(42, 13);

this.etHF_BW.TabIndex = 178;

this.etHF_BW.Text = "HF BW";

//

// etHF_FC

//

this.etHF_FC.AutoSize = true;

this.etHF_FC.Location = new System.Drawing.Point(771, 434);

this.etHF_FC.Name = "etHF_FC";

this.etHF_FC.Size = new System.Drawing.Size(37, 13);

this.etHF_FC.TabIndex = 177;

this.etHF_FC.Text = "HF FC";

//

// etBW_HF

//

this.etBW_HF.AutoSize = true;

this.etBW_HF.Location = new System.Drawing.Point(874, 258);

this.etBW_HF.Name = "etBW_HF";

this.etBW_HF.Size = new System.Drawing.Size(59, 13);

Page 496: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

496

this.etBW_HF.TabIndex = 176;

this.etBW_HF.Text = "BW = 0 Hz";

//

// etFreqCentral_HF

//

this.etFreqCentral_HF.AutoSize = true;

this.etFreqCentral_HF.Location = new System.Drawing.Point(770, 258);

this.etFreqCentral_HF.Name = "etFreqCentral_HF";

this.etFreqCentral_HF.Size = new System.Drawing.Size(72, 13);

this.etFreqCentral_HF.TabIndex = 175;

this.etFreqCentral_HF.Text = "FC = 4000 Hz";

//

// tbBW_HF

//

this.tbBW_HF.BackColor = System.Drawing.Color.LightYellow;

this.tbBW_HF.Location = new System.Drawing.Point(876, 284);

this.tbBW_HF.Maximum = 12000;

this.tbBW_HF.Name = "tbBW_HF";

this.tbBW_HF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbBW_HF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbBW_HF.Size = new System.Drawing.Size(45, 137);

this.tbBW_HF.TabIndex = 174;

this.tbBW_HF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbBW_HF.Scroll += new System.EventHandler(this.tbBW_HF_Scroll);

//

// tbFreqCentral_HF

//

this.tbFreqCentral_HF.BackColor = System.Drawing.Color.LightYellow;

this.tbFreqCentral_HF.Location = new System.Drawing.Point(774, 284);

this.tbFreqCentral_HF.Maximum = 16000;

this.tbFreqCentral_HF.Minimum = 4000;

this.tbFreqCentral_HF.Name = "tbFreqCentral_HF";

this.tbFreqCentral_HF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbFreqCentral_HF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbFreqCentral_HF.Size = new System.Drawing.Size(45, 137);

this.tbFreqCentral_HF.TabIndex = 173;

this.tbFreqCentral_HF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbFreqCentral_HF.Value = 4000;

this.tbFreqCentral_HF.Scroll += new System.EventHandler(this.tbFreqCentral_HF_Scroll);

//

// et0dB_HF

Page 497: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

497

//

this.et0dB_HF.AutoSize = true;

this.et0dB_HF.Location = new System.Drawing.Point(638, 346);

this.et0dB_HF.Name = "et0dB_HF";

this.et0dB_HF.Size = new System.Drawing.Size(29, 13);

this.et0dB_HF.TabIndex = 172;

this.et0dB_HF.Text = "0 dB";

//

// etGuany_HF

//

this.etGuany_HF.AutoSize = true;

this.etGuany_HF.Location = new System.Drawing.Point(670, 258);

this.etGuany_HF.Name = "etGuany_HF";

this.etGuany_HF.Size = new System.Drawing.Size(49, 13);

this.etGuany_HF.TabIndex = 171;

this.etGuany_HF.Text = "G = 0 dB";

//

// etHF_G

//

this.etHF_G.AutoSize = true;

this.etHF_G.Location = new System.Drawing.Point(670, 434);

this.etHF_G.Name = "etHF_G";

this.etHF_G.Size = new System.Drawing.Size(32, 13);

this.etHF_G.TabIndex = 170;

this.etHF_G.Text = "HF G";

//

// etMenys12sB_HF

//

this.etMenys12sB_HF.AutoSize = true;

this.etMenys12sB_HF.Location = new System.Drawing.Point(629, 408);

this.etMenys12sB_HF.Name = "etMenys12sB_HF";

this.etMenys12sB_HF.Size = new System.Drawing.Size(38, 13);

this.etMenys12sB_HF.TabIndex = 169;

this.etMenys12sB_HF.Text = "-12 dB";

//

// etMes12dB_HF

//

this.etMes12dB_HF.AutoSize = true;

this.etMes12dB_HF.Location = new System.Drawing.Point(626, 284);

this.etMes12dB_HF.Name = "etMes12dB_HF";

this.etMes12dB_HF.Size = new System.Drawing.Size(41, 13);

this.etMes12dB_HF.TabIndex = 168;

Page 498: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

498

this.etMes12dB_HF.Text = "+12 dB";

//

// tbGuany_HF

//

this.tbGuany_HF.BackColor = System.Drawing.Color.LightYellow;

this.tbGuany_HF.Location = new System.Drawing.Point(673, 284);

this.tbGuany_HF.Maximum = 12;

this.tbGuany_HF.Minimum = -12;

this.tbGuany_HF.Name = "tbGuany_HF";

this.tbGuany_HF.Orientation = System.Windows.Forms.Orientation.Vertical;

this.tbGuany_HF.RightToLeft = System.Windows.Forms.RightToLeft.No;

this.tbGuany_HF.Size = new System.Drawing.Size(45, 137);

this.tbGuany_HF.TabIndex = 167;

this.tbGuany_HF.TickStyle = System.Windows.Forms.TickStyle.Both;

this.tbGuany_HF.Scroll += new System.EventHandler(this.tbGuany_HF_Scroll);

//

// btEqReset

//

this.btEqReset.Location = new System.Drawing.Point(466, 474);

this.btEqReset.Name = "btEqReset";

this.btEqReset.Size = new System.Drawing.Size(75, 23);

this.btEqReset.TabIndex = 183;

this.btEqReset.Text = "RESET";

this.btEqReset.UseVisualStyleBackColor = true;

this.btEqReset.Click += new System.EventHandler(this.btEqReset_Click);

//

// FormFill_Eq_Parametric

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(966, 522);

this.Controls.Add(this.btEqReset);

this.Controls.Add(this.et0Hz_HF);

this.Controls.Add(this.et12000Hz_HF);

this.Controls.Add(this.et4000Hz_HF);

this.Controls.Add(this.et16000Hz_HF);

this.Controls.Add(this.etHF_BW);

this.Controls.Add(this.etHF_FC);

this.Controls.Add(this.etBW_HF);

this.Controls.Add(this.etFreqCentral_HF);

this.Controls.Add(this.tbBW_HF);

this.Controls.Add(this.tbFreqCentral_HF);

Page 499: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

499

this.Controls.Add(this.et0dB_HF);

this.Controls.Add(this.etGuany_HF);

this.Controls.Add(this.etHF_G);

this.Controls.Add(this.etMenys12sB_HF);

this.Controls.Add(this.etMes12dB_HF);

this.Controls.Add(this.tbGuany_HF);

this.Controls.Add(this.et0Hz_MLF);

this.Controls.Add(this.et1750Hz_MLF);

this.Controls.Add(this.et250Hz_MLF);

this.Controls.Add(this.et2000Hz_MLF);

this.Controls.Add(this.etMLF_BW);

this.Controls.Add(this.etMLF_FC);

this.Controls.Add(this.etBW_MLF);

this.Controls.Add(this.etFreqCentral_MLF);

this.Controls.Add(this.tbBW_MLF);

this.Controls.Add(this.tbFreqCentral_MLF);

this.Controls.Add(this.et0dB_MLF);

this.Controls.Add(this.etGuany_MLF);

this.Controls.Add(this.etMLF_G);

this.Controls.Add(this.etMenys12dB_MLF);

this.Controls.Add(this.etMes12dB_MLF);

this.Controls.Add(this.tbGuany_MLF);

this.Controls.Add(this.et0Hz_MHF);

this.Controls.Add(this.et2000Hz_MHF_BW);

this.Controls.Add(this.et2000Hz_MHF_FC);

this.Controls.Add(this.et4000Hz_MHF);

this.Controls.Add(this.etMHF_BW);

this.Controls.Add(this.etMHF_FC);

this.Controls.Add(this.etBW_MHF);

this.Controls.Add(this.etFreqCentral_MHF);

this.Controls.Add(this.tbBW_MHF);

this.Controls.Add(this.tbFreqCentral_MHF);

this.Controls.Add(this.et0dB_MHF);

this.Controls.Add(this.etGuany_MHF);

this.Controls.Add(this.etMHF_G);

this.Controls.Add(this.etMenys12dB_MHF);

this.Controls.Add(this.etMes12dB_MHF);

this.Controls.Add(this.tbGuany_MHF);

this.Controls.Add(this.et0Hz_LF);

this.Controls.Add(this.et230Hz_LF);

this.Controls.Add(this.et20Hz_LF);

this.Controls.Add(this.et250Hz_LF);

Page 500: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

500

this.Controls.Add(this.etLowCut400Hz);

this.Controls.Add(this.etLowCut20Hz);

this.Controls.Add(this.etHighCut2500Hz);

this.Controls.Add(this.etHighCut20kHz);

this.Controls.Add(this.etLowCut);

this.Controls.Add(this.etHighCut);

this.Controls.Add(this.etFreqLowCut);

this.Controls.Add(this.etFreqHighCut);

this.Controls.Add(this.tbLowCut);

this.Controls.Add(this.tbHighCut);

this.Controls.Add(this.btCancelar);

this.Controls.Add(this.btEqOK);

this.Controls.Add(this.btGuardarEq);

this.Controls.Add(this.btCarregarEq);

this.Controls.Add(this.et0dBLimitador);

this.Controls.Add(this.et0dBGuanyGlobal);

this.Controls.Add(this.etMenys80dBLimitador);

this.Controls.Add(this.etMenys15dBGuanyGlobal);

this.Controls.Add(this.etMes20dBLimitador);

this.Controls.Add(this.etMes15dBGuanyGlobal);

this.Controls.Add(this.etLimitador);

this.Controls.Add(this.etGuanyGlobal);

this.Controls.Add(this.etLimitacioTextFixe);

this.Controls.Add(this.etGuany);

this.Controls.Add(this.et_LF_BW);

this.Controls.Add(this.et_LF_FC);

this.Controls.Add(this.etBW_LF);

this.Controls.Add(this.etFreqCentral_LF);

this.Controls.Add(this.tbLimitador);

this.Controls.Add(this.tbGuanyGlobal);

this.Controls.Add(this.tbBW_LF);

this.Controls.Add(this.tbFreqCentral_LF);

this.Controls.Add(this.et0dB_LF);

this.Controls.Add(this.etGuany_LF);

this.Controls.Add(this.et_LF_G);

this.Controls.Add(this.etMenys12dB_LF);

this.Controls.Add(this.etMes12dB_LF);

this.Controls.Add(this.tbGuany_LF);

this.Name = "FormFill_Eq_Parametric";

this.Text = "Equalitzador paramètric";

this.Load += new System.EventHandler(this.FormFill_Eq_Parametric_Load);

((System.ComponentModel.ISupportInitialize)(this.tbGuany_LF)).EndInit();

Page 501: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

501

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_LF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_LF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuanyGlobal)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbLimitador)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbHighCut)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbLowCut)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_MHF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_MHF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_MHF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_MLF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_MLF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_MLF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbBW_HF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbFreqCentral_HF)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbGuany_HF)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.TrackBar tbGuany_LF;

private System.Windows.Forms.Label etMes12dB_LF;

private System.Windows.Forms.Label etMenys12dB_LF;

private System.Windows.Forms.Label et_LF_G;

private System.Windows.Forms.Label etGuany_LF;

private System.Windows.Forms.Label et0dB_LF;

private System.Windows.Forms.TrackBar tbFreqCentral_LF;

private System.Windows.Forms.TrackBar tbBW_LF;

private System.Windows.Forms.TrackBar tbGuanyGlobal;

private System.Windows.Forms.TrackBar tbLimitador;

private System.Windows.Forms.Label etFreqCentral_LF;

private System.Windows.Forms.Label etBW_LF;

private System.Windows.Forms.Label et_LF_FC;

private System.Windows.Forms.Label et_LF_BW;

private System.Windows.Forms.Label etGuany;

private System.Windows.Forms.Label etLimitacioTextFixe;

private System.Windows.Forms.Label etGuanyGlobal;

Page 502: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

502

private System.Windows.Forms.Label etLimitador;

private System.Windows.Forms.Label etMes15dBGuanyGlobal;

private System.Windows.Forms.Label etMes20dBLimitador;

private System.Windows.Forms.Label etMenys15dBGuanyGlobal;

private System.Windows.Forms.Label etMenys80dBLimitador;

private System.Windows.Forms.Label et0dBGuanyGlobal;

private System.Windows.Forms.Label et0dBLimitador;

private System.Windows.Forms.Button btCarregarEq;

private System.Windows.Forms.Button btGuardarEq;

private System.Windows.Forms.Button btEqOK;

private System.Windows.Forms.Button btCancelar;

private System.Windows.Forms.TrackBar tbHighCut;

private System.Windows.Forms.TrackBar tbLowCut;

private System.Windows.Forms.Label etFreqHighCut;

private System.Windows.Forms.Label etFreqLowCut;

private System.Windows.Forms.Label etHighCut;

private System.Windows.Forms.Label etLowCut;

private System.Windows.Forms.Label etHighCut20kHz;

private System.Windows.Forms.Label etHighCut2500Hz;

private System.Windows.Forms.Label etLowCut20Hz;

private System.Windows.Forms.Label etLowCut400Hz;

private System.Windows.Forms.Label et250Hz_LF;

private System.Windows.Forms.Label et20Hz_LF;

private System.Windows.Forms.Label et230Hz_LF;

private System.Windows.Forms.Label et0Hz_LF;

private System.Windows.Forms.Label et0Hz_MHF;

private System.Windows.Forms.Label et2000Hz_MHF_BW;

private System.Windows.Forms.Label et2000Hz_MHF_FC;

private System.Windows.Forms.Label et4000Hz_MHF;

private System.Windows.Forms.Label etMHF_BW;

private System.Windows.Forms.Label etMHF_FC;

private System.Windows.Forms.Label etBW_MHF;

private System.Windows.Forms.Label etFreqCentral_MHF;

private System.Windows.Forms.TrackBar tbBW_MHF;

private System.Windows.Forms.TrackBar tbFreqCentral_MHF;

private System.Windows.Forms.Label et0dB_MHF;

private System.Windows.Forms.Label etGuany_MHF;

private System.Windows.Forms.Label etMHF_G;

private System.Windows.Forms.Label etMenys12dB_MHF;

private System.Windows.Forms.Label etMes12dB_MHF;

private System.Windows.Forms.TrackBar tbGuany_MHF;

private System.Windows.Forms.Label et0Hz_MLF;

Page 503: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

503

private System.Windows.Forms.Label et1750Hz_MLF;

private System.Windows.Forms.Label et250Hz_MLF;

private System.Windows.Forms.Label et2000Hz_MLF;

private System.Windows.Forms.Label etMLF_BW;

private System.Windows.Forms.Label etMLF_FC;

private System.Windows.Forms.Label etBW_MLF;

private System.Windows.Forms.Label etFreqCentral_MLF;

private System.Windows.Forms.TrackBar tbBW_MLF;

private System.Windows.Forms.TrackBar tbFreqCentral_MLF;

private System.Windows.Forms.Label et0dB_MLF;

private System.Windows.Forms.Label etGuany_MLF;

private System.Windows.Forms.Label etMLF_G;

private System.Windows.Forms.Label etMenys12dB_MLF;

private System.Windows.Forms.Label etMes12dB_MLF;

private System.Windows.Forms.TrackBar tbGuany_MLF;

private System.Windows.Forms.Label et0Hz_HF;

private System.Windows.Forms.Label et12000Hz_HF;

private System.Windows.Forms.Label et4000Hz_HF;

private System.Windows.Forms.Label et16000Hz_HF;

private System.Windows.Forms.Label etHF_BW;

private System.Windows.Forms.Label etHF_FC;

private System.Windows.Forms.Label etBW_HF;

private System.Windows.Forms.Label etFreqCentral_HF;

private System.Windows.Forms.TrackBar tbBW_HF;

private System.Windows.Forms.TrackBar tbFreqCentral_HF;

private System.Windows.Forms.Label et0dB_HF;

private System.Windows.Forms.Label etGuany_HF;

private System.Windows.Forms.Label etHF_G;

private System.Windows.Forms.Label etMenys12sB_HF;

private System.Windows.Forms.Label etMes12dB_HF;

private System.Windows.Forms.TrackBar tbGuany_HF;

private System.Windows.Forms.Button btEqReset;

}

}

Page 504: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

504

/*************************************************************

* Fitxer Prova2.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Equalitzador_FFT_1

{

public partial class FormFill_Prova2 : Form

{

public FormFill_Prova2()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* FormFill_Prova2

****************************************************************/

private void FormFill_Prova2_Load(object sender, EventArgs e)

{

PresentarResultats();

}

Page 505: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

505

/****************************************************************

* Funció que quan s'executa i l'usuari prem el botó IFFT

* apareixen les 32 mostres equiespaiades en el teps de la senyal.

*

* Nota: la IFFT es de tamany 32, on la primera mostra de la

* senyal es la mostra a l'instant 0. De la parella de valors que

* apareixen, el de a dalt es el valor calculat mitjançant la

* IFFT, i el de sota la mateixa senyal calculada mitjançant la

* seva expressió matemàtica en funció del temps. Per verificar

* el correcte funcionament del programa, els dos valors han de

* coincidir excepte petits i despreciables errors d'arrodoniment

****************************************************************/

private void PresentarResultats()

{

label0.Text = "V(0)= " + VG.p0f + "\n" +

"V(0)= " + VG.p0t;

label1.Text = "V(1)= " + VG.p1f + "\n" +

"V(1)= " + VG.p1t;

label2.Text = "V(2)= " + VG.p2f + "\n" +

"V(2)= " + VG.p2t;

label3.Text = "V(3)= " + VG.p3f + "\n" +

"V(3)= " + VG.p3t;

label4.Text = "V(4)= " + VG.p4f + "\n" +

"V(4)= " + VG.p4t;

label5.Text = "V(5)= " + VG.p5f + "\n" +

"V(5)= " + VG.p5t;

label6.Text = "V(6)= " + VG.p6f + "\n" +

"V(6)= " + VG.p6t;

label7.Text = "V(7)= " + VG.p7f + "\n" +

"V(7)= " + VG.p7t;

label8.Text = "V(8)= " + VG.p8f + "\n" +

"V(8)= " + VG.p8t;

label9.Text = "V(9)= " + VG.p9f + "\n" +

"V(9)= " + VG.p9t;

label10.Text = "V(10)= " + VG.p10f + "\n" +

"V(10)= " + VG.p10t;

label11.Text = "V(11)= " + VG.p11f + "\n" +

"V(11)= " + VG.p11t;

label12.Text = "V(12)= " + VG.p12f + "\n" +

"V(12)= " + VG.p12t;

Page 506: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

506

label13.Text = "V(13)= " + VG.p13f + "\n" +

"V(13)= " + VG.p13t;

label14.Text = "V(14)= " + VG.p14f + "\n" +

"V(14)= " + VG.p14t;

label15.Text = "V(15)= " + VG.p15f + "\n" +

"V(15)= " + VG.p15t;

label16.Text = "V(16)= " + VG.p16f + "\n" +

"V(16)= " + VG.p16t;

label17.Text = "V(17)= " + VG.p17f + "\n" +

"V(17)= " + VG.p17t;

label18.Text = "V(18)= " + VG.p18f + "\n" +

"V(18)= " + VG.p18t;

label19.Text = "V(19)= " + VG.p19f + "\n" +

"V(19)= " + VG.p19t;

label20.Text = "V(20)= " + VG.p20f + "\n" +

"V(20)= " + VG.p20t;

label21.Text = "V(21)= " + VG.p21f + "\n" +

"V(21)= " + VG.p21t;

label22.Text = "V(22)= " + VG.p22f + "\n" +

"V(22)= " + VG.p22t;

label23.Text = "V(23)= " + VG.p23f + "\n" +

"V(23)= " + VG.p23t;

label24.Text = "V(24)= " + VG.p24f + "\n" +

"V(24)= " + VG.p24t;

label25.Text = "V(25)= " + VG.p25f + "\n" +

"V(25)= " + VG.p25t;

label26.Text = "V(26)= " + VG.p26f + "\n" +

"V(26)= " + VG.p26t;

label27.Text = "V(27)= " + VG.p27f + "\n" +

"V(27)= " + VG.p27t;

label28.Text = "V(28)= " + VG.p28f + "\n" +

"V(28)= " + VG.p28t;

label29.Text = "V(29)= " + VG.p29f + "\n" +

"V(29)= " + VG.p29t;

label30.Text = "V(30)= " + VG.p30f + "\n" +

"V(30)= " + VG.p30t;

label31.Text = "V(31)= " + VG.p31f + "\n" +

"V(31)= " + VG.p31t;

}

Page 507: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

507

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó sortir

****************************************************************/

private void btSortir_Click(object sender, EventArgs e)

{

//Tancar el formulari fill Prova2,

//i tornar el control al formulari pare.

this.Close();

}

}//Fi partial class FormFill_Prova2

}//Fi namespace Equalitzador_FFT_1

Page 508: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

508

/*************************************************************

* Fitxer Prova2.Designer.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class FormFill_Prova2

{

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

/// <param name="disposing">true si los recursos administrados

///se deben eliminar; false en caso contrario, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido del método con el editor de código.

Page 509: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

509

/// </summary>

private void InitializeComponent()

{

this.btSortir = new System.Windows.Forms.Button();

this.label0 = new System.Windows.Forms.Label();

this.label1 = new System.Windows.Forms.Label();

this.label2 = new System.Windows.Forms.Label();

this.label3 = new System.Windows.Forms.Label();

this.label4 = new System.Windows.Forms.Label();

this.label5 = new System.Windows.Forms.Label();

this.label6 = new System.Windows.Forms.Label();

this.label7 = new System.Windows.Forms.Label();

this.label8 = new System.Windows.Forms.Label();

this.label9 = new System.Windows.Forms.Label();

this.label10 = new System.Windows.Forms.Label();

this.label11 = new System.Windows.Forms.Label();

this.label12 = new System.Windows.Forms.Label();

this.label13 = new System.Windows.Forms.Label();

this.label14 = new System.Windows.Forms.Label();

this.label15 = new System.Windows.Forms.Label();

this.label16 = new System.Windows.Forms.Label();

this.label17 = new System.Windows.Forms.Label();

this.label18 = new System.Windows.Forms.Label();

this.label19 = new System.Windows.Forms.Label();

this.label20 = new System.Windows.Forms.Label();

this.label21 = new System.Windows.Forms.Label();

this.label22 = new System.Windows.Forms.Label();

this.label23 = new System.Windows.Forms.Label();

this.label24 = new System.Windows.Forms.Label();

this.label25 = new System.Windows.Forms.Label();

this.label26 = new System.Windows.Forms.Label();

this.label27 = new System.Windows.Forms.Label();

this.label28 = new System.Windows.Forms.Label();

this.label29 = new System.Windows.Forms.Label();

this.label30 = new System.Windows.Forms.Label();

this.label31 = new System.Windows.Forms.Label();

this.SuspendLayout();

//

// btSortir

//

this.btSortir.Location = new System.Drawing.Point(357, 369);

this.btSortir.Name = "btSortir";

Page 510: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

510

this.btSortir.Size = new System.Drawing.Size(75, 23);

this.btSortir.TabIndex = 1;

this.btSortir.Text = "\tSORTIR";

this.btSortir.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;

this.btSortir.UseVisualStyleBackColor = true;

this.btSortir.Click += new System.EventHandler(btSortir_Click);

//

// label0

//

this.label0.AutoSize = true;

this.label0.Location = new System.Drawing.Point(13, 29);

this.label0.Name = "label0";

this.label0.Size = new System.Drawing.Size(35, 13);

this.label0.TabIndex = 2;

this.label0.Text = "label0";

//

// label1

//

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(13, 67);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(35, 13);

this.label1.TabIndex = 3;

this.label1.Text = "label1";

//

// label2

//

this.label2.AutoSize = true;

this.label2.Location = new System.Drawing.Point(12, 110);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(35, 13);

this.label2.TabIndex = 4;

this.label2.Text = "label2";

//

// label3

//

this.label3.AutoSize = true;

this.label3.Location = new System.Drawing.Point(13, 149);

this.label3.Name = "label3";

this.label3.Size = new System.Drawing.Size(35, 13);

this.label3.TabIndex = 5;

Page 511: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

511

this.label3.Text = "label3";

//

// label4

//

this.label4.AutoSize = true;

this.label4.Location = new System.Drawing.Point(12, 191);

this.label4.Name = "label4";

this.label4.Size = new System.Drawing.Size(35, 13);

this.label4.TabIndex = 6;

this.label4.Text = "label4";

//

// label5

//

this.label5.AutoSize = true;

this.label5.Location = new System.Drawing.Point(12, 229);

this.label5.Name = "label5";

this.label5.Size = new System.Drawing.Size(35, 13);

this.label5.TabIndex = 7;

this.label5.Text = "label5";

//

// label6

//

this.label6.AutoSize = true;

this.label6.Location = new System.Drawing.Point(12, 271);

this.label6.Name = "label6";

this.label6.Size = new System.Drawing.Size(35, 13);

this.label6.TabIndex = 8;

this.label6.Text = "label6";

//

// label7

//

this.label7.AutoSize = true;

this.label7.Location = new System.Drawing.Point(12, 312);

this.label7.Name = "label7";

this.label7.Size = new System.Drawing.Size(35, 13);

this.label7.TabIndex = 9;

this.label7.Text = "label7";

//

// label8

//

this.label8.AutoSize = true;

this.label8.Location = new System.Drawing.Point(182, 29);

Page 512: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

512

this.label8.Name = "label8";

this.label8.Size = new System.Drawing.Size(35, 13);

this.label8.TabIndex = 10;

this.label8.Text = "label8";

//

// label9

//

this.label9.AutoSize = true;

this.label9.Location = new System.Drawing.Point(182, 67);

this.label9.Name = "label9";

this.label9.Size = new System.Drawing.Size(35, 13);

this.label9.TabIndex = 11;

this.label9.Text = "label9";

//

// label10

//

this.label10.AutoSize = true;

this.label10.Location = new System.Drawing.Point(182, 110);

this.label10.Name = "label10";

this.label10.Size = new System.Drawing.Size(41, 13);

this.label10.TabIndex = 12;

this.label10.Text = "label10";

//

// label11

//

this.label11.AutoSize = true;

this.label11.Location = new System.Drawing.Point(182, 149);

this.label11.Name = "label11";

this.label11.Size = new System.Drawing.Size(41, 13);

this.label11.TabIndex = 13;

this.label11.Text = "label11";

//

// label12

//

this.label12.AutoSize = true;

this.label12.Location = new System.Drawing.Point(182, 191);

this.label12.Name = "label12";

this.label12.Size = new System.Drawing.Size(41, 13);

this.label12.TabIndex = 14;

this.label12.Text = "label12";

//

// label13

Page 513: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

513

//

this.label13.AutoSize = true;

this.label13.Location = new System.Drawing.Point(182, 229);

this.label13.Name = "label13";

this.label13.Size = new System.Drawing.Size(41, 13);

this.label13.TabIndex = 15;

this.label13.Text = "label13";

//

// label14

//

this.label14.AutoSize = true;

this.label14.Location = new System.Drawing.Point(182, 271);

this.label14.Name = "label14";

this.label14.Size = new System.Drawing.Size(41, 13);

this.label14.TabIndex = 16;

this.label14.Text = "label14";

//

// label15

//

this.label15.AutoSize = true;

this.label15.Location = new System.Drawing.Point(182, 312);

this.label15.Name = "label15";

this.label15.Size = new System.Drawing.Size(41, 13);

this.label15.TabIndex = 17;

this.label15.Text = "label15";

//

// label16

//

this.label16.AutoSize = true;

this.label16.Location = new System.Drawing.Point(376, 29);

this.label16.Name = "label16";

this.label16.Size = new System.Drawing.Size(41, 13);

this.label16.TabIndex = 18;

this.label16.Text = "label16";

//

// label17

//

this.label17.AutoSize = true;

this.label17.Location = new System.Drawing.Point(376, 67);

this.label17.Name = "label17";

this.label17.Size = new System.Drawing.Size(41, 13);

this.label17.TabIndex = 19;

Page 514: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

514

this.label17.Text = "label17";

//

// label18

//

this.label18.AutoSize = true;

this.label18.Location = new System.Drawing.Point(376, 110);

this.label18.Name = "label18";

this.label18.Size = new System.Drawing.Size(41, 13);

this.label18.TabIndex = 20;

this.label18.Text = "label18";

//

// label19

//

this.label19.AutoSize = true;

this.label19.Location = new System.Drawing.Point(376, 149);

this.label19.Name = "label19";

this.label19.Size = new System.Drawing.Size(41, 13);

this.label19.TabIndex = 21;

this.label19.Text = "label19";

//

// label20

//

this.label20.AutoSize = true;

this.label20.Location = new System.Drawing.Point(376, 191);

this.label20.Name = "label20";

this.label20.Size = new System.Drawing.Size(41, 13);

this.label20.TabIndex = 22;

this.label20.Text = "label20";

//

// label21

//

this.label21.AutoSize = true;

this.label21.Location = new System.Drawing.Point(376, 229);

this.label21.Name = "label21";

this.label21.Size = new System.Drawing.Size(41, 13);

this.label21.TabIndex = 23;

this.label21.Text = "label21";

//

// label22

//

this.label22.AutoSize = true;

this.label22.Location = new System.Drawing.Point(376, 271);

Page 515: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

515

this.label22.Name = "label22";

this.label22.Size = new System.Drawing.Size(41, 13);

this.label22.TabIndex = 24;

this.label22.Text = "label22";

//

// label23

//

this.label23.AutoSize = true;

this.label23.Location = new System.Drawing.Point(376, 312);

this.label23.Name = "label23";

this.label23.Size = new System.Drawing.Size(41, 13);

this.label23.TabIndex = 25;

this.label23.Text = "label23";

//

// label24

//

this.label24.AutoSize = true;

this.label24.Location = new System.Drawing.Point(577, 29);

this.label24.Name = "label24";

this.label24.Size = new System.Drawing.Size(41, 13);

this.label24.TabIndex = 26;

this.label24.Text = "label24";

//

// label25

//

this.label25.AutoSize = true;

this.label25.Location = new System.Drawing.Point(577, 67);

this.label25.Name = "label25";

this.label25.Size = new System.Drawing.Size(41, 13);

this.label25.TabIndex = 27;

this.label25.Text = "label25";

//

// label26

//

this.label26.AutoSize = true;

this.label26.Location = new System.Drawing.Point(577, 110);

this.label26.Name = "label26";

this.label26.Size = new System.Drawing.Size(41, 13);

this.label26.TabIndex = 28;

this.label26.Text = "label26";

//

// label27

Page 516: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

516

//

this.label27.AutoSize = true;

this.label27.Location = new System.Drawing.Point(577, 149);

this.label27.Name = "label27";

this.label27.Size = new System.Drawing.Size(41, 13);

this.label27.TabIndex = 29;

this.label27.Text = "label27";

//

// label28

//

this.label28.AutoSize = true;

this.label28.Location = new System.Drawing.Point(577, 191);

this.label28.Name = "label28";

this.label28.Size = new System.Drawing.Size(41, 13);

this.label28.TabIndex = 30;

this.label28.Text = "label28";

//

// label29

//

this.label29.AutoSize = true;

this.label29.Location = new System.Drawing.Point(577, 229);

this.label29.Name = "label29";

this.label29.Size = new System.Drawing.Size(41, 13);

this.label29.TabIndex = 31;

this.label29.Text = "label29";

//

// label30

//

this.label30.AutoSize = true;

this.label30.Location = new System.Drawing.Point(577, 271);

this.label30.Name = "label30";

this.label30.Size = new System.Drawing.Size(41, 13);

this.label30.TabIndex = 32;

this.label30.Text = "label30";

//

// label31

//

this.label31.AutoSize = true;

this.label31.Location = new System.Drawing.Point(577, 312);

this.label31.Name = "label31";

this.label31.Size = new System.Drawing.Size(41, 13);

this.label31.TabIndex = 33;

Page 517: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

517

this.label31.Text = "label31";

//

// FormFill_Prova2

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(784, 414);

this.Load += new System.EventHandler(FormFill_Prova2_Load);

this.Controls.Add(this.label31);

this.Controls.Add(this.label30);

this.Controls.Add(this.label29);

this.Controls.Add(this.label28);

this.Controls.Add(this.label27);

this.Controls.Add(this.label26);

this.Controls.Add(this.label25);

this.Controls.Add(this.label24);

this.Controls.Add(this.label23);

this.Controls.Add(this.label22);

this.Controls.Add(this.label21);

this.Controls.Add(this.label20);

this.Controls.Add(this.label19);

this.Controls.Add(this.label18);

this.Controls.Add(this.label17);

this.Controls.Add(this.label16);

this.Controls.Add(this.label15);

this.Controls.Add(this.label14);

this.Controls.Add(this.label13);

this.Controls.Add(this.label12);

this.Controls.Add(this.label11);

this.Controls.Add(this.label10);

this.Controls.Add(this.label9);

this.Controls.Add(this.label8);

this.Controls.Add(this.label7);

this.Controls.Add(this.label6);

this.Controls.Add(this.label5);

this.Controls.Add(this.label4);

this.Controls.Add(this.label3);

this.Controls.Add(this.label2);

this.Controls.Add(this.label1);

this.Controls.Add(this.label0);

this.Controls.Add(this.btSortir);

this.Name = "FormFill_Prova2";

Page 518: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

518

this.Text = "Prova 2 (Prova IFFT)";

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btSortir;

private System.Windows.Forms.Label label0;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.Label label4;

private System.Windows.Forms.Label label5;

private System.Windows.Forms.Label label6;

private System.Windows.Forms.Label label7;

private System.Windows.Forms.Label label8;

private System.Windows.Forms.Label label9;

private System.Windows.Forms.Label label10;

private System.Windows.Forms.Label label11;

private System.Windows.Forms.Label label12;

private System.Windows.Forms.Label label13;

private System.Windows.Forms.Label label14;

private System.Windows.Forms.Label label15;

private System.Windows.Forms.Label label16;

private System.Windows.Forms.Label label17;

private System.Windows.Forms.Label label18;

private System.Windows.Forms.Label label19;

private System.Windows.Forms.Label label20;

private System.Windows.Forms.Label label21;

private System.Windows.Forms.Label label22;

private System.Windows.Forms.Label label23;

private System.Windows.Forms.Label label24;

private System.Windows.Forms.Label label25;

private System.Windows.Forms.Label label26;

private System.Windows.Forms.Label label27;

private System.Windows.Forms.Label label28;

private System.Windows.Forms.Label label29;

private System.Windows.Forms.Label label30;

private System.Windows.Forms.Label label31;

}

}

Page 519: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

519

/*************************************************************

* Fitxer Prova3.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Equalitzador_FFT_1

{

public partial class FormFill_Prova3 : Form

{

public FormFill_Prova3()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* FormFill_Prova3

****************************************************************/

private void FormFill_Prova3_Load(object sender, EventArgs e)

{

PresentarResultats();

}

Page 520: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

520

/****************************************************************

* Funció que quan s'executa i l'usuari prem el botó IFFT

* apareixen les 32 mostres equiespaiades en el teps de la senyal.

*

* Nota: la IFFT es de tamany 32, on la primera mostra de la

* senyal es la mostra a l'instant 0. De la parella de valors que

* apareixen, el de a dalt es el valor calculat mitjançant la

* IFFT, i el de sota la mateixa senyal calculada mitjançant la

* seva expressió matemàtica en funció del temps. Per verificar

* el correcte funcionament del programa, els dos valors han de

* coincidir excepte petits i despreciables errors d'arrodoniment

****************************************************************/

private void PresentarResultats()

{

label0.Text = "V(0)i= " + VG.p0i + "\n" +

"V(0)o= " + VG.p0o;

label1.Text = "V(1)i= " + VG.p1i + "\n" +

"V(1)o= " + VG.p1o;

label2.Text = "V(2)i= " + VG.p2i + "\n" +

"V(2)o= " + VG.p2o;

label3.Text = "V(3)i= " + VG.p3i + "\n" +

"V(3)o= " + VG.p3o;

label4.Text = "V(4)i= " + VG.p4i + "\n" +

"V(4)o= " + VG.p4o;

label5.Text = "V(5)i= " + VG.p5i + "\n" +

"V(5)o= " + VG.p5o;

label6.Text = "V(6)i= " + VG.p6i + "\n" +

"V(6)o= " + VG.p6o;

label7.Text = "V(7)i= " + VG.p7i + "\n" +

"V(7)o= " + VG.p7o;

label8.Text = "V(8)i= " + VG.p8i + "\n" +

"V(8)o= " + VG.p8o;

label9.Text = "V(9)i= " + VG.p9i + "\n" +

"V(9)o= " + VG.p9o;

label10.Text = "V(10)i= " + VG.p10i + "\n" +

"V(10)o= " + VG.p10o;

label11.Text = "V(11)i= " + VG.p11i + "\n" +

"V(11)o= " + VG.p11o;

label12.Text = "V(12)i= " + VG.p12i + "\n" +

"V(12)o= " + VG.p12o;

Page 521: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

521

label13.Text = "V(13)i= " + VG.p13i + "\n" +

"V(13)o= " + VG.p13o;

label14.Text = "V(14)i= " + VG.p14i + "\n" +

"V(14)o= " + VG.p14o;

label15.Text = "V(15)i= " + VG.p15i + "\n" +

"V(15)o= " + VG.p15o;

label16.Text = "V(16)i= " + VG.p16i + "\n" +

"V(16)o= " + VG.p16o;

label17.Text = "V(17)i= " + VG.p17i + "\n" +

"V(17)o= " + VG.p17o;

label18.Text = "V(18)i= " + VG.p18i + "\n" +

"V(18)o= " + VG.p18o;

label19.Text = "V(19)i= " + VG.p19i + "\n" +

"V(19)o= " + VG.p19o;

label20.Text = "V(20)i= " + VG.p20i + "\n" +

"V(20)o= " + VG.p20o;

label21.Text = "V(21)i= " + VG.p21i + "\n" +

"V(21)o= " + VG.p21o;

label22.Text = "V(22)i= " + VG.p22i + "\n" +

"V(22)o= " + VG.p22o;

label23.Text = "V(23)i= " + VG.p23i + "\n" +

"V(23)o= " + VG.p23o;

label24.Text = "V(24)i= " + VG.p24i + "\n" +

"V(24)o= " + VG.p24o;

label25.Text = "V(25)i= " + VG.p25i + "\n" +

"V(25)o= " + VG.p25o;

label26.Text = "V(26)i= " + VG.p26i + "\n" +

"V(26)o= " + VG.p26o;

label27.Text = "V(27)i= " + VG.p27i + "\n" +

"V(27)o= " + VG.p27o;

label28.Text = "V(28)i= " + VG.p28i + "\n" +

"V(28)o= " + VG.p28o;

label29.Text = "V(29)i= " + VG.p29i + "\n" +

"V(29)o= " + VG.p29o;

label30.Text = "V(30)i= " + VG.p30i + "\n" +

"V(30)o= " + VG.p30o;

label31.Text = "V(31)i= " + VG.p31i + "\n" +

"V(31)o= " + VG.p31o;

}

Page 522: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

522

/****************************************************************

* Funció que es crida quan es fa clic sobre el botó sortir

****************************************************************/

private void btSortir_Click(object sender, EventArgs e)

{

//Tancar el formulari fill Prova2,

//i tornar el control al formulari pare.

this.Close();

}

}//Fi partial class FormFill_Prova3

}//Fi namespace Equalitzador_FFT_1

Page 523: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

523

/*************************************************************

* Fitxer Prova3.Designer.cs

*

* Programa: Equalitzador FFT

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Equalitzador_FFT_1

{

partial class FormFill_Prova3

{

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

/// <param name="disposing">true si los recursos administrados

///se deben eliminar; false en caso contrario, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido del método con el editor de código.

/// </summary>

private void InitializeComponent()

Page 524: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

524

{

this.btSortir = new System.Windows.Forms.Button();

this.label0 = new System.Windows.Forms.Label();

this.label1 = new System.Windows.Forms.Label();

this.label2 = new System.Windows.Forms.Label();

this.label3 = new System.Windows.Forms.Label();

this.label4 = new System.Windows.Forms.Label();

this.label5 = new System.Windows.Forms.Label();

this.label6 = new System.Windows.Forms.Label();

this.label7 = new System.Windows.Forms.Label();

this.label8 = new System.Windows.Forms.Label();

this.label9 = new System.Windows.Forms.Label();

this.label10 = new System.Windows.Forms.Label();

this.label11 = new System.Windows.Forms.Label();

this.label12 = new System.Windows.Forms.Label();

this.label13 = new System.Windows.Forms.Label();

this.label14 = new System.Windows.Forms.Label();

this.label15 = new System.Windows.Forms.Label();

this.label16 = new System.Windows.Forms.Label();

this.label17 = new System.Windows.Forms.Label();

this.label18 = new System.Windows.Forms.Label();

this.label19 = new System.Windows.Forms.Label();

this.label20 = new System.Windows.Forms.Label();

this.label21 = new System.Windows.Forms.Label();

this.label22 = new System.Windows.Forms.Label();

this.label23 = new System.Windows.Forms.Label();

this.label24 = new System.Windows.Forms.Label();

this.label25 = new System.Windows.Forms.Label();

this.label26 = new System.Windows.Forms.Label();

this.label27 = new System.Windows.Forms.Label();

this.label28 = new System.Windows.Forms.Label();

this.label29 = new System.Windows.Forms.Label();

this.label30 = new System.Windows.Forms.Label();

this.label31 = new System.Windows.Forms.Label();

this.SuspendLayout();

//

// btSortir

//

this.btSortir.Location = new System.Drawing.Point(357, 369);

this.btSortir.Name = "btSortir";

this.btSortir.Size = new System.Drawing.Size(75, 23);

this.btSortir.TabIndex = 1;

Page 525: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

525

this.btSortir.Text = "\tSORTIR";

this.btSortir.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;

this.btSortir.UseVisualStyleBackColor = true;

this.btSortir.Click += new System.EventHandler(btSortir_Click);

//

// label0

//

this.label0.AutoSize = true;

this.label0.Location = new System.Drawing.Point(13, 29);

this.label0.Name = "label0";

this.label0.Size = new System.Drawing.Size(35, 13);

this.label0.TabIndex = 2;

this.label0.Text = "label0";

//

// label1

//

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(13, 67);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(35, 13);

this.label1.TabIndex = 3;

this.label1.Text = "label1";

//

// label2

//

this.label2.AutoSize = true;

this.label2.Location = new System.Drawing.Point(12, 110);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(35, 13);

this.label2.TabIndex = 4;

this.label2.Text = "label2";

//

// label3

//

this.label3.AutoSize = true;

this.label3.Location = new System.Drawing.Point(13, 149);

this.label3.Name = "label3";

this.label3.Size = new System.Drawing.Size(35, 13);

this.label3.TabIndex = 5;

this.label3.Text = "label3";

//

Page 526: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

526

// label4

//

this.label4.AutoSize = true;

this.label4.Location = new System.Drawing.Point(12, 191);

this.label4.Name = "label4";

this.label4.Size = new System.Drawing.Size(35, 13);

this.label4.TabIndex = 6;

this.label4.Text = "label4";

//

// label5

//

this.label5.AutoSize = true;

this.label5.Location = new System.Drawing.Point(12, 229);

this.label5.Name = "label5";

this.label5.Size = new System.Drawing.Size(35, 13);

this.label5.TabIndex = 7;

this.label5.Text = "label5";

//

// label6

//

this.label6.AutoSize = true;

this.label6.Location = new System.Drawing.Point(12, 271);

this.label6.Name = "label6";

this.label6.Size = new System.Drawing.Size(35, 13);

this.label6.TabIndex = 8;

this.label6.Text = "label6";

//

// label7

//

this.label7.AutoSize = true;

this.label7.Location = new System.Drawing.Point(12, 312);

this.label7.Name = "label7";

this.label7.Size = new System.Drawing.Size(35, 13);

this.label7.TabIndex = 9;

this.label7.Text = "label7";

//

// label8

//

this.label8.AutoSize = true;

this.label8.Location = new System.Drawing.Point(182, 29);

this.label8.Name = "label8";

this.label8.Size = new System.Drawing.Size(35, 13);

Page 527: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

527

this.label8.TabIndex = 10;

this.label8.Text = "label8";

//

// label9

//

this.label9.AutoSize = true;

this.label9.Location = new System.Drawing.Point(182, 67);

this.label9.Name = "label9";

this.label9.Size = new System.Drawing.Size(35, 13);

this.label9.TabIndex = 11;

this.label9.Text = "label9";

//

// label10

//

this.label10.AutoSize = true;

this.label10.Location = new System.Drawing.Point(182, 110);

this.label10.Name = "label10";

this.label10.Size = new System.Drawing.Size(41, 13);

this.label10.TabIndex = 12;

this.label10.Text = "label10";

//

// label11

//

this.label11.AutoSize = true;

this.label11.Location = new System.Drawing.Point(182, 149);

this.label11.Name = "label11";

this.label11.Size = new System.Drawing.Size(41, 13);

this.label11.TabIndex = 13;

this.label11.Text = "label11";

//

// label12

//

this.label12.AutoSize = true;

this.label12.Location = new System.Drawing.Point(182, 191);

this.label12.Name = "label12";

this.label12.Size = new System.Drawing.Size(41, 13);

this.label12.TabIndex = 14;

this.label12.Text = "label12";

//

// label13

//

this.label13.AutoSize = true;

Page 528: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

528

this.label13.Location = new System.Drawing.Point(182, 229);

this.label13.Name = "label13";

this.label13.Size = new System.Drawing.Size(41, 13);

this.label13.TabIndex = 15;

this.label13.Text = "label13";

//

// label14

//

this.label14.AutoSize = true;

this.label14.Location = new System.Drawing.Point(182, 271);

this.label14.Name = "label14";

this.label14.Size = new System.Drawing.Size(41, 13);

this.label14.TabIndex = 16;

this.label14.Text = "label14";

//

// label15

//

this.label15.AutoSize = true;

this.label15.Location = new System.Drawing.Point(182, 312);

this.label15.Name = "label15";

this.label15.Size = new System.Drawing.Size(41, 13);

this.label15.TabIndex = 17;

this.label15.Text = "label15";

//

// label16

//

this.label16.AutoSize = true;

this.label16.Location = new System.Drawing.Point(376, 29);

this.label16.Name = "label16";

this.label16.Size = new System.Drawing.Size(41, 13);

this.label16.TabIndex = 18;

this.label16.Text = "label16";

//

// label17

//

this.label17.AutoSize = true;

this.label17.Location = new System.Drawing.Point(376, 67);

this.label17.Name = "label17";

this.label17.Size = new System.Drawing.Size(41, 13);

this.label17.TabIndex = 19;

this.label17.Text = "label17";

//

Page 529: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

529

// label18

//

this.label18.AutoSize = true;

this.label18.Location = new System.Drawing.Point(376, 110);

this.label18.Name = "label18";

this.label18.Size = new System.Drawing.Size(41, 13);

this.label18.TabIndex = 20;

this.label18.Text = "label18";

//

// label19

//

this.label19.AutoSize = true;

this.label19.Location = new System.Drawing.Point(376, 149);

this.label19.Name = "label19";

this.label19.Size = new System.Drawing.Size(41, 13);

this.label19.TabIndex = 21;

this.label19.Text = "label19";

//

// label20

//

this.label20.AutoSize = true;

this.label20.Location = new System.Drawing.Point(376, 191);

this.label20.Name = "label20";

this.label20.Size = new System.Drawing.Size(41, 13);

this.label20.TabIndex = 22;

this.label20.Text = "label20";

//

// label21

//

this.label21.AutoSize = true;

this.label21.Location = new System.Drawing.Point(376, 229);

this.label21.Name = "label21";

this.label21.Size = new System.Drawing.Size(41, 13);

this.label21.TabIndex = 23;

this.label21.Text = "label21";

//

// label22

//

this.label22.AutoSize = true;

this.label22.Location = new System.Drawing.Point(376, 271);

this.label22.Name = "label22";

this.label22.Size = new System.Drawing.Size(41, 13);

Page 530: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

530

this.label22.TabIndex = 24;

this.label22.Text = "label22";

//

// label23

//

this.label23.AutoSize = true;

this.label23.Location = new System.Drawing.Point(376, 312);

this.label23.Name = "label23";

this.label23.Size = new System.Drawing.Size(41, 13);

this.label23.TabIndex = 25;

this.label23.Text = "label23";

//

// label24

//

this.label24.AutoSize = true;

this.label24.Location = new System.Drawing.Point(577, 29);

this.label24.Name = "label24";

this.label24.Size = new System.Drawing.Size(41, 13);

this.label24.TabIndex = 26;

this.label24.Text = "label24";

//

// label25

//

this.label25.AutoSize = true;

this.label25.Location = new System.Drawing.Point(577, 67);

this.label25.Name = "label25";

this.label25.Size = new System.Drawing.Size(41, 13);

this.label25.TabIndex = 27;

this.label25.Text = "label25";

//

// label26

//

this.label26.AutoSize = true;

this.label26.Location = new System.Drawing.Point(577, 110);

this.label26.Name = "label26";

this.label26.Size = new System.Drawing.Size(41, 13);

this.label26.TabIndex = 28;

this.label26.Text = "label26";

//

// label27

//

this.label27.AutoSize = true;

Page 531: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

531

this.label27.Location = new System.Drawing.Point(577, 149);

this.label27.Name = "label27";

this.label27.Size = new System.Drawing.Size(41, 13);

this.label27.TabIndex = 29;

this.label27.Text = "label27";

//

// label28

//

this.label28.AutoSize = true;

this.label28.Location = new System.Drawing.Point(577, 191);

this.label28.Name = "label28";

this.label28.Size = new System.Drawing.Size(41, 13);

this.label28.TabIndex = 30;

this.label28.Text = "label28";

//

// label29

//

this.label29.AutoSize = true;

this.label29.Location = new System.Drawing.Point(577, 229);

this.label29.Name = "label29";

this.label29.Size = new System.Drawing.Size(41, 13);

this.label29.TabIndex = 31;

this.label29.Text = "label29";

//

// label30

//

this.label30.AutoSize = true;

this.label30.Location = new System.Drawing.Point(577, 271);

this.label30.Name = "label30";

this.label30.Size = new System.Drawing.Size(41, 13);

this.label30.TabIndex = 32;

this.label30.Text = "label30";

//

// label31

//

this.label31.AutoSize = true;

this.label31.Location = new System.Drawing.Point(577, 312);

this.label31.Name = "label31";

this.label31.Size = new System.Drawing.Size(41, 13);

this.label31.TabIndex = 33;

this.label31.Text = "label31";

//

Page 532: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

532

// FormFill_Prova3

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(784, 414);

this.Load += new System.EventHandler(FormFill_Prova3_Load);

this.Controls.Add(this.label31);

this.Controls.Add(this.label30);

this.Controls.Add(this.label29);

this.Controls.Add(this.label28);

this.Controls.Add(this.label27);

this.Controls.Add(this.label26);

this.Controls.Add(this.label25);

this.Controls.Add(this.label24);

this.Controls.Add(this.label23);

this.Controls.Add(this.label22);

this.Controls.Add(this.label21);

this.Controls.Add(this.label20);

this.Controls.Add(this.label19);

this.Controls.Add(this.label18);

this.Controls.Add(this.label17);

this.Controls.Add(this.label16);

this.Controls.Add(this.label15);

this.Controls.Add(this.label14);

this.Controls.Add(this.label13);

this.Controls.Add(this.label12);

this.Controls.Add(this.label11);

this.Controls.Add(this.label10);

this.Controls.Add(this.label9);

this.Controls.Add(this.label8);

this.Controls.Add(this.label7);

this.Controls.Add(this.label6);

this.Controls.Add(this.label5);

this.Controls.Add(this.label4);

this.Controls.Add(this.label3);

this.Controls.Add(this.label2);

this.Controls.Add(this.label1);

this.Controls.Add(this.label0);

this.Controls.Add(this.btSortir);

this.Name = "FormFill_Prova3";

this.Text = "Prova 3";

this.ResumeLayout(false);

Page 533: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

533

this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btSortir;

private System.Windows.Forms.Label label0;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.Label label4;

private System.Windows.Forms.Label label5;

private System.Windows.Forms.Label label6;

private System.Windows.Forms.Label label7;

private System.Windows.Forms.Label label8;

private System.Windows.Forms.Label label9;

private System.Windows.Forms.Label label10;

private System.Windows.Forms.Label label11;

private System.Windows.Forms.Label label12;

private System.Windows.Forms.Label label13;

private System.Windows.Forms.Label label14;

private System.Windows.Forms.Label label15;

private System.Windows.Forms.Label label16;

private System.Windows.Forms.Label label17;

private System.Windows.Forms.Label label18;

private System.Windows.Forms.Label label19;

private System.Windows.Forms.Label label20;

private System.Windows.Forms.Label label21;

private System.Windows.Forms.Label label22;

private System.Windows.Forms.Label label23;

private System.Windows.Forms.Label label24;

private System.Windows.Forms.Label label25;

private System.Windows.Forms.Label label26;

private System.Windows.Forms.Label label27;

private System.Windows.Forms.Label label28;

private System.Windows.Forms.Label label29;

private System.Windows.Forms.Label label30;

private System.Windows.Forms.Label label31;

}

}

Page 534: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

534

/*************************************************************

* Fitxer Program.cs

*

* Programa: Equalitzador FFT 1

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.Linq;

using System.Windows.Forms;

using System.Threading.Tasks;

namespace Equalitzador_FFT_1

{

static class Program

{

/// <summary>

/// Punto de entrada principal para la aplicación.

/// </summary>

[STAThread]

static void Main()

{

//Es fa servir el mateix el mateix funcionament del

//Program.cs del projecte[24]

//Únicament es permet una instància de l'aplicació

//Equalitzador FFT 1, ja que tant sols un programa

//d'aplicació que utilitzi el driver de Measurement

//Computing pot executar-se a la vegada.

if (PrimeraInstancia)

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Page 535: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

535

Application.Run(new Form1());

}

else

{

MessageBox.Show("Equalitzador FFT 1 ja s'està executant");

Application.Exit();

}

}

private static bool PrimeraInstancia

{

get

{

//Verificar si ja existeix una instància de l'aplicació.

System.Threading.Mutex exmut;

string nom_exmut = "ApWinForms";

bool nova;

exmut = new System.Threading.Mutex(true, nom_exmut, out nova);

return nova;

}

}

}

}

Page 536: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

536

/*************************************************************

* Fitxer de classes VG.cs

*

* Programa: Equalitzador FFT 1

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Equalitzador_FFT_1

{

//Declaració de les variables globals VG.

//Nomès seran actualitzades mitjançant

//els formularis fills dels equalitzadors,

//i seran utilitzades per a equalitzar la

//senyal en el formulari pare

class VG

{

//Amplificació global de la senyal.

//Rang d'amplificació de -15 i +15 dB.

public static double guanyGlobal;

//Limitació que s'aplica a cada component freqüencial

//de la senyal.

public static double limitador;

//Les components freqüencials menors que lowCut

Page 537: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

537

//s'eliminen.

public static double lowCut; //Freqüència de tall a baixes

//freqüències. Sempre en Hz.

//Les components freqüencials majors que highCut

//s'eliminen.

public static double highCut; //Freqüència de tall a altes

//freqüències. Sempre en Hz.

/****************************************************

* Variables de guany dels equalitzadors d'una octava

* i terç d'octava

****************************************************/

//Guany en dB segons la posició del fadder,

//Rang entre -12 i +12 dB

public static double guany20Hz; //Guany en el terç d'octava de 20 Hz

public static double guany25Hz; //Guany en el terç d'octava de 25 Hz

public static double guany31coma5Hz; //Guany en l'octava i terç d'octava

//de 31,5 Hz

public static double guany40Hz; //Guany en el terç d'octava de 40 Hz

public static double guany50Hz; //Guany en el terç d'octava de 50 Hz

public static double guany63Hz; //Guany en l'octava i terç d'octava

//de 63 Hz

public static double guany80Hz; //Guany en el terç d'octava de 80 Hz

public static double guany100Hz; //Guany en el terç d'octava de 100 Hz

public static double guany125Hz; //Guany en l'octava i terç d'octava

//de 125 Hz

public static double guany160Hz; //Guany en el terç d'octava de 160 Hz

public static double guany200Hz; //Guany en el terç d'octava de 200 Hz

public static double guany250Hz; //Guany en l'octava i terç d'octava

Page 538: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

538

//de 250 Hz

public static double guany315Hz; //Guany en el terç d'octava de 315 Hz

public static double guany400Hz; //Guany en el terç d'octava de 400 Hz

public static double guany500Hz; //Guany en l'octava i terç d'octava

//de 500 Hz

public static double guany630Hz; //Guany en el terç d'octava de 630 Hz

public static double guany800Hz; //Guany en el terç d'octava de 800 Hz

public static double guany1000Hz; //Guany en l'octava i terç d'octava

//de 1 kHz

public static double guany1250Hz; //Guany en el terç d'octava de 1250 Hz

public static double guany1600Hz; //Guany en el terç d'octava de 1600 Hz

public static double guany2000Hz; //Guany en l'octava i terç d'octava

//de 2 kHz

public static double guany2500Hz; //Guany en el terç d'octava de 2500 Hz

public static double guany3150Hz; //Guany en el terç d'octava de 3150 Hz

public static double guany4000Hz; //Guany en l'octava i terç d'octava

//de 4 kHz

public static double guany5000Hz; //Guany en el terç d'octava de 5 kHz

public static double guany6300Hz; //Guany en el terç d'octava de 6300 Hz

public static double guany8000Hz; //Guany en l'octava i terç d'octava

//de 8 kHz

public static double guany10000Hz; //Guany en el terç d'octava de 10 kHz

public static double guany12500Hz; //Guany en el terç d'octava de 12500 Hz

public static double guany16000Hz; //Guany en l'octava i terç d'octava

//de 16 kHz

/****************************************************

* Variables de l'equalitzador paramètric

*

* Nota:

Page 539: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

539

*

* LF: 20 a 250 Hz

* MLF: 250 a 2 kHz

* MHF: 2 k a 4 kHz

* HF: 4 k a 16 kHz

****************************************************/

//Guany en dB segons la posició del fadder,

//Rang entre -12 i +12 dB

public static double guany_LF; //Guany en la banda LF

public static double guany_MLF; //Guany en la banda MLF

public static double guany_MHF; //Guany en la banda MHF

public static double guany_HF; //Guany en la banda HF

//Freqüència Central de la banda, en Hz

public static double freqCentral_LF; //Freq. Central de la banda LF

public static double freqCentral_MLF; //Freq. Central de la banda MLF

public static double freqCentral_MHF; //Freq. Central de la banda MHF

public static double freqCentral_HF; //Freq. Central de la banda HF

//Ample de banda (BW), en Hz

public static double bW_LF; //BW de la banda LF

public static double bW_MLF; //BW de la banda MLF

public static double bW_MHF; //BW de la banda MHF

public static double bW_HF; //BW de la banda HF

/****************************************************

* Variable que indica l'equalitzador seleccionat

*

* Nota:

* 1: Equalitzador d'una octava

* 2: Equalitzador de terç d'octava

* 3: Equalitzador paramètric

****************************************************/

public static int equalitzador;

/****************************************************

Page 540: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

540

* Variables utilitzades en la prova2

****************************************************/

//pXt ---> punt x temporal

public static double p0t;

public static double p1t;

public static double p2t;

public static double p3t;

public static double p4t;

public static double p5t;

public static double p6t;

public static double p7t;

public static double p8t;

public static double p9t;

public static double p10t;

public static double p11t;

public static double p12t;

public static double p13t;

public static double p14t;

public static double p15t;

public static double p16t;

public static double p17t;

public static double p18t;

public static double p19t;

public static double p20t;

public static double p21t;

public static double p22t;

public static double p23t;

public static double p24t;

public static double p25t;

public static double p26t;

public static double p27t;

public static double p28t;

public static double p29t;

public static double p30t;

public static double p31t;

//pXf ---> punt x freqüencial

Page 541: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

541

public static double p0f;

public static double p1f;

public static double p2f;

public static double p3f;

public static double p4f;

public static double p5f;

public static double p6f;

public static double p7f;

public static double p8f;

public static double p9f;

public static double p10f;

public static double p11f;

public static double p12f;

public static double p13f;

public static double p14f;

public static double p15f;

public static double p16f;

public static double p17f;

public static double p18f;

public static double p19f;

public static double p20f;

public static double p21f;

public static double p22f;

public static double p23f;

public static double p24f;

public static double p25f;

public static double p26f;

public static double p27f;

public static double p28f;

public static double p29f;

public static double p30f;

public static double p31f;

/****************************************************

* Variables utilitzades en la prova3

****************************************************/

//pXi ---> punt x de entrada (abans de començar

//el processament de la senyal).

Page 542: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

542

public static double p0i;

public static double p1i;

public static double p2i;

public static double p3i;

public static double p4i;

public static double p5i;

public static double p6i;

public static double p7i;

public static double p8i;

public static double p9i;

public static double p10i;

public static double p11i;

public static double p12i;

public static double p13i;

public static double p14i;

public static double p15i;

public static double p16i;

public static double p17i;

public static double p18i;

public static double p19i;

public static double p20i;

public static double p21i;

public static double p22i;

public static double p23i;

public static double p24i;

public static double p25i;

public static double p26i;

public static double p27i;

public static double p28i;

public static double p29i;

public static double p30i;

public static double p31i;

//pXo ---> punt x de sortida (un cop

//acabat el processament de senyal).

public static double p0o;

public static double p1o;

Page 543: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

543

public static double p2o;

public static double p3o;

public static double p4o;

public static double p5o;

public static double p6o;

public static double p7o;

public static double p8o;

public static double p9o;

public static double p10o;

public static double p11o;

public static double p12o;

public static double p13o;

public static double p14o;

public static double p15o;

public static double p16o;

public static double p17o;

public static double p18o;

public static double p19o;

public static double p20o;

public static double p21o;

public static double p22o;

public static double p23o;

public static double p24o;

public static double p25o;

public static double p26o;

public static double p27o;

public static double p28o;

public static double p29o;

public static double p30o;

public static double p31o;

}

}

Page 544: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

544

Anexo 2

Programa Grabador Audio

Page 545: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

545

/*************************************************************

* Fitxer Form1.cs

*

* Programa: Grabador Audio

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

* Nota: Aquest fitxer es una versió que ha d'anar inclosa dins

* el programa principal Equalitzador FFT 1. Es una versió de

* prova totalment funcional.

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Media;

using WMPLib;

using System.IO;

namespace Grabador_audio

{

public partial class Form1 : Form

{

const double TAU = 2 * Math.PI;

string ruta;

private const double PI = 3.14159265358979;

private bool pausado = false;

private bool parado = true;

private int numSamples = 400000;//400.000 mostres = 10 segons

Page 546: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

546

private ushort numChannels = 1;

private ushort sampleLength = 2; // BitsPerSample/8 = 2

private uint sampleRate = 40000;

private uint sample = 1024;

private ushort N=128; //Número de punts de la FFT

private int nota = 1000; //Inicialització de la nota a 1000 Hz

private string ElsMeusDocuments; //Ruta els meus document

private string carpetaProjecte; //Ruta carpeta arrel del projecte

private string subCarpeta5; //Ruta subCarpeta contindrá els arxius .wav

private string nomArxiu; //Ruta del arxiu incial Fitxer.wav

private string nouArxiu; //Ruta del nou arxiu Fitxer#.wav

private double[] vectorDadesReal; //Per a contenir primer el vector del

//qual calcular la FFT, en les etapes

//intermitjes del càlcul els resultats

//intermitjos, i finalment, en

//l'última etapa, la FFT calculada,

//i després les amplituds. Sempre la

//part real dels punts.

private double[] vectorDadesIm; //Per a contenir primer el vector del

//qual calcular la FFT, en les etapes

//intermitjes del càlcul els resultats

//intermitjos, i finalment, en

//l'última etapa, la FFT calculada.

//Sempre la part imaginaria dels punts.

static byte[] RIFF_HEADER = new byte[] { 0x52, 0x49, 0x46, 0x46 }; //"RIFF"

static byte[] FORMAT_WAVE = new byte[] { 0x57, 0x41, 0x56, 0x45 }; //"WAVE"

static byte[] SUBCHUNK1_ID = new byte[] { 0x66, 0x6d, 0x74, 0x20 }; //"fmt "

static byte[] SUBCHUNK1_SIZE = new byte[] { 0x10, 0x00, 0x00, 0x00 };//16 PCM

static byte[] AUDIO_FORMAT = new byte[] { 0x01, 0x00 }; //1 PCM

static byte[] NUM_CHANNELS = new byte[] { 0x01, 0x00 }; //1 mono 2 stereo

static byte[] SAMPLE_RATE = new byte[] { 0x40, 0x9c, 0x00, 0x00 }; //40.000

//BYTE_RATE = SampleRate·NumChannels·(BitsPerSample/8)= 80.000

static byte[] BYTE_RATE = new byte[] { 0x88, 0x38, 0x01, 0x00 };

static byte[] BITS_PER_SAMPLE = new byte[] { 0x10, 0x00 }; //16

//BLOCK_ALIGN = NumChannels · (BitsPerSample/8) = 2

Page 547: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

547

static byte[] BLOCK_ALIGN = new byte[] { 0x02, 0x00, }; //2

static byte[] BITS = new byte[] { 0x10, 0x00, }; //16 bits

static byte[] SUBCHUNK_ID2 = new byte[] { 0x64, 0x61, 0x74, 0x61 }; //"data"

//Creació de l'instancia sonido

WindowsMediaPlayer sonido;

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* Form1

****************************************************************/

public void Form1_Load(object sender, EventArgs e)

{

btPause.Enabled = false;

btPlay.Enabled = false;

btStop.Enabled = false;

btContinuar.Enabled = false;

etEstat.Visible = false;

tbNota.Value = 100;

nota = tbNota.Value;

}

public Form1()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta quan es prem el botó play

****************************************************************/

private void btPlay_Click(object sender, EventArgs e)

{

btCrearWave.Enabled = false;

btObrirSo.Enabled = false;

try

{

if (sonido == null && parado == true)

{

Page 548: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

548

sonido = new WindowsMediaPlayer();

sonido.URL = ruta;

sonido.controls.play();

parado = false;

FileInfo info = new FileInfo(ruta);

string nom = info.Name;

etEstat.Text = nom;

etEstat.Text = "Reproduïnt " + nom;

etEstat.Visible = true;

timer1.Start();

}

}

catch (Exception ex)

{

MessageBox.Show("Error:" + ex);

}

}

/****************************************************************

* Funció que s'excecuta quan es prem el botó stop

****************************************************************/

private void btStop_Click(object sender, EventArgs e)

{

if (sonido != null)

{

sonido.controls.stop();

sonido = null;

parado = true;

timer1.Stop();

tbTime.Value = 0;

}

btCrearWave.Enabled = true;

btObrirSo.Enabled = true;

}

/****************************************************************

* Funció que s'excecuta quan es prem el botó pause

****************************************************************/

private void btPause_Click(object sender, EventArgs e)

Page 549: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

549

{

if (sonido != null)

{

sonido.controls.pause();

pausado = true;

FileInfo info = new FileInfo(ruta);

string nom = info.Name;

etEstat.Text = nom;

etEstat.Text = "Pausat " + nom;

etEstat.Visible = true;

timer1.Stop();

}

}

/*************************************************************************

* Si l'usuari manipula el trackBar del control de l'estat del temps de la

* reproducció, la posició actual del so reproduïnt-se també es modifica

*************************************************************************/

private void btContinuar_Click(object sender, EventArgs e)

{

if (sonido != null && pausado == true)

{

double tiempo = sonido.controls.currentPosition;

sonido.controls.currentPosition = tiempo;

sonido.controls.play();

pausado = false;

timer1.Start();

}

}

/*************************************************************************

* La funció ObrirSo, quan es fa clic en el boto obrir, obre el caudre

* de dialeg en la subcarpeta corresponent. L'usuari si fa clic en OK,

* s'adquereix la ruta del fitxer en questió.

*************************************************************************/

private void btObrirSo_Click(object sender, EventArgs e)

{

//Es mostra el quadre de dialeg obrir. Nomès es mostren

//els fitxers .wav de la subCarpeta 5

Page 550: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

550

OpenFileDialog DlgObrir = new OpenFileDialog();

DlgObrir.InitialDirectory = subCarpeta5;

DlgObrir.Filter = "fitxers audio (*wav)|*.wav";

if (DlgObrir.ShowDialog() == DialogResult.OK)

{

//Obtenir ruta del fitxer

ruta = DlgObrir.FileName;

}

//S'habilita els botons de control de la reproducció

//de l'audio i, es fa visible el nom de l'arxiu obert

btPause.Enabled = true;

btPlay.Enabled = true;

btStop.Enabled = true;

btContinuar.Enabled = true;

etEstat.Visible = true;

etEstat.Enabled = true;

FileInfo info = new FileInfo(ruta); //Obentció del nom+extensió de l'arxiu

string nom = info.Name;

etEstat.Text = nom; //escribim el nom del arxiu a l'etiqueta

}

/*************************************************************************

* Si l'usuari manipula el trackBar del control de l'estat del temps de la

* reproducció, la posició actual del so reproduïnt-se també es modifica

*************************************************************************/

private void tbTime_Scroll(object sender, EventArgs e)

{

if (ruta != null) //si tenim carregat el so

{

sonido.controls.currentPosition = tbTime.Value;

}

}

/*************************************************************************

* La funció timer1_Tick s'executa cada segon. Actualitza la posició del

Page 551: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

551

* trackBar que controla l'estat del temps de la reproducció.

*************************************************************************/

private void timer1_Tick(object sender, EventArgs e)

{

tbTime.Maximum = (int)sonido.controls.currentItem.duration;

tbTime.Value = (int)sonido.controls.currentPosition;

}

/******************************************************************

* La funció CalcularFunció() calcula i omple el vectorDadesReal[]

* amb els valors de la funció sinusoidal amb la component de cada

* instant de temps segons la freqüència del to escollida per

* l'usuari.

******************************************************************/

private void CalcularFuncio()

{

vectorDadesReal = new double[numSamples];

//f = (1/mostresPerSegon) * 2 * PI

double f = (0.00005*Math.PI);

//1r Octava La 440 Hz

//2n 880 Hz

//3ra 1760 ...

ushort volum = 15000; //Variable de control del volum

double freq = f * nota;

for (int n = 0; n < numSamples; n++)

{

vectorDadesReal[n] = volum*(1+Math.Sin(freq*n));

}

}

/***************************************************************************

* Quan es fa click al botó creac wave, es guarda un arxiu de 10 segons

* amb una ona sinusoidal amb la freqüència escollida per l'usuari. Aquesta

* funció representa un to pur a la freqüència escollida

***************************************************************************/

Page 552: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

552

private void btCrearWave_Click(object sender, EventArgs e)

{

//La variable conta contindrá el valor

//del index de repetició de l'arxiu.

int conta = 1;

//Es calcula la funció que conté el to pur seleccionat

//per l'usuari.

CalcularFuncio();

//1r s'assegura que la ruta a els meus documents

//estigui buida, llavors s'obté la ruta de la carpeta els meus documents

ElsMeusDocuments = "";

ElsMeusDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

//Creació la la ruta de la carpeta del projecte dins la carpeta

//els meus documents

carpetaProjecte = "";

carpetaProjecte = Path.Combine(ElsMeusDocuments, "EqualitzadorFFT");

//Creació de la ruta a la subcarpeta "Arxius wav"

//subCarpeta 5 contindrá els arxius .wav

subCarpeta5 = "";

subCarpeta5 = Path.Combine(carpetaProjecte, "Arxius wav");

nomArxiu = "";

nouArxiu = "";

nomArxiu = Path.Combine(subCarpeta5, "Fitxer");

//Extensió dels arxius .wav

string extensio = ".wav";

//Creació de la nova instancia SaveFileDialog com DlgGuardar

Page 553: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

553

SaveFileDialog DlgGuardar = new SaveFileDialog();

//Si existeix l'arxiu Fitxer.wav es crea un nou nom

//on la variable conta portara el número d'arxius Fitxer

//que hi han al directori. Si existeix Fitxer.wav es crea

//Fitxer1.wav, si aquets també existeix es crea Fitxer2.wav

//i així successivament

if (File.Exists(nomArxiu + extensio))

{

nouArxiu = nomArxiu + conta;

//Es comprova que el nou nom no exiteix.

//Si existeix, s'incrementa la conta

//i es guarda altre vegada en la variable

//nouArxiu.

while (File.Exists(nouArxiu + extensio))

{

conta++;

nouArxiu = nomArxiu + conta;

}

//Aparició per defecte del nom a guardar al quadre

//de dialeg. L'usuari pot modificar aquest nom manualment,

//però per defecte, tindrá l'opció automatica de guardar

//amb el nom consecutivament disponible

DlgGuardar.FileName = nouArxiu;

}

//Si l'arxiu Fitxer.wav no existeix, apareixerá per defecte

//l'opció d'aquest nom al usuari

else

{

DlgGuardar.FileName = nomArxiu;

}

//Directori inicial del quadre de dialeg

DlgGuardar.InitialDirectory = subCarpeta5;

Page 554: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

554

//Es filtra l'extensió a guardar

DlgGuardar.Filter = "(*.wav)|*.wav"; //filtratge de l'extensió a guardar

DlgGuardar.Title = "Guardar fitxers .wav";

//Si s'ha fet clic al botó guardar del quadre de dialeg...

if (DlgGuardar.ShowDialog() == DialogResult.OK)

{

//S'obté el nom de l'artxiu per guardar a la ruta de la subcarpeta

//corresponent.

subCarpeta5 = DlgGuardar.FileName;

using (FileStream stream = new FileStream(subCarpeta5, FileMode.Create))

{

using (BinaryWriter escriu = new BinaryWriter(stream))

{

//S'ecriu la cabecera RIFF

escriu.Write(RIFF_HEADER);

escriu.Write(36 + numSamples * numChannels * sampleLength);

escriu.Write(FORMAT_WAVE);

//Bloc subChunk1

escriu.Write(SUBCHUNK1_ID);

escriu.Write(SUBCHUNK1_SIZE);

escriu.Write(AUDIO_FORMAT);

escriu.Write(NUM_CHANNELS);

escriu.Write(SAMPLE_RATE);

escriu.Write(BYTE_RATE);

escriu.Write(BLOCK_ALIGN);

escriu.Write(BITS_PER_SAMPLE);

//Bloc subChnunk2

escriu.Write(SUBCHUNK_ID2);

escriu.Write(numSamples * sampleLength);

//S'envien les mostres en blocs de 2 bytes.

Page 555: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

555

for (int i = 0; i < numSamples; i++)

{

escriu.Write((ushort)(vectorDadesReal[i]));

}

escriu.Close();

//Es lliberen els recursos utilitzat pel FileStream

escriu.Dispose();

}

}

}//Fi if showDialog

}//Fi btCrearWave

private void tbNota_Scroll(object sender, EventArgs e)

{

etNotaHz.Text = tbNota.Value + "Hz";

nota = tbNota.Value;

}

}

}

Page 556: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

556

/*************************************************************

* Fitxer Form1.Designer.cs

*

* Programa: Grabador Audio

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Grabador_audio

{

partial class Form1

{

/// <summary>

/// Variable del diseñador necesaria.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén usando.

/// </summary>

/// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido de este método con el editor de código.

Page 557: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

557

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.btPlay = new System.Windows.Forms.Button();

this.btStop = new System.Windows.Forms.Button();

this.btPause = new System.Windows.Forms.Button();

this.btContinuar = new System.Windows.Forms.Button();

this.btObrirSo = new System.Windows.Forms.Button();

this.tbTime = new System.Windows.Forms.TrackBar();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.btCrearWave = new System.Windows.Forms.Button();

this.tbNota = new System.Windows.Forms.TrackBar();

this.etNotaHz = new System.Windows.Forms.Label();

this.etTextNota = new System.Windows.Forms.Label();

this.etEstat = new System.Windows.Forms.Label();

((System.ComponentModel.ISupportInitialize)(this.tbTime)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.tbNota)).BeginInit();

this.SuspendLayout();

//

// btPlay

//

this.btPlay.Location = new System.Drawing.Point(12, 32);

this.btPlay.Name = "btPlay";

this.btPlay.Size = new System.Drawing.Size(75, 23);

this.btPlay.TabIndex = 0;

this.btPlay.Text = "Play";

this.btPlay.UseVisualStyleBackColor = true;

this.btPlay.Click += new System.EventHandler(this.btPlay_Click);

//

// btStop

//

this.btStop.Location = new System.Drawing.Point(255, 32);

this.btStop.Name = "btStop";

this.btStop.Size = new System.Drawing.Size(75, 23);

this.btStop.TabIndex = 1;

this.btStop.Text = "Stop";

this.btStop.UseVisualStyleBackColor = true;

this.btStop.Click += new System.EventHandler(this.btStop_Click);

//

// btPause

//

Page 558: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

558

this.btPause.Location = new System.Drawing.Point(93, 32);

this.btPause.Name = "btPause";

this.btPause.Size = new System.Drawing.Size(75, 23);

this.btPause.TabIndex = 2;

this.btPause.Text = "Pause";

this.btPause.UseVisualStyleBackColor = true;

this.btPause.Click += new System.EventHandler(this.btPause_Click);

//

// btContinuar

//

this.btContinuar.Location = new System.Drawing.Point(174, 32);

this.btContinuar.Name = "btContinuar";

this.btContinuar.Size = new System.Drawing.Size(75, 23);

this.btContinuar.TabIndex = 3;

this.btContinuar.Text = "Continuar";

this.btContinuar.UseVisualStyleBackColor = true;

this.btContinuar.Click += new System.EventHandler(this.btContinuar_Click);

//

// btObrirSo

//

this.btObrirSo.Location = new System.Drawing.Point(12, 61);

this.btObrirSo.Name = "btObrirSo";

this.btObrirSo.Size = new System.Drawing.Size(75, 23);

this.btObrirSo.TabIndex = 4;

this.btObrirSo.Text = "Obrir";

this.btObrirSo.UseVisualStyleBackColor = true;

this.btObrirSo.Click += new System.EventHandler(this.btObrirSo_Click);

//

// tbTime

//

this.tbTime.Location = new System.Drawing.Point(96, 71);

this.tbTime.Maximum = 100;

this.tbTime.Name = "tbTime";

this.tbTime.Size = new System.Drawing.Size(241, 45);

this.tbTime.TabIndex = 1;

this.tbTime.TickStyle = System.Windows.Forms.TickStyle.None;

//

// timer1

//

this.timer1.Interval = 1;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

Page 559: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

559

// btCrearWave

//

this.btCrearWave.Location = new System.Drawing.Point(12, 167);

this.btCrearWave.Name = "btCrearWave";

this.btCrearWave.Size = new System.Drawing.Size(75, 23);

this.btCrearWave.TabIndex = 5;

this.btCrearWave.Text = "Crear WAVE";

this.btCrearWave.UseVisualStyleBackColor = true;

this.btCrearWave.Click += new System.EventHandler(this.btCrearWave_Click);

//

// tbNota

//

this.tbNota.LargeChange = 1;

this.tbNota.Location = new System.Drawing.Point(12, 116);

this.tbNota.Maximum = 20000;

this.tbNota.Minimum = 100;

this.tbNota.Name = "tbNota";

this.tbNota.Size = new System.Drawing.Size(169, 45);

this.tbNota.TabIndex = 6;

this.tbNota.TickStyle = System.Windows.Forms.TickStyle.None;

this.tbNota.Value = 100;

this.tbNota.Scroll += new System.EventHandler(this.tbNota_Scroll);

//

// etNotaHz

//

this.etNotaHz.AutoSize = true;

this.etNotaHz.Location = new System.Drawing.Point(188, 116);

this.etNotaHz.Name = "etNotaHz";

this.etNotaHz.Size = new System.Drawing.Size(41, 13);

this.etNotaHz.TabIndex = 7;

this.etNotaHz.Text = "100 Hz";

//

// etTextNota

//

this.etTextNota.AutoSize = true;

this.etTextNota.Location = new System.Drawing.Point(188, 133);

this.etTextNota.Name = "etTextNota";

this.etTextNota.Size = new System.Drawing.Size(102, 13);

this.etTextNota.TabIndex = 8;

this.etTextNota.Text = "Freqüència a grabar";

//

// etEstat

Page 560: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

560

//

this.etEstat.AutoSize = true;

this.etEstat.Location = new System.Drawing.Point(93, 177);

this.etEstat.Name = "etEstat";

this.etEstat.Size = new System.Drawing.Size(39, 13);

this.etEstat.TabIndex = 9;

this.etEstat.Text = "Label1";

//

// Form1

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(349, 202);

this.Controls.Add(this.etEstat);

this.Controls.Add(this.etTextNota);

this.Controls.Add(this.etNotaHz);

this.Controls.Add(this.tbNota);

this.Controls.Add(this.btCrearWave);

this.Controls.Add(this.tbTime);

this.Controls.Add(this.btObrirSo);

this.Controls.Add(this.btContinuar);

this.Controls.Add(this.btPause);

this.Controls.Add(this.btStop);

this.Controls.Add(this.btPlay);

this.MaximizeBox = false;

this.Name = "Form1";

this.Text = "Form1";

this.Load += new System.EventHandler(this.Form1_Load);

((System.ComponentModel.ISupportInitialize)(this.tbTime)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.tbNota)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btPlay;

private System.Windows.Forms.Button btStop;

private System.Windows.Forms.Button btPause;

private System.Windows.Forms.Button btContinuar;

private System.Windows.Forms.Button btObrirSo;

Page 561: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

561

private System.Windows.Forms.TrackBar tbTime;

private System.Windows.Forms.Timer timer1;

private System.Windows.Forms.Button btCrearWave;

private System.Windows.Forms.TrackBar tbNota;

private System.Windows.Forms.Label etNotaHz;

private System.Windows.Forms.Label etTextNota;

private System.Windows.Forms.Label etEstat;

}

}

Page 562: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

562

/*************************************************************

* Fitxer Program.cs

*

* Programa: Grabador Audio

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace Grabador_audio

{

static class Program

{

/// <summary>

/// Punto de entrada principal para la aplicación.

/// </summary>

[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

}

}

Page 563: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

563

Anexo 3

Programa Arxius grab

Page 564: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

564

/*************************************************************

* Fitxer Form1.cs

*

* Programa: Arxius Grab

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*

* Nota: Aquest fitxer no està integrat encara dins el

* programa principal Equalitzador FFT 1. Es una versió de

* prova funcional.

*************************************************************/

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.IO;

namespace Arxius_Grab

{

public partial class Form1 : Form

{

private double[] vectorDadesReal;

private double[] vectorDadesIm;

private int tempsGrab=10; //Temps de grabació escollit per

//l'usuari

private const double PI = 3.14159265358979;

private int segons=0;

private int minuts=0;

Page 565: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

565

private int tamanyGrab = 0;

private int N = 1024; //Número de punts de la FFT

private int logN = 10; //log en base 2 de N

private int M; //Número de punts a capturar

//pel mètode AInScan()

private int mostresPerSegon=40000; //Freqüència de mostreig de l'ADC

//de la tarjeta.

private int fonsEscalaADC=7; //Per a contenir quin és el fons

//d'escala de l'ADC de la tarjeta.

//Els valors que podrà adquirir són

//els següents:

//Fons d'escala ADC +/- 10 volts

//fonsEscalaADC = 7

//Fons d'escala ADC +/- 5 volts

//fonsEscalaADC = 6

//Fons d'escala ADC +/- 4 volts

//fonsEscalaADC = 5

//Fons d'escala ADC +/- 2,5 volts

//fonsEscalaADC = 4

//Fons d'escala ADC +/- 2 volts

//fonsEscalaADC = 3

//Fons d'escala ADC +/- 1,25 volts

//fonsEscalaADC = 2

//Fons d'escala ADC +/- 1 volt

//FonsEscalaADC = 1

private string ElsMeusDocuments; //Ruta els meus document

private string carpetaProjecte; //Ruta carpeta arrel del projecte

private string subCarpeta4; //Ruta subCarpeta 1 contindrá els arxius .eq1

private string nomArxiu; //Ruta del arxiu incial EqOctava.eq1

private string nouArxiu; //Ruta del nou arxiu EqOctava#.eq1

Page 566: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

566

private int temps = 0;

public Form1()

{

InitializeComponent();

}

/****************************************************************

* Funció que s'excecuta cada vegada que es carrega el formulari

* Form1

****************************************************************/

private void Form1_Load(Object sender, EventArgs e)

{

//Obtenció de la ruta de la carpeta els meus documents

ElsMeusDocuments = Environment.GetFolderPath

(Environment.SpecialFolder.MyDocuments);

//Creació la la ruta de la carpeta del projecte dins la carpeta

//de els meus documents

carpetaProjecte = Path.Combine(ElsMeusDocuments, "EqualitzadorFFT");

//Es crea la ruta a la subcarpeta "Arxius grab"

//subCarpeta 1 contindrá els arxius .grab

subCarpeta4 = Path.Combine(carpetaProjecte, "Arxius grab");

nomArxiu = string.Empty;

nouArxiu = string.Empty;

panelGrabant.Visible = false;

pbGrabant.Visible = false;

etGrabant.Visible = false;

}

/*******************************************

* funcio per omplir el vector de dades real

Page 567: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

567

*******************************************/

private void OmplirVectorDadesReal ()

{

vectorDadesReal = new double [tamanyGrab];

double f = N / 128;

for (int n = 0; n < tamanyGrab; n++)

{

vectorDadesReal[n] = 0 +

1 * Math.Sin(1 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(2 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(3 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(4 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(5 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(6 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(7 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(8 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(9 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(10 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(11 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(12 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(13 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(14 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(15 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(16 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(17 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(18 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(19 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(20 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(21 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(22 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(23 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(24 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(25 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(26 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(27 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(28 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(29 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(30 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(31 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(32 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(33 * f * ((2 * PI * n) / N)) +

Page 568: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

568

1 * Math.Sin(34 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(35 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(36 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(37 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(38 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(39 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(40 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(41 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(42 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(43 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(44 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(45 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(46 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(47 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(48 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(49 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(50 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(51 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(52 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(53 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(54 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(55 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(56 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(57 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(58 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(59 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(60 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(61 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(62 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(63 * f * ((2 * PI * n) / N)) +

1 * Math.Sin(64 * f * ((2 * PI * n) / N));

}

}

/****************************************************************

* Funció que es crida quan s'actualitza el fadder del temps

* a seleccionar de l'arxiu a grabar

****************************************************************/

private void tbTemps_Scroll(object sender, EventArgs e)

{

tempsGrab = tbTemps.Value;

Page 569: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

569

if (tempsGrab < 60)

{

segons = tempsGrab;

minuts = 0;

}

if (tempsGrab >= 60 && tempsGrab < 120)

{

minuts = 1;

segons = tempsGrab - 60;

}

if (tempsGrab >= 120 && tempsGrab < 180)

{

minuts = 2;

segons = tempsGrab - 120;

}

if (tempsGrab >= 180 && tempsGrab < 240)

{

minuts = 3;

segons = tempsGrab - 180;

}

if (tempsGrab >= 240 && tempsGrab < 300)

{

minuts = 4;

segons = tempsGrab - 240;

}

etTemps.Text = minuts + " min " + segons + " seg ";

}

/****************************************************************

* La funció btGrabar_Click s'executa cuan l'usuari fa clic al

* botó guardar. Quan es fa click es deshabilita el botó guardar

* i el trackBar. Es fa visible en panell grabant amb el progres

* de la grabació i l'informació Grabant..Per últim s'inicia el

* timer1

***************************************************************/

private void btGrabar_Click(object sender, EventArgs e)

{

temps = 0;

tamanyGrab = mostresPerSegon * tbTemps.Value;

Page 570: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

570

tbTemps.Enabled = false;

btGrabar.Enabled = false;

panelGrabant.Visible = true;

pbGrabant.Visible = true;

etGrabant.Visible = true;

//El valor del temps de grabació ha de ser el valor máxim del

//progresBar.

pbGrabant.Maximum = tbTemps.Value;

pbGrabant.Value = 0;

timer1.Start();

OmplirVectorDadesReal();

}

/*----------------------------------------------------------

* La funció timer1_Tick_1 s'executa cada segon

*----------------------------------------------------------*/

private void timer1_Tick_1(object sender, EventArgs e)

{

//Mentre el temps que es porta sigui inferior al temps

//de grabació s'incrementa el contador temps i

//s'incrementa la posició del progressBar

if (temps <tbTemps.Value)

{

temps++;

pbGrabant.Value++;

}

//Si hem arribat al final del temps a grabat

//s'atura el timer i apareix el missatge i l'opció de guardar l'arxiu

else

{

timer1.Stop(); //S'atura el timer

temps = 0; //reset de la variable que porta la conta del temps

string missatgeBox = "Vols guardar l'arxiu grabat?";

string titolBox = "Info";

MessageBoxButtons buttons = MessageBoxButtons.YesNo;

DialogResult resultat;

Page 571: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

571

// Displays the MessageBox.

resultat = MessageBox.Show(missatgeBox, titolBox, buttons);

if (resultat == DialogResult.Yes)

{

//Es mostra el Dialeg Guardar on s'haura d'escriure el

//nom del fitxer a guardar. S'ha de escollir la ruta de guardar,

//per defecte ve donada //C://..//Mis documentos

//La variable conta contindrá el valor

//del index de repetició de l'arxiu.

int conta = 1;

//nomArxiu conté la ruta C://.../Arxius grab//Grabacio

//sense extensió.

subCarpeta4 = "";

subCarpeta4 = Path.Combine(carpetaProjecte, "Arxius grab");

nomArxiu = "";

nouArxiu = "";

nomArxiu = Path.Combine(subCarpeta4, "Grabacio");

//Extensió dels arxius .grab

string extensio = ".grab";

//Creació de la nova instansia SaveFileDialog com DlgGuardar

SaveFileDialog DlgGuardar = new SaveFileDialog();

//Si existeix l'arxiu Grabacio.grab es crea un nou nom

//on la variable conta portara el número d'arxius Grabacio

//que hi han al directori. Si existeix Grabacio.grab es crea

Page 572: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

572

//Grabacio1.grab, si aquets també existeix es crea Grabacio2.grab

//i així successivament

if (File.Exists(nomArxiu + extensio))

{

nouArxiu = nomArxiu + conta;

//Comprovació que el nou nom no exiteix Si existeix, s'incrementa

//la conta y es guarda altre vegada en nouArxiu

while (File.Exists(nouArxiu + extensio))

{

conta++;

nouArxiu = nomArxiu + conta;

}

//Aparició per defecte del nom a guardar al quadre

//de dialeg. L'usuari pot modificar aquest nom manualment,

//però per defecte, tindrá l'opció automatica de guardar

//amb el nom consecutivament disponible

DlgGuardar.FileName = nouArxiu;

}

//Si l'arxiu EqOctava.eq1 no existeix, apareixerá per defecte

//l'opció d'aquest nom al usuari.

else

{

DlgGuardar.FileName = nomArxiu;

}

//Directori inicial del quadre de dialeg

DlgGuardar.InitialDirectory = subCarpeta4;

//Es filtra l'extensió a guardar

Page 573: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

573

DlgGuardar.Filter = "(*.grab)|*.grab";

DlgGuardar.Title = "Guardar fitxer grabat";

//Si s'ha fet clic al botó guardar del quadre de dialeg...

if (DlgGuardar.ShowDialog() == DialogResult.OK)

{

//S'obté el nom de l'artxiu per guardar a la ruta de la subcarpeta

//corresponent.

subCarpeta4 = DlgGuardar.FileName;

//S'utilitza la funció FileStream per crear l'artxiu binary

using (FileStream stream = new FileStream(subCarpeta4, FileMode.Create))

{

using (BinaryWriter escriu = new BinaryWriter(stream))

{

//S'escriu cada valor consecutivament.

//BinaryWriter apunta automàticament a la

//següent posició

escriu.Write(mostresPerSegon);

escriu.Write(tbTemps.Value);

escriu.Write(tamanyGrab);

escriu.Write(fonsEscalaADC);

for (int i=0; i<tamanyGrab;i++)

/*

Escriure cada posició del vector dades real

*/

escriu.Close();

}

}

}//Fi if DialogGuardar

Page 574: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

574

}//Fi if mostrar missatge

//Si l'usuari no vol guardar l'arxiu...

else

{

//no guardar el vectorDadesReal[]

}

//Una vegada tancat el dialog es torna a habilitar

//el tbTemps, i el btGrabar. S'amaguen pbGrabant

//etGrabant i el panelGrabant.

tbTemps.Enabled = true;

btGrabar.Enabled = true;

panelGrabant.Visible = false;

pbGrabant.Visible = false;

etGrabant.Visible = false;

}//fi else final del temps de grabació

}//fi funció timer

}

}

Page 575: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

575

/*************************************************************

* Fitxer Form1.Designer.cs

*

* Programa: Arxius Grab

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

namespace Arxius_Grab

{

partial class Form1

{

/// <summary>

/// Variable del diseñador necesaria.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Limpiar los recursos que se estén usando.

/// </summary>

/// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Código generado por el Diseñador de Windows Forms

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

Page 576: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

576

/// el contenido de este método con el editor de código.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.tbTemps = new System.Windows.Forms.TrackBar();

this.etTemps = new System.Windows.Forms.Label();

this.etTextTemps = new System.Windows.Forms.Label();

this.btGrabar = new System.Windows.Forms.Button();

this.panelGrabant = new System.Windows.Forms.Panel();

this.pbGrabant = new System.Windows.Forms.ProgressBar();

this.etGrabant = new System.Windows.Forms.Label();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.pFondo = new System.Windows.Forms.Panel();

((System.ComponentModel.ISupportInitialize)(this.tbTemps)).BeginInit();

this.panelGrabant.SuspendLayout();

this.SuspendLayout();

//

// tbTemps

//

this.tbTemps.LargeChange = 1;

this.tbTemps.Location = new System.Drawing.Point(12, 30);

this.tbTemps.Maximum = 300;

this.tbTemps.Minimum = 10;

this.tbTemps.Name = "tbTemps";

this.tbTemps.Size = new System.Drawing.Size(218, 45);

this.tbTemps.TabIndex = 0;

this.tbTemps.Value = 10;

this.tbTemps.Scroll += new System.EventHandler(this.tbTemps_Scroll);

//

// etTemps

//

this.etTemps.AutoSize = true;

this.etTemps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.etTemps.Location = new System.Drawing.Point(181, 55);

this.etTemps.Name = "etTemps";

this.etTemps.Size = new System.Drawing.Size(99, 20);

this.etTemps.TabIndex = 1;

this.etTemps.Text = "0 min 10 seg";

//

// etTextTemps

Page 577: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

577

//

this.etTextTemps.AutoSize = true;

this.etTextTemps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.etTextTemps.Location = new System.Drawing.Point(12, 55);

this.etTextTemps.Name = "etTextTemps";

this.etTextTemps.Size = new System.Drawing.Size(166, 20);

this.etTextTemps.TabIndex = 2;

this.etTextTemps.Text = "Temps de grabació:";

//

// btGrabar

//

this.btGrabar.Location = new System.Drawing.Point(103, 110);

this.btGrabar.Name = "btGrabar";

this.btGrabar.Size = new System.Drawing.Size(75, 23);

this.btGrabar.TabIndex = 3;

this.btGrabar.Text = "Grabar";

this.btGrabar.UseVisualStyleBackColor = true;

this.btGrabar.Click += new System.EventHandler(this.btGrabar_Click);

//

// panelGrabant

//

this.panelGrabant.Controls.Add(this.pbGrabant);

this.panelGrabant.Controls.Add(this.etGrabant);

this.panelGrabant.Location = new System.Drawing.Point(12, 139);

this.panelGrabant.Name = "panelGrabant";

this.panelGrabant.Size = new System.Drawing.Size(260, 110);

this.panelGrabant.TabIndex = 4;

//

// pbGrabant

//

this.pbGrabant.Location = new System.Drawing.Point(0, 14);

this.pbGrabant.MarqueeAnimationSpeed = 1000;

this.pbGrabant.Name = "pbGrabant";

this.pbGrabant.Size = new System.Drawing.Size(260, 23);

this.pbGrabant.Step = 1;

this.pbGrabant.TabIndex = 1;

//

// etGrabant

//

this.etGrabant.AutoSize = true;

this.etGrabant.Location = new System.Drawing.Point(4, 94);

Page 578: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

578

this.etGrabant.Name = "etGrabant";

this.etGrabant.Size = new System.Drawing.Size(54, 13);

this.etGrabant.TabIndex = 0;

this.etGrabant.Text = "Grabant...";

//

// timer1

//

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick_1);

//

// pFondo

//

this.pFondo.Dock = System.Windows.Forms.DockStyle.Fill;

this.pFondo.Location = new System.Drawing.Point(0, 0);

this.pFondo.Name = "pFondo";

this.pFondo.Size = new System.Drawing.Size(284, 261);

this.pFondo.TabIndex = 6;

//

// Form1

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.BackColor = System.Drawing.SystemColors.Control;

this.ClientSize = new System.Drawing.Size(284, 261);

this.Controls.Add(this.panelGrabant);

this.Controls.Add(this.btGrabar);

this.Controls.Add(this.etTextTemps);

this.Controls.Add(this.etTemps);

this.Controls.Add(this.tbTemps);

this.Controls.Add(this.pFondo);

this.DoubleBuffered = true;

this.IsMdiContainer = true;

this.Name = "Form1";

this.Text = "Form1";

this.Load += new System.EventHandler(this.Form1_Load);

((System.ComponentModel.ISupportInitialize)(this.tbTemps)).EndInit();

this.panelGrabant.ResumeLayout(false);

this.panelGrabant.PerformLayout();

this.ResumeLayout(false);

this.PerformLayout();

}

Page 579: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

579

#endregion

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede modificar

/// el contenido de este método con el editor de código.

/// </summary>

private System.Windows.Forms.TrackBar tbTemps;

private System.Windows.Forms.Label etTemps;

private System.Windows.Forms.Label etTextTemps;

private System.Windows.Forms.Button btGrabar;

private System.Windows.Forms.Panel panelGrabant;

private System.Windows.Forms.ProgressBar pbGrabant;

private System.Windows.Forms.Label etGrabant;

private System.Windows.Forms.Timer timer1;

private System.Windows.Forms.Panel pFondo;

}

}

Page 580: KILIAN GARCIA RUIZ EL PC COMO PROCESADOR DE SONIDO …deeea.urv.cat/public/PROPOSTES/pub/pdf/2514pub.pdf · 2019-04-29 · 1 Objetivo 4 1 Objetivo El objetivo de este proyecto es

580

/*************************************************************

* Fitxer Program.cs

*

* Programa: Arxius Grab

*

* TFG: "El PC como procesador de Sonido"

*

* Autor: Kilian Garcia Ruiz

*

* Director del TFG: Esteban del Castillo Pérez

*

* Data: 04/06/2018

*************************************************************/

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace Arxius_Grab

{

static class Program

{

/// <summary>

/// Punto de entrada principal para la aplicación.

/// </summary>

[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

}

}