|
How can i generate the sine wave sound in VB?
I want to generate the sine wave sound for customized duration and customized frequency
Any help?
|
|
|
|
|
Hello
search for fmod sound engine(fmod.dll) usage.
|
|
|
|
|
Hello,
declare:
Private Declare Function MakeSound Lib "kernel32" (ByVal soundFrequency As Int32, ByVal soundDuration As Int32) As Int32
after that you can call for the MakeSound([frequency in hz],[duration in ms]) function and the computer will generate the tone trough its speakers.
|
|
|
|
|
i want to do something like this
Option Explicit
Option Base 1
Private Sub CommandButton1_Click()
Dim Sc(3) as integer
Dim Frequency=440
Dim Duration = 1000 ' in millisecond
Sc(1)=1
Sc(2)=1.125
Sc(3)=1.2
For i = 1 to 3
' some code is required to play the sine wave sound for above frequency and duration
next i
End
|
|
|
|
|
try this:
Option Explicit
Option Base 1
Public Class NameYourClass
Private Declare Function Beep Lib "kernel32" (ByVal soundFrequency As Int32, ByVal soundDuration As Int32) As Int32
Private Sub CommandButton1_Click()
Dim Sc(3) as integer
Dim Frequency as int32 = 440
Dim Duration as int32 = 1000
Sc(1)=1
Sc(2)=1.125
Sc(3)=1.2
For i = 1 to 3
Beep(Frequency, Duration)
next i
End sub
End Class
note: i just putted a class around it so you could see where to paste what.
modified 26-Jun-12 4:42am.
|
|
|
|
|
hi nick
Actually i don't want to use the beep function but to generate the sine wave sound
|
|
|
|
|
isnt that just a very long beep? note that the kernel32 beep isnt the .net beep (the .net beep will give you the windows error 'klunk' while the kernel32 beep will generate a tone with the given amount of hertz during the given amount of milliseconds)
but now that i think about it, not sure how it works with the 'wave' part..
did i quick google for ya and found this[^] its in vb6 a bit old...and not directly what you need. but it might be able to help you (or so i think)
|
|
|
|
|
see www.3dstate.com about using fmod functionality for 3d games.spacially horn sample.
modified 27-Jun-12 6:29am.
|
|
|
|
|
how to edit a simple games using visual basic?
|
|
|
|
|
Hello
for making a game you need to use a 3d engine.
contact www.3dstate.com
it has a wonderful game engine.
easy,user license,...
sdks for vb6,vb.net,c#,delphi
Oh,you want to edit a game?
modified 23-Jun-12 21:49pm.
|
|
|
|
|
Get the source code, make your change, compile.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
how to edit a simple games using visual basic?
|
|
|
|
|
What do you mean by "edit"?
And don't post the same question twice.
|
|
|
|
|
like opening plants vs zombies solution in visual basic?
|
|
|
|
|
Unless you have the source code you cannot edit it.
|
|
|
|
|
You cannot do this without the source code. It does not matter how simple the game is, if you only have the executable then you need to decompile it and rebuild from the decompiled source.
|
|
|
|
|
but i think decompile and edit an exe is not that easy, it's already an assembly code, am i wrong?
|
|
|
|
|
You are correct, it is extremely difficult, and probably not worth the effort. The chances of you being able to hack the game are quite low.
|
|
|
|
|
so every game hacker are editing assembly code?
mother of code
by the way, thank you for the information.
|
|
|
|
|
Midnight Ahri wrote: so every game hacker are editing assembly code?
Some are probably editing direct machine code; but there are better ways to use your talents in this world.
|
|
|
|
|
I made a control which has a button on it.
But I need to change the text of it when it is clicked.
this is what I have tried but it didn't work:
If Button1.Text = "1" then
Button1.Text = "0"
Elseif Button1.Text = "0" then
Button1.Text = "1"
End if
|
|
|
|
|
Where did you put this code?? What EXACTLY do you want this to happen??
|
|
|
|
|
I put that code on a button_click event in a UserControl that I made.
It is supposed to work as a boolean. eg if the value is 1 then it should change it to 0
else if the value is 0 it should change it to 1.
|
|
|
|
|
The click event is not going to work for this. Click is fired after the button is pushed AND released.
Similar code has to be called by the MouseDown, MouseUp, KeyDown and KeyUp handlers. The xDown events fire when the button is pushed down and the mouse or key is still being held down. The xUp events fire when the mouse or key is released.
|
|
|
|
|
Hello
before selecting another event to let your code,
make a breakpoint after bottun_click() line,run your control in dubug mode check if
break point stop your program,therefore event has no problem,then check your condition state.
|
|
|
|