*disclaimer
603015
sound recording
- 音声を録音・再生する
Picture Description Task
; sound recording 11 ; copyleft 2017-06-24 sugiura@nagoya-u.jp ; 2019-09-11 タイムスタンプつけて音声ファイルの保存 ; 再生ファイルをダイアログウィンドウで選択 ; 2019-09-17 picture description task with cound down ; 2020-06-28 mci命令の誤植訂正 ; 指示を日本語に ; record10-J 2020-06-28 自動で録音・保存するように変更 ; record11-J 2020-06-29 mciコマンドの修正 設定を一行にまとめる #pack "sample.jpg" pos 550, 30 mes "秒読み" mes "------" pos 200, 100 mes "絵について英語で説明してもらいます。" mes "20秒間、話す準備をする時間があります。" mes "-----" await 2000 mes "いいですか" await 1000 mes "用意してください" await 1000 mes "はい、下の絵について何を話すか考えてください。" await 1000 pos 200, 230 picload "sample.jpg", 1 pos 580, 60 i =20 repeat 20 mes i await 1000 i = i - 1 loop cls pos 550, 30 mes "秒読み" mes "------" pos 200, 100 ;mes "録音開始ボタンを押して録音を開始してください。" mes "話す時間は20秒です。" mes "-----" await 800 mes "スタートの合図で話し始めてください。" await 800 mes "" mes "用意してください" await 2000 mes "" color 255,0,0 mes "スタート!" ;await 1000 await 500 pos 300, 350 ;button gosub "録音開始", *record ;mes "録音開始" gosub *record color 255,0,0 mes "録音中" mes "" pos 580, 60 i =20 color 255,0,0 repeat 20 mes i await 1000 i = i - 1 loop mes "" color 0,0,0 mes "終了!" await 2000 cls pos 200, 100 ;mes "保存ボタンを押して録音を保存してください。" mes "録音を保存します" mes "" ;button gosub "保存", *teisi gosub *teisi await 2000 mes "保存しました" mes "" mes "" button gosub "再生", *play mes "" mes "" button goto "終了", *owari stop *owari mci "close sou" cls pos 300, 200 mes "Bye" wait 100 end ; sub -------------------------- *record mci "open new alias sam type waveaudio" mci "set sam channels 2 samplespersec 44100 bitspersample 16" ;mci "set sam channels 2" ;mci "set sam samplespersec 44100" ;mci "set sam bitspersample 16" mci "record sam" return *play dialog "wav", 16, "WAVファイルを選択" dialog "このファイルを再生します:"+refstr,0,"確認" mci "open \""+refstr+"\" alias sou type waveaudio" mci "play sou" return *teisi nen = gettime(0) gatu = gettime(1) niti = gettime(3) ji = gettime(4) fun = gettime(5) taimu = "sound"+nen+"-"+gatu+"-"+niti+"-"+ji+"-"+fun+".wav" mci "stop sam" mci "save sam \""+taimu+"\" mci "close sam" return ;
ソースコードファイル record11-J.hsp(190)
- mciの音声ファイルの設定の箇所、1行に書かないと適切に処理されない点を修正 2020-06-29
実行ファイル(サンプルの絵入り)record11-J.exe(259)
以下のスクリプト中、誤植があります。(2020-06-14)
誤:samplepersec
正:samplespersec
; sound recording ; copyleft 2017-06-24 sugiura@nagoya-u.jp ; 2019-09-11 タイムスタンプつけて音声ファイルの保存 ; 再生ファイルをダイアログウィンドウで選択 ; gosub *set pos 300, 200 button gosub "Record", *record mes "" mes "" button gosub "Stop Rec", *teisi mes "" button gosub "Play", *play mes "" mes "" button goto "End", *owari stop *owari mci "close sou" cls pos 300, 200 mes "Bye" wait 100 end ; sub -------------------------- *set mci "set sam channels 2" mci "set sam samplepersec 44100" mci "set sam bitspersample 16" return *record mci "open new alias sam type waveaudio" mci "record sam" return *play dialog "wav", 16, "WAVファイルを選択" dialog "このファイルを再生します:"+refstr,0,"確認" mci "open \""+refstr+"\" alias sou type waveaudio" mci "play sou" return *teisi nen = gettime(0) gatu = gettime(1) niti = gettime(3) ji = gettime(4) fun = gettime(5) taimu = "sound"+nen+"-"+gatu+"-"+niti+"-"+ji+"-"+fun+".wav" mci "stop sam" mci "save sam \""+taimu+"\" mci "close sam" return
record05-CLEAN.hsp(238)
record05.exe(277)
https://sugiura-ken.org/wiki/