Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/math3ussdl/Plugin.Maui.AudioRecorder
This plugin provides functionality to record audio and transcribe spoken text into written format in real-time, while saving the audio file. It is designed for use with .NET Multi-platform App UI (MAUI) framework.
https://github.com/math3ussdl/Plugin.Maui.AudioRecorder
android audio audio-processing ios macos maui tizen windows
Last synced: 30 days ago
JSON representation
This plugin provides functionality to record audio and transcribe spoken text into written format in real-time, while saving the audio file. It is designed for use with .NET Multi-platform App UI (MAUI) framework.
- Host: GitHub
- URL: https://github.com/math3ussdl/Plugin.Maui.AudioRecorder
- Owner: math3ussdl
- License: agpl-3.0
- Created: 2023-04-27T15:52:03.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-09T19:25:06.000Z (over 1 year ago)
- Last Synced: 2024-08-03T17:13:32.851Z (4 months ago)
- Topics: android, audio, audio-processing, ios, macos, maui, tizen, windows
- Language: C#
- Homepage:
- Size: 26.4 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-dotnet-maui - Plugin.Maui.AudioRecorder - time, while saving the audio file.|[![GitHub stars](https://img.shields.io/github/stars/math3ussdl/Plugin.Maui.AudioRecorder?style=flat-square)](https://github.com/math3ussdl/Plugin.Maui.AudioRecorder/stargazers)|[![GitHub last-commit](https://img.shields.io/github/last-commit/math3ussdl/Plugin.Maui.AudioRecorder?style=flat-square)](https://github.com/math3ussdl/Plugin.Maui.AudioRecorder/commits) (Plugins)
README
# Plugin.Maui.AudioRecorder
## Overview
This plugin provides functionality to record audio and transcribe spoken text into written format in real-time, while saving the audio file. It is designed for use with .NET Multi-platform App UI (MAUI) framework.## Features
* Record audio from device microphone
* Real-time transcription of spoken text to written format
* Ability to save the audio file with transcription## Installation
1 - Install the NuGet package ```Plugin.Maui.AudioRecorder```
2 - In your .NET MAUI project, add the following using statement to ```MauiProgram.cs``` file to use this plugin:
```csharp
using Plugin.Maui.AudioRecorder;
```
3 - Add this plugin to the ```MauiApp``` pipeline:
```csharp
builder
// ...
.UseAudioRecorder()
// ...
```
4 - Enjoy it!## Usage
## Inject the Audio service
First of all, you must inject the ```IAudioRecorder``` service, remembering that in this example we will consider a class that uses MVVM with the CommunityToolkit.Mvvm module.
```csharp
using CommunityToolkit.Mvvm.ComponentModel;
using Plugin.Maui.AudioRecorder;namespace MyAwesomeProject.ViewModels;
[ObservableObject]
public partial class RecordingPageViewModel
{
private readonly IAudioRecorder _audioRecorderService;public RecordingPageViewModel(IAudioRecorder audioRecorderService)
{
_audioRecorderService = audioRecorderService;
}[ObservableProperty]
private bool isRecording;// ...
}
```
If you prefer, you can call the instance as follows:
```csharp
var audioRecorderService = Services.GetService(typeof(IAudioRecorder)) as IAudioRecorder;// ...
```### Start Recording
To start the recording we offer the ```StartRecordAsync``` method, which can be called in two ways:* Without parameters: In this way we only save the audio in the chosen path, i.e. we do not transcribe the audio for you.
```csharp
[RelayCommand]
private async void HandleRecord()
{
// Setting the path of the file
_audioRecorderService.FilePath = Path.Combine("/storage/emulated/0/Download", fileName);await audioService.StartRecordAsync();
}
```* With parameters: If you want us to return to you, in addition to saving the audio, the transcribed text, you will need to pass three arguments to this method: An ```CultureInfo``` instance so we know what language your input audio will be, an ```IProgress``` instance, so you decide how the text will be processed, and a ```CancellationToken```, standard for asynchronous methods.
```csharp
[RelayCommand]
private async void HandleRecord()
{
// Setting the path of the file
_audioRecorderService.FilePath = Path.Combine("/storage/emulated/0/Download", fileName);await _audioService.StartRecordAsync(
CultureInfo.GetCultureInfo("en-us"),
new Progress(partialText =>
{
// ...
}),
CancellationToken.None,
);
}
```### Stop Recording
To stop the recording we offer the ```StopRecordAsync``` method:
```csharp
[RelayCommand]
private async void HandleStopRecord()
{
// will returns a Audio instance!
var audio = await _audioService.StopRecordAsync();
}
```## Limitations
* Transcription accuracy may vary depending on factors such as background noise, speaker accent, and speech speed.
* This plugin only works on android. If you want, you can add support for other platforms via PRs.## License
This plugin is released under the GNU AFFERO GENERAL PUBLIC License. See the LICENSE file for details.