Author |
Message |
Gordon Charlton
Joined: Oct 07, 2006 Posts: 75 Location: UK
|
Posted: Mon Sep 03, 2007 5:05 am Post subject:
computing microtonal intervals with rational numbers Subject description: an ANS Forth rational arithmetic word-set |
|
|
I noticed there is at least one Forth programmer around here (Hi Blue Hell!) and I remembered a word-set I wrote ages ago when I was programming that might be useful if you want to do maths beyond */ with microtonal frequencies or generate rational approximations to equal temperament intervals.
It's a rational number word-set (i.e. two thirds is represented as 2 3 rather than a floating point approximation) with a full range of basic arithmetic functions. To avoid overflow it implements a mediant rounding scheme as described in The Art of Computer Programming by D E Knuth. (Volume 2, Seminumerical Algorithms 2nd Edition (1981, Addison Wesley), 4.5.3 Analysis of Euclids Algorithm, page 363, exercise 40) which has been shown to generate best possible approximations.
http://ftp.aarnet.edu.au/pub/forth/Scientific/vulgar.fth
It appears to work fine on gforth.
WTF's Forth? - Here's a little intro to a weird language, showing how it corresponds directly to data flow diagrams like in Max/MSP.
http://www.forth.org/forth_intro/stackflo.htm Last edited by Gordon Charlton on Mon Sep 03, 2007 5:29 am; edited 3 times in total |
|
Back to top
|
|
|
seraph
Editor
Joined: Jun 21, 2003 Posts: 12398 Location: Firenze, Italy
Audio files: 33
G2 patch files: 2
|
Posted: Mon Sep 03, 2007 5:11 am Post subject:
|
|
|
Gordon Charlton wrote: | Gordon has been using Forth since 1985 when he bought a Jupiter Ace, which was styled after the Sinclair ZX80 but had Forth in ROM. These days he uses an Apple Macintosh with 4Meg of RAM, or 4096 times as much as the Jupiter Ace. Both machines are similar, however, in that the operating system uses roughly half the available RAM! |
http://www.forth.org/forth_intro/credits.htm
how old is this page
_________________ homepage - blog - forum - youtube
Quote: | Don't die with your music still in you - Wayne Dyer |
|
|
Back to top
|
|
|
Gordon Charlton
Joined: Oct 07, 2006 Posts: 75 Location: UK
|
Posted: Mon Sep 03, 2007 5:23 am Post subject:
|
|
|
I wrote it about 14 years and five macs ago.
The dodgy html (") worked just fine at the time. |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24085 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Mon Sep 03, 2007 5:38 am Post subject:
Re: computing microtonal intervals with rational numbers Subject description: an ANS Forth rational arithmetic word-set |
|
|
Gordon Charlton wrote: | ages ago |
Code: | .( Vulgar Maths Words. Version FSL1.1 23rd April 1996) CR |
Hope your code calculates more accurate
Serious though, this looks like a very well documented and useful package to me.
Good also to see triple numbers being used, I thought I was the only person in the world to have a need for that (for address calculations on the larger PIC processors).
BTW, by the time I was done with my Sinclair ZX81 it did have 4th in ROM (and basic still). _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
seraph
Editor
Joined: Jun 21, 2003 Posts: 12398 Location: Firenze, Italy
Audio files: 33
G2 patch files: 2
|
Posted: Mon Sep 03, 2007 5:44 am Post subject:
|
|
|
Gordon Charlton wrote: |
I wrote it about 14 years and five macs ago.
|
...maybe an update, once in awhile...
_________________ homepage - blog - forum - youtube
Quote: | Don't die with your music still in you - Wayne Dyer |
|
|
Back to top
|
|
|
dewdrop_world
Joined: Aug 28, 2006 Posts: 858 Location: Guangzhou, China
Audio files: 4
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24085 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Mon Sep 03, 2007 5:52 am Post subject:
Re: computing microtonal intervals with rational numbers Subject description: an ANS Forth rational arithmetic word-set |
|
|
dewdrop_world wrote: | The site isn't responding for me...
|
Hmm, it still works here. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
seraph
Editor
Joined: Jun 21, 2003 Posts: 12398 Location: Firenze, Italy
Audio files: 33
G2 patch files: 2
|
Posted: Mon Sep 03, 2007 6:05 am Post subject:
Re: computing microtonal intervals with rational numbers Subject description: an ANS Forth rational arithmetic word-set |
|
|
Blue Hell wrote: | dewdrop_world wrote: | The site isn't responding for me...
|
Hmm, it still works here. |
here too
_________________ homepage - blog - forum - youtube
Quote: | Don't die with your music still in you - Wayne Dyer |
|
|
Back to top
|
|
|
|