From 3f667519a0f89c82447b94e208ae428f6b850150 Mon Sep 17 00:00:00 2001 From: opera7133 Date: Fri, 17 Mar 2023 23:36:45 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=97=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F=E3=81=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dll/check.cs | 1 + dll/check.exe | Bin 4096 -> 4096 bytes dll/client.exe | Bin 5120 -> 5120 bytes dll/server.cs | 44 ++++++++++++++++------ dll/server.exe | Bin 8192 -> 9728 bytes main.uka | 99 +++++++++++++++++++++++++++++++++++-------------- 6 files changed, 106 insertions(+), 38 deletions(-) diff --git a/dll/check.cs b/dll/check.cs index 076b692..a9aa1ab 100644 --- a/dll/check.cs +++ b/dll/check.cs @@ -1,3 +1,4 @@ +using System.Text.RegularExpressions; using AI.Talk.Editor.Api; // csc /r:"C:\Program Files/\AI/\AIVoice/\AIVoiceEditor/\AI.Talk.Editor.Api.dll" diff --git a/dll/check.exe b/dll/check.exe index c32d3a4f93ca26729dac478de5246b741c3e6403..1382c32b95eb6c2522c6a4ce10142e455589a61b 100644 GIT binary patch delta 35 rcmZorXi%8Y!F0W9W7j(tf%p$^HZCsKc3o~}dX3e`nQe0iYXuho8Ica3 delta 35 rcmZorXi%8Y!4#XkvFja+KtqzEQPa$&{vC2w$2v4CmTc}|t>6Lx_R0;> diff --git a/dll/client.exe b/dll/client.exe index 662625e1c0f59b6675eebf790453920e3ed4a253..59962b59446960d0581849df7f0b93167023652e 100644 GIT binary patch delta 35 tcmV+;0Nnq8D1a!ChyvVtv5K|{5Y+O=Ky*e+MU_gt?48eNcB`z*WKa$Z2@e$M6qt__?36Ri)J diff --git a/dll/server.cs b/dll/server.cs index ac68221..4b34b67 100644 --- a/dll/server.cs +++ b/dll/server.cs @@ -213,6 +213,9 @@ public string GetCharList() } } + // arg: string + // 形式:"ボイス名,音量,話速,高さ,抑揚,短ポーズ(ms),長ポーズ(ms),喜び,怒り,悲しみ" + // 例 :"結月 ゆかり,1,1.2,1,1,150,370,0,0,0,こんにちは" public void talk(string arg) { pTtsControl = new TtsControl(); @@ -229,23 +232,42 @@ public void talk(string arg) char[] sep = new char[] { ',' }; string[] head = arg.Split(sep, 2); string CharPreset = head[0]; - pTtsControl.CurrentVoicePresetName = CharPreset; + string[] presets = pTtsControl.VoicePresetNames; + bool result = Array.Exists(presets, preset => preset == CharPreset + " 伺か一時プリセット"); + if (!result) + { + Match VoiceName = Regex.Match(pTtsControl.GetVoicePreset(CharPreset), "\"VoiceName\":\"([^\"]*)\""); + var initPreset = new Dictionary(){ + {"PresetName", CharPreset + " 伺か一時プリセット"}, + {"VoiceName", VoiceName.Groups[1].Value}, + }; + pTtsControl.AddVoicePreset(JsonConvert.SerializeObject(initPreset)); + } + pTtsControl.CurrentVoicePresetName = CharPreset + " 伺か一時プリセット"; Program.TalkingChar = CharPreset; Console.WriteLine("Char = " + CharPreset); - string[] Options = arg.Split(sep, 6); + string[] Options = arg.Split(sep, 11); - //共通項が4 - var masterControl = new Dictionary(){ - {"Volume", Convert.ToDouble(Options[1])}, - {"Speed", Convert.ToDouble(Options[2])}, - {"Pitch", Convert.ToDouble(Options[3])}, - {"PitchRange", Convert.ToDouble(Options[4])} - }; - pTtsControl.MasterControl = JsonConvert.SerializeObject(masterControl, Formatting.Indented); + //共通項が9 + string CurrentPreset = "{"; + //多次元連想配列の作り方がわからない + CurrentPreset += "\"PresetName\":\"" + CharPreset + " 伺か一時プリセット" + "\","; + CurrentPreset += "\"Volume\":" + Convert.ToDouble(Options[1]) + ","; + CurrentPreset += "\"Speed\":" + Convert.ToDouble(Options[2]) + ","; + CurrentPreset += "\"Pitch\":" + Convert.ToDouble(Options[3]) + ","; + CurrentPreset += "\"PitchRange\":" + Convert.ToDouble(Options[4]) + ","; + CurrentPreset += "\"MiddlePause\":" + Convert.ToDouble(Options[5]) + ","; + CurrentPreset += "\"LongPause\":" + Convert.ToDouble(Options[6]) + ","; + CurrentPreset += "\"Styles\":[{\"Name\":\"J\", \"Value\":" + Convert.ToDouble(Options[7]) + "},"; + CurrentPreset += "{\"Name\":\"A\", \"Value\":" + Convert.ToDouble(Options[8]) + "},"; + CurrentPreset += "{\"Name\":\"S\", \"Value\":" + Convert.ToDouble(Options[9]) + "}]"; + CurrentPreset += "}"; + + pTtsControl.SetVoicePreset(CurrentPreset); string[] MySep = { "MySep" }; - string VoiceText = Options[5]; + string VoiceText = Options[10]; //バルーン空打ち対策 string CheckText = VoiceText; diff --git a/dll/server.exe b/dll/server.exe index cc225bed25f965d8c31cd99947c244e4480ef81a..98f949a413218573d00a89a556bdd1a632c054ad 100644 GIT binary patch delta 3011 zcmb7Gdu$xV8UN;P_n!9p=GM38#CP`P;=sjcyXOEYjT4gCj?z#kHe6yrkeJJPn;cxc z$L_i$xaLf&K72IZ_dRB3W^ZB3!q}5P&i?M9_GxN7=gG&SEJ~CD5c0s8p<^#jDybo& zaRF>0Iwu`lr8=wFRK)HCl0i#3kFq@La(=p`+ak57@0pJs^wNgpW_gbJOz4TC((Hrg<)sK z;Y^J=?*+f%=bSq&p{&~vhLZI-k89n1&+vHEAM7xCz;EHPkam1tc=pYqPRUpUv^C6Q zmjfysS=Wh3$Sck?## z&=b^u6KdJ$!!&91LmC4@G}LOK5hjrPnt%%sSUESzE1h~i+l96PFUVq@KKVSjw_Jl% zhmAkj9d#>LL#CfmO%3y~8N}c-pKCDAt%EzEQPq`4Q9M)IdAr8d=Xrb5+zbN@I(R5~ zJa+>OAM1t%kQL_l5fg*ljn}5vU4F62?^q_^rRz=lisjPlBK-%O{FTe)3%b*!cP^V= z2mjS3KecQ==x;aa>813j?<*G{i&syY+%v+<>smfPX>MxLyTeQQl_l{_1Ax2r)Uda0 z>pX1SBsOaDs3JC1f+sZ7a%l-Q!b9DW<7$*g)fV1j;yl!HIDrxEG84yc!wK92jqPtF zmOAk^UP5i&5<4w1of;0&z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b/main.uka @@ -95,19 +95,29 @@ OnOtherGhostTalk { _Char = TalkCharacter( TalkingGhost ) if ( _Char != "" ) { _noSpaceChar = REPLACE(_Char, " ", "") - EVAL( "_Volume = AIVOICE.%(_noSpaceChar).Volume" ) - EVAL( "_Speed = AIVOICE.%(_noSpaceChar).Speed" ) - EVAL( "_Pitch = AIVOICE.%(_noSpaceChar).Pitch" ) - EVAL( "_PitchRange = AIVOICE.%(_noSpaceChar).PitchRange" ) - - if ( _Volume == "" ) { _Volume = 1 } - if ( _Speed == "" ) { _Speed = 1 } - if ( _Pitch == "" ) { _Pitch = 1 } - if ( _PitchRange == "" ) { _PitchRange = 1 } + EVAL( "_Volume = AIVOICE.%(_noSpaceChar).Volume" ) + EVAL( "_Speed = AIVOICE.%(_noSpaceChar).Speed" ) + EVAL( "_Pitch = AIVOICE.%(_noSpaceChar).Pitch" ) + EVAL( "_PitchRange = AIVOICE.%(_noSpaceChar).PitchRange" ) + EVAL( "_MiddlePause = AIVOICE.%(_noSpaceChar).MiddlePause" ) + EVAL( "_LongPause = AIVOICE.%(_noSpaceChar).LongPause" ) + EVAL( "_StyleJ = AIVOICE.%(_noSpaceChar).StyleJ" ) + EVAL( "_StyleA = AIVOICE.%(_noSpaceChar).StyleA" ) + EVAL( "_StyleS = AIVOICE.%(_noSpaceChar).StyleS" ) + + if ( _Volume == "" ) { _Volume = 1 } + if ( _Speed == "" ) { _Speed = 1.2 } + if ( _Pitch == "" ) { _Pitch = 1 } + if ( _PitchRange == "" ) { _PitchRange = 1 } + if ( _MiddlePause == "" ) { _MiddlePause = 150 } + if ( _LongPause == "" ) { _LongPause = 370 } + if ( _StyleJ == "" ) { _StyleJ = 0 } + if ( _StyleA == "" ) { _StyleA = 0 } + if ( _StyleS == "" ) { _StyleS = 0 } _Script = reference[4] _VoiceText = TalkText( _Script ) - _args = "%(_Char),%(_Volume),%(_Speed),%(_Pitch),%(_PitchRange),%(_VoiceText)" + _args = "%(_Char),%(_Volume),%(_Speed),%(_Pitch),%(_PitchRange),%(_MiddlePause),%(_LongPause),%(_StyleJ),%(_StyleA),%(_StyleS),%(_VoiceText)" //Char = _Char //args = _args @@ -173,9 +183,9 @@ TalkText { //_text = RE_REPLACE( _text , '\\u' , "GhostName" ) // 名前置き換え - //_text = RE_REPLACE( _text , '\\![embed,On_一人称]' , "\![embed,On_一人称]") - //_text = RE_REPLACE( _text , '\\!\[embed,On_ユーザ名\]' , "\![embed,On_ユーザ名]") - + //_text = REPLACE( _text , '\![embed,On_一人称]' , "私") + //_text = REPLACE( _text , '\![embed,On_ユーザ名]' , "マスター") + //サクラスクリプト除去 _text = RE_REPLACE( _text , '\\__.\[.*?\]' , "" ) _text = RE_REPLACE( _text , '\\_.\[.*?\]' , "" ) @@ -250,6 +260,8 @@ TalkText { _text = REPLACE( _text , '!?!?' , '!?' ) _text = REPLACE( _text , '?!?!' , '?!' ) + _text = REPLACE( _text , '-----------', '') + if (SUBSTR(_text,0,1) == "。") { _text = ERASE(_text,0,1) } @@ -263,19 +275,37 @@ OnAIVOICE.CharConfigMenu { _Char = reference[0] _noSpaceChar = REPLACE(_Char, " ", "") - EVAL( "_Volume = AIVOICE.%(_noSpaceChar).Volume" ) - EVAL( "_Speed = AIVOICE.%(_noSpaceChar).Speed" ) - EVAL( "_Pitch = AIVOICE.%(_noSpaceChar).Pitch" ) - EVAL( "_PitchRange = AIVOICE.%(_noSpaceChar).PitchRange" ) - if ( _Volume == "" ) { _Volume = 1 } - if ( _Speed == "" ) { _Speed = 1.2 } - if ( _Pitch == "" ) { _Pitch = 1 } - if ( _PitchRange == "" ) { _PitchRange = 1 } + EVAL( "_Volume = AIVOICE.%(_noSpaceChar).Volume" ) + EVAL( "_Speed = AIVOICE.%(_noSpaceChar).Speed" ) + EVAL( "_Pitch = AIVOICE.%(_noSpaceChar).Pitch" ) + EVAL( "_PitchRange = AIVOICE.%(_noSpaceChar).PitchRange" ) + EVAL( "_MiddlePause = AIVOICE.%(_noSpaceChar).MiddlePause" ) + EVAL( "_LongPause = AIVOICE.%(_noSpaceChar).LongPause" ) + EVAL( "_StyleJ = AIVOICE.%(_noSpaceChar).StyleJ" ) + EVAL( "_StyleA = AIVOICE.%(_noSpaceChar).StyleA" ) + EVAL( "_StyleS = AIVOICE.%(_noSpaceChar).StyleS" ) + + if ( _Volume == "" ) { _Volume = 1 } + if ( _Speed == "" ) { _Speed = 1.2 } + if ( _Pitch == "" ) { _Pitch = 1 } + if ( _PitchRange == "" ) { _PitchRange = 1 } + if ( _MiddlePause == "" ) { _MiddlePause = 150 } + if ( _LongPause == "" ) { _LongPause = 370 } + if ( _StyleJ == "" ) { _StyleJ = 0 } + if ( _StyleA == "" ) { _StyleA = 0 } + if ( _StyleS == "" ) { _StyleS = 0 } + _AIVOICE.MainOptions = "/ - \![*]\q[%(_Volume ) : Volume ,OnAIVOICE.CharOption,%(_Char),Volume]\n/ - \![*]\q[%(_Speed ) : Speed ,OnAIVOICE.CharOption,%(_Char),Speed]\n/ - \![*]\q[%(_Pitch ) : Pitch ,OnAIVOICE.CharOption,%(_Char),Pitch]\n/ - \![*]\q[%(_PitchRange) : PitchRange,OnAIVOICE.CharOption,%(_Char),PitchRange]\n/ + \![*]\q[%(_Volume ) : Volume ,OnAIVOICE.CharOption,%(_Char),Volume]\n/ + \![*]\q[%(_Speed ) : Speed ,OnAIVOICE.CharOption,%(_Char),Speed]\n/ + \![*]\q[%(_Pitch ) : Pitch ,OnAIVOICE.CharOption,%(_Char),Pitch]\n/ + \![*]\q[%(_PitchRange ) : PitchRange ,OnAIVOICE.CharOption,%(_Char),PitchRange]\n/ + \![*]\q[%(_MiddlePause) : MiddlePause,OnAIVOICE.CharOption,%(_Char),MiddlePause]\n/ + \![*]\q[%(_LongPause ) : LongPause ,OnAIVOICE.CharOption,%(_Char),LongPause]\n/ + -----------\n/ + \![*]\q[%(_StyleJ ) : StyleJ ,OnAIVOICE.CharOption,%(_Char),StyleJ]\n/ + \![*]\q[%(_StyleA ) : StyleA ,OnAIVOICE.CharOption,%(_Char),StyleA]\n/ + \![*]\q[%(_StyleS ) : StyleS ,OnAIVOICE.CharOption,%(_Char),StyleS]\n/ -----------\n" ////誰が誰にしゃべらせるか。, @@ -332,9 +362,24 @@ OnAIVOICE.SetOption { "0.5から2.0までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" } elseif ( AIVOICE.Option == "PitchRange" && (_num < 0 || 2 < _num) ) { "0.0から2.0までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" + } elseif ( AIVOICE.Option == "MiddlePause" && (_num < 80 || 500 < _num) ) { + "80から500までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" + } elseif ( AIVOICE.Option == "LongPause" && (_num < 80 || 2000 < _num) ) { + "80から2000までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" + } elseif ( AIVOICE.Option == "StyleJ" && (_num < 0 || 1 < _num) ) { + "0.0から1.0までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" + } elseif ( AIVOICE.Option == "StyleA" && (_num < 0 || 1 < _num) ) { + "0.0から1.0までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" + } elseif ( AIVOICE.Option == "StyleS" && (_num < 0 || 1 < _num) ) { + "0.0から1.0までの値を半角で入力してください。\![open,inputbox,OnAIVOICE.SetOption]" } else { - _tempNum = (ROUND(_num*10))/10 - EVAL( "AIVOICE.%(_noSpaceChar).%(AIVOICE.Option) = %(_tempNum)" ) + if ( AIVOICE.Option == "MiddlePause" || AIVOICE.Option == "LongPause" ) { + _tempNum = ROUND(_num) + EVAL( "AIVOICE.%(_noSpaceChar).%(AIVOICE.Option) = %(_tempNum)" ) + } else { + _tempNum = (ROUND(_num*100))/100 + EVAL( "AIVOICE.%(_noSpaceChar).%(AIVOICE.Option) = %(_tempNum)" ) + } //確認のメニューはさっきのを呼びなおす //設定に戻る。 //設定終了