ok... we can read any image file and put it in a long array variable.. and then show it in a picturebox\form\usercontrol and others that have hdc property.
ok... we can read wave files(for example) byte a byte and put it in a variable... but how we put it on columns(left... right) (for we ear a sound)?
(i'm not speak about directx)
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Public Sub getAudioSoundFile(s As String)
On Error Resume Next
Open s For Binary As #1
ReDim WavSound(LOF(1) - 1)
Get #1, , WavSound
Close #1
End Sub
instead catch all sound, i can catch half and play half?
(why these thread\question??? i have used sndPLaysound() and mciSendString() api functions(for CD Audio, MP3, Wave....)... and i have the same problem: the functions need very time for put the sound on memory, before play it)
All of the sounds are loaded first into a byte array then when you press a key on the textbox a sound will be heard.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
All of the sounds are loaded first into a byte array then when you press a key on the textbox a sound will be heard.
yes.. but imagine that you just need play the sound by steps. because read all file, at once, the cpu needs time. then the user wait some time(depending on file\music size), before the sound be ear.... it's possible ear the sound by steps and faster?
This is just a small sample to play WAVE sounds that correspond to the keyboard. You can change it anyway you want to because the sound stuff is all in a Class file so you make the Form code to read and play as you desire
EDIT
..... i can catch half and play half?
If you are asking if you can load half of a WAVE file and play that half while at same time you load the 2nd half I don't think so because it would be like loading half of a GIF file and show only half of the image. The sound processor needs to have the complete file. Now there is audio streaming which you might want to look up on the net and see if you can find anything about how to do it.
Last edited by jmsrickland; Aug 18th, 2012 at 05:47 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
This is just a small sample to play WAVE sounds that correspond to the keyboard. You can change it anyway you want to because the sound stuff is all in a Class file so you make the Form code to read and play as you desire
but the variable put all sound at once. imagine if just put some part of sound, then the cpu needs less time to put it in memory and then play it
but the variable put all sound at once. imagine if just put some part of sound, then the cpu needs less time to put it in memory and then play it
That's because it goes through a loop loading all the sound files first. Change the loop to load just what you want
Code:
For i = 32 To 126
Set KeyboardCharacterSound(i) = New AudioSounds
KeyboardCharacterSound(i).getAudioSoundFile App.Path & "\sounds\" & i & ".wav"
Next i
Don't use this loop; just do one or two at a time
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
That's because it goes through a loop loading all the sound files first. Change the loop to load just what you want
Code:
For i = 32 To 126
Set KeyboardCharacterSound(i) = New AudioSounds
KeyboardCharacterSound(i).getAudioSoundFile App.Path & "\sounds\" & i & ".wav"
Next i
Don't use this loop; just do one or two at a time
thanks
(sorry, but by forum rules, i can't give you more "points")
You also can have a look at the "winmm.dll". With the functions "waveOutPrepareHeader" and "waveOutWrite" you can send your created sound to the soundcard.
You also can have a look at the "winmm.dll". With the functions "waveOutPrepareHeader" and "waveOutWrite" you can send your created sound to the soundcard.
hum... they are more faster, reading a file(before play it), than sndSoundplay() api function?
Hmmm... not sure about speed. I was more referring to:
Originally Posted by joaquim
ok... we can read wave files(for example) byte a byte and put it in a variable... but how we put it on columns(left... right) (for we ear a sound)?
(i'm not speak about directx)
You fill up a struct, containing arrays for left and right, (buffer) and pass it to the api. You will get a callback when the buffer can be filled again.
You can create any sound, like a sine etc, with some math and pass it to the soundcard. You don't need to write to a file first.
Hmmm... not sure about speed. I was more referring to:
You fill up a struct, containing arrays for left and right, (buffer) and pass it to the api. You will get a callback when the buffer can be filled again.
You can create any sound, like a sine etc, with some math and pass it to the soundcard. You don't need to write to a file first.