question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Framework for audio playback

See original GitHub issue

Description

Currently, Maui does not have any audio playback framework. Implementing such an API is relatively simple. However, I noticed that in places like Stackoverflow there are many examples for Xamarin that have memory leaks and other bugs for various reasons. I know that now, when we are approaching the release, it is quite late to add such a large interface, but I think that it is worth considering as part of long-term plans in order to systematize some assumptions.

API content

I think the first step should be classes that allow to:

  • Play, pause, stop audio,
  • Set position, playback volume,
  • Implement custom, low-level filters on the stream.

Then we might consider adding:

  • Changing the pitch, panorama of the sound played,
  • Recording audio from a microphone,

The most important difficulties

Windows, iOS, Mac, and Android all have different sets of audio formats supported by default. For example, iOS does not natively support the OGG format. Interfaces returning a list of supported codecs / containers and good documentation would be necessary.

If this proposal is accepted, I will gladly implement it.

Public API Changes

We should add custom interface, something like Microsoft.Maui.Media.Audio

Intended Use-Case

Many apps use simple audio for informing users about in-app events. Implementing that option in Maui would simplify the work needed and encourage more developers to use this.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:15
  • Comments:10

github_iconTop GitHub Comments

3reactions
jcmontoyacommented, May 21, 2022

.Net MAUI is in RC Status. in my opinion not having any supported sound library should be addressed. We can use essentials to play a sound using the launcher functionality. But if all I need is a beep in my app, that is not really a good user experience. I know there is already some ideas in the pipeline, but Sound and Media (Camera/Scanner) is a must for all platforms… at least in today’s world.

0reactions
jones-web-consultingcommented, May 5, 2023

This is a needed feature. There are tutorials on YouTube (eg. https://youtu.be/3jcVYUE-Tww) featuring MSFT employees such as @jamesmontemagno demonstrating the creation of games. While MAUI wouldn’t be a good solution for most games, basic games, such as card games could be developed using .Net MAUI. Even with these videos describing the creation of real-time games, there is no way to play sounds within .Net MAUI. Without the ability to play sounds, using MAUI for basic games is not practical. Games require sounds. There’s no reason why .Net MAUI couldn’t work as a solution for 2D games, like Solitaire.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Audio Playback DAC Framework Module Guide
The Audio Playback Framework handles synchronization to play mono 16-bit pulse-code modulation (PCM) samples.
Read more >
Audio Toolbox | Apple Developer Documentation
The AudioToolbox framework provides interfaces for recording, playback, and stream parsing. In iOS, the framework provides additional interfaces for ...
Read more >
Audio
Apple platforms provide a comprehensive set of audio frameworks and ... Play audio files in your apps with APIs such as Media Player...
Read more >
howler.js - JavaScript audio library for the modern web
Easily define and control segments of files with audio sprites for more precise playback and lower resources. Spatial Audio. Whether a simple stereo...
Read more >
Which framework for audio playback in WPF?
1 Answer 1 ... Multiple playbacks are supported. You can optionally create a mixer, to have one playback and mix different inputs in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found