The second method of recording music is electronic recording. Electronic recordings go back to the invention of keyboards and synthesizers, and also with basses and guitars. The idea of using a direct electrical signal is that you are bypassing the acoustics altogether. For many instruments like bass and guitar, the amplifier is a huge part of the sound you are trying to create. Without the speakers and acoustic environment, you have to count on the electronics you are using to create the sound for you.
The typical method for capturing electronic audio is through a DI box. The DI box will take any signal that comes from a high impedance unbalanced source, like from a guitar or bass and convert it into a balanced signal so it can be plugged into a mic preamp and recorded. The balanced lines help to keep the signal quiet with a minimum of degradation. Long guitar cables will pick up loads of noise and you can end up with significant signal degradation. Always keep unbalanced cables to a minimum in terms of their length.
When recording music with keyboards, you are dealing with electronics that are controlling oscillators to generate synthesized sounds that are sometimes meant to emulate acoustic instruments. The older ones are typically connected to a DI although many of them now have balanced line level outputs. This allows them to be brought directly into a line level input in a recording console. They can then be recorded without having to add a significant amount of gain, thus keeping noise to a minimum.
The only issues from a technical perspective are selecting the sounds and editing them until you get it to sound the way you like. If it is a bass, you will need to change pickups, adjust the tome knobs or switch between picks or fingering methods to get the sound you’re looking for. Many direct boxes, designed for bass, have pre-amplification stages that include distortion equalization and tube components that allow you to add some character. The same can be done with guitar using pedals and effects to add warmth and depth to the sound before gets recorded.
Otherwise, the only other issues that you are making sure the signalpasses cleanly, is full frequency, and that there are no buzzes, hums or noises. Most DI boxes have ground lift switches that help to eliminate these problems.