@@ -56,16 +56,17 @@ public void TestProcess()
5656
5757 Assert . IsTrue ( File . Exists ( modelFilePath ) , $ "File.Exists(modelFilePath) --> { modelFilePath } ") ;
5858 keywordPaths . ForEach ( keywordFilePath => Assert . IsTrue ( File . Exists ( keywordFilePath ) , $ "File.Exists(keywordFilePath) --> { keywordFilePath } ") ) ;
59- Console . WriteLine ( keywordPaths ) ;
6059 Porcupine p = new Porcupine ( modelFilePath , keywordPaths : keywordPaths , sensitivities : sensitivities ) ;
61- WAVFile file = new WAVFile ( ) ;
62- file . Open ( "multiple_keywords.wav" , WAVFile . WAVFileMode . READ ) ;
63- Assert . AreEqual ( p . SampleRate ( ) , file . AudioFormat . SampleRateHz , "The samplerate is not equal!!!" ) ;
60+
6461 List < short > data = new List < short > ( ) ;
65- while ( file . NumSamplesRemaining > 0 )
66- {
67- data . Add ( BitConverter . ToInt16 ( file . GetNextSample_ByteArray ( ) ) ) ;
62+ using ( BinaryReader reader = new BinaryReader ( File . Open ( "multiple_keywords.wav" , FileMode . Open ) ) ) {
63+ reader . ReadBytes ( 44 ) ;
64+
65+ while ( reader . BaseStream . Position != reader . BaseStream . Length ) {
66+ data . Add ( reader . ReadInt16 ( ) ) ;
67+ }
6868 }
69+
6970 int framecount = ( int ) Math . Floor ( ( decimal ) ( data . Count / p . FrameLength ( ) ) ) ;
7071 var results = new List < int > ( ) ;
7172 for ( int i = 0 ; i < framecount ; i ++ )
@@ -77,7 +78,6 @@ public void TestProcess()
7778 if ( result >= 0 )
7879 {
7980 results . Add ( result ) ;
80- Console . WriteLine ( result ) ;
8181 }
8282 }
8383
0 commit comments