[RESOLVED] Working on Game Project That Involves Sound and Graphics
I'm up against a rock and a hard spot. In my project I have coded to allow user to speak into a microphone and record the sound and at the same time display some graphics. My question is how can I substitute a sound buffer for the microphone and record the sound from a byte array instead of from the microphone? Normally, the user will speak into a microphone, record what he says and display some graphics that animate in sync with the voice as it is being recorded. Now, I also need to be able to allow user to input his own pre-recorded sound, play it back as it is being read in and display some graphics or have the sound read into a buffer first then from the buffer record it and also display some graphics at the same time which ever is the best or easiest way to go. I am using waveIn and waveOut API calls and would like to keep it that way as everything else in the project uses these APIs.
Re: Working on Game Project That Involves Sound and Graphics
I think you would need some kind of program to do that
Re: Working on Game Project That Involves Sound and Graphics
What language are you using vb6, vb.net, c++, c#?
I've personally never worked with the waveIn and waveOut API's, but working with sound period is a difficult task.
Re: Working on Game Project That Involves Sound and Graphics
Personally I would have prefered DirectSound, which is part of DirectX. It's much much faster and better than those API's.
Re: Working on Game Project That Involves Sound and Graphics
Its not quite clear to me what you want. I guess I need some coffee first.
These API's are the closed to the soundcard, and are the underlaying for DirectX. So you are on the right track.
Re: Working on Game Project That Involves Sound and Graphics
I suppose to put it in simple terms is how do I play a sound from a .wav file using waveOut and show animated graphics simultaneously.
For example:
I load a sound file "sound.wav" into my app and using the waveOut APIs play the sound from that file while showing some type of animated graphics at the same time where the animated graphics are in sync with the sound. A good example of this would be like when you turn on your sound equipment (a stereo set for example) and play a song from a CD and you see a series of colored lights on your set that seem to bounce up and down in sync with the music being played. I want to do something similar to this except it will not be bouncing colored lights; it will be some other graphics, but the idea is the same.
BTW: I am programming in VB6.
Re: Working on Game Project That Involves Sound and Graphics
Re: Working on Game Project That Involves Sound and Graphics
OMG! Why do you point me to my own thread? That is my project, not his. It is not what I want. If it was what I wanted then I would have no reason to open this thread. That project loads a file, makes a sine wave first, then plays the sound. I want the be able to create the graphics at the same time as the sound is being played, not created first then play.
Re: Working on Game Project That Involves Sound and Graphics
Well I have to back out of the thread as I don't know how to work with an outdated language(no offence), but I will leave on "The little experience I've had with advanced sounds have been pretty difficult in comparison with everything else I've done."
Re: Working on Game Project That Involves Sound and Graphics
Quote:
Originally Posted by
dday9
Well I have to back out of the thread as I don't know how to work with an outdated language(no offence), but I will leave on "The little experience I've had with advanced sounds have been pretty difficult in comparison with everything else I've done."
Then show me how you would do it in the language of your choice.
Re: Working on Game Project That Involves Sound and Graphics
OK, maybe I'm asking too complex of a question so let me re-define my question
How can I play small segments of a wave file? Let's say I have a file that has 612000 bytes of sound data. Now I know I can send the entire 612000 bytes to the waveOutwrite API and it will play the entire sound file. No problem there. But let's say I want to only send a few at a time, like 3000 bytes or whatever at a time. So, how do I make a loop that pulls 3000 bytes out of the 612000 byte array, sends those bytes to the play API and continue on in the loop until I have sent all 612000 bytes knowing that one of the outputs will not be exactly 3000 bytes?
Re: Working on Game Project That Involves Sound and Graphics
Quote:
Originally Posted by
jmsrickland
OMG! Why do you point me to my own thread? That is my project, not his. It is not what I want. If it was what I wanted then I would have no reason to open this thread.
Hmmm.....
Well as long as "waveOutGetPosition" gives you an idea what position is in the sound buffer, I guess you can use this to plot your graphics.
And yes...I didn't download your project because I haven't used VB6 for quit some time. And yes I used those API's quit often. And ......
And I'm sorry it wasn't quit clear to me what you WANT.
Re: Working on Game Project That Involves Sound and Graphics
Actually, namrekka, although pointing me to my own project was totally out of step I actually found a big clue to my problem in one of your own VB6 projects which I am quite surprised you didn't even post a link to that one.
Anyway, it doesn't matter now as I solved this myself.
Re: Working on Game Project That Involves Sound and Graphics
Quote:
Originally Posted by
jmsrickland
Anyway, it doesn't matter now as I solved this myself.
Mind sharing the solution to the problem with us?