title: Drive sound card from R
body: <p>I am working on an experiment that utilizes a sound card to play sound and output electrical signals from a multi-channel sound card. From MatLab, I can directly drive each channel, but I would prefer to use R. I have been able to make a multi-channel file and name the channels, but I'm unable to get them to play properly. I have set the soundcard as the default and when I play the test in the config window in the 'Sound' window, but when I run my code it does not play. The code opens WMP and a file plays that is the correct length for the signal I created, but I'm not getting sound from the speakers and I'm not able to measure an electrical signal from the other channels that I have set up. 
  Windows 7
  Soundcard: Lynx E44
  R 3.4.4</p>
  
  <pre><code>library("seewave")
  library("tuneR")
  s1 &lt;- 10*sin(2*pi*440*seq(0,1,length.out=8000))
  s1_multi &lt;- WaveMC(data = cbind(s1, s1, s1, s1),
                 samp.rate=8000, 
                 bit=16)
   colnames(s1_multi) &lt;- c("FL", "FR", "FC", "LF")
  setWavPlayer(shQuote("C:/Program Files (x86)/Windows Media Player/wmplayer.exe"))
  
  listen(s1_multi)
  </code></pre>
  
  <p>Anything I'm doing wrong? Is there a way to drive the channels of the sound card directly from R?</p>
  
  <hr>
  
  <p>I posted the same question to the seewave developers message board and was informed why my exact code didn't work (listen() for WaveMC plays the first channel only). But my bigger question is if there is a way to directly drive a sound card from R, or if it must go through a third party player. So far I have tried tuneR and seewave.</p>
  
  <p>Thanks.</p>