Questions tagged [soundplayer]

SoundPlayer is a method which plays .wav files in c#

133 questions
0
votes
0 answers

.NET SoundPlayer or application mute

There is a program which has several classes and each of them contains SoundPlayer instance. How can I mute/unmute all sounds from the program? (on CheckBox CheckedChanged but that's not important)
va.
  • 848
  • 3
  • 17
  • 39
0
votes
2 answers

is it possible to add sound effect to the Kinect Paint buttons?

sorry for my bad English and straight forwarding. i have something about the coding to ask... i would like to ask, is it possible to add sound for all the button? seems like the button with a "click" sound when it is selected would be nice. anyone…
-1
votes
1 answer

How to use a string instead of the "name" for a properties.resources."name"

I have a bunch of audio files stored in resources as I want them to be carried around by the program, I want to assign each file on creation to each soundplayer stored in a soundplayer array, each resources name is the same as strings stored in a…
Velarux
  • 9
  • 5
-1
votes
1 answer

Clicking a button then playing a sound, pauses the UI and if you spam the button continuously plays?

I've been trying to get this button to do what I want for a little now. I want it to play a sound when I press it, which is what I managed to do. However, its like the application freezes every time you press the button, giving the sound all of its…
Hypergyzed
  • 45
  • 1
  • 2
  • 10
-1
votes
1 answer

Play/Pause button for .wav file

I have seen a few posts about multi-function buttons here and elsewhere, but I am having trouble implementing their suggestions. I am coding a synthesizer that generates and saves a .wav file. I have a button that plays the sound with SoundPlayer…
-1
votes
1 answer

C# - Get time from soundplayer

Is there any way to get the number of milliseconds that have passed since the soundplayer started playing? So far I'm using Environment's tick counter by getting the start time and then the current time every frame, but sometimes that's inaccurate…
iptq
  • 657
  • 1
  • 7
  • 15
-1
votes
1 answer

Variable not declared error in a Maze Game

The maze game I have developed via a tutorial I found by research is doing well. Step by step I have been debugging this application for Windows using VB in Visual Studio 2012. I was told by the tutorial to use the following code: Private Sub…
Alex Stack
  • 51
  • 2
  • 2
  • 7
-2
votes
0 answers

VisualStudio SoundPlayer error "The file located at _____ is not a valid wave file."

I downloaded the file from a YouTube to .wav converter and it works when I play it through Windows Media Player, but not in Visual Studio. music.SoundLocation = songs[comboBox1.SelectedIndex]; //this file does exist and works in…
aleksa
  • 1
  • 1
-2
votes
2 answers

Is it possible to create a loop where if i click on a picture box it will stop music, on click again play it

private void pictureBox1_Click(object sender, EventArgs e) { SoundPlayer ssp = new SoundPlayer(); ssp.Stop(); pctmutesplash.Image = Properties.Resources.unmuteicon; }
RyanJM
  • 19
  • 5
-2
votes
1 answer

FIle dialog gives path that doesn't work with soundplayer

When I use the file dialog to get a path it gives me the path but it doesn't work with SoundPlayer. The path it returns has the disk letter capitalised which doesn't work with SoundPlayer. I don't know how to word what I'm searching so I came…
Niami
  • 23
  • 4
-2
votes
1 answer

playing AWS Lex response audio stream using .net SoundPlayer gives error "The wave header is corrupt"

I am trying to develop a winforms application to integrating AWS lex voice service. I am not able to play the audio received from AWS Lex bot "postContentResponse.AudioStream" in winforms application. I am using SoundPlayer to play the audio stream.…
Varun
  • 422
  • 3
  • 14
-3
votes
1 answer

Using audio file in c# console application

I'm making a text based game on cmd using c#, and I need your help. I'm using this code for playing audio: SoundPlayer sndPlayer = new SoundPlayer(); sndPlayer.SoundLocation = @"C:\Users\Uri\Desktop\Music\Music for game\sp8.wav"; …
Toortelz
  • 9
  • 2
-5
votes
2 answers

Program exists when using the Play method in SoundPlayer

When I use the Play method with the SoundPlayer, my program exits and there is no sound playing. Please help me. Code: SoundPlayer player; player = new SoundPlayer(); private void wii_WiimoteChanged(object s, EventArgs e) { if…
1 2 3
8
9