Un día, en la facultad, en una tediosa clase, aburrido, me fijé en una mosca que tras posarse en la mesa de delante, se movía haciendo círculos inacabados. Pareciera que éstos los repitiera una y otra vez. Intenté garabatear su movimiento y me salían figuras curvas que se cerraban finalmente. La clase trataba de movimiento vibratorios y se me ocurrió proyectar el movimiento en uno de los ejes y añadir el tiempo en el eje de abscisas. Curiosamente se parecía a lo que el profesor trataba de explicar con el concepto de armónicos.
Como una imagen vale más de mil palabras ( y un vídeo, por tanto, más de un millón) os muestro algo parecido, en bonito, de lo que dibujara:
One day; in the faculty, a tedious class. I was bored. I noticed a fly after landing at the front desk, moved by unfinished circles. They seem to repeat them again and again. I tried to scribble their movement: The teacher theme was vibratory motion. I happened to project the movement in one axis and add time in the horizontal axis. Interestingly resembled what the teacher was trying to explain the concept of harmonics.
As a picture is worth a thousand words (and a video, therefore, more than a million) I show you something, in nice, what drew:
One day; in the faculty, a tedious class. I was bored. I noticed a fly after landing at the front desk, moved by unfinished circles. They seem to repeat them again and again. I tried to scribble their movement: The teacher theme was vibratory motion. I happened to project the movement in one axis and add time in the horizontal axis. Interestingly resembled what the teacher was trying to explain the concept of harmonics.
As a picture is worth a thousand words (and a video, therefore, more than a million) I show you something, in nice, what drew:
¿Cómo está hecho el dibujo? / How is made the design?
Lo primero es colocar unos cuantos puntos:
The first is to put a few points:
Lo segundo es unir los punos 1-2, 2-3 y 3-1 con una semirrecta de origen en el primer punto:
The second is to connect the points 1-2, 2-3 and 3-1 with a halft-straight. The origin of this will be the first point
El tercer paso es situar un punto azar y hacerlo girar en torno al punto 1 hasta que choque con la semirrecta 1-2. En ese momento girará en torno al punto 2 hasta que choque con la recta 2-3. Y así sucesivamente:
The third step is to place a random point and rotate around the point 1 until collision with the line 1-2. Then it will rotate around point 2 until it hits the line 2-3. And so on:
Gif animado del vuelo de la mosca con varios pasos intermedios |
¿Qué mas se puede hacer con la onda creada?
Con la escala de tiempo adecuada hemos creado sonidos. La forma de guardar un sonido es la siguiente:
Se crea un Tipo para la lectura / guarda de datos:
What else can you do with the wave created?
With the appropriate time scale we created sounds. How to save a sound is:
One type is created to read / save data:
Type WaveHeader
riff As String * 4
riffdatasize As Long
wave As String * 4 '
End Type
Type WaveFormat
fmt As String * 4
formatsize As Long
formatTag As Integer
nChannels As Integer
samplesPerSecond As Long
aveBytesPerSecond As Long
blockAlign As Integer
bitsPerSample As Integer
End Type
Type WaveDatachunk
dataposition As String * 4
wavedatasize As Long
End Type
Se le dan los siguientes valores:
wh.riff = "RIFF"
wh.wave = "WAVE"
wh.riffdatasize = CInt(0)
wf.fmt = "fmt "
wf.formatsize = 16
wf.formatTag = 1
wf.nChannels = 2 ' stereo, 1 para Mono
wf.samplesPerSecond = 96000 ' 44100 para calidad CD
wf.aveBytesPerSecond = wf.nChannels * wf.samplesPerSecond * 2
wf.bitsPerSample = 16 ' integer type
wf.blockAlign = (wf.bitsPerSample * wf.nChannels) / 8
dc.dataposition = "data"
dc.wavedatasize = CInt(0)
Para guardar los datos:
[...]
Open fichero For Binary As #1
Put #1, , wh
Put #1, , wf
Put #1, , dc
For i = 1 To finfin
Put #1, , DataValue(i)
Next i
fileSize = LOF(1)
Put #1, 5, CLng(fileSize - 8)
Put #1, 41, CLng(fileSize - 44)
Close #1
[...]
Los sonidos de varias de las pruebas están disponibles aquí:
The sounds of several tests are available here:
Lógicamente también se nos ha ocurrido que podríamos hacer un programa que leyera estos datos y así poder hacer el vuelo de la mosca a posteriori.
Of course we also have happened that could make a program to read this data and be able to make the flight fly afterwards.
No hay comentarios:
Publicar un comentario