Skip to main content
Software View

Main navigation

  • Home
  • Trainer Profile
  • Blog
  • Contact
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Blog

Turning QWERTY Into Music

By Kamal Wickramanayake, 15 February, 2007

It is extremely easy to get a tiny little keyboard to generate melody in your Linux box. In fact, you can play hundreds of instruments. Here’s how I did it in my Fedora Core 6 and 7 laptops:

Software:

  1. timidity++ - This can turn MIDI into audio (A synthesizer).
  2. vkeybd - A virtual keyboard for your X desktop.

To install in Fedora Core 6, just type the following command:

$ yum -y install timidity++ vkeybd

Play:

  1. Start timidity (and connect to ALSA) :

    $ timidity -iA 

    In Fedora 7, you can try 'timidity -iA -Os'. Or else, 'esd' in another terminal before 'timidity -iA' also worked for me.

  2. Start vkeybd:

    $ vkeybd 

  3. Join the keyboard output and the synthesizer input together:
    Identify the correct client and port numbers of the keyboard and the synthesizer:

    $ cat /proc/asound/seq/clients

    The following is the output in my laptop:

    Client info
    cur clients : 5
    peak clients : 5
    max clients : 192Client 0 : “System” [Kernel]
    Port 0 : “Timer” (Rwe-)
    Port 1 : “Announce” (R-e-)
    Connecting To: 15:0
    Client 14 : “Midi Through” [Kernel]
    Port 0 : “Midi Through Port-0″ (RWe-)
    Client 15 : “OSS sequencer” [Kernel]
    Port 0 : “Receiver” (-we-)
    Connected From: 0:1
    Client 128 : “TiMidity” [User]
    Port 0 : “TiMidity port 0″ (-We-)
    Port 1 : “TiMidity port 1″ (-We-)
    Port 2 : “TiMidity port 2″ (-We-)
    Port 3 : “TiMidity port 3″ (-We-)
    Output pool :
    Pool size : 500
    Cells in use : 0
    Peak cells in use : 0
    Alloc success : 0
    Alloc failures : 0
    Input pool :
    Pool size : 1000
    Cells in use : 0
    Peak cells in use : 0
    Alloc success : 0
    Alloc failures : 0
    Client 129 : “Virtual Keyboard” [User]
    Port 0 : “Virtual Keyboard” (R-e-)
    Output pool :
    Pool size : 500
    Cells in use : 0
    Peak cells in use : 0
    Alloc success : 0
    Alloc failures : 0

    This reveals that I can join the keyboard with the synthesizer by issuing the following command with the correct addresses used as arguments to aconnect and in correct order (MIDI source first, then the sink):

    $ aconnect 129:0 128:0

Now you can play. To change the instrument, see the Virtual Keyboard options (View->Program List). If required, increase the volume by using timidity option ‘-An’ (e.g.: $ timidity -A300 -iA).

timidity and vkeybd have many options to get different behaviors. See the manual pages for details.

Instead of timidity, you can use fluidsynth (but eats lots of cpu cycles). Instead of vkeybd, you can connect an external MIDI keyboard to the computer and make sound through timidity by providing the correct arguments to aconnect in the same way.

If you like complexity for reason, professional sound manipulation programs like Jack and/or Rosegarden can also be incorporated into the picture. In whatever the scenario, vkeybd and timidity will prove to be useful.

Enjoy!

Linux
Music
  • Add new comment

Highlights

  • O'Reilly Book "97 Things Every Software Architect Should Know" Accepts A Write Up From Kamal
  • "Service Oriented Architecture - Making IT Infrastructure Speaks Business" - Presentation At The ISACA 4th Annual Conference
  • The Second Bacth Of ICTA Nanasala e-Society Members Receives Trainings On HTML/CSS and GIMP
  • GIMP Training For ICTA Nanasala Project
  • Agile Processes Training For PPSL (Pvt) Ltd
  • Computer Society of Sri Lanka (CSSL) - Talk on "Introduction to IT Governance and Enterprise Architecture"
  • Motorola Sends A Second Batch Through Software Patterns Training
  • Kamal To Act As The Marketing Director - ISACA Sri Lanka Chapter
  • ISACA Sri Lanka Chapter Invites Kamal To Join As A Board Member
  • Epic Lanka Technologies (Pvt) Ltd Receives Java SE And Java EE Trainings From Software View
  • Patterns Training For PPSL (Pvt) Ltd
  • ISACA Members Day Presentation On "Introduction To IT Governance And Enterprise Architecture"
  • Opening Lecture On Information Technology For SLIDA Master Of Public Management Course Delivered By Kamal
  • Customized Java Enterprise Edition Training For SLIDA
  • No One To Beat Software View - Epic Lanka Technologies (Pvt) Ltd
  • Motorola Receives Software Patterns Training From Software View
  • Custom Java Enterprise Edition Training for ICTA/SLIDA - Only from Software View!
  • Java EE 5, JavaServer Faces, Hibernate And Spring For PPSL (Pvt) Ltd
  • "Brain Trust" For Linux Journal Weekly Newsletter From Kamal
  • Java Platform, Enterprise Edition 5 Training At The CEIT, University Of Peradeniya
  • Another Group Of Around 100 Sri Lanka Telecom Engineers And Managers Were Service Oriented!
  • Java Platform, Enterprise Edition 5 Training Will Be Held At The CEIT, University Of Peradeniya
  • Service Oriented Architecture: Another Two Sessions Conducted at SLT
  • Photos of IET Monthly Forum at the Peradeniya University
RSS feed
Copyright © 2007 - 2023 Software View