02-05-2008, 09:06 AM
does anyone know if it's possible to Write Sound Data to a VB Form or Resource page and them have VB play the Sound back for you? (IE: I want ot have my program monitor something at a regular interval and take the data and write it to a file, then at the end oif the day I want it to take the Data from that file and compile it into a piece of music.) "like playmenow = 34,56,32,33,54,43,66,72,92,88,28, etc......" and it would then play the selected items as tones in a sequence. I am not looking for "Beep".
I know this can be done in "Dark Basic"(which is what I use to write Games.), but I don't know how to do this in VB6, or if it's even possible. if anyone has ideas or links that could point me in the correct direction it would be appreciated! I am looking for a tutorial or something I can learn from rather than Just a quick download.
( i have seen someting similar to this ability built in now in VB 2008, but I am writing this program in VB6 so I need to figure this out in VB6.)
any help is greatly appreciated!
02-05-2008, 09:15 AM
You can add each tone as a seperate sound file. If you put them in a resource file then you can use the PlaySound API to play them
I remember seeing some examples of MIDI in VB on www.pscode.com before if you would prefer that
02-05-2008, 10:19 AM
"the Master" - Thanks for the reply, while the suggestio you give is valid, it's too much for this project as I would have to have 20k+ sound files as resources. and the midi would be an option potentialy, but I am really looking for something that will take the number I supply and lay them out into a sound file and play it. - in my searches I was able to find a modual as part of someones "Wave Drawing pad" that will work with some tweaks. the original Code and info is here: http://www.freevbcode.com/ShowCode.Asp?ID=4370 - the code is simple enough, but backwards engineering the MAth from his Drawing pad to my Data set is going to be the hard Part!
at any rate I am still looking for a simpler way to do this so if anyone has any ideas or suggestions please feel free!
02-05-2008, 11:10 AM
I dont think it gets much easier. Either creating a waveform and playing it or using MIDI are about your only options
02-05-2008, 12:03 PM
- I believe you are right this is pretty simple and is working fine. I would however like to find a tutorial on this somewhere to better understand it, as right now I am mearly reverse engineering the code and re-writing the parts I need to. but I would like to actually learn more from this exercise, if it is possible, so next time I can write it from scratch.
Thanks again for the responses!
once I get all this figured out I will share in the appropriate thread.
I found a VB6 MIDI example here:
(Look for the VBMIDI6 link, not 3 or 5). It can send MIDI play commands to the Microsoft Wavetable Synth that plays through your speakers (or to external devices). Should be fairly easily modifiable to do what you require. Unforunately, not a sound file, but you could probably use software to record the output.
Alternately, I found another example that uses DirectX8 to generate sine/square waves. You should be able to export these to a file (haven't tried it myself):
Unfortunately, it requires the DirectX8 SDK, and it is tricky to find now since MS took it down. There is a chance that it is already installed on your computer though.
02-05-2008, 01:10 PM
Excellent, I will check them out thanks! I am not aposed to Midi if I need to use it, but I like the other idea better and it sounds similar to what I am looking at right now so I will check it out for sure!
02-11-2008, 06:55 AM
JPB - thanks for the links! the "direct X - generator" is Just what I was looking for it will allow me to get the data and convert it to a set of strings and then play them in sequence which is just what I needed! Thanks.