; Post Office sound answer time recording ; copyleft 2017-06-27 sugiura@nagoya-u.jp ; 2021-06-10 mci 命令の修正 #pack "po.png" #pack "po.mp3" mmload "po.mp3", 0 ; mci "set sam channels 2" ; mci "set sam samplespersec 44100" ; mci "set sam bitspersample 16" mci "open new alias sam type waveaudio" mci "set sam channels 2 samplespersec 44100 bitspersample 16" *settei screen 0, 640, 680 notesel log *main pos 50, 180 picload "po.png", 1 color 255,255,204 boxf 0, 0, 640, 120 pos 150, 10 font "ゴシック", 18, 1 color 0,0,0 mes "Now, you are at the red star." mes "A woman is asking you a question." mes "---------------------------------" font "ゴシック", 18, 1 mes "Woman: \"Excuse me.\"" mes "You: " pos 230, 80 button gosub "Yes?", *po color 255,255,204 boxf 0, 560, 640, 680 pos 100, 560 color 0,0,0 mes "Push the button and start speaking." button goto "Answer", *kaitou ; 解答開始ボタン stop *kaitou cls ; 一旦クリア gosub *RTs ; 時間の計測開始 mci "record sam" ; 録音の開始 ;---------------------------------- pos 50, 180 picload "po.png", 1 color 255,255,204 boxf 0, 0, 640, 120 pos 150, 10 font "ゴシック", 18, 1 color 0,0,0 mes "Now, you are at the red star." mes "A woman is asking you a question." mes "---------------------------------" font "ゴシック", 18, 1 mes "Woman: \"Excuse me.\"" mes "You: " pos 230, 80 button gosub "Yes?", *po color 255,255,204 boxf 0, 560, 640, 680 pos 100, 560 color 255,0,0 mes "When finished, push the button." ; ここまで同じ ;------------------------------------------------------------------- button goto "Finish", *owari ; 終了ボタン stop *owari gosub *RTe ; 計測を停止し mci "stop sam" ; 録音停止 mci "save sam \"sample.wav\"" ; 音声ファイル保存 mci "close sam" ; 録音終了(デバイスを閉じる) jikan = str(jikan) ; 時間を文字列に変換 noteadd jikan ; 時間を記録 notesave "time.txt" ; ファイルに保存 cls pos 300, 400 font "ゴシック", 24, 1 mes "Thank you!" wait 200 end ; sub ------------------------------------------------------------------ *po mmplay 0 return *RTs ; 計測開始 hajime = 0 ; まず変数を空に ji = 0 hun = 0 byou = 0 miri = 0 ji = gettime(4) ; 秒まででよいかと思ったら、分をまたぐ場合がある hun = gettime(5) ; のみならず時をまたぐ場合もある。 byou = gettime(6) ; 秒の単位まで計測して miri = gettime(7) ; ミリセカンドのレベルで調べる hajime = (hun*60000)+(byou*1000)+miri return *RTe ; リ計測終了 kokomade = 0 ; 変数を空に jikan = 0 jie = 0 hune = 0 byoue = 0 mirie = 0 jie = gettime(4) ; ここのところの変数名を開始時のものと変えた hune = gettime(5) byoue = gettime(6) mirie = gettime(7) ; ミリセカンドのレベルで調べる kokomade = (hune*60000)+(byoue*1000)+mirie if ji < jie : kokomade = kokomade + 3600000 ; もし時間をまたいだ場合は ; 1時間分のミリセカンドを足す jikan = kokomade - hajime ; 引き算をしてかかった時間を計算 return