SoundPlayer is a method which plays .wav files in c#
Questions tagged [soundplayer]
133 questions
1
vote
1 answer
Is there a way to publish a C# console app running on the .NET Framework with System.media Soundplayer?
When I publish my app and run it, it says that it couldn't find the path to sound.wav file and it crashes.
I put my sound files into a bin/Debug/sound folder, and use it like this in my code:
public void OpenInventory()
{
SoundPlayer inventory =…

Warden Zoxs
- 11
- 2
1
vote
0 answers
C# Play WAV Soundfile - Error: "The wave header is corrupt."
I have the following issue.
I want to play a WAV audio file in my C# program, which I converted from MP3 to WAV before. I can't just play it as a MP3 as C# needs the Media Player library added first, but I don't want to use any other library that…

Menrion
- 41
- 1
1
vote
0 answers
Play .wav file without crashing the program
I'm currently using this method to play a .wav file:
private void button5_Click(object sender, System.EventArgs e)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.Song1);
player.PlaySync();
}
It's…

Scrooge McDuck
- 11
- 3
1
vote
1 answer
System.Media.SoundPlayer, Playing more than 1 sound?
Is there a way to play more than one sound while let's say the background music is going?
The way I have it is:
public static void PlaySound(string filename)
{
SoundPlayer player = new SoundPlayer();
player.SoundLocation =…

Easelm
- 11
- 1
- 2
1
vote
2 answers
Unresolved reference: Context in android MediaPlayer (kotlin)
I created this function to make the button do a sound when i click it, the sound file is mp3 located in raw/button_click.mp3 directory .
fun play_sound(which_one:Int) {
if(which_one == 1){
val mediaPlayer:MediaPlayer? =…

Adel gamer
- 23
- 7
1
vote
0 answers
SoundPlayer cannot be found in visual studio code
So i am fairly new to coding and have been working on a little text based game. I wanted to add music and most sources i have found recommend using "SoundPlayer" which is supposed to be a part of "System.Media" however every time i type it into…

Caleb
- 11
- 1
1
vote
2 answers
How can I play a sound that will be in the application folder?
I am trying to make that when the program initialize it plays a sound, but when I pass the installer to someone else it doesn't work since the destination is not correct in their computer.
How can I refer to the file in a way that will work in…
1
vote
1 answer
How do I ensure reliable async wav playback in dotnet?
I am playing wav files as user prompts in dotnet. My code works fine on a laptop, but seems to skip sounds on a netbook. How do I ensure wav playback is consistent on the netbook in dotnet?
Current code that causes occasional playback problems in…

moca
- 656
- 5
- 3
1
vote
0 answers
coverflow images onclick streaming specific sound file (mp3)
i googled coverflow code i found one useful and work great to me (im not professional in android development ), what i need it.
when click on each image it will stream predetermined mp3 song for each image and another click will stop it ,
so each…

frozenhill4
- 157
- 1
- 9
1
vote
0 answers
Trying to play audio in C# (Using Xamarin Studio)
After trying to run a simple audio player, I get this error:
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
Here's my code:
using System;
namespace PurePlayer
{
class MainClass
{
public static void…

user3770842
- 11
- 1
1
vote
2 answers
Pause/ Resume background music in c#
I have a background music and i want to be able to pause/unpause it or mute/unmute it with the press of one button.Anyone any suggestions? Thanks in advance. This is what I have until now, but i can't get it working;
edit: I used WMP because you…

henk_bae
- 25
- 7
1
vote
0 answers
Play real-time sound buffer using C# Media.SoundPlayer
I have developed a system in which a C# program receives sound buffers (byte arrays) from another subsystem. It is supposed to play the incoming buffers continuously. I searched in the web and I decided to use SoundPlayer. It works perfectly in the…

Yasser Mohseni
- 453
- 2
- 7
- 17
1
vote
2 answers
playing of .wav file
I am making a piano app, where each key plays a different .wav file. For instance, if the C note is pressed then C.wav is played.
So far I have only managed to play a wav file using the code in the screenshot, otherwise the file is not found.…

Mar
- 13
- 6
1
vote
2 answers
Playing two (or more) .wav sounds in a WindowForms Application
I made a kind of Tetris game in C# with a Win Forms Application.
I want the program to play-looping a .wav file during the game and another short .wav file only occasionally but parallel to the "main" sound.
I declared at the beginning:
SoundPlayer…

user3283415
- 119
- 1
- 2
- 12
1
vote
0 answers
System.Media.SoundPlayer.Play() freezes GUI
I am trying to implement a simple game in .NET with C#. There is a ball bouncing against objects, and when it bounces I play a sound asynchronously using System.Media:SoundPlayer. The problem is that most of the time (not always) the ball freezes at…

Hakan Eriksson
- 11
- 2