Author Topic: Help with freq( command  (Read 3176 times)

0 Members and 1 Guest are viewing this topic.

Offline goodegg610

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Help with freq( command
« on: April 16, 2012, 08:18:47 pm »
How does the frequency command work? If we wanted to play a C for a period of time, what would you put in and why?

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Help with freq( command
« Reply #1 on: April 16, 2012, 08:50:44 pm »
I believe it works like Freq(wavelength,period).
And it uses to produce sound.
EDIT: Freq(314,10000) produces A3 note (I think)
« Last Edit: April 16, 2012, 08:53:06 pm by TBO_Yeong »
Sig wipe!

Offline linuxgeek96

  • LV3 Member (Next: 100)
  • ***
  • Posts: 99
  • Rating: +4/-0
  • ( ͡° ͜ʖ ͡°)
    • View Profile
    • Personal Site
Re: Help with freq( command
« Reply #2 on: April 16, 2012, 08:55:07 pm »
Freq(1.29,1000)

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Help with freq( command
« Reply #3 on: April 16, 2012, 09:38:20 pm »
Can freq( take decimal value?
Sig wipe!

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Help with freq( command
« Reply #4 on: April 16, 2012, 10:44:08 pm »
I'm assuming no, since Axe doesn't work natively with decimals. Also, for smaller questions like these maybe you want to post them in the Axe Q&A thread here?
« Last Edit: April 16, 2012, 10:44:29 pm by leafy »
In-progress: Graviter (...)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Help with freq( command
« Reply #5 on: April 16, 2012, 11:00:13 pm »
Leafy you silly, Axe supports converting decimal numbers like 1.29 into 8x8 format :D

Code: [Select]
INT.DEC The non-integer decimal number as an 8.8 fixed point number. Maximum 3 decimal places allowed.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Help with freq( command
« Reply #6 on: April 16, 2012, 11:41:39 pm »
The Freq() command takes two arguments: wavelength and time. TBO_Yeong and linuxgeek96, I'm not sure where you got your wavelength numbers from, but neither of them appear to be correct. The approximate value that I got was 487, using this formula for the wavelength argument with middle C's frequency, 261.63Hz:

Wavelength argument = (6000000/frequency - 62)/47



Now, to deal with the time argument. The formula for this is a little more complex, since it doesn't have an explicit form, only implicit:

Desired duration = (47*time argument + 48*floor(time argument/wavelength argument) + 71)/6000000

However, if we give floor(time argument/wavelength argument) an approximate constant value instead (I'll give it about 50), we can get an explicit form:

Time argument = (6000000/desired duration - 2500)/47

If we wanted a note length of 1/4 of a second, this would give us a time argument of approximately 31900.



Putting it all together, to play middle C for about 1/4 of a second, you would use the following code: Freq(487,31900).
« Last Edit: April 16, 2012, 11:42:50 pm by Runer112 »

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Help with freq( command
« Reply #7 on: April 17, 2012, 10:12:29 pm »
Oops. What I meant was A2, not A3. XP

Also, for wavelength, here: http://www.phy.mtu.edu/~suits/notefreqs.html

It works. :D
Sig wipe!