Arduino Uno sound producing

so i am using the Arduino basic sound code at the moment in C++, i have every little coding experience, actually this is the first time i have ever done coding and all seriousness have almost no idea what i am doing. I am in year 12 at my school and doing my HSE basically my tests to see my final mark. I am trying to program an Arduino Uno and then convert it to a Arduino Lilypad, the program basically just has to emit a sound of 100,000 Hz below is the code and where it states // ____ for the first 8 lines the frequency does not match to 100,000 hz i believe that this is due to the notes being musical notes such as middle C

i have the circuit set up for the system to be used in i just need the code to be able to emit a 100,000 Hz sound

// TONES ==========================================
// Start by defining the relationship between
// note, period, & frequency.
#define c 3830 //
#define d 3400 //
#define e 3038 //
#define f 2864 //
#define g 2550 //
#define a 2272 //
#define b 2028 //
#define C 1912 //
// Define a special note, ‘R’, to represent a rest
#define R 0

// SETUP ============================================
// Set up speaker on a PWM pin (digital 9, 10 or 11)
#include “pitches.h”

int speakerOut = 9;
// Do we want debugging on serial out? 1 for yes, 0 for no
int DEBUG = 1;

void setup() {
pinMode(speakerOut, OUTPUT);
if (DEBUG) {
Serial.begin(9600); // Set serial out if we want debugging
}
}

// MELODY and TIMING =======================================
// melody is an array of notes, accompanied by beats,
// which sets each note’s relative length (higher #, longer note)
int melody = { C, b, g, C, b, e, R, C, c, g, a, C };
int beats = { 16, 16, 16, 8, 8, 16, 32, 16, 16, 16, 8, 8 };
int MAX_COUNT = sizeof(melody) / 2; // Melody length, for looping.

// Set overall tempo
long tempo = 10000;
// Set length of pause between notes
int pause = 1000;
// Loop variable to increase Rest length
int rest_count = 100; //<-BLETCHEROUS HACK; See NOTES

// Initialize core variables
int tone_ = 0;
int beat = 0;
long duration = 0;

// PLAY TONE ==============================================
// Pulse the speaker to play a tone for a particular duration
void playTone() {
long elapsed_time = 0;
if (tone_ > 0) { // if this isn’t a Rest beat, while the tone has
// played less long than ‘duration’, pulse speaker HIGH and LOW
while (elapsed_time < duration) {

digitalWrite(speakerOut,HIGH);
delayMicroseconds(tone_ / 2);

// DOWN
digitalWrite(speakerOut, LOW);
delayMicroseconds(tone_ / 2);

// Keep track of how long we pulsed
elapsed_time += (tone_);
}
}
else { // Rest beat; loop times delay
for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
delayMicroseconds(duration);
}
}
}

// LET THE WILD RUMPUS BEGIN =============================
void loop() {
// Set up a counter to pull from melody and beats
for (int i=0; i<MAX_COUNT; i++) {
tone_ = melody*;*
_ beat = beats*;_
_ duration = beat * tempo; // Set up timing_
_
playTone();_
_
// A pause between notes…_
_
delayMicroseconds(pause);_
_
if (DEBUG) { // If debugging, report loop, tone, beat, and duration*_
* Serial.print(i);*
* Serial.print(":");*
* Serial.print(beat);*
* Serial.print(" "); *
* Serial.print(tone_);
_
Serial.print(" ");_
_
Serial.println(duration);_
_
}_
_
}_
_
}*_
any help will be greatly appreciated
thank you for your time
*Jacob Samuel *

100,000 Hz is above the range of human hearing. Are you trying to frighten the local dogs? The max. frequency that can be heard by humans is around 20,000 Hz, and only for you youngsters. Oldies like me have a much lower frequency level that we can hear. You could tell your teacher that your project is really emitting 100,000 Hz, even though it's not, but he can't hear it. :D

How long have you got to prepare for your exam? Almost no idea? You're like "I don't know the alphabet but need to write meaningful Haiku really soon."

What do you need to produce 100KHz oscillations for? Does it have to be through the use of code? Because if so, you have a lot of learning to do!

BTW, you don't need anything like that much code. You need to turn a pin HIGH and LOW 200K times a second, not play songs.