Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8270987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:43:58+00:00 2026-06-08T06:43:58+00:00

I am writing a simple timer app for OSX10.6 using Mono. How can I

  • 0

I am writing a simple timer app for OSX10.6 using Mono. How can I play an alarm sound (it may be a wav/mp3 file or something else)?

I tried several ways, unfortunately none did work:

  1. NSSound seems to be not supported by Mono yet.

    MonoMac.AppKit.NSSound alarm = new MonoMac.AppKit.NSSound("alarm.wav");
    alarm.Play();
    
  2. Using a SoundPlayer didn’t work either:

    System.Media.SoundPlayer player = new System.Media.SoundPlayer("alarm.wav");
    player.PlaySync();
    
  3. I was able to play a sound by opening a System.Diagnostics.Process and then use the OSX command line command afplay. Unfortunately, this command opens in a new terminal window, which is quite annoying in a GUI app.

I realize there are CoreAudio bindings in Mono. But I have not figured out how to use them to play a sound.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:43:59+00:00Added an answer on June 8, 2026 at 6:43 am

    You’re using the wrong NSSound constructor is all.

    new MonoMac.AppKit.NSSound("alarm.wav") expects an NSData (implicitly cast from string), you want to use new NSSound(string, bool). Probably want to pass false for the second parameter.

    I threw together a quicky test project (based on the default MonoMac project) to confirm this works:

    public override void FinishedLaunching (NSObject notification)
    {
      mainWindowController = new MainWindowController ();
      mainWindowController.Window.MakeKeyAndOrderFront (this);
    
      // Only lines added
      var sound = new NSSound("/Users/kevinmontrose/Desktop/bear_growl_y.wav", byRef: false);
    
      sound.Play();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently writing a simple, timer-based mini app in C# that performs an
i am writing a simple folder synchronization app. Therefore i want at the time
i am writing a simple timer aspect to instrument all the methods in all
I'm writing a simple alarm utility in Python. #!/usr/bin/python import time import subprocess import
I am writing simple parallel program in C++ using OpenMP. I am working on
I'm writing simple GUI using wxPyhon and faced some problems. My application does simple
I'm writing a simple App Engine app. I have a simple page that allows
I am writing an app that’s a very simple web service client. I have
I am writing a simple app with 24 items in a hash to be
I am writing an app using the MVVM (Model-View-ViewModel) pattern and am leveraging the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.