-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add audio service to transcribe local mp3/wav file #566
add audio service to transcribe local mp3/wav file #566
Conversation
#if DEBUG | ||
[AllowAnonymous] | ||
#endif | ||
[Route("[controller]/text/[action]")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this to specific function.
_audioService = audioService; | ||
} | ||
|
||
[HttpGet] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[HttGet("audio/transcript"]
|
||
public Stream ConvertMp3ToStream(string mp3FileName) | ||
{ | ||
var fileStream = File.OpenRead(mp3FileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to using var fileStream =
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on my local. Adding "using" statement at the beginning will result in a disposed "fileStream" if SampleRate is 16000. The value returned by this function will not contain any data.
public Stream ConvertMp3ToStream(string mp3FileName) | ||
{ | ||
var fileStream = File.OpenRead(mp3FileName); | ||
var reader = new Mp3FileReader(fileStream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using var reader =
public class AudioInput | ||
{ | ||
public string FilePath { get; set; } | ||
public Stream stream { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upper case Stream
No description provided.