Posts: 19
Threads: 7
Joined: Jul 2003
hi me and my freind have been experimenting with qbasic for a while and we were wondering how to go about using frequencies for we saw some source for a bethoven song and they used frequencies to do it. how would i go about doing this? liek wat is the syntx for it, and also does anyone have a tutorial maybe on how to work it? any help would b great, thank you
Posts: 6,419
Threads: 74
Joined: Mar 2002
Each note has a different frequency, IE, middle A is 440 Hz. Almighty google gave me a complete list in a while:
http://www.phy.mtu.edu/~suits/notefreqs.html
Posts: 3,343
Threads: 83
Joined: Mar 2003
Then you use the SOUND command to play the note. Eg, for middle A for one second:
18.2 = 1 second, 36.4 = 2 seconds etc.
Posts: 19
Threads: 7
Joined: Jul 2003
thats it? really? thats sweet man! thanks so much. but wait i have just one more question what if i wanted the frequency to in one continuos soud just like go low to high and back down again like in 3 seconds go from like (off the top of my head) from 100mhz to 400mhz then back down to 200mhz all in one sound do i just do one after another or is there liek another way to do it?
Posts: 6,419
Threads: 74
Joined: Mar 2002
yeah, use a loop:
Code:
SUB Slide( stf%, enf%, duration! )
if enf% = stf% then sound stf%,duration!: Exit Sub
timeC! = duration! / ( abs ( enf% - stf% ) + 1 )
For i% = stf% TO enf% step sgn ( enf% - stf% )
sound i%, timeC!
next i%
END SUB
I've writen this sub from the top of my head. It takes a starting frequency, an ending frequency, and a duration, and it slides from starting frequency to ending frequency during "duration" ticks.