Link to home
Start Free TrialLog in
Avatar of technologist
technologist

asked on

Generating wave forms

This is a tricky one. I need to generate wave forms and play them via the sound card. The data (x, y) should be used from an array and it should NOT be a simple sine, saw or any other common wave form. If this isn't hard enough I want to do this in STEREO with different arrays for each channel.

Maybe you don't have a complete solution, but I want to know as much as you know.
Avatar of Matvey
Matvey

Now you know as much as I know...
If you don't want a simple waveform, combine several simple waves together.
I've ssurfed in the sites above metioned and the are all about share or freeware, or how to use the multimedia functions.
When reading the question, I thaught you were looking for more techincal help (the wave format, how to build wave buffers (mono and stereo), which bytes in the buffers are for the left and for the right channels, etc... )... Am I wrong?

trillo, first url to 00000022.htm gives info about wave format.?
This is more a question of mathematics than it is files and program code...but that depends on what technologist has to say about it:

Is it safe to assume that you already know the file format?  Is it safe to assume you know how to play a wave?  

Do you just want to know how to generate the waves and place them in an array (or two), and then go from there?
Avatar of technologist

ASKER

I know the mathematics (heavy code!) and I've got all the data I want to play. The problem is that I want to play the wave in REAL TIME (Not only "compiling" a filename.wav to play later, but I want to do this too) and send it to the sound card. The purpose is to reflect a laser beam by using two loudspeakers for x and y axis and "write" figures and letters. I have tested this with music and it works great! Now I want to do this in the computer.

So what I want to do is to place the array in a buffer (if that's the way to do it) and then play it. In stereo.


Try DelphiX, which is Delphi implementation of DirectX that you can find anywhere on the Delphi pages. I think it has exactly the component for this, although DirectX isn't the only way at all. You can find C sources all around of such progys. I can send you all some of them, if it helps. I also think that if you see the audio pages on the Delphi sites, you see some components that might be implementing writing to the buffer in real-time. Download all of them (there is not much), and look in the sources. Abstract, huh? Well, I'll look around for more, sorry...
technologist: Give me some hours and I'll try to write everithing you need to start coding.
ASKER CERTIFIED SOLUTION
Avatar of trillo
trillo

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
Now I've posted my answer I see thet the font is different, so if you want to see the diagrams properly, copy and paste the text on NotePad.
I'll have a look at it later. Thanks in advance!

If it works, I'll give you the highest grade (of course)

Thanks once again!

// Victor