Overview

Embedding music in your applications

The only music format natively supported by Palm OS and the Palm OS equiped devices is the WAV format. That means developers who want their software to be able playing music in background must use this uncompressed music format. The size of WAV file may become very big, for example four minutes of music stored with the format PCM - mono - 16 bits with a sample rate of 22050Hz will produce a file size of about 10Mb! Of course, it is possible to use the compressed mp3 format but that will probably not solve the problem: The mp3 decoder may be quite hard to develop, the needed cpu time for mp3 decoding will drastically slow down the speed of the application and finally four minutes of music will produce a file of about 4Mb.

The idea is then to use a small format for music encoding, such as the MIDI format, but unfortunately not supported by Palm OS. Moreover the devices equiped with such a platform do not include a hardware synthesizer.

I've started Palm OS applications development for several years and I've often suffered the lack of MIDI support for some of my applications, so I've decided to develop a suite of software dedicated to MIDI music rendering running on Palm OS.

MIDI music rendering: software synthesizer.

The Musical Instrument Digital Interface or MIDI is a protocol for communication and control for exchanging data between electronic musical instruments (such as keyboard controllers, computers, and other electronic equipment). MIDI is an industry-standard protocol and it is described in the complete MIDI 1.0 detailed specification. The MIDI standard describes music not as an audio recording, but in terms of the notes being played (pitch,volume and duration) and the instruments on which they are being played. These information are structured in terms of events (note on, note off and more) associated to their execution time. The time is not absolute but relative, that's to say that the time associated to an event represents the interval of time before the event occurs. Finally a music described using the MIDI stantard is like a music score and we need musicians and their instruments for hearing it, this is what does the software synthesizer.

Standard MIDI files provide a common file format used by most musical software and hardware devices to store music's information (the title, time signature, tempo, etc) and what instruments to use and the sequence of musical events, such as notes and instrument control information needed to play the music.

From MIDI to simplified MIDI

My primary goal was to render music using a minimum of cpu time but offering a quite good quality of sound. Even using the power of ARM processors, I was pretty sure that I should limit the synthesizer's capacities to avoid slowing down an application such as a game using lots of animations. After having read the MIDI specification I've decided to reduce the number of messages and particularly the ones that imply a big cpu-time consumption (filters use a lot of computations).

I've called MIDS such a simplified MIDI format. The name is not really important, what is important is to keep in mind that my software synthetiser has been optimized to be fast and then it cannot play MIDI music but a simplified format. That means you need to convert MIDI music to my MIDS format if you want it to be played using my codes, that's why I've developped the Windows tool (that does the job for you).

As the music can be played independantly in any applications, the MIDS format does not only includes MIDI events but it also embeds instruments used (i.e. soundfonts). That's to say it is not possible to provide a code which includes all instruments (the GM standard allows 128 instruments!) , the size of the compiled application could become uselessly big and not runnable on the device. That's why my MIDS file format is quite similar to the MOD file format.

Have I "reinvented the wheel"?... may be, but once again my goal was to play music with a minimum cpu-time consumption and with music files with the smallest size as possible, thus I have used my knownledge in music (I'm musician too) and computing to create such a synthesizer and to define adapted music format.

Provided software and the process for embedding music.

The Midsiku software consists of two parts:

Midsiku software overview

Windows © application

It is mainly used for converting and exporting MIDI music to my MIDS format and for creating virtual instruments (sound banks).

Creating a new project is very easy by simply opening a MIDI file, then simply select and put tracks you want to embed in your MIDS file by using drag and drop. The project can be saved in a proprietary format that also stores the original MIDI music, thus the project file is self-sufficient and it is the only file needed for exportation.

This software also includes a soundfonts creator tool (sound bank) especially dedicated for my MIDS format with some usefull features (such as preview of interpolation in tone's range) and some other tools to make your job easier (particularly a converter tool that lets you get and manage your work created on your device).

Palm OS © application

It is used for editing the MIDS music's properties (such as tempo, title, etc.) and assigning instruments to all tracks with their respective settings.

Of course, and that's the ultimate goal, you can play the currently edited music and thus you can hear in realtime the changes you made. You also can navigate in your music to find the part you want it to be changed.

It offers all necessary features to let you change instruments, ADSR envelope, loop mode and more. You can open and save your musics as Palm databases or as MIDS music files on memory cards readable on your computer.

Why two software on two different platforms?

My first tries were made using only Palm OS applications, but I quickly encountered many problems, one of them was the time needed for all conversions and the backup after changes. Moreover, due to the slow processor and the small display integrated in handheld devices, I found that it was more difficult to manage samples and to manipulate binary data than it could be using the power of computers (faster, lot of memory, large display and a platform offering visual controls more versatile).

But on the other hand, the music must be rendered on the device itself. The sound quality is depending on how you want it to be rendered: by using headphones? on the device speaker? So let assume that you are a game developer and that you want the user hears your music on the built-in speaker. The settings of instruments will be different as it could be on headphone, that's to say, for example, that you will have to increase the volume for instruments having low pitched sound (as the speaker has got a very limited bandwidth). Of course, once again we could use filters for that but remember that my goal is to use a minimum of cpu-time.

Finally, I've decided to provide two complementary tools: one for music conversion, virtual instruments creation and all data manipulations and one for onboard music editing and for rendering the sound exactly as you will hear it in your application.

I really don't know if my point of view is correct, but now that the job is done I'm satisfied of the speed of my synthesizer and of the good quality of the rendered sound, you can hear the result of some good music in the music download section.

You can see more screenshots of both software and of the downloadable sample projects.

Latest revision (new)

After having used a lot the Palm OS version, I was tired of moving files from PC to Palm OS device and from the Palm OS device to PC. So, I've decided to make a Windows version of the MIDS music editor.

Midsiku software overview

I've used this software for personnal use without any problem, but it may be considered as an experimental application as it hasn't been tested by a lot of developers.

Midsiku for musicians or developers?

This web site and its content have been firstly created for developers who want to embed MIDI music in their Palm OS applications developped with the HB++ IDE. You will not find here neither musical theory nor detailed explainations about MIDI format, additive synthesis and wavetable synthesis. I let developers read books and documentations that talk about those techniques.

Can I say that developers can easily create soundfont without knowledge of musical theory or what is a sound or a waveform and thus how to create and integrate samples? I really don't know but may be that a minimum of knowledge in music (and in signal theory?) is probably required to create virtual instruments. You will find in the download section some soundfonts that I've made but unfortunatly for now I haven't got the time to create more. You can contribute to this project by creating soundfonts, musics or any project that uses my MIDS player. I can publish your work to make it sharable, simply send me an email: Quagliozzi Eric.