Cavalo Morto

Hola! Os dejo una transcripción sonora del poema de Juan Carlos Mestre.

https://soundcloud.com/fartagaintuxedo/cavalo-morto

Hecho con Ruby, el código a continuación,


# Encoding : UTF-8
require 'wavefile'
include WaveFile
require 'win32/sound'
include Win32

format = Format.new(:mono, :pcm_16, 44100)
writer = Writer.new(“my_file.wav”, format)

a=(‘a’..’z’).to_a
hashlista=Hash.new(100)

freq=200

a.each do |item|
freq+=100
hashlista[item]=freq
end

hashlista[‘ ‘]=100

mensaje=”Cavalo Morto es un lugar que existe en un poema de Ledo Ivo [sigue…]”
listamensaje=[]

for i in 0…mensaje.length
listamensaje.push(mensaje[i])
end

listamensaje.each do |char|
cycle = ([1] * (hashlista[char]/100)) + ([-1] * (hashlista[char]/100))
buffer = Buffer.new(cycle, Format.new(:mono, :float, 44100))
100.to_i.times do
writer.write(buffer)
end

puts hashlista[char]
end

writer.close()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s