I'd love to have my Texstudio play a sound (.wav) after it finished compiling. Does anyone know how to do this? Thanks!

  • Related: tex.stackexchange.com/questions/343937/…. It says somewhere in the question "Recompile Texstudio with the option PHONON=true"... So possibly somewhere you have that option or you need a new installation with that option – koleygr Sep 8 '18 at 17:10

On easy possibility would be to instruct TXS to call some external program of your choice to play the sound. Some examples of suitable programs are afplay or vlc (the later is probably overkill just to play some sound).

To add this to the compilation, open your texstudio preferences and edit the "Build and View" command (or whatever command you use to compile you document)

enter image description here

  • For example on a mac I compile with latexmk, open the .log and .pdf and afterwards play the audio:

    txs:///latexmk | txs:///view-log | txs:///view-pdf | afplay <path to audio file>/quack.wav
  • For windows (thanks to @user1805743 !)

    txs:///compile | txs:///view | powershell -c (New-Object Media.SoundPlayer "C:\Windows\Media\notify.wav").PlaySync();
  • ah that looks good so far, but i need to play abit: i have win10, trying now to get vlc to start via command line.... next step: "C:\Program Files (x86)\VideoLAN\VLC>vlc.exe "<path>\Windows 98 Sound Chord.mp3" – user1805743 Sep 8 '18 at 17:36
  • @user1805743 For windows superuser.com/questions/101974/… might also be interesting. – user36296 Sep 8 '18 at 17:40
  • thanks for hetting me on the right track. i finally solved with the following line in the build & view: txs:///compile | txs:///view | powershell -c (New-Object Media.SoundPlayer "C:\Windows\Media\notify.wav").PlaySync(); – user1805743 Sep 8 '18 at 17:59
  • @user1805743 Good to hear you got it working! Would you mind if I include this information in my answer? – user36296 Sep 8 '18 at 18:01
  • 1
    @marmot This happens anyway everytime I forget a ; in tikz :) – user36296 Sep 9 '18 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.