@@ -185,13 +185,17 @@ private static void Run(Options options)
185185 config . Model . Debug = options . Debug ;
186186 config . Model . Provider = "cpu" ;
187187 config . RuleFsts = options . RuleFsts ;
188- config . MaxNumSentences = options . MaxNumSentences ;
189-
190- var tts = new OfflineTts ( config ) ;
191- var speed = 1.0f / options . LengthScale ;
192- var sid = options . SpeakerId ;
193-
194- Console . WriteLine ( PortAudio . VersionInfo . versionText ) ;
188+ config . MaxNumSentences = options . MaxNumSentences ;
189+
190+ var tts = new OfflineTts ( config ) ;
191+ var speed = 1.0f / options . LengthScale ;
192+ var sid = options . SpeakerId ;
193+ OfflineTtsGenerationConfig genConfig = new OfflineTtsGenerationConfig ( ) ;
194+ genConfig . Sid = sid ;
195+ genConfig . Speed = speed ;
196+ genConfig . SilenceScale = 0.2f ;
197+
198+ Console . WriteLine ( PortAudio . VersionInfo . versionText ) ;
195199 PortAudio . Initialize ( ) ;
196200 Console . WriteLine ( $ "Number of devices: { PortAudio . DeviceCount } ") ;
197201
@@ -224,11 +228,11 @@ private static void Run(Options options)
224228 // https://learn.microsoft.com/en-us/dotnet/standard/collections/thread-safe/blockingcollection-overview
225229 var dataItems = new BlockingCollection < float [ ] > ( ) ;
226230
227- var myCallback = ( IntPtr samples , int n ) =>
228- {
229- float [ ] data = new float [ n ] ;
230-
231- Marshal . Copy ( samples , data , 0 , n ) ;
231+ var myCallback = ( IntPtr samples , int n , float progress , IntPtr arg ) =>
232+ {
233+ float [ ] data = new float [ n ] ;
234+
235+ Marshal . Copy ( samples , data , 0 , n ) ;
232236
233237 dataItems . Add ( data ) ;
234238
@@ -314,10 +318,10 @@ IntPtr userData
314318
315319 stream . Start ( ) ;
316320
317- var callback = new OfflineTtsCallback ( myCallback ) ;
318-
319- var audio = tts . GenerateWithCallback ( options . Text , speed , sid , callback ) ;
320- var ok = audio . SaveToWaveFile ( options . OutputFilename ) ;
321+ var callback = new OfflineTtsCallbackProgressWithArg ( myCallback ) ;
322+
323+ var audio = tts . GenerateWithConfig ( options . Text , genConfig , callback ) ;
324+ var ok = audio . SaveToWaveFile ( options . OutputFilename ) ;
321325
322326 if ( ok )
323327 {
0 commit comments