NAudio playing mp3 files

- Posted in Coding by

If you're going to play songs, you wanna use .mp3 format. That's not quite as simple. After some research, I found it's not difficult if you use a freely available library called NAudio. Your code must reference this library, whose code is contained in file NAudio.dll

Your code must reference this library, whose code is contained in file NAudio.dll (downloadable here). I should note that the following code will suffice equally well whether you wish to play .wav or .mp3 files.

<script src="https://gist.github.com/kyrathasoft/607c71059fc608224279c3da5ddabfc2.js"></script>

Busy proofreading and need to study skit lines

- Posted in Uncategorized by

Our new TR enrollment is 15. Hopefully this will aid us in meeting our direct-time requirement.

Hopefully, if the weather doesn't change, I'll be jogging this afternoon. It's supposed to be overcast but 60 °F. It's been three weeks, today, since I last jogged. I got that UTI, then I was covered up for several days with a pair of lucrative proofreading jobs. So, just an easy pace to burn calories.

Then this evening, while Susan sits with her dad, I need to discipline myself to practice my lines for the Christmas skit.

I've updated the name and site pic of my Facebook group. It's now "Apps, Proofreading, Websites" at the following URL: https://www.facebook.com/groups/AppsProofreadingWebsites. I went to fiverr and re-downloaded the voiceover video advert I had made months ago, and uploaded that video to my little corner of FB and LinkedIn. I also put it on my website homepage, along with a bold link beneath it on the homepage redirecting visitors to my FB Group page.

Play .wav or .mp3 media using c-sharp

- Posted in Coding by
using System;

namespace PlayWav{    

    class Program {                

        static void Main(string[] args)
        {

            Console.Clear();            

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "upbeat.wav";
            player.Play();
            Console.WriteLine("nn Press any key to exit...");
            Console.ReadKey();
        }

    }

}

Now, this is quite handy for small .wav files used as sound effects. But if you're going to play songs, you wanna use .mp3 format. That's not quite as simple. After some research, I found it's not difficult if you use a freely available library called NAudio. Your code must reference this library, whose code is contained in file NAudio.dll. I should note that the following code will suffice equally well whether you wish to play .wav or .mp3 files:

using System;
using NAudio;
using NAudio.Wave;

namespace PlayMp3{   

    class Program {                

        static void Main(string[] args)
        {

            Console.Clear(); 
            Console.WriteLine("n Press a key to play a 7-second segment from 'Somewhere Out There' (a 1986 song)");
            Console.ReadKey();
            using(var audioFile = new AudioFileReader("somewhere.mp3"))
            using(var outputDevice = new WaveOutEvent())
            {
                outputDevice.Init(audioFile);
                outputDevice.Play();
                while (outputDevice.PlaybackState == PlaybackState.Playing)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            Console.WriteLine("nn Press any key to exit...");
            Console.ReadKey();
        }

    }

}