Is it possible to control microphone gain in Flutter? - flutter

I feel like I have searched and tried every audio package out there, but can't find a way to control the microphone gain. I'm building a recording app and theres a big issue when it comes to the volume of the recorded sounds. I don't want to increase the output volume, I want to increase the input volume.
If I understand it correctly, the iOS native API is the AVAudioSession. I found this package that I thought would enable this control, but doesn't seem to offer this functionality. Do I need to write some bridge code to deal with the native APIs for this or is it not even possible?

Related

I am trying to develop a pitch detection feature in flutter and need some suggestion regarding what kind of packages and library to use

A pitch detecting feature where a user records his voice and app should process the audio and tell what is the frequency of the voice. With this knowledge, a musician can use to tune their voice. I found a couple of good resources like ML5 and Tensorflow lite which I like the idea of. I don't have to have my own dataset models, I can see many available models which are basic but gets the job done, but I don't know which one will be best for flutter integration? or even they are compatible to use! Any kind of relevant suggestion will be appreciated.

How to change HLS quality in ijkplayer for flutter or alternative solutions?

Hi can anyone help me with this issue, we decided to use the flutter ijkplayer as it's the only player on flutter that supports the option to change playback speed, but it doesn't have the option to change the hls quality, and neither does any other player as per my findings, if anyone knows please share.
As for what I've tried, I download the file and split it into 4 files with each file having only one video and audio stream and use a button to change the file.
I also tried to look into changing the tracks from master with the player but while FFMpeg does support this, I'm not sure how to do that from flutter.
Currently it works, but the splitting is hardcoded and might need to be changed for different master m3u8(we use vimeo and expect the same file format for master m3u8 but they can change it down the road or we could change service for video), and it would be preferable to change streams from the player itself instead of using an external ui button which for example won't be available in full screen mode, which you would expect most people to watch the video in.
I'm trying to make the splitting part more generalized but would like to know how others handle this problem.
Edit I've made the splitting somewhat dynamic, but I just came across another issue, in ffmpeg(complied in the ijk player it is 4-5 years old not the latest version) I have to use format option - protocol_whitelist,'http, https, tls, file, crypto, tcp, udp, concat' so I can play local file, but the player by default sets the format option - fflags 'fastseek' to allow playing faster than 1, but for some reason that functionality breaks the fastseek, or in other words, if I play local file I can't use speeds greater than 1, which I can on files I play from the internet.
Using this version of flutter ijkplayer github
You can use better player for flutter its good to choose quality
Better Player Flutter

Does Agora.io for Unity provide these features?

I'm a bit lost looking through all the various Agora.io modules (and not sure what it means that only some of them have Unity-specific downloads).
I want to make a Unity app where two remote phones exchange data as follows:
Streaming voice in both directions
Streaming video in one direction (recorded from device camera)
Streaming a small amount of continuously-changing custom data in the other direction (specifically, a position + orientation in a virtual world; probably encoded as 7 floats)
The custom data needs to have low latency but does not need reliability (it's fine if some updates get lost; app only cares about the most recent update). Updates basically every frame.
Ideally I want to support both Android and iOS.
I started looking at Agora video (successfully built a test project) and it seems like it will cover the voice and video, but I'm struggling to find a good way to send the custom data (position + orientation). It's probably theoretically possible to encode it as a custom video feed but that sounds complex and inefficient. Is there some out-of-band signalling mechanism I could use to send some extra data alongside/instead of a video?
Agora real-time messaging sounds like it would probably work for this, but I can't seem to find any info about integrating it with Unity (either on Agora's web site or in a general web search). Can I roll this in somehow?
Agora interactive gaming could maybe also be relevant? The overview doesn't seem real clear about how it's different from regular Agora video. I suspect it's overkill but that might be fine if there isn't a large performance cost.
Could anyone point me in the right direction?
I would also consider alternatives to Agora if there's a better plugin for implementing this feature set in Unity.
Agora's Video SDK for Unity supports exporting projects to Android, iOS, MacOS, and Windows (non-UWP).
Regarding your data streaming needs, Agora's RTM SDK is in the process of being ported to work within Unity. At the moment the best way to send data using the Agora SDK is to use CreateDataStream to leverage Agora's ability to open a data stream that is sent along with the frames. Data stream messages are limited to 1kb per frame and 30kb/s so I would be cautious about running it on every frame if you are using a frame-rate above 30fps.

Google Assistant for voice-input game

I'd like to develop a game/skill on Google Assistant that requires the following, once the user has entered the game/session (“hey Google, start game123”)
playing an audio file that is a few minutes long
playing a second audio file while the first clip is still playing
always listening. While the files are playing, the game needs to listen and respond for specific voice phrases without the “Hey Google” keyword.
Are these capabilities supported? Thanks in advance.
"Maybe." A lot of it depends what devices on the Actions on Google platform you're looking to support and how necessary some of the requirements are. Depending on your needs, you may be able to play some tricks.
Playing an audio file that is "a few minutes" long.
You can play audio using SSML that is up to 120 seconds long. But that will be played before the microphone is opened to accept a response.
For longer files, you can use a Media Response. This has the interesting feature that when the audio finishes, an event will be sent to your server, so you have some limited way to handle timed responses and looping. On the downside - users have to say "Hey Google" to interrupt it. (And there are currently some bugs when using it.)
Since you're doing a game, you can take advantage of the Interactive Canvas. This will let you use things such as the HTML <audio> tag and the Web Audio API. The big downside is that this is only available on Smart Displays and Android devices - you can't use it on Smart Speakers.
Playing multiple audio tracks
Google has an extension to SSML that allows parallel audio tracks for multiple spoken and audio output. But you can't layer these on top of a Media Response.
If you're using the Web Audio API with the Interactive Canvas, I believe it supports multiple simultaneous inputs.
Can I leave the microphone open so they don't have to say "Hey Google" every time.
Probably not, but this may not be a good idea in some cases, anyway.
For Smart Speakers, you can't do this. People are used to something conversational, so they're waiting for the silence to know when they should be saying something. If you are constantly providing audio, they don't necessarily know when it is their "turn".
With the Interactive Canvas devices, we have a display that we can work with that cues them. And we can keep the microphone open during this time... at least to a point. The downside is that we don't know when the microphone is open and closed, so we can't duck the audio during this time. (At least not yet.)
Can I do what I want?
You're the only judge of that. It sounds like the Interactive Canvas might work well for your needs - but won't work everywhere. In some cases, you might be able to determine the capabilities of the device the user is playing with and present slightly different games depending on the features you have. Google does this, for example, with their "Lucky Trivia" game.

Real-time Pitch Shifting on the iPhone

I have a children's iPhone application that I am writing and I need to be able to shift the pitch of a sound sample using Core Audio. Does anyone have any example code I could look at where this is done. There are many music and game apps in the app store that do this so I know I am not the first one. However, I cannot find any examples of it being done.
you can use dirac-2 from dsp dimension for pitch shifting on the iphone. quote: -
"DIRAC2 is available as both a commercial object library offering unlimited sample rates and phase locked multichannel support and as a free single channel, 44.1/48kHz LE version."
use the soundtouch open source project to change pitch
Here is the link : http://www.surina.net/soundtouch/
Once you add soundtouch to your project, you have to give the input sound file path, output sound file path and pitch change as the input.
Since it takes more time to process your sound its better to modify soundtouch so that when you record the voice, directly give the data for processing. It will make your application better.
I know it's too late for the person who asked but it is really a valuable link (As I found) for any one else who is looking for the solution of the same problem.
So Here we have latest DIRAC3 with it's own audio player classes which will take care of run time pitch and speed(explore for god knows what more) shifting. Run the sample and have huge round of applause for that.
Try Dirac - it's the best technology out there and it's available on Win, Linux, MacOS X and iOS. We're using it in all our products (and a couple of others do as well, search for "Capo" on the App Store). They're at version 3 now which has seen a huge increase in performance since previous versions. Hope this helps.
See: Related question
How much control over pitch do you need... could you precalculate all the different sounds?
If the answer is yes, then you can just pick the right sounds and play them.
You could also use Audio Converter Services in conjunction with AVAudioPlayer, which will allow you to resample the audio (which will effectively repitch them, though they'll change duration).
Alternatively, as the related question points out, you could use OpenAL and AL_PITCH