Set up default sound player

2019-02-20 15:46发布

By using R packages like tuneR and seewave I generated sounds that I want to play with some software that is not Windows Media Player but I don't know how to set this up. This command

setWavPlayer("mplay32")

Is the only thing that works (and its WMP). When I try something like this

setWavPlayer("C:/Program Files/foobar2000/foobar2000.exe")

The synth or play command just gives this error when I try to playback my sound

'C:/Program' is not recognized as an internal or external command, operable program or batch file.

Any hints?

标签: r wav
2条回答
三岁会撩人
2楼-- · 2019-02-20 16:30

If you want to do it in windows this is what I did. Unfortunately wmplayer does not work perfectly. Nonetheless you can play sounds with it.

  setWavPlayer('"C:/Program Files/Windows Media Player/wmplayer.exe"')
查看更多
我只想做你的唯一
3楼-- · 2019-02-20 16:34

Here's what works for me under OSX: assuming I've installed an app called 'play.app' ,

setWavPlayer('/applications/play')

In your case it would appear that somewhere along the line your path string's space (in "Program[space]Files" ) is causing the string to be split up. That error message is pretty clearly coming from a CommandPrompt or similar shell. You need to quote the string using shQuote so that the space is handled properly:

setWavPlayer(shQuote("C:/Program Files/foobar2000/foobar2000.exe"))
查看更多
登录 后发表回答