yum-archive/TaSTT-Whisper

High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model

git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper

KonstantinAPI documentation1da6f30

master
1.7 KiB29 linesraw
1using ComLight;
2using System.Runtime.InteropServices;
3
4namespace Whisper
5{
6	/// <summary>A buffer with a chunk of audio.</summary>
7	/// <remarks>Note the interface supports both marshaling directions.<br/>
8	/// You can implement this interface in C#, to supply PCM audio data to the native code.</remarks>
9	/// <seealso href="https://gist.github.com/Const-me/082c8d96eb10b76058c5dd9c68b5bfe1" />
10	[ComInterface( "013583aa-c9eb-42bc-83db-633c2c317051", eMarshalDirection.BothWays )]
11	public interface iAudioBuffer: IDisposable
12	{
13		/// <summary>Count of samples in the buffer, equal to ( length in seconds ) * 16000</summary>
14		int countSamples();
15
16		/// <summary>Unmanaged pointer to the internal buffer with single-channel <c>float</c> PCM samples @ 16 kHz sample rate.</summary>
17		/// <remarks>If you implementing this interface in C# and your audio data is on the managed heap, use <see cref="GCHandle" /> to make sure it doesn't move.<br/>
18		/// Or better yet, move the data to unmanaged buffer allocated with <see cref="Marshal.AllocHGlobal(int)" /> or <see cref="Marshal.AllocCoTaskMem(int)" /> method.</remarks>
19		IntPtr getPcmMono();
20
21		/// <summary>Unmanaged pointer to the internal buffer with interleaved stereo <c>float</c> PCM samples @ 16 kHz sample rate.</summary>
22		/// <remarks>When the buffer doesn’t have stereo data, the method should return <see cref="IntPtr.Zero" />.</remarks>
23		IntPtr getPcmStereo();
24
25		/// <summary>Start time of the buffer, relative to the start of the media.</summary>
26		/// <remarks>The value is used to produce timestamps in <see cref="sSegment.time" /> and <see cref="sToken.time" /> fields.</remarks>
27		void getTime( out TimeSpan time );
28	}
29}