ggwave icon indicating copy to clipboard operation
ggwave copied to clipboard

Web Demo issue

Open chulochula opened this issue 4 years ago • 4 comments

Very great library!

Firstly, for the Web Demo, inside onchange event of "Tx Protocol" combobox , please assign the integer value to protocolId instead of a string value. Otherwise, the "broadcast" cannot work properly when calling _sendData.

Secondly, on MacOS & iOS Safari, the Web Demo can _getText from hearable sound but not from Ultrasound. They both work on Mac Chrome though. Any idea please? Because I want to embed this into a iPhone Cordova app. Many thanks!

chulochula avatar Jan 06 '21 16:01 chulochula

Thanks for spotting the protocolId issue - it is fixed now!

Regarding the ultrasound issue: That is interesting observation and I am not sure what is causing the ultrasound to not work with Safari. One potential idea could be that the following part for adjusting the capture parameters does not work for Safari:

https://github.com/ggerganov/ggwave/blob/108425f27fcbd283ad4f2cfcc11dc452393148aa/examples/ggwave-wasm/index-tmpl.html#L219-L227

Although it seems unlikely. I will do some experiments on my MacBook and see if I can find more information.

ggerganov avatar Jan 06 '21 21:01 ggerganov

Cool!

One more question about the Web Demo. I have played around it as well as the iPhone demo (from App Store). The transmission distance and accuracy are very high on iPhone while not the same performance on Web Demo. It is the same when I send data from App/Web on iPhone and receive it on Mac Chrome. App has much better transmission distance.

Anything can I fine tune the source of the Web Demo please?

chulochula avatar Jan 07 '21 03:01 chulochula

I can reproduce the same issue with Safari on my MacBook. For some reason the high-frequency audio in Safari is filtered. Here is Safari (left) and Chrome (right) receiving an Ultrasound message simultaneously:

safari-issue

The higher portion of the audio spectrum in Safari is completely missing. Probably the Safari is capturing at a much lower sample rate, even though SDL reports 48kHz. Not sure..

Regarding the performance issue: Probably the audio capture parameters of the browser need to be tuned in some way. There might be some filtering going on in the background that I am not aware of.

ggerganov avatar Jan 07 '21 17:01 ggerganov

It has been suggested that this might be a security risk mitigation by Safari. Not sure if that is the case.

ggerganov avatar Feb 20 '21 18:02 ggerganov