Busindre » Blog Archive » Midi en Linux (Timidity++)

Midi en Linux (Timidity++)

August 24th, 2006 by Busindre

MIDI no contiene sonido digital muestreado, contiene la descripción de cómo hacer el sonido (Como partituras). Los sintetizadores se usan para pasar esas notas a sonido real, usaremos ALSA como sintetizador gracias a timidity.
¿Mi tarjeta necesita timidity para reproducir archivos midi?
Algunas vienen con sintetizador interno midi (Sound blaster), las cuales no necesitan usar alsa con ese fin. para verlo hacemos lo siguiente:

$ pmidi -l

Port Client name Port name
64:0 External MIDI 0 MIDI 0-0
65:0 Emu10k1 WaveTable Emu10k1 Port 0
65:1 Emu10k1 WaveTable Emu10k1 Port 1
65:2 Emu10k1 WaveTable Emu10k1 Port 2
65:3 Emu10k1 WaveTable Emu10k1 Port 3

En este caso no necesitamos timidity:

pmidi -p 65:0 prueba.mid

Deberiamos escuchar la canción, si por el contrario:

$ pmidi -l Port Client name Port name

Debemos usar timidity ya que la tarjeta carece de sintetizador.
Timidity++

Reproduce midis con calidad audio digital.Contiene instrumentos con mucha calidad.Percusiones GX,GM y conversor de MIDI a WAV. Si tienes problemas por ejemplo con kmidi o te saltan errores de intrumentos “No instrument mapped to tone ban” leete este post. Se encuentra para Linux, FreeBSD, HP-UX, SunOS y Windows.

Paquetes:

TiMidity++-2.13.0.tar.gz


pmidi-1.6.0.tar.gz

Instalación pmidi

$ ./configure
$ make
# make install

Instalación Timidity

$ ./configure
$ make
# make install

Creamos /usr/local/share/timidity/timidity.cfg y lo editamos:

opt -s 44100
opt -EFchorus=d
opt -EFresamp=d
opt -EFreverb=d
#opt -EFvlpf=d

dir /usr/local/share/timidity/freepats
source /etc/timidity/freepats/freepats.cfg
#++ using
# This config file. Please refer to the timidity.cfg(5) manpage
# for more details

## If you have a slow CPU, uncomment these:
#opt EFresamp=d #disable resampling
#opt EFvlpf=d #disable VLPF
#opt EFreverb=d #disable reverb
#opt EFchorus=d #disable chorus
#opt EFdelay=d #disable delay
#opt no-anti-alias #disable sample anti-aliasing
#opt EWPVSETOZ #disable all Midi Controls
#opt p32a #default to 32 voices with auto reduction
#opt s32kHz #default sample frequency to 32kHz
#opt fast-decay #fast decay notes

## If you have a moderate CPU, try these:
#opt EFresamp=l
#opt EFreverb=g,42
#opt EFchorus=s
#opt s32kHz
#opt p64a

# Disabling some of the Midi Controls can help with the CPU usage a lot.
# The same goes to the VLPF, sample anti-aliasing and effects such as
# reverb and chorus

# By default, try to use the instrument patches from freepats:

source /etc/timidity/freepats.cfg

Debemos bajarnos los intrumentos (freepats.opensrc.org):

Paquete:http://freepats.opensrc.org/freepats-20060219.zip

$ unzip freepats-20060219.zip
# cp -r freepats /usr/local/share/timidity/
# cp freepats/freepats.cfg /etc/timidity/freepats/
# cp freepats/freepats.cfg /etc/timidity/

Ya podemos usar timidity

$ timidity cancion.mid

Puede dar algun error algun instrumento, pero se suelen escuchar casi todas bien, depende de como este contruido el midi, yo he visto la misma canción en varios lados y alguna daba menos problemas. Aun asi es una maravilla de programa.

Ejemplo:

No instrument mapped to tone bank 0, program *** - this instrument will not be heard

Pasar de midi a wav

$timidity cancion.mid -Ow1S -s 44100 -o cancion.wav

Pasar de mid a ogg (Damos permisos de ejecucion al script, este lo pasara a wav primero)

#/bin/bash
# midi2ogg
# by Lorenzo Prince
# Convierte midi en archivos Ogg Vorbis especificando la calidad
# Dependencia TiMidity++ y oggenc
# formats that can be played by TiMidity++.
# Uso: midi2ogg
# Ejemplo: midi2ogg test.mid test.ogg 3.5

if [ "$1" = "-v" -o "$1" = "--version" ]; then
echo midi2ogg version 1.0 by Lorenzo Prince
elif [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "" ]; then
echo midi2ogg
echo by Lorenzo Prince
echo Converts a midi file to Ogg Vorbis at the quality specified
echo This script requires oggenc and TiMidity++ and will support all file
echo formats that can be played by TiMidity++.
echo
echo "Usage: midi2ogg   "
echo example: midi2ogg test.mid test.ogg 3.5
echo
echo other options:
echo midi2ogg -v [--version] Print version information
echo midi2ogg -h [--help] Print this help message
elif [ -e "$1" ]; then
timidity "$1" -Ow1S -s 44100 -o - | oggenc - -q$3 -o "$2"
else
echo midi2ogg: $1: No such file or directory
fi

Posted in Multimedia |

3 Responses

  1. Pedro Diaz Gutierrez Says:

    Busqué información hacerca de Timidity, pero me manda a visitar unos espejos…(mirrors). La verdad no sé que signifiquen los espejos, el punto es que cuando quería instalar el timidity me aparecía un .exe (ejecutable de windows). Creo yo que timidity es sólo para Linux ¿verdad?.
    Entonces, ¿porqué me descargó un ejecutable de windows?

    De antemano,
    Gracias por sus respuestas,
    Pedro
    México

  2. Busindre Says:

    Lee el post y descargalo :!:

  3. Tux Huellas » Midi en Linux (Timidity++) Says:

    […] Fuente:http://www.busindre.com/midi-en-linux-timidity/ Igual tambien te interesan…. EasyubuntuInstalación de sound blaster audigy 2 SE en Mandriva 2006 free.Mas tutoriales de Linux y de phpArticulos “Donde” […]

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.