Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #135045 > unrolled thread
| Started by | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| First post | 2026-05-01 19:44 +0200 |
| Last post | 2026-07-11 18:49 +0200 |
| Articles | 11 — 4 participants |
Back to article view | Back to comp.lang.forth
Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-05-01 19:44 +0200
Re: Back & Forth - It still sounds MID.. [7b] marcel hendrix <mhx@iae.nl> - 2026-07-03 15:24 +0200
Re: Back & Forth - It still sounds MID.. [7b] dxf <dxforth@gmail.com> - 2026-07-05 18:33 +1000
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-05 19:08 +0200
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-09 18:18 +0200
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-10 14:43 +0200
Re: Back & Forth - It still sounds MID.. [7b] albert@SPENARNC.XS4ALL.NL - 2026-07-11 17:09 +0200
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-11 18:21 +0200
Re: Back & Forth - It still sounds MID.. [7b] dxf <dxforth@gmail.com> - 2026-07-12 15:02 +1000
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-12 16:15 +0200
Re: Back & Forth - It still sounds MID.. [7b] Hans Bezemer <the.beez.speaks@gmail.com> - 2026-07-11 18:49 +0200
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-05-01 19:44 +0200 |
| Subject | Back & Forth - It still sounds MID.. [7b] |
| Message-ID | <10t2opl$1jcba$1@dont-email.me> |
Now on YT: https://youtu.be/ExDbY0X7Cvg Hans Bezemer
[toc] | [next] | [standalone]
| From | marcel hendrix <mhx@iae.nl> |
|---|---|
| Date | 2026-07-03 15:24 +0200 |
| Message-ID | <1128d70$2c3qg$1@dont-email.me> |
| In reply to | #135045 |
On 5/1/2026 7:44 PM, Hans Bezemer wrote: > Now on YT: https://youtu.be/ExDbY0X7Cvg > > Hans Bezemer What about chords and multiple players? https://iforth.nl/canonc.mid -marcel
[toc] | [prev] | [next] | [standalone]
| From | dxf <dxforth@gmail.com> |
|---|---|
| Date | 2026-07-05 18:33 +1000 |
| Message-ID | <6a4a16f6$1@news.ausics.net> |
| In reply to | #135223 |
On 3/07/2026 11:24 pm, marcel hendrix wrote: > On 5/1/2026 7:44 PM, Hans Bezemer wrote: >> Now on YT: https://youtu.be/ExDbY0X7Cvg >> >> Hans Bezemer > > What about chords and multiple players? > > https://iforth.nl/canonc.mid Whatever that is, it reminded me of ... https://youtu.be/2r0CCRbHh70
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-05 19:08 +0200 |
| Message-ID | <112e32m$18bld$1@dont-email.me> |
| In reply to | #135223 |
On 03-07-2026 15:24, marcel hendrix wrote: > On 5/1/2026 7:44 PM, Hans Bezemer wrote: >> Now on YT: https://youtu.be/ExDbY0X7Cvg >> >> Hans Bezemer > > What about chords and multiple players? > > https://iforth.nl/canonc.mid > > -marcel Well, I think I set out my initial design objectives pretty well. And yeah -- I think I have a clue on how to do chords. But the motto of my project has always been "this is supposed to be fun". And at this moment I'm not too motivated to put the effort in. If others wanna do that, be my guest. If someone begged me to do that, maybe. If I come along something that required chords, I think I might pull the libs out and enhance them accordingly. But right now, I'm fine. It was fun! :-) Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-09 18:18 +0200 |
| Message-ID | <112ohl4$h5ci$1@dont-email.me> |
| In reply to | #135223 |
On 03-07-2026 15:24, marcel hendrix wrote:
> On 5/1/2026 7:44 PM, Hans Bezemer wrote:
>> Now on YT: https://youtu.be/ExDbY0X7Cvg
>>
>> Hans Bezemer
>
> What about chords and multiple players?
>
> https://iforth.nl/canonc.mid
>
> -marcel
What about this?
: m.Chord ( p1 p2 p3 px x duration delay --)
>MID rot swap \ setup (duration n delay)
[: over if .delay 90 emit rot mid&C dup emit m.Velocity emit >r 1- 0
recurse
swap dup .delay 80 emit r> emit m.Velocity emit >zero ;then drop ;]
execute drop drop ; \ execute the chord
Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-10 14:43 +0200 |
| Message-ID | <112qpdn$17m9d$1@dont-email.me> |
| In reply to | #135229 |
On 09-07-2026 18:18, Hans Bezemer wrote: $ svn commit -m "Added chords to midi-w.4th" Sending 4th.src/lib/midi-w.4th Transmitting file data .done Committing transaction... Committed revision 1780. I guessed you bagged too much, I couldn't resist it no more. :-) Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | albert@SPENARNC.XS4ALL.NL |
|---|---|
| Date | 2026-07-11 17:09 +0200 |
| Message-ID | <nnd$2614b7c3$5709f7e4@2048be628611cce3> |
| In reply to | #135045 |
Hans Bezemer <the.beez.speaks@gmail.com> wrote:
> Now on YT: https://youtu.be/ExDbY0X7Cvg
>
> Hans Bezemer
I hate that you don't mention what it is all about.
It is about midi. It invites me to type ExDbYo(or 0) in the newsreader
cause the newsreader don't support cut and place. So I followed
up, my editor does it better.
We are at it, This is the rosetta challenge to play a scale.
A regular speaker required! MAKE-ACCESSABLE is not needed for MSDOS.
In linux you want XOS generic OS access, e.g. in ciforth.
---------------------------------------
"$-PREFIX" WANTED "-scripting-" WANTED
: MAKE-ACCESSABLE ( n-) 1 1 $65 XOS
DUP IF ." You cannot access i/o ports, become root" CR THROW THEN ;
: MAKE-SPEAKER-ACCESSABLE ( - )
$42 MAKE-ACCESSABLE $43 MAKE-ACCESSABLE $61 MAKE-ACCESSABLE ;
: SET-FREQUENCY ( n - ) $B6 $43 PC! DUP $42 PC! 8 RSHIFT $42 PC! ;
: SPEAKER-ON ( - ) $61 PC@ 3 OR $61 PC! ;
: SILENT-SPEAKER ( -) $61 PC@ $FC AND $61 PC! ;
: secunde 17843 18904 */ ;
CREATE _notes 35613 ( C2) 12 0 DO DUP , secunde LOOP DROP
: >timing ( n - n) 24 - 12 /MOD SWAP CELLS _notes + @ SWAP RSHIFT ;
: NOTE-ON ( n-) >timing SET-FREQUENCY SPEAKER-ON ;
: NOTE-OFF ( n-) DROP SILENT-SPEAKER ;
: PLAY-NOTE ( n n -) OVER NOTE-ON MS NOTE-OFF ;
: .. ( n - ) 1000 PLAY-NOTE ;
\ Play a scale starting at the keyhole c.
: PLAY-SCALE
\ c' d' e' f' g' a' b' c''
60 .. 62 .. 64 .. 65 .. 67 .. 69 .. 71 .. 72 ..
3000 MS ;
MAKE-SPEAKER-ACCESSABLE PLAY-SCALE
---------------------------------------
The same scale played on mswindows. (Assuming WINMM.DLL is present
in SYSTEM32. a multimedia library.)
openmidi sendmidi closemidi are wrappers around dll calls.
They are slightly more than wrappers, because if you
do
wina -c midi.frt
a midi.exe is generated that you can transport accross
windows systems (i.e. no Forth system needs to be present).
---------------------------------------
\ $Id: midi.frt,v 1.7 2015/04/15 02:04:17 albert Exp albert $
\ Copyright (2012): Albert van der Horst {by GNU Public License}
\ Uses MIDI facility to play a simple melody.
\ vrij naar Jones jonesforth
WANT sendmidi ( and openmidi closemid )
WANT CASE-INSENSITIVE CASE-INSENSITIVE
1 CONSTANT 'Grand_Piano'
VARIABLE instrument
: midi-errors
"
2001 : Failed to open MIDI output device
2002 : Failed to close MIDI output device
2003 : Failed to send to MIDI output device
" TYPE ;
: -i SHIFT-ARGS 1 ARG[] EVALUATE instrument ! SHIFT-ARGS ;
: -h midi-errors
"
-h this help
-i <instr> : install instrument to play on
" ETYPE
BYE ;
HEX
\ Send a midi start message for NOTE
: StartNote 8 LSHIFT 7F0090 OR sendmidi ;
\ Send a midi stop message for NOTE
: StopNote 8 LSHIFT 80 OR sendmidi ;
\ Send a midi select message for VOICE
: SetInstrument 8 LSHIFT 7F00C0 OR sendmidi ;
DECIMAL
\ Play a NOTE for TIME milliseconds.
: PlayNote OVER StartNote MS StopNote ;
: handle-args ARGC 1 > IF 1 ARG[] EVALUATE THEN ;
: play
instrument @ SetInstrument
70 500 PlayNote
72 500 PlayNote
68 500 PlayNote
56 500 PlayNote
63 1000 PlayNote
1000 MS
;
: doit openmidi handle-args play closemidi ;
---------------------------------------
A midiplayer for actual midi files is easy given WINMM.DLL,
but the margin is too small to contain it.
Groetjes Albert
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-11 18:21 +0200 |
| Message-ID | <112tqhd$266vb$1@dont-email.me> |
| In reply to | #135232 |
On 11-07-2026 17:09, albert@SPENARNC.XS4ALL.NL wrote:
> Hans Bezemer <the.beez.speaks@gmail.com> wrote:
>> Now on YT: https://youtu.be/ExDbY0X7Cvg
>>
>> Hans Bezemer
> I hate that you don't mention what it is all about.
> It is about midi. It invites me to type ExDbYo(or 0) in the newsreader
> cause the newsreader don't support cut and place. So I followed
> up, my editor does it better.
> We are at it, This is the rosetta challenge to play a scale.
> A regular speaker required! MAKE-ACCESSABLE is not needed for MSDOS.
> In linux you want XOS generic OS access, e.g. in ciforth.
>
> ---------------------------------------
> "$-PREFIX" WANTED "-scripting-" WANTED
> : MAKE-ACCESSABLE ( n-) 1 1 $65 XOS
> DUP IF ." You cannot access i/o ports, become root" CR THROW THEN ;
> : MAKE-SPEAKER-ACCESSABLE ( - )
> $42 MAKE-ACCESSABLE $43 MAKE-ACCESSABLE $61 MAKE-ACCESSABLE ;
> : SET-FREQUENCY ( n - ) $B6 $43 PC! DUP $42 PC! 8 RSHIFT $42 PC! ;
> : SPEAKER-ON ( - ) $61 PC@ 3 OR $61 PC! ;
> : SILENT-SPEAKER ( -) $61 PC@ $FC AND $61 PC! ;
> : secunde 17843 18904 */ ;
> CREATE _notes 35613 ( C2) 12 0 DO DUP , secunde LOOP DROP
> : >timing ( n - n) 24 - 12 /MOD SWAP CELLS _notes + @ SWAP RSHIFT ;
> : NOTE-ON ( n-) >timing SET-FREQUENCY SPEAKER-ON ;
> : NOTE-OFF ( n-) DROP SILENT-SPEAKER ;
> : PLAY-NOTE ( n n -) OVER NOTE-ON MS NOTE-OFF ;
> : .. ( n - ) 1000 PLAY-NOTE ;
> \ Play a scale starting at the keyhole c.
> : PLAY-SCALE
> \ c' d' e' f' g' a' b' c''
> 60 .. 62 .. 64 .. 65 .. 67 .. 69 .. 71 .. 72 ..
> 3000 MS ;
> MAKE-SPEAKER-ACCESSABLE PLAY-SCALE
> ---------------------------------------
>
> The same scale played on mswindows. (Assuming WINMM.DLL is present
> in SYSTEM32. a multimedia library.)
> openmidi sendmidi closemidi are wrappers around dll calls.
> They are slightly more than wrappers, because if you
> do
> wina -c midi.frt
> a midi.exe is generated that you can transport accross
> windows systems (i.e. no Forth system needs to be present).
>
> ---------------------------------------
> \ $Id: midi.frt,v 1.7 2015/04/15 02:04:17 albert Exp albert $
> \ Copyright (2012): Albert van der Horst {by GNU Public License}
> \ Uses MIDI facility to play a simple melody.
> \ vrij naar Jones jonesforth
>
> WANT sendmidi ( and openmidi closemid )
> WANT CASE-INSENSITIVE CASE-INSENSITIVE
> 1 CONSTANT 'Grand_Piano'
>
> VARIABLE instrument
>
> : midi-errors
> "
> 2001 : Failed to open MIDI output device
> 2002 : Failed to close MIDI output device
> 2003 : Failed to send to MIDI output device
> " TYPE ;
>
> : -i SHIFT-ARGS 1 ARG[] EVALUATE instrument ! SHIFT-ARGS ;
>
> : -h midi-errors
> "
> -h this help
> -i <instr> : install instrument to play on
> " ETYPE
> BYE ;
>
> HEX
> \ Send a midi start message for NOTE
> : StartNote 8 LSHIFT 7F0090 OR sendmidi ;
>
> \ Send a midi stop message for NOTE
> : StopNote 8 LSHIFT 80 OR sendmidi ;
>
> \ Send a midi select message for VOICE
> : SetInstrument 8 LSHIFT 7F00C0 OR sendmidi ;
> DECIMAL
>
> \ Play a NOTE for TIME milliseconds.
> : PlayNote OVER StartNote MS StopNote ;
>
>
> : handle-args ARGC 1 > IF 1 ARG[] EVALUATE THEN ;
>
> : play
> instrument @ SetInstrument
> 70 500 PlayNote
> 72 500 PlayNote
> 68 500 PlayNote
> 56 500 PlayNote
> 63 1000 PlayNote
> 1000 MS
> ;
>
> : doit openmidi handle-args play closemidi ;
> ---------------------------------------
>
> A midiplayer for actual midi files is easy given WINMM.DLL,
> but the margin is too small to contain it.
>
> Groetjes Albert
I have no idea what your beef is. If I wonder what's it all about in YT,
I pull up the description, which in this case says:
"Last time, we learned how to create Midi files using Forth. We were
able to convert old ZX BASIC programs to the library we created - and
replicate these melodies without too much effort.
In this second part, we say goodbye to the Midi piano and learn how to
use different instruments. We will see how we can encode musical notes -
and even raw frequencies."
I have no idea what you want with "playing a scale". Because that's
trivial in the lib I wrote, since you can reference the notes themselves
by their name.
I can't remember the last time I used the beeper -- since PCs come with
sound cards since the turn of the century. But don't let me keep you
from having fun. If that wets your taste for nostalgia, let it be.
I have no idea whether there is an actual MIDI device in my current
soundcard -- and frankly I don't care. I tend to use timidity - and that
works with files.
If I wanna use a Midi sample, I'll pass it through LAME and I got an MP3
which works just fine with Kdenlive.
The latter example was just fun. I converted it to the library and this
came out:
include lib/midi-w.4th
---8<---
s" ce3k.mid" MIDopen abort" Can't open Midi file"
Bright_Acoustic_Piano m.Use
50 10 m.Beep
50 12 m.Beep
50 8 m.Beep
50 -4 m.Beep
100 3 m.Beep
MIDclose
---8<---
This was the first time I created a "beep" file from a MIDI file. Note
that this format was derived from the ZX Spectrum. So I fired up Fuse
and typed:
10 BEEP 0.5,10: BEEP 0.5,12: BEEP 0.5,8: BEEP 0.5,-4: BEEP 1,3
And then ran it. Perfect rendition! Written in 4tH, transcribed to BASIC
and ported to the ZX Spectrum.
You know: we all have our nostalgia weaknesses! :-)
Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | dxf <dxforth@gmail.com> |
|---|---|
| Date | 2026-07-12 15:02 +1000 |
| Message-ID | <6a531fce$1@news.ausics.net> |
| In reply to | #135233 |
On 12/07/2026 2:21 am, Hans Bezemer wrote: > ... > I have no idea whether there is an actual MIDI device in my current soundcard -- and frankly I don't care. I tend to use timidity - and that works with files. Wondering what might be available to play MID under DOSBOX, I found this: https://mateusz.fr/dosmid/ It played a MID file straight up without any extra parms on the command line. That's probably because DOSBOX was already preconfigured for sound. FWIW here's what's in my 'dosbox-0.74-3.conf' mount C D:\ C:\ SET BLASTER=A220 I5 D1 H5 P330 T6 PATH Z:\;C:\COMMAND CD \FORTH\DX MIXER SB 75:75 /NOSHOW TURBOKEY D 1 Not sure what the MIXER command did - maybe volume. Generating midi notes from DX-Forth would require a DOS BAT file - first generate the MID file, then invoke the utility above to play it. Probably it can all be done within forth as there's a SHELL command. Wow - I've almost incentivised myself to do it. You need to stop that :)
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-12 16:15 +0200 |
| Message-ID | <11307i0$2sh4k$1@dont-email.me> |
| In reply to | #135235 |
On 12-07-2026 07:02, dxf wrote: > On 12/07/2026 2:21 am, Hans Bezemer wrote: >> ... >> I have no idea whether there is an actual MIDI device in my current soundcard -- and frankly I don't care. I tend to use timidity - and that works with files. > > Wondering what might be available to play MID under DOSBOX, I found this: > > https://mateusz.fr/dosmid/ > > It played a MID file straight up without any extra parms on the command line. > That's probably because DOSBOX was already preconfigured for sound. > FWIW here's what's in my 'dosbox-0.74-3.conf' > > mount C D:\ > C:\ > SET BLASTER=A220 I5 D1 H5 P330 T6 > PATH Z:\;C:\COMMAND > CD \FORTH\DX > MIXER SB 75:75 /NOSHOW > TURBOKEY D 1 > > Not sure what the MIXER command did - maybe volume. > > Generating midi notes from DX-Forth would require a DOS BAT file - first > generate the MID file, then invoke the utility above to play it. Probably > it can all be done within forth as there's a SHELL command. > > Wow - I've almost incentivised myself to do it. You need to stop that :) > MIXER is a DOSbox utility: https://www.dosbox.com/wiki/index.php?title=MIXER It selects the device, left:right volume settings, and executes in quiet mode. You'll find it on your "Z:" drive. 4tH does have an external "SYSTEM", which uses the pipes in 4th: [UNDEFINED] system [IF] ( a n -- f) : system output pipe + open error? tuck if drop ;then close ; [THEN] Unfortunately, I had some issues with the popen() command in DJGPP, so I disabled the pipes. Turbo C v2 didn't have them anyway. So -- in theory I could do all this, but because I put reliability before functionality, no go on DOS. :-( I must say I've got very little incentive to do anything with DOS anyway, so I don't think I'll put much effort into this. I may do on Linux, cause it's trivial: ---8<--- include lib/system.4th 128 string cmdline argn 1- if cmdline >r s" timidity --quiet=2 " r@ place 1 args r@ +place r> count system abort" Can't execute 'timidity'" then ---8<--- You could bind the thing into a program that generates it -- but why? - First you have to issue a command line parameter, otherwise the file name and location are predetermined and that makes the whole thing awkward. I mean: Why select a filename and directory in the first place? - Second, if you *would* use a fixed name, you don't need the whole shebang. s" timidity --quiet=2 ce3k.mid" would do just fine; - Third, is it about file generation - or just playing the thing? If it's the latter, you could wipe the MID file after completion. This to prevent leaving corpses all over your machine. Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2026-07-11 18:49 +0200 |
| Message-ID | <112ts69$26mor$1@dont-email.me> |
| In reply to | #135232 |
On 11-07-2026 17:09, albert@SPENARNC.XS4ALL.NL wrote:
> Hans Bezemer <the.beez.speaks@gmail.com> wrote:
>> Now on YT: https://youtu.be/ExDbY0X7Cvg
>>
>> Hans Bezemer
> I hate that you don't mention what it is all about.
> It is about midi. It invites me to type ExDbYo(or 0) in the newsreader
> cause the newsreader don't support cut and place. So I followed
> up, my editor does it better.
> We are at it, This is the rosetta challenge to play a scale.
> A regular speaker required! MAKE-ACCESSABLE is not needed for MSDOS.
> In linux you want XOS generic OS access, e.g. in ciforth.
>
> ---------------------------------------
> "$-PREFIX" WANTED "-scripting-" WANTED
> : MAKE-ACCESSABLE ( n-) 1 1 $65 XOS
> DUP IF ." You cannot access i/o ports, become root" CR THROW THEN ;
> : MAKE-SPEAKER-ACCESSABLE ( - )
> $42 MAKE-ACCESSABLE $43 MAKE-ACCESSABLE $61 MAKE-ACCESSABLE ;
> : SET-FREQUENCY ( n - ) $B6 $43 PC! DUP $42 PC! 8 RSHIFT $42 PC! ;
> : SPEAKER-ON ( - ) $61 PC@ 3 OR $61 PC! ;
> : SILENT-SPEAKER ( -) $61 PC@ $FC AND $61 PC! ;
> : secunde 17843 18904 */ ;
> CREATE _notes 35613 ( C2) 12 0 DO DUP , secunde LOOP DROP
> : >timing ( n - n) 24 - 12 /MOD SWAP CELLS _notes + @ SWAP RSHIFT ;
> : NOTE-ON ( n-) >timing SET-FREQUENCY SPEAKER-ON ;
> : NOTE-OFF ( n-) DROP SILENT-SPEAKER ;
> : PLAY-NOTE ( n n -) OVER NOTE-ON MS NOTE-OFF ;
> : .. ( n - ) 1000 PLAY-NOTE ;
> \ Play a scale starting at the keyhole c.
> : PLAY-SCALE
> \ c' d' e' f' g' a' b' c''
> 60 .. 62 .. 64 .. 65 .. 67 .. 69 .. 71 .. 72 ..
> 3000 MS ;
> MAKE-SPEAKER-ACCESSABLE PLAY-SCALE
> ---------------------------------------
>
> The same scale played on mswindows. (Assuming WINMM.DLL is present
> in SYSTEM32. a multimedia library.)
> openmidi sendmidi closemidi are wrappers around dll calls.
> They are slightly more than wrappers, because if you
> do
> wina -c midi.frt
> a midi.exe is generated that you can transport accross
> windows systems (i.e. no Forth system needs to be present).
>
> ---------------------------------------
> \ $Id: midi.frt,v 1.7 2015/04/15 02:04:17 albert Exp albert $
> \ Copyright (2012): Albert van der Horst {by GNU Public License}
> \ Uses MIDI facility to play a simple melody.
> \ vrij naar Jones jonesforth
>
> WANT sendmidi ( and openmidi closemid )
> WANT CASE-INSENSITIVE CASE-INSENSITIVE
> 1 CONSTANT 'Grand_Piano'
>
> VARIABLE instrument
>
> : midi-errors
> "
> 2001 : Failed to open MIDI output device
> 2002 : Failed to close MIDI output device
> 2003 : Failed to send to MIDI output device
> " TYPE ;
>
> : -i SHIFT-ARGS 1 ARG[] EVALUATE instrument ! SHIFT-ARGS ;
>
> : -h midi-errors
> "
> -h this help
> -i <instr> : install instrument to play on
> " ETYPE
> BYE ;
>
> HEX
> \ Send a midi start message for NOTE
> : StartNote 8 LSHIFT 7F0090 OR sendmidi ;
>
> \ Send a midi stop message for NOTE
> : StopNote 8 LSHIFT 80 OR sendmidi ;
>
> \ Send a midi select message for VOICE
> : SetInstrument 8 LSHIFT 7F00C0 OR sendmidi ;
> DECIMAL
>
> \ Play a NOTE for TIME milliseconds.
> : PlayNote OVER StartNote MS StopNote ;
>
>
> : handle-args ARGC 1 > IF 1 ARG[] EVALUATE THEN ;
>
> : play
> instrument @ SetInstrument
> 70 500 PlayNote
> 72 500 PlayNote
> 68 500 PlayNote
> 56 500 PlayNote
> 63 1000 PlayNote
> 1000 MS
> ;
>
> : doit openmidi handle-args play closemidi ;
> ---------------------------------------
>
> A midiplayer for actual midi files is easy given WINMM.DLL,
> but the margin is too small to contain it.
>
> Groetjes Albert
BTW, according to my research, this is a much closer approximation to
that theme:
---8<---
include lib/midi-w.4th
s" ce3k.mid" MIDopen abort" Can't open Midi file"
Square_Wave_Lead m.Use \ PC 81: Lead 1 (Square)
0 &D 50 m.Play
0 &E 50 m.Play
0 &C 50 m.Play
-1 +to m.Octave
0 &C 50 m.Play
0 &G 100 m.Play
MIDclose depth .
---8<---
Hans Bezemer
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.forth
csiph-web