4

I try to play a sound from a Raspberry Pi 3 with Raspbian installed. I have mono installed. I tested it on Windows, and it runs well. But when running it on Raspbian. I don't get any error message and no sound either.

public void PlaySound()
{
    try
    {
        using (var file = new FileStream("example.wav",
            FileMode.Open, FileAccess.Read, FileShare.Read))
        {
            var player = new SoundPlayer(file);
            player.PlaySync();
        }
    }
    catch (Exception e)
    {
        Console.WriteLine("Sound failed to play");
    }
}

Mono version

Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-10)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:           __thread
SIGSEGV:       normal
Notifications: epoll
Architecture:  armel,vfp+hard
Disabled:      none
Misc:          softdebug
LLVM:          supported, not enabled.
GC:            sgen
Sven Borden
  • 171
  • 4

1 Answers1

0
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install mono-complete

or

sudo apt-get dist-upgrade

if your mono is already installed

This should fix the problem for SoundPlayer in RPI3

s k
  • 121
  • 4