Subject: Re: [colorforth] "Play and Display"
Nick Maroudas <[email protected]> Sun, 20 Apr 2008 11:55:54 +0300
| Newsgroups | gmane.comp.lang.forth.colorforth |
|---|---|
| Message-ID | <[email protected]> |
Nick here: Tutorial: Play and Display The words "pause" and "blk" can be used to display a music score while playing it, block by block. Blk holds the block number, and Pause refreshes the display. For example, the word "Handel" is on block 68 of Howerd Oakford's CFDOS4 (see my tutorial on Monday, 10 Mar 2008 Re: [colorforth] Hello - and where to begin?). One can redefine the word Handel so that it displays block 68 before playing Handel's gavotte. : Handel 68 blk ! pause Handel ; One can then define a word to display the next block as well : pd ( Play & Display) blk @ 2 + blk ! pause ; This will cause Handel to chain block 70 after it has played block 68 : Handel 68 blk ! pause Handel pd ; That way, one can chain a Play & Display music score, block after block. If you want to skip n blocks : ppd ( n>>) blk @ + pause ; and redefine pp : pp 2 ppd ; I have used this method to Play & Display 114 bars of Beethoven's string quartet Rasoumovsky 1, each bar being sourced on a separate block. As far as I can judge by ear, the multitasker word "Pause" does not introduce a perceptible pause between the bars. Thus, CF's display refresh seems to have a low enough latency for the purpose of bar by bar P&D.