CWを何とかして覚えたいと言う気持ちから作成しました。プログラムのデバック中にCWが覚える事が出来ないかと目論んでいるのですが(^^);

 

MIDIを使用して発音しています。いろんな音で聞くことが出来ます。(いらない機能かも知れません)

速度も変更出来ます。現在の設定は1ドットの長さは120mS

ランダム発音は0から9までとAからZまでをランダムに発音します。

NO.1からNO.5までのボタンは右側のテキストボックスの内容で発音します。テキストの内容は変更出来ます。

ラバースタンプの内容は結構長いです。そのため横幅が広く成りました。

 

HSP3のプログラムです。

//

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

// 2011/03/27  cw_test8_ok.hsp

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

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

// CWコード変数

 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

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

title "CW聴き取り練習 ランダム ラバースタンプ(文字は変更可)"

 

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

 fname = "map.txt"

 exist fname

 sdim progname, strsize+1

 bload fname, progname, strsize

 

 screen 0,1000,255,,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

 

 

 MidiOpen -1

 if stat {

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

  end

 }

 onexit *OnQuit

 

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

midiProgram 0, 64

*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

 loop

 return

 

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

*txt1: textn = text1: goto *txt_

*txt2: textn = text2: goto *txt_

*txt3: textn = text3: goto *txt_

*txt4: textn = text4: goto *txt_

 

*txt_

 cn = 20

 

 for p,0,200,1

  ch=strmid(textn,p,1)

 

  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=" " : await spd: goto *ext

  if ch="" : return

*ext

 await spd*3

 next

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

 

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

*code_

 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

 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

 

*OnQuit

 MidiReset

 MidiClose

 

 end

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

プログラムはここまでです。

作成中なので改変するかも知れません。必要ならこのページを保存して下さい。

 

ホームページの作成が未熟な為に実行ファイルをアップする事出来ません。試して見たい方はJARLのJA2PUWにメール下さい。