Link to home
Start Free TrialLog in
Avatar of Rauli
Rauli

asked on

How can I start playing several wave-sounds at the same time? (e.g. playing a chord by playing 3 notes at the same time)

I want to write a program that plays different chords that are built up by 3 or 4 notes. For each note I have one wave-file. After clicking on a button the wave will be played at the same time so I can hear a full chord.

My first attempt was to use 3 different mediaplayer-components. It works, i will hear 3 different sounds at the same time, but they are not synchronized (it sounds like an arpeggio). The sounds don't start to play at exactly the same time. I suppose the problem is because of the "queue" im my procedure:

procedure play_chords;
begin
  ...
  mediaplayer1.play;
  mediaplayer2.play;
  mediaplayer3.play;
  ...
end;

Do you know any other (easy way) possibility?

It would be also okay, if someone could tell me how I can play several MIDI-Notes, but I don't really know how to use MIDI in delphi...
Avatar of Zip58
Zip58

Hi Rauli

maby you can take a look to the beeper component ist freeware with source

You can make your own songs if you whant with this

This is the link

http://homepages.borland.com/torry/vcl/sound/pcspeaker/btbeeper.zip

Regards

Zip58
If I were you, I'd look into DirectSound(part of the DirectX library)

I'll see if I can get an example to you in the near future
Hi Rauli;
This may help you out.
============================
http://www.programmersheaven.com/zone10/cat235/6794.htm

Wavemix DLL - play multiple wav files simultaneously (sound)
The wavemix DLL is a utility that allows multiple wav files to be played simultaneously. It is designed to be as simple to use as possilbe but still have the power to do what is required by games. The DLL supports 8 channels of simultaneous wave play, the ability to queue up waves along the same...
============================
Good luck
T.
ASKER CERTIFIED SOLUTION
Avatar of tongalite
tongalite

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial