title: c# music bot pipe broken
body: <p>My code:</p>
  
  <pre><code>public class MusicModule : ModuleBase&lt;SocketCommandContext&gt;
  {
  
      private static IAudioClient _audioclient;
  
      [Command("join", RunMode = RunMode.Async)]
      public async Task JoinChannel(IVoiceChannel channel = null)
      {
          channel = channel ?? (Context.User as IGuildUser)?.VoiceChannel;
  
          if (channel == null)
          {
              await ReplyAsync("Error: Couldn't find channel to join");
              return;
          }
          var audioClient = await channel.ConnectAsync();
      }
  
      [Command("leave", RunMode = RunMode.Async)]
      public async Task StopAsync(IVoiceChannel channel = null)
      {
          if (channel == null)
          {
              await ReplyAsync("Error: Couldn't find channel to leave");
              return;
          }
          await _audioclient.StopAsync();
      }
  
      [Command("play", RunMode = RunMode.Async)]
      public async Task PlaySong([Remainder] string url)
      {
          await ReplyAsync("**Song:** " + (url) + " Has now started.");
  
          // Create FFmpeg using the previous example
          var ffmpeg = CreateStream(url);
          var output = ffmpeg.StandardOutput.BaseStream;
          var stream = _audioclient.CreatePCMStream(AudioApplication.Mixed);
          await output.CopyToAsync(stream);
          await stream.FlushAsync();
  
      }
  
      private Process CreateStream(string url)
      {
          var ffmpeg = new ProcessStartInfo
          {
              FileName = "cmd.exe",
              Arguments = $"/C youtube-dl -o - {url} | ffmpeg -i pipe:0 -ac 2 -f s16le -ar 48000 pipe:1",
              UseShellExecute = false,
              RedirectStandardOutput = true,
          };
          return Process.Start(ffmpeg);
      }
  
      private async Task SendAsync(IAudioClient client, string path)
      {
          // Create FFmpeg using the previous example
          var ffmpeg = CreateStream(path);
          var output = ffmpeg.StandardOutput.BaseStream;
          var discord = client.CreatePCMStream(AudioApplication.Mixed);
          await output.CopyToAsync(discord);
          await discord.FlushAsync();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I play a song, I either get this:
  <a href="https://gyazo.com/aca4573535a84108d498f3736e7871a9" rel="nofollow noreferrer">https://gyazo.com/aca4573535a84108d498f3736e7871a9</a> or:
  <a href="https://gyazo.com/7a7b07d333e9fb7646bb40856e47ec65" rel="nofollow noreferrer">https://gyazo.com/7a7b07d333e9fb7646bb40856e47ec65</a></p>
  
  <p>Any help would be much appreciated!
  I do !play (LINK)
  it doesnt join but in the console it says its downloading and then it says in red BROKEN PIPE.</p>