最新バージョンです。と言っても改良、追加中です。プログラムをぼちぼち作って入る方が好きなので肝心のCWがさっぱり覚えれません。

[NO.5]の入力エリアはキーボードから入力すると入力文字を発音します。キー入力はブラインドタッチが出来ないのと、CWのコードの発音時間が

まちまちなので綺麗な送信には成りそうも有りません。

[クリア]ボタンは[NO.5]の入力エリアの内容を消去します。あとはランダム発音が1度では聴き取り難いので2回発音を選択出来る様にしました。

作成しているソフトはフリーのHSP3です。VB等に比べ簡単に作る事が出来ます。少し難しい事はwebで探せば色々参考に成るプログラム有ります。興味があれば始めて見て下さい。

//------------------------------------------------------------------------------

//

// CW符号発音 数字、文字のランダム 乱数タイプ

// CW聴き取り練習 ランダム ラバースタンプ キー入力で発音

// 2011/04/05  cw_test12_ok.hsp

//  まだ文字コードが不足してます。

//------------------------------------------------------------------------------

// CWコード変数

*top

 sdim cw_code,64,40,2

 

 cw_code.0.0 = "0"

 cw_code.0.1 = "303030303" //0

 cw_code.1.0 = "1"

 cw_code.1.1 = "103030303" //1

 cw_code.2.0 = "2"

 cw_code.2.1 = "101030303" //2

 cw_code.3.0 = "3"

 cw_code.3.1 = "101010303" //3

 cw_code.4.0 = "4"

 cw_code.4.1 = "101010103" //4

 cw_code.5.0 = "5"

 cw_code.5.1 = "101010101" //5

 cw_code.6.0 = "6"

 cw_code.6.1 = "301010101" //6

 cw_code.7.0 = "7"

 cw_code.7.1 = "303010101" //7

 cw_code.8.0 = "8"

 cw_code.8.1 = "303030101" //8

 cw_code.9.0 = "9"

 cw_code.9.1 = "303030301" //9

 

 cw_code.10.0 = "A"

 cw_code.10.1 = "103"        //A

 cw_code.11.0 = "B"

 cw_code.11.1 = "3010101" //B

 cw_code.12.0 = "C"

 cw_code.12.1 = "3010301" //C

 cw_code.13.0 = "D"

 cw_code.13.1 = "30101"    //D

 cw_code.14.0 = "E"

 cw_code.14.1 = "1"          //E

 cw_code.15.0 = "F"

 cw_code.15.1 = "1010301" //F

 cw_code.16.0 = "G"

 cw_code.16.1 = "30301"    //G

 cw_code.17.0 = "H"

 cw_code.17.1 = "1010101" //H

 cw_code.18.0 = "I"

 cw_code.18.1 = "101"        //I

 cw_code.19.0 = "J"

 cw_code.19.1 = "1030303"  //J

 

 cw_code.20.0 = "K"

 cw_code.20.1 = "30103"    //K

 cw_code.21.0 = "L"

 cw_code.21.1 = "1030101" //L

 cw_code.22.0 = "M"

 cw_code.22.1 = "303"       //M

 cw_code.23.0 = "N"

 cw_code.23.1 = "301"       //N

 cw_code.24.0 = "O"

 cw_code.24.1 = "30303"    //O

 cw_code.25.0 = "P"

 cw_code.25.1 = "1030301" //P

 cw_code.26.0 = "Q"

 cw_code.26.1 = "3030103" //Q

 cw_code.27.0 = "R"

 cw_code.27.1 = "10301"    //R

 cw_code.28.0 = "S"

 cw_code.28.1 = "10101"    //S

 cw_code.29.0 = "T"

 cw_code.29.1 = "3"          //T

 

 cw_code.30.0 = "U"

 cw_code.30.1 = "10103"    //U

 cw_code.31.0 = "V"

 cw_code.31.1 = "1010103" //V

 cw_code.32.0 = "W"

 cw_code.32.1 = "10303"    //W

 cw_code.33.0 = "X"

 cw_code.33.1 = "3010103" //X

 cw_code.34.0 = "Y"

 cw_code.34.1 = "3010303" //Y

 cw_code.35.0 = "Z"

 cw_code.35.1 = "3030101" //Z

 cw_code.36.0 = "?"

 cw_code.36.1 = "10103030101"//?

 

//--------------------------------------

title "CW聴き取り練習 ランダム ラバースタンプ キー入力で発音"

 

 #include "midiapi.as"  // HSPのホームページで探してcommonに入れる

 fname = "map.txt"

 exist fname

 sdim progname, strsize+1

 bload fname, progname, strsize

 

 screen 0,1000,300,,10,10

 

 GetMidiDevNum : devnum = stat

 sdim devname, devnum+1*32

 repeat devnum+1

  GetMidiDevName cnt-1

  devname += refstr + "\n"

 loop

 

 pos 10, 4 : mes "MIDI 出力デバイス"

 pos 3, 24 : objsize 255, 24 : combox idev,, devname

 pos 260, 24 : objsize 60, 24 : button gosub "変更", *ChangeDevice

 

 pos 10, 50 : mes "楽器選択"

 pos 3, 72 : objsize 255, 24 : combox iprog,, progname

 pos 260, 72 : objsize 60, 24 : button gosub "変更", *ChangeProgNo

 

 spd = 120

 pos 10, 100 : mes "速度": pos 60, 100: input spd, 40, 18

 

 pos 10, 125 : mes "ランダム発音"

 pos 120, 125 : objsize 50, 22 : button gosub " ON ", *MyProg

 

 text1 = "CQ CQ CQ DE JA2PUW JA2PUW JA2PUW PSE K"

 pos 3,150 : objsize 50, 22 : button gosub "NO.1", *txt1

 pos 60, 150: input text1, 930, 20

 

 text2 = "JA2PUW JA2PUW JA2PUW DE JA1QRP JA1QRP JA1QRP K"

 pos 3, 175 : objsize 50, 22 : button gosub "NO.2", *txt2

 pos 60, 175: input text2, 930, 20

 

 text3 = "JA1QRP DE JA2PUW GM DR OM TNX FER UR CALL BT UR RST 599 ES QTH GAMAGOORI GAMAGOORI CITY ES NAME KATOU KATOU HW? JA1QRP DE JA2PUW KN"

 pos 3, 200 : objsize 50, 22 : button gosub "NO.3", *txt3

 pos 60, 200: input text3, 930, 20

 

 text4 = "R JA2PUW DE JA1QRP GM DR KATO SAN TKS FB REPT FM GAMAGOORI CITY BT UR RST 599 ES QTH FUKUSHIMA FUKUSHIMA CITY ES NAME JIRO JIRO HW? JA2PUW DE JA1QRP KN"

 pos 3, 225 : objsize 50, 22 : button gosub "NO.4", *txt4

 pos 60, 225: input text4, 930, 20

 

 pos 3, 250 : objsize 50, 22 : button gosub "NO.5", *txt5

 

 pos 3, 275 : objsize 50, 22 : button gosub "クリア", *CL

 

 pos 60, 275 : objsize 50, 22 : button gosub "STOP", *teisi

 

 pos 180, 125 : objsize 50, 22: chkbox "2回", chck

 

 

 MidiOpen -1

 if stat {

  dialog "MIDI デバイスのオープンに失敗しました。", 1

  end

 }

 onexit *OnQuit

 

//-------------------------------------

// リアルタイムでボックス内の文字入力を監視 (by Kpan)

 

; 上位ワード取得用マクロ

#define ctype HIWORD(%1) (%1 >> 16 & $FFFF)

 

; WM_COMMAND

 text5 = ""

 oncmd gosub *command, $111

 pos 60, 250: input text5,930,20,120

 hInput = objinfo(stat, 2)

 objsel 8

 

stop

 

//--------------------------------------

// キー入力で発音

*command

 if lparam = hInput {

;  wparamの上位ワードに通知コード

;  (内容が変更されると EN_CHANGE が通知される)

  if HIWORD(wparam) = $300 {

   ch = strmid( text5,-1,1 ): await 50: gosub *tx

   return

  }

  return

 }

 return

 

//--------------------------------------

//  MAIN

*mainloop

 await 10

 

 goto *mainloop

 

//--------------------------------------

*ChangeDevice

 if idev < 0 : idev = 0

 MidiClose

 MidiOpen idev-1

 return

 

*ChangeProgNo

 midiProgram 0, iprog

return

 

//--------------------------------------

*MyProg

 cn = 20

 randomize

 repeat

  c=rnd(37)

 

  moji = cw_code.c.0

  color 255, 255, 255: boxf 170, 100, 250, 130

  color 0, 0, 0: pos 120, 100: mes "文字= ":font msgothic, 18: pos 170, 100:mes moji

  sysfont

  code = cw_code.c.1

  gosub *code_

  await spd*3

 

  if chck = 0: goto *jp

  code = cw_code.c.1

  gosub *code_

  await spd*3

*jp

 loop

return

 

//--------------------------------------

*txt1: textn = text1: goto *txt_

*txt2: textn = text2: goto *txt_

*txt3: textn = text3: goto *txt_

*txt4: textn = text4: goto *txt_

*txt5: textn = text5: await 100: goto *txt_

*CL: objprm 16, "": return

 

//--------------------------------------

*txt_

 await spd

 for p,0,200,1

  ch=strmid(textn,p,1)

  gosub *tx

 next

return

 

//--------------------------------------

*tx

 if ch="0" : c =0: gosub *chre: goto *ext

 if ch="1" : c =1: gosub *chre: goto *ext

 if ch="2" : c =2: gosub *chre: goto *ext

 if ch="3" : c =3: gosub *chre: goto *ext

 if ch="4" : c =4: gosub *chre: goto *ext

 if ch="5" : c =5: gosub *chre: goto *ext

 if ch="6" : c =6: gosub *chre: goto *ext

 if ch="7" : c =7: gosub *chre: goto *ext

 if ch="8" : c =8: gosub *chre: goto *ext

 if ch="9" : c =9: gosub *chre: goto *ext

 if ch="A" : c =10: gosub *chre: goto *ext

 if ch="B" : c =11: gosub *chre: goto *ext

 if ch="C" : c =12: gosub *chre: goto *ext

 if ch="D" : c =13: gosub *chre: goto *ext

 if ch="E" : c =14: gosub *chre: goto *ext

 if ch="F" : c =15: gosub *chre: goto *ext

 if ch="G" : c =16: gosub *chre: goto *ext

 if ch="H" : c =17: gosub *chre: goto *ext

 if ch="I" : c =18: gosub *chre: goto *ext

 if ch="J" : c =19: gosub *chre: goto *ext

 if ch="K" : c =20: gosub *chre: goto *ext

 if ch="L" : c =21: gosub *chre: goto *ext

 if ch="M" : c =22: gosub *chre: goto *ext

 if ch="N" : c =23: gosub *chre: goto *ext

 if ch="O" : c =24: gosub *chre: goto *ext

 if ch="P" : c =25: gosub *chre: goto *ext

 if ch="Q" : c =26: gosub *chre: goto *ext

 if ch="R" : c =27: gosub *chre: goto *ext

 if ch="S" : c =28: gosub *chre: goto *ext

 if ch="T" : c =29: gosub *chre: goto *ext

 if ch="U" : c =30: gosub *chre: goto *ext

 if ch="V" : c =31: gosub *chre: goto *ext

 if ch="W" : c =32: gosub *chre: goto *ext

 if ch="X" : c =33: gosub *chre: goto *ext

 if ch="Y" : c =34: gosub *chre: goto *ext

 if ch="Z" : c =35: gosub *chre: goto *ext

 if ch="?" : c =36: gosub *chre: goto *ext

 if ch=" " : await spd: goto *ext

 if ch="" : return

*ext

 await spd*3

return

 

//--------------------------------------

*chre

 

 moji = cw_code.c.0

 color 255, 255, 255: boxf 170, 100, 250, 130

 color 0, 0, 0: pos 120, 100: mes "文字= ":font msgothic, 18: pos 170, 100:mes moji

 sysfont

 code = cw_code.c.1

 gosub *code_

return

 

//--------------------------------------

// 1文字の発音

*code_

 codef = 1

 cn = 20

 midiProgram 0, 64 //音色の設定

 for a,0,40,1

  b=strmid(code,a,1)

  if b="" :_break

  if b="0" :gosub *spc :goto *nex

  if b="1" :gosub *dot :goto *nex

  if b="3" :gosub *dush :goto *nex

  if b=" " :gosub *spce

*nex

 next

 codef = 0

return

 

//--------------------------------------

*spc

 await spd

return

 

*dot

 midiNoteOn 0, 55+cn, $7f

 await spd

 midiNoteOff 0, 55+cn

return

 

*dush

 midiNoteOn 0, 55+cn, $7f

 await spd*3

 midiNoteOff 0, 55+cn

return

 

*spce

 await spd*2

return

 

*teisi

 MidiReset

 MidiClose

 goto *top

 

*OnQuit

 MidiReset

 MidiClose

 

end

//------------------------------------------------------------------------------