ravi said:
Hi Can anybody tell me you to play MIDI file through a C program ?
i am using lccwin for WinXP
Decoding the midi file and then play it by directly interfacing with
speakers using inportb() function in conio.h or sound() function in
dos.h.
is it possible or not and if possible then HOW TO DECODE MIDI FILE ?
going off-topic here...
this is really not a good group for this question (non-standard,
non-portable, ...).
this is also not a question with any simple or easy answer.
in MS-DOS, you essentially have to write a driver for whatever sound HW
happens to be in the system.
for DOS apps in Windows, one has to target whichever HW Windows is faking
(typically, a SoundBlaster), but this is only in 9x and 32-bit XP. DOSBox is
another target.
in this case, the SB HW (or faked SB HW), allows MIDI playback, so it is
mostly a matter of feeding the command-stream to the HW. if you want to go
the driver-writing route, go look up info on the particular HW yourself...
however, none of this will work in an actual Windows app.
Windows provides some of its own facilities, which can be used.
typically, these just synthesize the music in SW, and use waveform playback.
(MIDI is unrelated to waveform audio, and is actually a command-language
which depends on a fair amount of external data and logic, and so it takes
writing or using a synthesizer to get it into a playable form).
to make an analogy: MIDI tells the notes one would play on a piano, but
unless one supplies said piano, there is really nothing to hear from it...
(much like a rock-band trying to make their music via air-guitar...).
Linux generally involves using libraries (such as Timidity), which can also
be used on Windows (however, one has to provide them oneself, as they are
NOT part of the OS).
or, if one really wants to, they can write their own synthesizer, but how to
get the sound to the sound HW remains an OS-specific issue...