packages feed

silero-vad 0.1.0.0 → 0.1.0.1

raw patch · 4 files changed

+1/−207 lines, 4 files

Files

− cbits/silero/detector.h
@@ -1,35 +0,0 @@-#ifndef SILERO_DETECTOR_H-#define SILERO_DETECTOR_H--#include <stdio.h>-#include "model.h"-#include "math.h"-#include "../vec.h"--struct SpeechSegment {-  int start_index;-  int end_index;-  float start_time;-  float end_time;-};--struct VoiceDetector {-  struct SileroModel *model;-  float start_threshold;-  float end_threshold;-  float min_speech_samples;-  float max_speech_samples;-  float speech_pad_samples;-  float min_silence_samples;-  float min_silence_samples_at_max_speech;-};--void detect_segments(-  struct VoiceDetector *vad,-  const size_t samples_length,-  const float *samples,-  size_t *out_segments_length,-  struct SpeechSegment **out_segments-);--#endif
− cbits/silero/model.h
@@ -1,33 +0,0 @@-#ifndef SILERO_MODEL_H-#define SILERO_MODEL_H--#include "../../lib/onnxruntime/onnxruntime_c_api.h"--#define WINDOW_LENGTH 512-#define WINDOW_BYTES WINDOW_LENGTH * sizeof(float)--#define SAMPLE_RATE 16000--int64_t get_window_length();-int64_t get_sample_rate();--struct SileroModel-{-  const struct OrtApi *api;-  OrtEnv *env;-  OrtSessionOptions *session_options;-  OrtSession *session;-  OrtMemoryInfo *memory_info;-  float *state;-  float *context;-  float *buffer;-  int64_t input_shape[2];-  bool is_first_run;-};--struct SileroModel *load_model(OrtApiBase *(*ortGetApiBase)(), const void *model_path);-void release_model(struct SileroModel *model);-void reset_model(struct SileroModel *model);-float detect_speech(struct SileroModel *model, const float *samples);--#endif
− cbits/vec.h
@@ -1,129 +0,0 @@-/*-BSD 3-Clause License--Copyright (c) 2024, Mashpoe-All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:--1. Redistributions of source code must retain the above copyright notice, this-   list of conditions and the following disclaimer.--2. Redistributions in binary form must reproduce the above copyright notice,-   this list of conditions and the following disclaimer in the documentation-   and/or other materials provided with the distribution.--3. Neither the name of the copyright holder nor the names of its-   contributors may be used to endorse or promote products derived from-   this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-*/--#ifndef vec_h-#define vec_h--#ifdef __cpp_decltype-#include <type_traits>-#define typeof(T) std::remove_reference<std::add_lvalue_reference<decltype(T)>::type>::type-#endif--#ifdef __cplusplus-extern "C" {-#endif--#include <stdbool.h>-#include <stdlib.h>--#define vector(type) type *--// generic type for internal use-typedef void* vector;-// number of elements in a vector-typedef size_t vec_size_t;-// number of bytes for a type-typedef size_t vec_type_t;--// TODO: more rigorous check for typeof support with different compilers-#if _MSC_VER == 0 || __STDC_VERSION__ >= 202311L || defined __cpp_decltype--// shortcut defines--// vec_addr is a vector* (aka type**)-#define vector_add_dst(vec_addr)\-	((typeof(*vec_addr))(\-	    _vector_add_dst((vector*)vec_addr, sizeof(**vec_addr))\-	))-#define vector_insert_dst(vec_addr, pos)\-	((typeof(*vec_addr))(\-	    _vector_insert_dst((vector*)vec_addr, sizeof(**vec_addr), pos)))--#define vector_add(vec_addr, value)\-	(*vector_add_dst(vec_addr) = value)-#define vector_insert(vec_addr, pos, value)\-	(*vector_insert_dst(vec_addr, pos) = value)--#else--#define vector_add_dst(vec_addr, type)\-	((type*)_vector_add_dst((vector*)vec_addr, sizeof(type)))-#define vector_insert_dst(vec_addr, type, pos)\-	((type*)_vector_insert_dst((vector*)vec_addr, sizeof(type), pos))--#define vector_add(vec_addr, type, value)\-	(*vector_add_dst(vec_addr, type) = value)-#define vector_insert(vec_addr, type, pos, value)\-	(*vector_insert_dst(vec_addr, type, pos) = value)--#endif--// vec is a vector (aka type*)-#define vector_erase(vec, pos, len)\-	(_vector_erase((vector)vec, sizeof(*vec), pos, len))-#define vector_remove(vec, pos)\-	(_vector_remove((vector)vec, sizeof(*vec), pos))--#define vector_reserve(vec_addr, capacity)\-	(_vector_reserve((vector*)vec_addr, sizeof(**vec_addr), capacity))--#define vector_copy(vec)\-	(_vector_copy((vector)vec, sizeof(*vec)))--vector vector_create(void);--void vector_free(vector vec);--void* _vector_add_dst(vector* vec_addr, vec_type_t type_size);--void* _vector_insert_dst(vector* vec_addr, vec_type_t type_size, vec_size_t pos);--void _vector_erase(vector vec_addr, vec_type_t type_size, vec_size_t pos, vec_size_t len);--void _vector_remove(vector vec_addr, vec_type_t type_size, vec_size_t pos);--void vector_pop(vector vec);--void _vector_reserve(vector* vec_addr, vec_type_t type_size, vec_size_t capacity);--vector _vector_copy(vector vec, vec_type_t type_size);--vec_size_t vector_size(vector vec);--vec_size_t vector_capacity(vector vec);--// closing bracket for extern "C"-#ifdef __cplusplus-}-#endif--#endif /* vec_h */
silero-vad.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           silero-vad-version:        0.1.0.0+version:        0.1.0.1 synopsis:       Voice activity detection powered by SileroVAD. description:    A haskell implentation of SileroVAD, a pre-trained enterprise-grade voice activity detector. category:       Audio, Sound@@ -72,11 +72,8 @@       cbits   c-sources:       cbits/silero/detector.c-      cbits/silero/detector.h       cbits/silero/model.c-      cbits/silero/model.h       cbits/vec.c-      cbits/vec.h   build-depends:       base >=4.14.3.0 && <5     , derive-storable >=0.3.0.0 && <1@@ -130,11 +127,8 @@       cbits   c-sources:       cbits/silero/detector.c-      cbits/silero/detector.h       cbits/silero/model.c-      cbits/silero/model.h       cbits/vec.c-      cbits/vec.h   build-tool-depends:       markdown-unlit:markdown-unlit   build-depends:@@ -194,11 +188,8 @@       cbits   c-sources:       cbits/silero/detector.c-      cbits/silero/detector.h       cbits/silero/model.c-      cbits/silero/model.h       cbits/vec.c-      cbits/vec.h   build-depends:       WAVE ==0.1.*     , base >=4.14.3.0 && <5