Linux sine wave audio generator [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this questionI 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?
If you want to generate sound files under linux, I recommend Sox
Pulseaudio has a module for generating sine waves:
$ pactl load-module module-sine frequency=1000
And to make it stop:
$ pactl unload-module module-sine
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:
- https://ffmpeg.org/ffmpeg-filters.html#sine
- https://www.ffmpeg.org/ffmpeg-devices.html#lavfi
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:
- https://superuser.com/questions/724391/how-to-generate-a-sine-wave-with-ffmpeg
- How to run ffplay as a window-less process?
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?
Today Linux uses the Alsa infrastructure for sound. Check out Alsa documentation and tutorials (for instance this one).
Looking around on google I found this software, not sure if it is what you are looking for.
http://www.softpedia.com/get/Multimedia/Audio/Other-AUDIO-Tools/Multisine.shtml
You could run it under wine.
Oh... before the additional note in the original post, sorry.
Edit: Woohoo, found one!
http://www.comp.leeds.ac.uk/jj/linux/siggen.html
Apparently the software Audacity can do it also.
Referencing http://ubuntuforums.org/showthread.php?t=308065
精彩评论