wm: doc

ref: f6b4d9b9dc53c2842b23dee80081cb5a874a1138
dir: /audio.ms/

View raw version
# Audio

If the sound card is detected: 



    ; ls '#A'
    '#A/audio'
    '#A/audioctl'
    '#A/audiostat'
    '#A/volume'
    



    ; ls /dev/audiostat
    

You can check which pins are being used for input and output (output for Thinkpad x200): 



    ; cat /dev/audiostat
    bufsize   1024 buffered      0
    codec 0 pin 25 inpin 29
    aout 16 c1d
    aout 17 c1d
    aout 18 211
    beep 19 70000c
    ain 20 100d1b ← pin 29, pin 23
    ain 21 100d1b ← pin 24
    pin 22 out jack ext right hpout green ← aout 16, aout 17
    pin 23 in nothing sep rear micin pink
    pin 24 in jack ext right micin pink
    pin 25 out nothing sep rear hpout green ← aout 16, aout 17
    pin 26 out fix int N/A speaker ? eapd ← aout 16, aout 17
    pin 27 out nothing ext N/A other ? eapd ← aout 16, aout 17
    pin 28 out nothing ext N/A other ? ← aout 18
    pin 29 in fix int N/A micin ?
    beep 30 f00000
    outpath aout 16 → pin 26
    outamp aout 16
    inpath pin 29 → ain 20
    inamp ain 20
    

This line `codec 0 pin 25 inpin 29` shows that pin 25 is being used for output and pin 29 used for input. On my laptop, it is necessary to set the output pin to 26: 



    ; echo pin 26 > /dev/audioctl
    

Now it's possible to play music: 



    ; audio/oggdec < music.ogg >/dev/audio
    ; audio/mp3dec < music.mp3 >/dev/audio
    

Sources: 



*   <http://nopenopenope.net/posts/audio> 
*   <https://git.sr.ht/~ft/jacksense>