Copyright (c) Hyperion Entertainment and contributors.

AmiWest Lesson 5

From AmigaOS Documentation Wiki
Jump to navigation Jump to search

AmiWest Lesson 5: MIDI

MIDI (Musical Instrument DIgital Interface) was first created as a serial link that allowed a musical keyboard to control synthesizers.

In the AmigaOS, we have CAMD library to makes interconnection of MIDI applications easy.

This lesson will be to take an existing CAMD application and dress it up with proper BOOPSI graphics elements.

Preparation

Before beginning this lesson, you will need: A working installation of GCC on your Amiga. camd.library, available from OS4Depot[1] The camd developers files, which the install script should offer to install when camd is installed. Some program to play a MIDI file. My favorite is CAMDPlay, available at OS4Depot[2] A midi file of your favorite song. most MIDI files end in ".mid". There are hundreds of places to find them, Google is your friend. The application we will be dressing up is "MidiActive". Source and executable are available at OS4Depot[3]

If you'd like to hear the music, you'll also need either a MIDI synthesizer, or a software synth like SoftSyn[4] Softsyn will need a compatible "instrument definition" file. I use This one[5]

That's a lot of "stuff" to set up. I'll have a flash drive on hand to help anyone who has trouble during the lesson.

Checking it out

One drawback to playing music on a software synth is that you cannot see channel activity. The "MidiActive" app opens a window that will show instrument names and note on/off activity so that you can see what is playing. Play a MIDI file (to an external synth or to SoftSyn), then run MidiActive and set the MIDI link to the same CAMD link as your synth. You should see 16 "tracks", each will show the instrument name when each instrument is selected. Each "track" will also flash a little red square in one of three modes: OFF when no notes are playing, a small red square when a single note is playing, or a larger square for multiple notes.

Improving the application

The red squares are a bit plain. Maybe even ugly. The goal of this lesson is to replace the squares with more modern graphics. The source for MidiActive includes a file named "images.h". Inside that file you'll find the three squares that we are now using.

You should be able to search all the project code to find where those images are being drawn, the code to figure out when to draw is already complete. Better graphics? Those are up to you. Any of the methods that have been discussed already are fair game. If you have AISS[6] installed, you'll have hundreds, maybe thousands of graphics to choose from. Remember that the "image" will require one OFF state plus TWO on states, one for a "little" sound, and the other for a "lot" of sound. You can change images, colors, whatever you think might look good.

wrap-up

I am happy to show a bit of CAMD code. By the end of this lesson your Amiga will have all it needs to play MIDI files, and you'll be able to see the playback activity with graphics that you created yourself. If you have an interest in music on the Amiga, I encourage you to look over all the tools in the camdtools archive. Each one comes with complete source code that you can build upon.