Saturday, December 11, 2021

IdeaPost: convert usb keyboard mouse to bluetooth

Note:
This is an IDEA post not a standalone working solution.


I was planning to create an Android app which converts usb keyboard and mouse to bluetooth. This is an idea that can easily be created but there are various problems which make it inconsistent also. The idea is to plug usb keyboard and mouse into Android device using otg and then using a software to establish bluetooth connection with pc or other device. The software are already available on Playstore which can do something like this e.g. https://play.google.com/store/apps/details?id=io.appground.blek

There are many other apps also. However these apps do not route keyboard and mouse events from usb. They make screen itself as a mouse and utilize input text field for keyboard events.

The solution is to make app which listens to hardware events and transfers them to PC etc. Android can use various services to intercept keyboard and mouse events. If anyone is interested i can make it but i don't think it (again) will help me financially like previous apps gone through. If you are a developer then do share me your app if you make one.

If you are a normal user who has found a working solution do share it in comments section i will update the blogpost. The solution of complex methods already exists!. Like using rooting of device, accessibility service for inputs etc. These apps are surely going to stop working in coming android updates :0.

Privacy/Security threat:
Any app which can listen to keyboard can also log all events and cause a privacy security threat. For  example if you are visiting a bank website and its obviously sure whatever your type after opening this website is your password, username etc. This is what loggers do. They save whatever you type. Due to this listening to input events is not allowed by any operating system. I hope this article gives some ideas and some possible problems while implementating the ideas.

Wednesday, December 1, 2021

Cheapest, simplest method to record Binaural sounds using 2 recorders, phones etc.

 


Binaural sounds are almost like what we hear with natural source. If someone says hi behind us and we record audio in mono, stereo and binaural the best output with realism is recorded in binaural. This article makes a basic quality binaural recorder. The quality is not great because of limitations and manual steps required causing further inaccuracies. You can check the sample quality at end of article to check what it feels like.


As picture above shows we need 2 audio recorders. I used 2 Samsung devices with same official recorder app. Phone acts as left ear and tab acts as right ear. MIC are at top of the devices and therefore top is kept at middle of a box. Box acts are head reducing audio from both sides. Recording on both devices should begin at the same time!. If recording time is not same on both we have to shift the playback timing of one track to match both tracks.


IMPORTANT:

2 recorders must be of same hardware/model, same software and same settings to get same audio data. Different devices can work but many times volume levels & dominating frequency can differ e.g. high frequency/volume on left, lower on right etc.


When recording is done below steps are to be done to create final sound.

- Start Audacity app.

- Import Left audio recording from whatever device acted as left. If imported file is stereo it has to be converted into mono. Audacity can do that easily. Now this mono track should be set to Left Only track. There is a slider to set panning between Left and Right. Slide it to leftmost.

- Same as above right track is imported. Slider is shifted rightmost.

- Now Check the waveforms and using this the shifting of track can be done to match the timing issues happened during starting of recorders. Suppose started recording with a clap. Using the clap as reference we can do shifting of Left or right track until the timing error caused during recording is diminished.

- NOTE: Lets assume both track have been set to perfect time match i.e. a sound is heard at both ears at same time. This is actual wrong setup for binaural!. When sound comes from right it reaches right ear first and then left. The time travelled between right left ear MUST EXIST between the tracks. This is important for accuracy of audio source positions. Below is technical information and can be avoided if you cannot understand the topic but it tells the importance of time difference between Left and Right.

https://en.wikipedia.org/wiki/Interaural_time_difference

https://en.wikipedia.org/wiki/Sound_localization


After shifting of tracks sound can be tested and it will surely sound like binaural. The above method is very cheap and prone to lots of errors. This article is for giving understanding of binaural and some experimentations for advance work. Below is the recording I created.


Sample recording file:


https://drive.google.com/file/d/140yaOUVX4ptCyBduURUFXzGjx3Nrwl7o/view?usp=sharing


I hope this article has helped you in binaural recording. I also made an Android app in 2016 with automated process and create binaural recording easily. However I could not keep developing the app. Below are some links to the app -


https://forum.xda-developers.com/t/binaural-3d-sound-recorder-app-using-2-devices-as-mic.3361953/


backup apks for old android devices only. -


https://drive.google.com/file/d/1PP1N1HsOfLVqaMEMj77g0giLON9ecNuV/view?usp=sharing

Sample i recorded using my android app

https://drive.google.com/file/d/1PftsM9XHOUJB8vzL4cB4vUV5mGZ-28v3/view?usp=sharing




Thursday, September 23, 2021

SBI sending sms for advance intimation of inward Remittance. What to do?

Did you get this sms?

"Dear SBI Customer, This is an advance intimation of an inward Remittance of USDxxx.xxx value Date 20210922. Please contact branch with Relevant Documents."

This doesn't mean you have to visit branch even if you have submitted the FEMA documents. This is only advance notification and nothing else. SBI is using generic sms format to all customers.

I submitted my FEMA documents years ago when i was receiving money through other bank. This means if you have submitted documents before you need not worry. Just ignore this message.

If you have not submitted FEMA documents then you must visit branch. They will provide a page where you have to mention the reason of the inward remittance. For Adsense, Admob earned through PlayStore apps, website ads, YouTube ads etc you must mention software services in the document. This document must be submitted for every new source of income. Like earning money from another source requires another declaration. Its a one time process & takes few minutes. You can also keep the scan or take pictures of signed documents for personal future use. It will remind you of whatever you mentioned in the documents.


More information regarding Fema can be found below:

Thursday, July 29, 2021

Enhanced version of BeepFX 1.12 with export WAV and raw formats.

 The original version BeepFX 1.11 which is

"Beeper sound effects cross editor for ZX Spectrum 48K. Generates sound effects using small set of parameters, also has sample support. Source code included."

available at http://shiru.untergrund.net/software.shtml.

 

Original version is limited to ZX Spectrum users only however audio effects produced using just 1bit sound can be used in modern games also. The problem is it doesn't saves audio in wav etc format. For the same i edited the source and added Export RAW & WAV formats in batch. Editing source was not easy because i couldn't install Borland Studio 2006 on both Windows and Linux. So had to install VirtualBox with windowsXP and worked inside it. The source along with the BeepFX 1.12 binary is available below link -

https://drive.google.com/file/d/1b4A5NSbx5Nye2BuPHsM_lCIxEKkgbc7K/view?usp=sharing

 

There is also online version of similar software capable of producing nice audio effects.

Link - https://zx.remysharp.com/audio

 

Sunday, March 7, 2021

Connect Dualshock 3 via Bluetooth on WIndows 10 without SCP toolkit and Motionjoy.

Dualshock 3 connects to Linux like butter both wired and wireless but windows requires lots of work to do. I tried motionjoy but it was like a malware so surrendered it immediately. Then i tried SCP toolkit but it barely worked after restart. Below were problems faced with scptoolkit -

- It installs drivers (filter drivers) which disables bluetooth to be used by other devices. Some users may use a dedicated dongle for it.

- After restart almost every time DS3 was not working until drivers are reinstalled.

- SCP toolkit is no longer maintained.

 

Now coming to the solution that worked very well and is also more compatible and doesn't cause unwanted trouble of disabling bluetooth etc. In parallel do take a look at https://vigem.org/projects/BthPS3/Installation-Guide-Shibari-Edition/


Limitations:

- Works on Windows 10 only.

- Pressure sensitivity and sensors not supported.


Download and install the latest versions of software from below links:

- Install BthPS3 from https://github.com/ViGEm/BthPS3/releases/latest. Install this first and restart PC. BthPS3 is the bluetooth driver.

- FireShock from https://downloads.vigem.org/projects/FireShock/stable/. This is the USB driver which detects connected DS3 and sets current PC's bluetooth as its master. More info below.

- ViGEmBus https://github.com/ViGEm/ViGEmBus/releases/latest

- Shibari.zip from https://buildbot.vigem.org/builds/Shibari/master/


How it all works?

Dualshock 3 doesn't work with standard bluetooth protocol because it uses its own custom bluetooth protocol. This protocol must be installed in some form to the OS which connects to DS3. We install BthPS3 for this task.

 

DS3 always saves a master bluetooth MAC address in its memory. This MAC address is set using USB connection therefore DS3 are connected with console via USB cable and then it starts working. When PS button is pressed DS3 sends a pairing request to this master bluetooth device. We install FireShock for this purpose. I don't know what else fireshock does but in theory if using other apps to set DS3's master BT device then we may not need this step. However It must be installed for possible unwanted or unpredictable issues.


When DS3 gets connected we want it to behave as XBOX 360 controller. We install ViGEmBus for this purpose.


Now we have to run Shibari.Dom.Server.exe. As the official page says it acts as a bridge among the bundle of software we installed. Kindly refer to the official page for more details to run this program as a service and auto start after boot.


Troubleshoot:

- Ensure DS3 is not damaged. You may reset the controller by pressing a tiny button at backside. There is a tiny hole at rightside of top-middle bolt. Press it with thin object. This resets the gamepad.

 - Ensure programs are installed as mentioned in official page because the details i have mentioned is for versions released on March 2021. Apps must be run as administrator rights.

- Current version of above software works on Windows 10 only.


Below is example log from shibari:


[06:16:42 INF] Launching Shibari, version: 1.6.186.0
Configuration Result:
[Success] Name Shibari.Dom.Server
[Success] DisplayName Shibari Dom Server
[Success] Description Manages AirBender, FireShock & BthPS3 Devices.
[Success] ServiceName Shibari.Dom.Server
Topshelf v4.2.1.215, .NET Framework v4.0.30319.42000
[06:16:43 INF] Loaded sink plugin ViGEm Xbox 360 Sink
[06:16:43 INF] Loaded bus emulator BthPS3 Bus Emulator
[06:16:43 INF] Starting bus emulator BthPS3 Bus Emulator
[06:16:43 INF] BthPS3 Bus Emulator started
[06:16:43 INF] Bus emulator BthPS3 Bus Emulator started successfully
[06:16:43 INF] Loaded bus emulator FireShock Bus Emulator
[06:16:43 INF] Starting bus emulator FireShock Bus Emulator
[06:16:43 INF] FireShock Bus Emulator started
[06:16:43 INF] Bus emulator FireShock Bus Emulator started successfully
The Shibari.Dom.Server service is now running, press Control+C to exit.
[06:17:43 INF] Found SIXAXIS device \\?\BTHPS3BUS#{53F88889-1AAF-4353-A047-556B69EC6DA6}#A&1E23908E&0&0007040BAF51#{7B0EAE3D-4414-4024-BCBD-1C21523768CE} (BTHPS3BUS\{53F88889-1AAF-4353-A047-556B69EC6DA6}\A&1E23908E&0&0007040BAF51)
[06:17:43 INF] Device DualShock3 (00:07:04:0B:AF:51) got attached via Bluetooth
[06:17:43 WRN] Auto-pairing not supported as BthPS3 and/or Bluetooth Host Radio not found
[06:17:43 INF] Connecting ViGEm target Nefarius.ViGEm.Client.Targets.Xbox360Controller
[06:17:43 INF] ViGEm target Nefarius.ViGEm.Client.Targets.Xbox360Controller connected successfully
Controller 1: [■■■ ]
(its green colored bar)

 


For using other drivers or testing of ds3 using rpcs3 emulator

https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration

Sunday, February 14, 2021

Connect gen game s3, x3, GSH, shanwan wireless gamepad to various devices

The controller is available in various different brand names but its same. Companies do rebranding and sell.

 

Flipkart page for sample -

https://www.flipkart.com/dwh-x3-mobile-wireless-bluetooth-game-controller-bracket-gamepad-support-ios-android-smart-t-v-pc-black-joystick-black-pc/p/itm5fa472358e25b


 

I have tested it on Android phones, tablet and Ubuntu laptop. It works with both Bluetooth and usb mode. Wifi/wireless mode also supposed to work using a BM-703 dongle which i couldn't test due to lack of dongle.


This seems to be BEST BUDGET gamepad!. Very surprising when compared with others at Rs1000.


Update:

I tested GSH model and it looks like multiple types of other clone models also exist. But the basic idea and techniques to connect are same as described below. Your device may show different name and may have different combinations of keys!. Don't give up by thinking your device is not working it just has different keys and ways to connect. Don't throw your gamepad manual because its hard to find on internet and unique to your device.



As Bluetooth gamepad in Keyboard mode:


Turn on Bluetooth of Android. If gamepad is on then turn it off by long pressing home button until lights are off. Press X or Y then home for ~3-5 seconds. Home led with blink and Bluetooth search will show a wireless keyboard device named "gamepad". Will easily pair and DON'T forget to enable option "show virtual keyboard when hardware keyboard is connected" option in Android otherwise soft keyboard will remain disabled!. In this mode home button can be pressed to switch to Mode 2 and L3,R3 will act as mouse. This seems to be most compatible mode.



Bluetooth HID gamepad mode

Press A or B then home and Bluetooth gamepad will show and gamepadplus name will show. In this mode it doesn't act like keyboard and not every app can detect correct key names. Some apps may show KEY_UNKNOWN while mapping. This mode supports L3,R3 which is needed for PS1, PSP etc games. Retroarch worked very well with both above modes.


Try experimenting with home + all the buttons you have. Even if your model is different, old version or latest some keys can surely work.


Some combinations mentioned in manual below:


Home+X = Android

Home+Y = Ios

Home+A = Switch

Home+B = PS3

Home+L1,L2 for PC Bluetooth or cable.


Manual provides other details for Ios.


USB otg mode:

Press R1 + Home. 1 and 4 leds will blink. If XBox gamepad drivers are present in ANY OS the gamepad will detect after plugging by usb cable. 

NOTE: provided usb cable in box is not data cable but charging cable. Use data cable and gamepad works as Microsoft xbox 360 controller.


Lots of users are unable to find these details and think the gamepad is bad. Gamepad is really great and also has less latency. Almost like wired.



Official manual:


Manual also shows other devices and ways to connect.



Secret/Hidden:


There is a hole at the back side of gamepad to reset the current pairing master device just like dualshock 3 gamepad. Use something like needle and insert in the hole to press a switch. Hole at right side of usb port at back side. After reset the gamepad will not automatically connect to last Bluetooth device.



Common issues:


- Pairing fails on some devices like TV etc. Try different modes to get the connection established. The gamepad didn't connected to my TCL Android TV. May work by forcing to trust the device and pair or use other modes of gamepad.


- Stock androids lack commercial drivers and many other such drivers. This cause no detection of various gadgets not just this gamepad. E.g. F310 Logitech gamepad didn't connected to Nokia 8.1 but worked on other devices. Xinput mode requires drivers.


The gamepad is available with names MJ600, shanwan x3, gsh wireless, Gen Game S3 etc. All are same.


- When connection is getting problematic reset the gamepad by the secret hole at back side.