Now on YT: https://youtu.be/ExDbY0X7Cvg
Hans Bezemer
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
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
On 5/1/2026 7:44 PM, Hans Bezemer wrote:What about this?
Now on YT: https://youtu.be/ExDbY0X7Cvg
Hans Bezemer
What about chords and multiple players?
https://iforth.nl/canonc.mid
-marcel
Now on YT: https://youtu.be/ExDbY0X7CvgI hate that you don't mention what it is all about.
Hans Bezemer
Hans Bezemer <the.beez.speaks@gmail.com> wrote:
Now on YT: https://youtu.be/ExDbY0X7CvgI hate that you don't mention what it is all about.
Hans Bezemer
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
Hans Bezemer <the.beez.speaks@gmail.com> wrote:
Now on YT: https://youtu.be/ExDbY0X7CvgI hate that you don't mention what it is all about.
Hans Bezemer
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 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.
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 :)
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,127 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 34:45:48 |
| Calls: | 14,430 |
| Calls today: | 1 |
| Files: | 186,410 |
| D/L today: |
5,536 files (1,649M bytes) |
| Messages: | 2,552,552 |
| Posted today: | 2 |