Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Read this, please:

The sequence of steps to execute the scrit of Vocoder is the following one:
- First, it is recommendable that in the same folder where you have the programs Cosubf.m
and Decosubf.m you must have the audio file of compressing.
The original archives WAV to analyze are sampled to 44100 Hertz, 8 bits, 1 channel
(mono) and PCM.
If you want to use .wav archives of less frequency of sampling (for example 22 KHz or 11
KHz) you must modify
the number of points of the "window time". For example, for a file of 44100 Hertz of
sampling frequency, a window
of 880 data is used, that correspond approximately 20 milliseconds. It's means if you vary
the sampling frequency, you must modify the number of points by time window.

- You have to execute (in the command line of Matlab): "cosubf".


You should see the percentage of compression and the normalized spectral power, along
with the frequency response of a passband filter.
The compressed file is kept in a variable. In this case, it is in the variable "exit" (that is a
column vector).
If you execute the command "whos" in the command line of Matlab, you will be able to
see the size of the variables.
If you want to store the compressed file, you must add lines to the code that do fwrite of
the variable.
Nevertheless, I do not keep in a file the variable "exit", since I decompress it immediately.
The program shows the percentage to you of compression when finishing executing script
"Cosubf".
You can verify it with the command "whos".

- Soon, in the command line, you have to execute "decosubf(salida)". So, flames to script
decompression valve, with the name of the variable
where the powers obtained in cosubf estan. The progress of the program is in the number
of analyzed window of time (nv).
It remembers that according to the size of the file, you will have time windows more or
less.

- When finishing executing the file decosubf, is due to have created a called file
"descom.wav", that corresponds to the audio one decompressed
and corresponds to the sum of sinusoidal with the weights of the powers obtained in the
sub-bands of frequency (in each filter) within each window of time.
That decompressed file generally equal weight to the original file, but not always, since in
the last window they are had generally less than 880 points.
You will notice that it sounds synthetic, because is an approach of the original file, on the
basis of sum of sine.

NOT TO FORGET : THIS TYPE OF COMPRESSION IS SINTETIC QUALITY.


The commented lines are for step by step being able the powers of the sub-bands of
frequency in each window of time.
They do not influence in the final result.

I have the code in C for implementing a Vocoder in real time (for platform DSP Texas
Instruments DSK TMS320C6711). If you want it, write me an e-mail.

If you use the code, you do not forget to put to me within your references, please.

Greetings.

Juan Carlos Llanos V.


juancarlos@llanos.cl
www.llanos.cl
56-32-724007

Castellano:

La secuencia de pasos para poder ejecutar el programa es el siguiente:

- Primero, es recomendable que en la misma carpeta donde tienes los programas Cosubf.m
y Decosubf.m debes tener el archivo de audio a comprimir.
Los archivos .WAV originales a analizar estan muestreados a 44100 Hz, 8 bits, 1 canal
(mono) y PCM. Si quieres utilizar archivos .wav de menos frecuencia de muestreo (por
ejemplo 22 KHz o 11 KHz) debes modificar el número de puntos por ventana de tiempo.
Por ejemplo, para un archivo de 44100 Hz de frecuencia de muestreo, se utiliza una ventana
de 880 datos, que corresponden aproximadamente 20 milisegundos. Es decir, si varías la
frecuencia de muestreo, debes modificar el número de puntos por ventana de tiempo.

- Ejecutas en la linea de comandos de Matlab: " cosubf " . Deberias ver al final el
porcentaje de compresión y la potencia espectral normalizada, junto con la respuesta en
frecuencia de un filtro pasabanda. El archivo comprimido queda guardado en una variable.
En este caso, queda en la variable "salida" (que es un vector columna). Si ejecutas el
comando "whos" en la linea de comandos de Matlab, podrás ver el tamaño de las variables.
Si quieres almacenar el archivo comprimido, debes agregar lineas al código que hagan un
fwrite de la variable. Sin embargo, yo no guardo en un archivo la variable "salida", ya que
la descomprimo inmediatamente. El programa te muestra el porcentaje de compresión al
terminar de ejecutar el script "Cosubf". Puedes verificarlo haciendo el comando "whos".

- Luego, en la linea de comandos, ejecutas "decosubf(salida)". De esta forma, llamas al


script descompresor, con el nombre de la variable donde estan las potencias obtenidas en
cosubf. El progreso del programa se muestra en el número de ventana de tiempo analizada
(nv). Recuerda que según el tamaño del archivo, tendrás más o menos ventanas de tiempo.
- Al terminar de ejecutarse el archivo decosubf, se debe haber creado un archivo llamado
"descom.wav", que corresponde al audio descomprimido y corresponde a la suma de
sinusoidales con los pesos de las potencias obtenidas en las sub-bandas de frecuencia (en
cada filtro) dentro de cada ventana de tiempo. Ese archivo descomprimido pesa
generalmente igual al archivo original, pero no siempre, ya que en la última ventana
generalmente se tienen menos de 880 puntos.

Notarás que suena sintético, debido a que es una aproximación del archivo original, en base
a sumas de senoidales.

NO OLVIDAR QUE ESTE TIPO DE COMPRESION ES DE CALIDAD SINTETICA.

Las lineas comentadas son para poder paso a paso las potencias de las sub-bandas de
frecuencia en cada ventana de tiempo. No influyen en el resultado final.

Tengo los códigos en C para implementar el Vocoder en tiempo real. Estan escritos para la
plataforma DSP Texas Instruments DSK TMS320C6711. Si los quieres, escríbeme un e-
mail.

Si utilizas el código, no olvides ponerme dentro de tus referencias, por favor.

Saludos.

Juan Carlos Llanos V.


juancarlos@llanos.cl
www.llanos.cl
56-32-724007

You might also like