Skip to content

Instantly share code, notes, and snippets.

@KiTTYsh
Created October 8, 2018 04:37
Show Gist options
  • Save KiTTYsh/61a5df15c147b48907376e7c8c42b0e8 to your computer and use it in GitHub Desktop.
Save KiTTYsh/61a5df15c147b48907376e7c8c42b0e8 to your computer and use it in GitHub Desktop.

MSI GS63VR PulseAudio Configuration

The MSI GS63VR and similar late model MSI laptops have a known issue with it's audio card: The internal speakers work fine, but the headphone jack is painfully loud, and the volume cannot be adjusted.

Online Research

ArchWiki suggests using hdajackretask from the alsa-tools package to reassign the microphone jack as a headphone jack, but I've found that the quality is sub-par. Many other hdajackretask configurations will yield audio on any combination of the speakers, headphone jack, and microphone jack simultaneosly, with only one or two yielding sound only from the headphone jack, still without volume control from PulseAudio. Some of these configurations require another jack to be enabled simultaneously, with no apparent reason as to why. Even after one of these configurations are found, the results are unpredictable across a reboot.

There was a kernel patch submitted in early 2017 to enable support for a similar audio setup in System76 and Clevo laptops, but it required further correspondance to be accepted, and went nowhere. I doubt that this would make a difference anyway.

Experimentation

After spending many hours trying to figure out how to get the headphones port working properly on my MSI GS63VR, I buckled down and attempted to find a solution of my own.

I have found that the speakers can be disabled by setting the volume of the Speaker/Bass Speaker channels to 0 in alsamixer -c0, and the headphone audio can be disabled by muting S/PDIF 16. The overall volume of both speakers and headphones can be controlled with the PCM channel. My issues with doing this is that PulseAudio will attempt to mute the Master channel if it sees another channel muted, and PulseAudio still has no control of the PCM channel to adjust the volume for the headphones.

This might work fine for someone who is using ALSA by itself, but I wanted the end result to be simpler, more suited to daily use.

My Solution

After a lot more digging, and a lot of experimentation due to a lack of detailed documentation for PulseAudio, I came up with the following solution.

I have made a custom PulseAudio profile-set for this laptop, which has a possible bonus of offering simultaneous independent playback from both the speakers and the headphone jack, with independent and reliable volume control from both.

Setup is as follows:

  • Place the config below into /usr/share/pulseaudio/alsa-mixer/profile-sets/gs63vr.conf
  • Add a line to /etc/pulse/default.pa telling PulseAudio to use that config for the card
  • Open alsamixer -c0 and max out all mixer values

/usr/share/pulseaudio/alsa-mixer/profile-sets/gs63vr.conf

; Profile Set for MSI GS63VR with ALC898 Audio

[General]
auto-profiles = no

[Mapping internal-speakers]
description = Internal Speakers
device-strings = hw:%f,0,0
channel-map = left,right
direction = output

[Mapping microphone]
description = Microphone
device-strings = hw:%f,0,0
channel-map = left,right
direction = input

[Mapping headphones]
description = Headphones
device-strings = hw:%f,1,0
channel-map = left,right
direction = output

[Profile output:speakers-headphones+input:microphone]
description = Duplex Audio + Headphones
output-mappings = internal-speakers headphones
input-mappings = microphone
priority = 100
skip-probe = yes

/etc/pulse/default.pa

  ### Load audio drivers statically
  ### (it's probably better to not load these drivers manually, but instead
  ### use module-udev-detect -- see below -- for doing this automatically)
+ load-module module-alsa-card name="internal" device_id="0" profile_set="gs63vr.conf"
  #load-module module-alsa-sink
  #load-module module-alsa-source device=hw:1,0
  #load-module module-null-sink
  #load-module module-pipe-sink

It should be noted that PulseAudio would prefer that you set this profile-set by assigning a udev rule to your card. I personally found this to be too difficult and time consuming.

I assume volume control works because, due to the lack of paths, PulseAudio handles the volume in software. I suspect that the Realtek card is connected to the ESS Sabre DAC via S/PDIF on the board, so without the proprietary drivers, we might not have a way of controlling that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment