I want to use my laptop as sinus generator under linux. But I have not found a program that can generate sound. Can someone tell me the right program or script for it. Thank you.
PS: I don't want use wine for it. PS2: I found this: "aoss siggen" and "speaker_test". But first ncurses based and second can not generate a continuous signal. May be you know more?
ffmpeg
ffmpeg can do it, as usual.
Create a 5 seconds mono 1000Hz sinusoidal out.wav
sound file:
sudo apt-get install ffmpeg
ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" out.wav
Stereo instead:
ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" -ac 2 out.wav
The file will be 2x as large, and ffprobe
will say it has 2 channels
instead of 1 channel
.
Play the audio for 5 seconds without creating a file:
ffplay -f lavfi -i "sine=frequency=1000:duration=5" -autoexit -nodisp
Play forever until you go mad:
ffplay -f lavfi -i "sine=frequency=1000" -nodisp
Documentation:
The other section sunder Audio sources document other useful sound generation algorithms in addition to sine
, e.g.:
anoisesrc
: several noisesaevalsrc
takes arbitrary mathematical expressions!Bibliography:
Tested in Ubuntu 18.04, ffmpeg 3.4.6.
Minimal C audio generation example without extra libraries
Just for fun: How is audio represented with numbers in computers?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With