Guitar hum/noise when plugged into ungrounded outlet in Japanese apartment
The Problem
When I plug my electric guitar into my audio interface (a Focusrite 2i2 3rd generation, although it shouldn't matter) that is attached to my laptop and apply distortion, there is a ton of hum and noise when the laptop is plugged into the wall outlet of my Japanese apartment.
The noise can be mitigated slightly by touching the metal exterior of the jack. When the laptop is unplugged and running on battery power, the problem disappears.
The problem is the same when using guitar pedals not connected to the computer at all. Battery powered pedals are no problem, but pedals drawing power from the wall introduce hum and noise.
A lot of people online will tell you this is because of a ground loop, but I don't think that's correct in this instance. Most Japanese outlets don't have a ground pin, so the problem here is that the guitar isn't grounded at all.
The Solution
The solution is to run a ground wire (I connect mine to the ground connection that's part of the outlet for the aircon) and attach it to the metal exterior of the guitar cable jack. This seems to be effective no matter where in the circuit you place it, so I attach it to a jack on my overdrive pedal.
I found one Japanese person who built a dedicated "earthing box" for their pedal board. It's basically a pedal enclosure with an input and output jack, and inside the ground on one of the jacks is connected to an external connector for a grounding wire.
Why It Works
I am not an electrical engineer, but this is my understanding of what is going on: Guitars use unbalanced cables, so they don't reject external noise. The cables are shielded by a wire mesh, but that mesh doesn't work properly unless it's grounded.
When you're plugged into an ungrounded outlet in a Japanese apartment, for example, the guitar cable essentially turns into a big antenna, and picks up noise from power supplies. The noise is reduced when you touch the cable jack because you become the ground, which is a job you're not particularly well suited for and you probably shouldn't do. You need to properly ground the guitar in order to make the cable shielding effective.
What didn't work
Some people suggested that the problem was noisy power coming over USB, and that the solution was to buy a dongle that separates the USB data signal from the USB power supply, which you would provide via a separate wall wart. In this instance, this isn't effective at all because it doesn't address the lack of grounding in the circuit.
I saw some suggestions to buy "Hum Eliminator" devices, but they seem far more expensive and probably ineffective compared to adding a ground wire.
Why most Japanese outlets aren't grounded
Electricians in most countries are probably tearing their hair out at the concept of ungrounded outlets. In short, the Japanese system is different, and safety features are implemented at the circuit breaker instead. Here is an interesting video on the subject.