Oh MyUtils

Tone Generator - Audio Frequency & Waveform Generator Online

Generate sine, square, sawtooth, and triangle wave tones from 20Hz to 20kHz. Real-time waveform and spectrum visualization, multi-tone mixing, and musical note display β€” 100% client-side using Web Audio API.

Protect your ears. Start at a low volume level.

Hz
440.00 Hz
Closest Note:A4
50%
Visualization
100% Client-Side β€” All audio is generated in your browser, no data sent to server

Frequently Asked Questions

What is a tone generator and what is it used for?

A tone generator is a tool that produces audio signals at specific frequencies and waveform shapes. It is commonly used for testing speakers and headphones, calibrating audio equipment, tuning musical instruments, conducting hearing range tests, matching tinnitus frequencies, and educational demonstrations of sound wave properties. The generated tones range from low bass frequencies (20 Hz) to high treble frequencies (20,000 Hz), covering the full range of human hearing.

How do I use this tone generator?

1. Select a waveform type (sine for a pure tone, or square/sawtooth/triangle for richer harmonic content). 2. Set the desired frequency using the slider, numeric input, or preset buttons (e.g., 440 Hz for standard A4 tuning). 3. Adjust the volume to a comfortable level β€” start low to protect your hearing. 4. Click the Play button to start generating the tone. 5. Observe the waveform visualization to see the shape of the audio signal in real time. 6. Switch to Spectrum view to see the frequency content (harmonics) of the signal. 7. Use the Multi-Tone tab to mix multiple frequencies simultaneously.

Is my audio data sent to a server?

No. This tool is 100% client-side and uses the Web Audio API built into your browser. All audio synthesis, processing, and visualization happen entirely on your device. No audio data, frequency settings, or any other information is ever transmitted to a server. The tool works fully offline after the initial page load.

What is the difference between sine, square, sawtooth, and triangle waves?

Sine wave: The purest tone with only a single frequency (fundamental). Sounds smooth and clean. Used as the standard reference signal. Square wave: Contains only odd harmonics (3rd, 5th, 7th...) at decreasing amplitudes. Sounds hollow and buzzy. Common in retro video game music. Sawtooth wave: Contains all harmonics (both odd and even) at decreasing amplitudes. Sounds bright and harsh. Commonly used in synthesizer patches. Triangle wave: Contains only odd harmonics like a square wave, but they decrease much faster. Sounds mellow and flute-like, softer than a square wave.

Why can I not hear very low or very high frequencies?

The typical human hearing range is 20 Hz to 20,000 Hz, but this varies significantly by individual. Low frequencies (below ~40 Hz) require speakers or headphones capable of producing sub-bass, and many laptop speakers cannot reproduce them. High frequency hearing naturally decreases with age (presbycusis) β€” most adults over 25 cannot hear above 15-16 kHz. If you cannot hear a frequency, try increasing the volume cautiously, ensuring your speakers support that range, or testing with headphones.

Can I generate multiple tones at the same time?

Yes. Switch to the Multi-Tone tab to create and mix up to 4 simultaneous tones. Each tone has independent frequency, waveform, and volume controls. This is useful for creating intervals, chords, binaural beats, or testing how multiple frequencies interact (interference patterns, beating). The visualization shows the combined waveform of all active tones.

What is the 440 Hz frequency and why is it special?

440 Hz is the international standard for concert pitch, defined as the note A above middle C (A4). It was adopted by the International Organization for Standardization (ISO 16) in 1955 and is used worldwide as the reference frequency for tuning musical instruments. Some musicians and tuning systems use alternative references such as 432 Hz (sometimes called Verdi pitch), which is also available as a preset in this tool.

Code Examples

// Using the Web Audio API to generate tones in the browser

function playTone(frequency = 440, waveform = 'sine', volume = 0.5) {
  const ctx = new AudioContext();
  const oscillator = ctx.createOscillator();
  const gainNode = ctx.createGain();

  oscillator.type = waveform; // 'sine', 'square', 'sawtooth', 'triangle'
  oscillator.frequency.setValueAtTime(frequency, ctx.currentTime);
  gainNode.gain.setValueAtTime(volume, ctx.currentTime);

  oscillator.connect(gainNode);
  gainNode.connect(ctx.destination);
  oscillator.start();

  // Return stop function
  return () => {
    gainNode.gain.linearRampToValueAtTime(0, ctx.currentTime + 0.05);
    setTimeout(() => {
      oscillator.stop();
      oscillator.disconnect();
      ctx.close();
    }, 50);
  };
}

// Convert frequency to musical note name
function frequencyToNote(frequency) {
  const A4 = 440;
  const noteNames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];

  const semitones = 12 * Math.log2(frequency / A4);
  const roundedSemitones = Math.round(semitones);
  const cents = Math.round((semitones - roundedSemitones) * 100);

  const noteIndex = ((roundedSemitones % 12) + 12 + 9) % 12;
  const octave = Math.floor((roundedSemitones + 9) / 12) + 4;

  return { note: noteNames[noteIndex] + octave, cents };
}

// Example usage
const stop = playTone(440, 'sine', 0.5);
console.log(frequencyToNote(440));    // { note: 'A4', cents: 0 }
console.log(frequencyToNote(261.63)); // { note: 'C4', cents: 0 }
setTimeout(stop, 2000);

Related Tools