WebAudio API microphone Decibel Threshold/Gating ( Microphone input too sensitive ) - javascript

sorry I can't find any information on this. Doing a personal project using WebAudio API, getting microphone input, but the sensitivity is way too high. A friend told me to research the keywords Decibel Threshold/Gating but I can't seem to find any relevent information.. Anyone have any resources? I've referenced a lot of open sourced code so keep the terminology to the minimum please, THANKS!

There's no way to turn down the hardware microphone gain from Web Audio API, so if it's actually clipping, the user needs to turn down the gain. You could potentially detect that it's clipping (by looking for sample values close to plus or minus 1), and ask the user to turn it down.
If it's not clipping, but is still too loud for your purposes, you can just run it through a gain node. Or if you want to turn it down only if it's over a certain level, you can run it through a compressor node.

Related

Is it possible to build an AR App, with a VR display wrapper, for mobile devices, using Javascript?

thanks kindly for your time and attention. I recognise this is a long shot but I'm hoping someone might be generous enough to relay some advice or guidance. I am in the beginning phases of researching how I might build an app for a mobile device, using javascript and related tools, libraries and packages. The concept for the app is that it will access the device camera, recognise faces, and overlay animated AR assets onto the device display. However, I want users to couple their phone with a wearable headset, and use the app through a split screen VR style display. I assume I'll need some sort of VR wrapper for the core AR application. At the moment, I am focussed primarily on the graphical display and UI aspects, so that I can build a proof-of-concept to test whether the idea is even viable. I recognise I may be misguided to attempt this in javascript rather than native mobile languages - if this is the case, I would welcome any opinions on the matter. I'm asking about javascript because that's what I know, basically.
Thus far, I've been reading about various libraries such as WebXR, Three.js and others. I assume I'll need to use React Native, though it's not easy to get a clear sense of whether I should even be trying to achieve what I want using javascript. I have no code to show as yet.
Additionally, I recognise there are similar questions already posted to the forum - for example, this one: VR+AR on mobile phone.
I haven't found any recent threads that address this specific set of requirements so I do apologise if I've missed something. If there is info on the forum, grateful if someone could point me to the relevant thread. At the very least, thanks for reading. Cheers, all.
I found Snap's Lens Studio extremely intuitive and powerful. It provides templates for feature recognition, tracking, and physics. It also provides advanced controls for custom creative. I would also expect it to receive future feature development support. It can be monetized.
...or do you want to expose yourself to more computer vision terminology and patterns? Try searching CodePen or CodeSandbox for features such as: MediaPipe, OpenCV, face detection webcam. But the overhead of a VR/AR app is probably best described in an O'Reilly book or John Carmack keynote speech. Topics like pupil distance, foot tracking, and predictive tracking.

Save speach used to fill a textbox after dictating on (ipad/mobile device) with keyboard-microphone

By clicking on a textbox on ipad or mobile devices in a browser the keyboard appears on the screen. Here is possible to select the microphone to dictate the text directly into the inputbox with our voice without the need to write directly.
Because the speach conversion is not always perfet we vould like to save the audio of the speach itself on our server to be used when the text is not clear enough.
Is it possible to retrive, from the ipad/mobile, and save on our server, the audio of the speach that has been used to write the text in out textbox?
I know that i could write javascript code to convert the speach in text and record the voice directly but we would like to know if it is possible to get the audio (as a file) used for the speachtotext conversion used by the device to fill textbox.
In other words when I dictate by using the microphone, of the device keybord, does the device allows the page, where the coversion took place, to access the audio as a file?
Since you tagged this Android as well- not on that OS. The keyboard is its own app and handles the voice input itself. There is no way to access the files of another app.
If you want to do this in a native app, put up your own microphone button and use the speech to text service, which will return an array of possible inputs with probabilities. In a browser, you're just out of luck as there is no access to the service.
All of this is kind of a moot point anyway for a few reasons
Very few people use speech input. My last data on numbers is old, but it was unpopular enough when I worked at a keyboard company we had an option to remove the key.
Uploading those files would be a huge privacy concern. Look at the firestorm a year or so ago when it was found Google/Amazon did this same thing for the same reason. This was a bigger deal in their case as it was background processing, but users would likely still not be happy.
Unless you're spending a few million on researchers, you're not going to be doing it better than the existing solution. That kind of software is not easy to write, its not a totally solved problem even by Google and Nuance (owners of Dragon which powers Siri, or at least did) who have huge teams. Why do you think you'll do better? Unless you plan on listening to them manually. In which case the next point is even bigger.
Ok, so you upload the file and you do find a better solution- what are you going to do about it? Somehow change the text the user typed in 20 minutes ago? How are you going to do this and have a UX flow that makes sense?

HTML5 Audio Output Patching

I was wondering if there is a way to control audio output device patching in HTML5/JavaScript? Like, if the user wanted to have one sound in my web app to go out of one audio device, and another sound out of a different audio device. I know the user can set the default output device on their computer, but for the web app I'm working on, I would like them to be able to send individual sounds to individual outputs while other sounds are playing, similar to the interface below (from a program called QLab).
I feel like the obvious answer is NO, and I do not want to resort to using flash or java. I MIGHT be okay with having to write some sort of browser plugin that interfaces with javascript.
So, after receiving basically zero helpful answers - and finding no further helpful information online, I think I figured out something that we, as developers, NEED to start requesting from browser vendors and w3c. We need to be able to request hardware access from users, in a similar fashion that we can request to access a user's location, or how we can request to send a user push notifications.
Until web developers are allowed the same control as native application developers over hardware, we will be left at a huge disadvantage over what we can offer our users. I don't want to have my users install third/fourth party plugins to enable a little more control/access to their I/O. Users should not have to be inundated with keeping more software than just their web browser updated to have websites run well and securely. And I, for one, do not feel like it should be necessary to write in more languages than HTML, JavaScript, CSS, and PHP to get the same experience a user would get from a native application.
I have no idea how we approach browser vendors about this, but I feel like it would be good to start doing this.
I know this is a little old, but just this year a method was added called "setSinkId" that you can apply to a media element (video, audio) to set the device that audio will be outputted to.
$('#video-element').setSinkId('default');
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId
Though currently it seems only Chrome supports it. I haven't tested on Firefox or other web browsers.
I suggest you take a look at the Web Audio API:
Specs --- Tutorial
There is the destination property in the Web audio API. However it is a readonly property ... so not settable.
Here:
The destination property always correlates to the default hardware output of sound, whether it’s through speakers, attached headphones, or a Bluetooth headset.
I'm working on a sound installation based off web audio and have run into the same problem. I want to map different channel outputs to different speakers. have you had any progress on this?
This gentleman seems to have managed to do it: http://www.brucewiggins.co.uk/?p=311
I tested this out on a apogee quartet and it worked - outputting to 8 different channels.
I also found this article useful: http://www.html5audio.org/2013/03/surround-audio-comes-to-the-web.html
if (context.destination.maxChannelCount >= 4) {
context.destination.channelCount = 4;
}
// otherwise, let's down-mix to 2.0
else {
context.destination.channelCount = 2;
}
context.destination.channelCountMode = "explicit";
context.destination.channelInterpretation = "discrete";
context.destination.numberOfOutputs = 4;
While you can certainly use the splitter and merger nodes to assign to specific channels on the output, the actual devices you output are abstracted by the browser and inaccessible by your code.
I have done some experiments with 8-channel virtual audio cables and relaying that data to other sound devices outside of the browser. Unfortunately, I can't find a browser that will actually open an 8-channel sound card with more than 2 channels.
Hopefully, browsers in the future will provide more options. This flexibility will never come directly to JavaScript... and nor should it. This is an abstraction done for you, and if the browser uses it correctly, it won't be an issue.

detect volume of other open websites or even apps with js (probably)?

Is this possible?
google desn't seem to have anything on this..
So that if a user plays a video or song on another website the volume in mine would automaticly decrease
No, it is not possible.
If it were possible, it would have to be browser specific, and I don't see that happening. Even though it seems harmless to know whether audio is playing in another application (or tab), that is a slippery slope that would inevitably lead developers to ask for more and more. You are talking about poking a tiny hole in a very big firewall that is there for a very good reason. The moment average users start to feel insecure about javascript in their browser being able to look outside the sandbox it lives in, we all go back to the dark ages of web development.
The volume of other apps is almost entirely controlled by a variable assigned and owned by the program that assigned it. So to access it you would have to access another apps variables, straight through the danger zone...
I played around with this for a while trying to hack flash games (not maliciously, a skill I had to learn for work), and it would be almost impossible to determine what is controlling volume without actually interacting with the interface itself.
The main way this is done, is by looking at the value of a variable you want to change.
"i have 300 ammo, I want 1,000,000 ammo"
So you have to search for a memory address with a value of 300. You will find a bunch.
'Shoot some bullets'
By shooting some bullets, and searching for the new value, you can eventually find the memory address you wanted, however, this is a very arduous process, and you can quite easily crash your browser by modifying variables that should not be modified.
This is why it is likely impossible

Audio Analysis in WinJS

I've been poking around the API to find what I'm looking for, as well as searching online (but examples of Windows Store apps are pretty scarce). What I'm essentially looking for is a starting point for analyzing audio in a Windows Store JavaScript app. If I were creating a simple visualizer, for example, and I need to detect the various kinds of "bumps" in the currently playing audio.
Can anybody point me in the right direction here? Is this something that's even possible in a Windows Store JavaScript app? Whether it's the audio of a selected song, or the device's currently playing song, or the audio on the microphone... either way is fine for my needs at the moment. I'm just looking for where to start in the analysis of the audio.
GGG's response sounded skeptical of the possibility of a signal processor on WindowsRT, and I have to admit I don't know much about WindowsRT either. But we know you will have javascript available. It sounds like you are interested in Digital Signal Processing in Javascript. If you take a look at these resources. They could get you pointed in the right direction.
https://github.com/corbanbrook/dsp.js
http://www.bores.com/courses/intro/index.htm
http://arc.id.au/SpectrumAnalyser.html

Categories

Resources