正在显示
2 个修改的文件
包含
28 行增加
和
1 行删除
| 1 | -../../../../../../../../../SherpaOnnx/app/src/main/java/com/k2fsa/sherpa/onnx/WaveReader.kt |
| 1 | +package com.k2fsa.sherpa.onnx | ||
| 2 | + | ||
| 3 | +import android.content.res.AssetManager | ||
| 4 | + | ||
| 5 | +class WaveReader { | ||
| 6 | + companion object { | ||
| 7 | + // Read a mono wave file asset | ||
| 8 | + // The returned array has two entries: | ||
| 9 | + // - the first entry contains an 1-D float array | ||
| 10 | + // - the second entry is the sample rate | ||
| 11 | + external fun readWaveFromAsset( | ||
| 12 | + assetManager: AssetManager, | ||
| 13 | + filename: String, | ||
| 14 | + ): Array<Any> | ||
| 15 | + | ||
| 16 | + // Read a mono wave file from disk | ||
| 17 | + // The returned array has two entries: | ||
| 18 | + // - the first entry contains an 1-D float array | ||
| 19 | + // - the second entry is the sample rate | ||
| 20 | + external fun readWaveFromFile( | ||
| 21 | + filename: String, | ||
| 22 | + ): Array<Any> | ||
| 23 | + | ||
| 24 | + init { | ||
| 25 | + System.loadLibrary("sherpa-onnx-jni") | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | +} |
-
请 注册 或 登录 后发表评论