A simple program, where a random note is being chosen, shown and played. It supposed to use random number that will be used as an address in the name and file location arrays. But the program gives an error - "make sure the file is here". It is. Is there a specific place where it should be? I've tried almost all folders it the project folder. I don't want to inflate my array with a full path or add an extra code to combine paths, what is the problem here?
using System;
using System.Media;
class BassPractice {
static void Main() {
string[] notesArr = new string[]{"E - mi big","F - fa big","G - sol' big","A - la big",
"H - si big","a - la small","h - si small","c - do small",
"d - re small","e - mi small","f - fa small","g - sol' small","c1 - do first"};
string[] locations = new string[]{"Ebig.wav","Fbig.wav","Gbig.wav","Abig.wav","Hbig.wav","a.wav","h.wav","c.wav","d.wav","e.wav","f.wav","g.wav","c1.wav"};
Random note = new Random();
SoundPlayer sound = new SoundPlayer();
int ArrSize = notesArr.Length;
int current = 0;
Console.WriteLine ("Any Key to start");
for (;;)
{
Console.ReadKey();
Console.Clear();
current = note.Next(ArrSize);
Console.WriteLine ("note:");
Console.WriteLine ("");
Console.WriteLine (notesArr[current]);
sound.SoundLocation = locations[current];
sound.Play();
Console.WriteLine ("");
Console.WriteLine ("Any Key for the next one");
}
}
}
I thought that the folder with the .cs is the root, so I copied files there. Didn't work, so I copied it practically everywhere. Nothing changed.