Skip to content
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

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

evan-cao-wb
Copy link
Collaborator

No description provided.

@evan-cao-wb evan-cao-wb self-assigned this Jul 29, 2024
#if DEBUG
[AllowAnonymous]
#endif
[Route("[controller]/text/[action]")]
Copy link
Contributor

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]
Copy link
Contributor

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);
Copy link
Contributor

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 =

Copy link
Collaborator Author

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);
Copy link
Contributor

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; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upper case Stream

@Oceania2018 Oceania2018 merged commit e497233 into SciSharp:master Jul 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants