ref: 1268fa4a2670757c9c10522f7374583227ad44c2
dir: /audio.md/
Audio ===== ## MNT Reform `reform/audio`, see reform(1). ## Intel HDA With Intel HDA audio one most likely will need to set a proper "pin" for the sound to play on the correct output, and "inpin" for recorded samples to come from the right input. ### tl;dr Install [jacksense](https://git.sr.ht/~ft/jacksense). ### Long read The easy way to check which pins you have is, for output: grep ' out ' /dev/audiostat For input: grep ' in ' /dev/audiostat The output produced should give some idea about what those pins are. In order to check the currently used ones: grep path /dev/audiostat As an example, on a Thinkpad T480s the interesting pins (output and input) are: pin 20 out fix int N/A speaker ? eapd ← aout 2 pin 33 out jack ext right hpout black eapd ← aout 2, aout 3 pin 18 in fix int N/A micin ? pin 25 in jack ext right micin black Pin 20 is the built-in speaker, 33 is headphones jack. Pin 18 is the built-in mic, 25 is the mic input on the same jack that 33 is on. By doing `echo pin 20 >/dev/audioctl; echo 50 >/dev/volume` the output is switched to built-in speaker and the volume is set to 50, to avoid blasting with full volume immediately. `echo inpin 18 >/dev/audioctl` will make reads from `/dev/audio` produce samples captured from the built-in mic. You can adjust mic gain by doing `echo recgain 50 >/dev/volume`. To test the mic you can run the following command (preferably while using headphones): audio/pcmconv -i s16c1r44100 < '#A/audio' > /dev/audio `#A/audio` is used here due to the fact that `audio/mixfs` (if you have it running) binds on top of `/dev/audio` and can only be used for output. On some Lenovo laptops (T480s, IdeaPad Gaming 3i) 9front seems to have trouble playing audio on headphones jack, the sound will be garbled. To avoid that you can switch the _input_ to pin 25 (input jack), and perhaps back to 18 (built-in mic). That somehow fixes the issue.