Sine Wave Generator

Play a pure sine tone, see the wave on a labelled graph and change its frequency, amplitude and phase. Save the result as a WAV file, a PNG graph or a table of values for your code.

Horizontal axis

Equation

y(t) = sin(2π · 440 · t)

Textbook form: y = a · sin(b · (x − c)) + d
with a = 1, b = 2764.6 rad/s, c = 0 s, d = 0

Wave

Hz
°

Amplitude and offset change the graph and the equation only. Phase moves the curve, but a single tone sounds the same at any phase.

Sound

Output

Wave facts

Frequency
440 Hz
Period
2.27 ms
Angular frequency
2764.6 rad/s
Peak to peak
2
RMS
0.7071
Phase
0° (0 rad)
Time shift
none
Wavelength in air
78 cm
Nearest note
A4
Output level
-20 dBFS

Save or reuse the wave

s

Trims the length to whole cycles so a loop does not click. Turns the fade off.

5 s, 44.1 kHz, 16-bit, mono, 431 KB

The file uses the frequency, phase, volume and output side from above. It ignores amplitude and offset.

Rate Sine Wave Generator

How useful was this tool? Your rating helps others find it.

Sine wave generator with sound, graph and export

This sine wave generator plays a pure sine tone and draws the same wave on a labelled graph. Change the frequency, the amplitude, the phase and the vertical offset, and the sound, the picture and the equation change together. Use it as an online sine tone generator, as a sine wave graph for homework, or as a quick way to make a test signal.

The graph reads like an oscilloscope. The time axis adjusts to the frequency, so a 20 kHz wave and a 1 Hz wave both fill the screen with a few clean cycles. Switch to the angle axis to see the textbook sine curve in radians and degrees. Move the pointer over the graph to read the exact value at any point.

What frequency, amplitude, phase and offset do

Four settings describe every sine wave. The table shows what each one changes on the graph and in the formula y = A · sin(2πft + φ) + d.

SettingWhat it changesSymbol
Frequency (Hz)How many cycles fit in one second. A higher frequency packs more cycles into the same time and raises the pitch.f
AmplitudeThe height of the wave, from the midline to the peak. On the graph it stretches the curve up and down.A
Phase (degrees)How far the curve is shifted along the time axis. A positive phase moves it to the left. A shift of 360 degrees is one full cycle.φ
Vertical offsetMoves the whole wave up or down without changing its shape. The dotted line marks the new midline.d

Sine wave equation and the textbook form

In physics and electronics, the wave is written as y(t) = A · sin(2πft + φ) + d. Maths classes use the form y = a · sin(b · (x − c)) + d. Both describe the same curve, and they connect like this: a equals A, b equals 2πf (the angular frequency), c equals −φ / b, and d stays the same. The tool shows both forms with your own numbers under the graph.

A 440 Hz wave with an amplitude of 1 has a period of 2.27 ms, an angular frequency of 2764.6 rad/s and a wavelength of 78 cm in air at 20 °C. Change the frequency and the Wave facts panel recalculates the period, the angular frequency, the RMS value, the wavelength and the nearest musical note. On the angle axis, b equals 1 and x is measured in radians, so the curve repeats every 2π.

Save the wave as audio, an image or code

WAV file

Download up to 60 seconds of the tone as a 16-bit WAV file at 44.1 kHz or 48 kHz. Choose the left channel, the right channel or both, add a short fade, or trim the file to whole cycles so it loops without a click.

Graph image

Save the current graph as a PNG with a white background. The axes, the labels, the period bracket and the amplitude marker are included, so you can paste it straight into a report or a slide.

Table of values for code

Get one cycle as a lookup table with 16 to 1024 samples. Choose 8, 10, 12 or 16 bits, signed, unsigned or float values, and copy the table as a C array, an Arduino PROGMEM table, a Python list or CSV. Microcontroller projects use these tables to drive a DAC or a PWM output.

Common test tones and what they are for

Each preset under Frequency matches a tone that people use for a reason.

ToneWhat it is used for
20 HzThe lower edge of human hearing. Most speakers cannot play it, but you can see it on the graph.
50 Hz and 60 HzThe frequency of mains power: 50 Hz in most of Europe, 60 Hz in the United States, Canada and Mexico. The hum from poorly shielded audio gear sits at this pitch or at twice it.
C4 (261.63 Hz)Middle C on a piano.
A4 (440 Hz)The standard tuning pitch. Orchestras and tuners use it as a reference.
1 kHzThe usual reference tone for setting levels and testing equipment. Almost every device plays it well, and the ear hears it clearly.
5 kHzSits in the range where the ear is most sensitive, so it sounds sharp even at low volume.
15 kHzClose to the upper limit for many adults. Use it at low volume to test how high your hearing and your speakers reach.

Listen safely

Start quiet

The tool starts at a low volume. Raise it slowly. A pure tone has no gaps and no changes, so it feels louder and more tiring than music.

Take care with high pitches

Above 16 kHz many adults hear little, which makes it easy to turn the volume up too far. Keep the volume low and stop if you feel pressure or pain.

Protect your speakers

Very low tones at high volume push small speakers hard, and loud high tones can damage tweeters. Do not leave a tone running without watching it.

How the sine wave generator works

The generator draws the curve y = A · sin(2πft + φ) + d on a canvas, with more than one point for every pixel, so the line stays smooth at any zoom. The horizontal axis shows time in microseconds, milliseconds or seconds, or the angle in radians and degrees. For sound, the browser creates a sine oscillator with the Web Audio API and ramps the volume up and down over a few milliseconds, which avoids clicks. WAV files are written in the browser: each sample is the sine value at that moment, multiplied by the volume and stored as PCM audio. Nothing is sent to a server.

How to use the sine wave generator

1

Set the wave

Type a frequency in hertz or pick a preset such as 440 Hz or 1 kHz. Then set the amplitude, the phase and the vertical offset. The graph and the equation update as you type.

2

Read the graph

Switch the horizontal axis between time and angle, and choose how many cycles to show. Move the pointer over the graph to read the value at any point.

3

Play or save it

Press Play tone and set the volume. To keep the wave, download a WAV file, save the graph as a PNG, or copy a table of values for C, Arduino or Python.

Example Usage

A 440 Hz tone, the standard tuning pitch:

Input
Frequency: 440 Hz, amplitude: 1, phase: 0°
Output
y(t) = sin(2π · 440 · t) Period: 2.27 ms Nearest note: A4

Frequently Asked Questions

What is a sine wave?
A sine wave is a smooth curve that repeats. It rises to a peak, falls to a trough and returns to where it started, over and over. A pure tone in air, the voltage of mains power and the motion of a weight on a spring all follow this shape. Mathematicians call the same curve the sine function.
What do amplitude, frequency and phase mean?
Amplitude is the height of the wave, measured from the midline to the peak. Frequency is the number of cycles in one second, measured in hertz. Phase is how far the wave is shifted along the time axis, measured in degrees. A phase of 90 degrees moves the wave a quarter of a cycle to the left.
What is the formula for a sine wave?
The formula is y = A · sin(2πft + φ) + d. A is the amplitude, f is the frequency in hertz, t is the time in seconds, φ is the phase and d is the vertical offset. The tool writes the formula with your numbers under the graph. The textbook form, y = a · sin(b · (x − c)) + d, appears beside it, with b equal to 2πf.
What is the difference between a sine wave and a cosine wave?
A cosine wave is a sine wave shifted by 90 degrees. Set the phase to 90 degrees and the tool draws a cosine wave: it starts at the peak instead of at the midline.
How do I find the period from the frequency?
Divide 1 by the frequency. The period T is 1 / f. A 440 Hz wave repeats every 2.27 ms. For the current frequency, the tool also shows the angular frequency and the wavelength in air.
Can I download a sine wave as a WAV file?
Yes. Open the WAV file tab under Save or reuse the wave, choose a length of up to 60 seconds and a sample rate, then click Download WAV. The file is 16-bit PCM. It uses the frequency, the phase and the volume from the controls. Turn on End on a full cycle if you plan to play the file in a loop.
Do amplitude and phase change what I hear?
No. Amplitude and offset change only the graph and the equation. A computer has one fixed maximum output, so you set loudness with the Volume slider. The slider also shows the level in dBFS, where 100% is 0 dBFS and 10% is -20 dBFS. A single tone sounds the same at any phase, because the ear does not notice where in the cycle a steady tone began. Phase matters when you compare or add two waves. The WAV file starts at the phase you set.
What is 440 Hz, and which frequency should I use for a test?
440 Hz is the note A above middle C (A4), the standard tuning pitch. 1 kHz is the usual reference tone for checking levels and equipment. 50 Hz and 60 Hz match mains power, which runs at 50 Hz in most of Europe and 60 Hz in the United States. Use 20 Hz and 20 kHz to find the limits of your speakers and your hearing.
Why can I not hear very low or very high frequencies?
People hear from about 20 Hz to 20 kHz, and the upper limit falls with age. Many adults hear little above 15 kHz. Small speakers also play almost nothing below about 100 Hz, so a low tone can look right on the graph and still sound silent.
Is it safe for my ears and my speakers?
Keep the volume low. Start from the default and raise it slowly. A steady pure tone feels louder than music at the same level and can tire or hurt your ears. Very high tones at high volume can also damage small speakers and tweeters. The tool warns you about both.
What is the difference between a sine wave and a square or triangle wave?
A sine wave has a single frequency and no harmonics, which is why it sounds clean. Square, triangle and sawtooth waves add extra frequencies on top of the main one. This tool makes sine waves only. For other shapes, use the Online Tone Generator.
Does the tool upload my settings or my audio?
No. The graph, the sound and the files are made in your browser, and nothing is sent to a server. The Copy link button only builds a web address that holds your settings, so you can share them.

Related Tools

Comments

Comments are provided by Disqus. Loading them connects to Disqus, which sets cookies and processes data under its own privacy policy.

The Sine Wave Generator is maintained by CodeItBro. We aim to provide the best free developer tools on the web. If you have feedback or suggestions, please visit our contact page.

As featured on

CodeItBro - Free dev tools + practical guides to help you ship faster | Product HuntCodeItBro - Free Online Developer Tools badgeCodeItBro badge