sine

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#sine

see also

aevalsrc

The use of this filter is mainly for testing of the filter. This outputs a simple sine wave:

#! /bin/sh
# 440Hz sine wave ("A4" in MIDI scale) for 10 secs.
ffplay -f lavfi sine=440:d=10

To visualize by showcqt:

#! /bin/sh
ffmpeg -filter_complex "
sine=440:d=10,asplit[a][ac];
[ac]showcqt=s=960x540[v]
" -map '[v]' -map '[a]' -f matroska - | ffplay -

or:

#! /bin/sh
ffplay -f lavfi "
sine=440:d=10,asplit[out1][a];
[a]showcqt=s=960x540[out0]"

or:

#! /bin/sh
ffplay -f lavfi "
sine=440:d=10,asplit[out1],
showcqt=s=960x540
#! /bin/sh
# C4 + E4 + G4
ffplay -f lavfi "
sine=261.6255653005986:d=500[a1];
sine=329.6275569128699:d=500[a2];
sine=391.9954359817493:d=500[a3];
[a1][a2][a3]amix=inputs=3:duration=first"
#! /bin/sh
# C4 + E4 + G4
ffmpeg -filter_complex "
sine=261.6255653005986:d=500[a1];
sine=329.6275569128699:d=500[a2];
sine=391.9954359817493:d=500[a3];
[a1][a2][a3]amix=inputs=3:duration=first
" -f wav - | ffplay -
#! /bin/sh
# left: A3 / right: A3 + 7.83Hz
ffplay -f lavfi "
sine=220.00:d=500[a1];
sine=227.83:d=500[a2];
[a1][a2]amerge=inputs=2"
#! /bin/sh
# left: A3 / right: A3 + 7.83Hz (visualize)
ffplay -f lavfi "
sine=220.00:d=500[a1];
sine=227.83:d=500[a2];
[a1][a2]amerge=inputs=2,asplit[out1],channelsplit[a1][a2];
[a1]showcqt=s=960x270,setsar=1[v1];
[a2]showcqt=s=960x270,setsar=1,vflip[v2];
[v1][v2]vstack[out0]"
#! /bin/sh
# left: A3 / right: A3 + 7.83Hz
ffmpeg -filter_complex "
sine=220.00:d=500[a1];
sine=227.83:d=500[a2];
[a1][a2]amerge=inputs=2
" -f wav - | ffplay -
#! /bin/sh
# Twinkle Twinkle Little Star
ffmpeg -filter_complex "
sine=f=261.62556530059862:d=0.49[a00];
sine=f=0:d=0.0125[a01];
sine=f=261.62556530059862:d=0.49[a02];
sine=f=0:d=0.0125[a03];
sine=f=391.99543598174927:d=0.49[a04];
sine=f=0:d=0.0125[a05];
sine=f=391.99543598174927:d=0.49[a06];
sine=f=0:d=0.0125[a07];
sine=f=440.00000000000000:d=0.49[a08];
sine=f=0:d=0.0125[a09];
sine=f=440.00000000000000:d=0.49[a10];
sine=f=0:d=0.0125[a11];
sine=f=391.99543598174927:d=0.99[a12];
sine=f=0:d=0.0125[a13];
sine=f=349.22823143300388:d=0.49[a14];
sine=f=0:d=0.0125[a15];
sine=f=349.22823143300388:d=0.49[a16];
sine=f=0:d=0.0125[a17];
sine=f=329.62755691286992:d=0.49[a18];
sine=f=0:d=0.0125[a19];
sine=f=329.62755691286992:d=0.49[a20];
sine=f=0:d=0.0125[a21];
sine=f=293.66476791740757:d=0.49[a22];
sine=f=0:d=0.0125[a23];
sine=f=293.66476791740757:d=0.49[a24];
sine=f=0:d=0.0125[a25];
sine=f=261.62556530059862:d=0.99[a26];
sine=f=0:d=0.0125[a27];
sine=f=391.99543598174927:d=0.49[a28];
sine=f=0:d=0.0125[a29];
sine=f=391.99543598174927:d=0.49[a30];
sine=f=0:d=0.0125[a31];
sine=f=349.22823143300388:d=0.49[a32];
sine=f=0:d=0.0125[a33];
sine=f=349.22823143300388:d=0.49[a34];
sine=f=0:d=0.0125[a35];
sine=f=329.62755691286992:d=0.49[a36];
sine=f=0:d=0.0125[a37];
sine=f=329.62755691286992:d=0.49[a38];
sine=f=0:d=0.0125[a39];
sine=f=293.66476791740757:d=0.99[a40];
sine=f=0:d=0.0125[a41];
sine=f=391.99543598174927:d=0.49[a42];
sine=f=0:d=0.0125[a43];
sine=f=391.99543598174927:d=0.49[a44];
sine=f=0:d=0.0125[a45];
sine=f=349.22823143300388:d=0.49[a46];
sine=f=0:d=0.0125[a47];
sine=f=349.22823143300388:d=0.49[a48];
sine=f=0:d=0.0125[a49];
sine=f=329.62755691286992:d=0.49[a50];
sine=f=0:d=0.0125[a51];
sine=f=329.62755691286992:d=0.49[a52];
sine=f=0:d=0.0125[a53];
sine=f=293.66476791740757:d=0.99[a54];
sine=f=0:d=0.0125[a55];
sine=f=261.62556530059862:d=0.49[a56];
sine=f=0:d=0.0125[a57];
sine=f=261.62556530059862:d=0.49[a58];
sine=f=0:d=0.0125[a59];
sine=f=391.99543598174927:d=0.49[a60];
sine=f=0:d=0.0125[a61];
sine=f=391.99543598174927:d=0.49[a62];
sine=f=0:d=0.0125[a63];
sine=f=440.00000000000000:d=0.49[a64];
sine=f=0:d=0.0125[a65];
sine=f=440.00000000000000:d=0.49[a66];
sine=f=0:d=0.0125[a67];
sine=f=391.99543598174927:d=0.99[a68];
sine=f=0:d=0.0125[a69];
sine=f=349.22823143300388:d=0.49[a70];
sine=f=0:d=0.0125[a71];
sine=f=349.22823143300388:d=0.49[a72];
sine=f=0:d=0.0125[a73];
sine=f=329.62755691286992:d=0.49[a74];
sine=f=0:d=0.0125[a75];
sine=f=329.62755691286992:d=0.49[a76];
sine=f=0:d=0.0125[a77];
sine=f=293.66476791740757:d=0.49[a78];
sine=f=0:d=0.0125[a79];
sine=f=293.66476791740757:d=0.49[a80];
sine=f=0:d=0.0125[a81];
sine=f=261.62556530059862:d=0.99[a82];
sine=f=0:d=0.0125[a83];
[a00][a01][a02][a03][a04][a05][a06][a07][a08][a09]
[a10][a11][a12][a13][a14][a15][a16][a17][a18][a19]
[a20][a21][a22][a23][a24][a25][a26][a27][a28][a29]
[a30][a31][a32][a33][a34][a35][a36][a37][a38][a39]
[a40][a41][a42][a43][a44][a45][a46][a47][a48][a49]
[a50][a51][a52][a53][a54][a55][a56][a57][a58][a59]
[a60][a61][a62][a63][a64][a65][a66][a67][a68][a69]
[a70][a71][a72][a73][a74][a75][a76][a77][a78][a79]
[a80][a81][a82][a83]concat=n=84:v=0:a=1
" -f wav - | ffplay -

Because the purpose of this filter is primarily filter testing, this filter has an unnaturally integrated “beep” function. From the name of the filter and the role it plays, beep is clearly an “useless function” and it would be more appreciated for the user to be an independent filter. In fact, if your goal is to “generate a beep”, this is very annoying:

#! /bin/sh
# I only want a beep, but this creates silence.
ffplay -f lavfi sine=0:d=10:b=440
#! /bin/sh
# It is necessary to give at least 1Hz.
ffplay -f lavfi sine=1:d=10:b=440

In the first place, you can’t do anything more than “ring every second”, literally it can only be done. Personally I think this is a very stupid design, but if you want variations for other filter tests, it’s somewhat worth, so just put it in one corner of your head.