return str.toString().trim();\r
}\r
\r
- public List<WhisperSegment> fullTranscribeWithTime(WhisperFullParams whisperParams, float[] audioData) throws IOException {\r
+ /**\r
+ * Full transcribe with time list.\r
+ *\r
+ * @param whisperParams the whisper params\r
+ * @param audioData the audio data\r
+ * @return the list\r
+ * @throws IOException the io exception\r
+ */\r
+ public List<WhisperSegment> fullTranscribeWithTime(WhisperFullParams.ByValue whisperParams, float[] audioData) throws IOException {\r
if (ctx == null) {\r
throw new IllegalStateException("Model not initialised");\r
}\r
\r
- WhisperFullParams.ByValue valueParams = new WhisperFullParams.ByValue(\r
- lib.whisper_full_default_params_by_ref(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH.ordinal()));\r
- valueParams.read();\r
-\r
- if (lib.whisper_full(ctx, valueParams, audioData, audioData.length) != 0) {\r
+ if (lib.whisper_full(ctx, whisperParams, audioData, audioData.length) != 0) {\r
throw new IOException("Failed to process audio");\r
}\r
\r
int nSegments = lib.whisper_full_n_segments(ctx);\r
List<WhisperSegment> segments= new ArrayList<>(nSegments);\r
\r
-\r
for (int i = 0; i < nSegments; i++) {\r
long t0 = lib.whisper_full_get_segment_t0(ctx, i);\r
String text = lib.whisper_full_get_segment_text(ctx, i);\r
float[] floats = new float[b.length / 2];\r
\r
//WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
- WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
+ WhisperFullParams.ByValue params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
params.setProgressCallback((ctx, state, progress, user_data) -> System.out.println("progress: " + progress));\r
params.print_progress = CBool.FALSE;\r
//params.initial_prompt = "and so my fellow Americans um, like";\r