@@ -56,16 +56,17 @@ public void TestProcess()
56
56
57
57
Assert . IsTrue ( File . Exists ( modelFilePath ) , $ "File.Exists(modelFilePath) --> { modelFilePath } ") ;
58
58
keywordPaths . ForEach ( keywordFilePath => Assert . IsTrue ( File . Exists ( keywordFilePath ) , $ "File.Exists(keywordFilePath) --> { keywordFilePath } ") ) ;
59
- Console . WriteLine ( keywordPaths ) ;
60
59
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
+
64
61
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
+ }
68
68
}
69
+
69
70
int framecount = ( int ) Math . Floor ( ( decimal ) ( data . Count / p . FrameLength ( ) ) ) ;
70
71
var results = new List < int > ( ) ;
71
72
for ( int i = 0 ; i < framecount ; i ++ )
@@ -77,7 +78,6 @@ public void TestProcess()
77
78
if ( result >= 0 )
78
79
{
79
80
results . Add ( result ) ;
80
- Console . WriteLine ( result ) ;
81
81
}
82
82
}
83
83
0 commit comments