electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » How-tos » Micro Tuning
computing microtonal intervals with rational numbers
Post new topic   Reply to topic Moderators: seraph
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Gordon Charlton



Joined: Oct 07, 2006
Posts: 75
Location: UK

PostPosted: Mon Sep 03, 2007 5:05 am    Post subject: computing microtonal intervals with rational numbers
Subject description: an ANS Forth rational arithmetic word-set
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
seraph
Editor
Editor


Joined: Jun 21, 2003
Posts: 12398
Location: Firenze, Italy
Audio files: 33
G2 patch files: 2

PostPosted: Mon Sep 03, 2007 5:11 am    Post subject: Reply with quote  Mark this post and the followings unread

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!


arrow http://www.forth.org/forth_intro/credits.htm

how old is this page Question

Wink

_________________
homepage - blog - forum - youtube

Quote:
Don't die with your music still in you - Wayne Dyer
Back to top
View user's profile Send private message Visit poster's website
Gordon Charlton



Joined: Oct 07, 2006
Posts: 75
Location: UK

PostPosted: Mon Sep 03, 2007 5:23 am    Post subject: Reply with quote  Mark this post and the followings unread

seraph wrote:
arrow http://www.forth.org/forth_intro/credits.htm

how old is this page Question

Wink


I wrote it about 14 years and five macs ago. Smile

The dodgy html (&quot) worked just fine at the time.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24085
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: 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
Reply with quote  Mark this post and the followings unread

Gordon Charlton wrote:
ages ago


Code:
.( Vulgar Maths Words. Version FSL1.1  23rd April 1996) CR


Hope your code calculates more accurate Rolling Eyes

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
seraph
Editor
Editor


Joined: Jun 21, 2003
Posts: 12398
Location: Firenze, Italy
Audio files: 33
G2 patch files: 2

PostPosted: Mon Sep 03, 2007 5:44 am    Post subject: Reply with quote  Mark this post and the followings unread

Gordon Charlton wrote:

I wrote it about 14 years and five macs ago. Smile


...maybe an update, once in awhile...

Cool

_________________
homepage - blog - forum - youtube

Quote:
Don't die with your music still in you - Wayne Dyer
Back to top
View user's profile Send private message Visit poster's website
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Mon Sep 03, 2007 5:49 am    Post subject: Re: computing microtonal intervals with rational numbers
Subject description: an ANS Forth rational arithmetic word-set
Reply with quote  Mark this post and the followings unread

Gordon Charlton wrote:
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


The site isn't responding for me... Question Question

Code:
ping www.forth.org
PING www.forth.org (206.55.232.73): 56 data bytes
^C
--- www.forth.org ping statistics ---
8 packets transmitted, 0 packets received, 100% packet loss


James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24085
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: 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
Reply with quote  Mark this post and the followings unread

dewdrop_world wrote:
The site isn't responding for me... Question Question


Hmm, it still works here.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
seraph
Editor
Editor


Joined: Jun 21, 2003
Posts: 12398
Location: Firenze, Italy
Audio files: 33
G2 patch files: 2

PostPosted: 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
Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
dewdrop_world wrote:
The site isn't responding for me... Question Question


Hmm, it still works here.


here too

Shocked

_________________
homepage - blog - forum - youtube

Quote:
Don't die with your music still in you - Wayne Dyer
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: seraph
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » How-tos » Micro Tuning
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use