How Are Note Frequencies Chosen?

A musical note corresponds to a particular frequency. Frequency is measured in hertz (Hz). When you want an Arduino buzzer to play a specific pitch, you give your code the frequency for that note.

You do not need to calculate every note yourself. Find the note you want in the chart below and copy its frequency into your Arduino code.

Note naming: This chart uses standard scientific pitch notation, where A4 = 440.000 Hz.

Arduino Note Frequency Chart

Use this table to look up the frequency of the note you want to play.

Note Frequency (Hz)
C132.703
C#1 / Db134.647
D136.708
D#1 / Eb138.890
E141.203
F143.653
F#1 / Gb146.249
G148.999
G#1 / Ab151.913
A155.000
A#1 / Bb158.270
B161.735
C265.406
C#2 / Db269.296
D273.416
D#2 / Eb277.782
E282.407
F287.307
F#2 / Gb292.499
G297.999
G#2 / Ab2103.826
A2110.000
A#2 / Bb2116.541
B2123.471
C3130.813
C#3 / Db3138.591
D3146.832
D#3 / Eb3155.563
E3164.814
F3174.614
F#3 / Gb3184.997
G3195.998
G#3 / Ab3207.652
A3220.000
A#3 / Bb3233.082
B3246.942
C4261.626
C#4 / Db4277.183
D4293.665
D#4 / Eb4311.127
E4329.628
F4349.228
F#4 / Gb4369.994
G4391.995
G#4 / Ab4415.305
A4440.000
A#4 / Bb4466.164
B4493.883
C5523.251
C#5 / Db5554.365
D5587.330
D#5 / Eb5622.254
E5659.255
F5698.456
F#5 / Gb5739.989
G5783.991
G#5 / Ab5830.609
A5880.000
A#5 / Bb5932.328
B5987.767
C61046.502
C#6 / Db61108.731
D61174.659
D#6 / Eb61244.508
E61318.510
F61396.913
F#6 / Gb61479.978
G61567.982
G#6 / Ab61661.219
A61760.000
A#6 / Bb61864.655
B61975.533
C72093.005
C#7 / Db72217.461
D72349.318
D#7 / Eb72489.016
E72637.020
F72793.826
F#7 / Gb72959.955
G73135.963
G#7 / Ab73322.438
A73520.000
A#7 / Bb73729.310
B73951.066
C84186.009
C#8 / Db84434.922
D84698.636
D#8 / Eb84978.032
E85274.041
F85587.652
F#8 / Gb85919.911
G86271.927
G#8 / Ab86644.875
A87040.000
A#8 / Bb87458.620
B87902.133
C98372.018
C#9 / Db98869.844
D99397.272
D#9 / Eb99956.064
E910548.082
F911175.304
F#9 / Gb911839.822
G912543.854
G#9 / Ab913289.750
A914080.000
A#9 / Bb914917.240
B915804.264
C1016744.036
C#10 / Db1017739.688
D1018794.544
D#10 / Eb1019912.128
E1021096.164
F1022350.608
F#10 / Gb1023679.644
G1025087.708
G#10 / Ab1026579.500
A1028160.000
A#10 / Bb1029834.480
B1031608.528

Frequency data source: Composer Instruments – Scale and Frequency

How to Use This Frequency Chart with Arduino tone()

First, find the musical note you want in the table. Then store its frequency in a variable or constant. For example, A4 is 440.000 Hz, so you can define it like this:

const unsigned int A4 = 440;

Next, pass that frequency to the second argument of tone(). The first argument is the Arduino pin connected to the buzzer, and the optional third argument is the duration in milliseconds.

tone() tone(pin, frequency, duration);

Put the note frequency in argument 2.

Using a Note Frequency with Arduino tone()

Arduino tone() generates a square wave at the frequency you specify. The basic syntax is tone(pin, frequency). You can also add a duration in milliseconds as the third argument.

The frequency parameter used by tone() is an unsigned integer, so use a whole-number frequency in the actual function call. For example, 440.000 Hz becomes 440.

const int buzzerPin = 7;
const unsigned int A4 = 440;

void setup() {
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  // pin, frequency in Hz, duration in milliseconds
  tone(buzzerPin, A4, 500);

  delay(1000);
}

To play another note, find its frequency in the table and replace A4 with the value for that note.

How Does tone() Work?

You Can Make Your Own tone()!

Have you ever wondered how Arduino tone() works? You can create your own function that generates tones without using tone().

The following tutorial includes sample code for a custom function that can be used as an alternative to tone(), along with an explanation of how the function generates sound.

See the Custom tone() Alternative