Linux sine wave audio generator [closed]

2020-06-03 03:00发布

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?

标签: linux audio
5条回答
老娘就宠你
2楼-- · 2020-06-03 03:27

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.:

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?

查看更多
做个烂人
3楼-- · 2020-06-03 03:45

If you want to generate sound files under linux, I recommend Sox

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-06-03 03:45

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
查看更多
仙女界的扛把子
5楼-- · 2020-06-03 03:49

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

查看更多
forever°为你锁心
6楼-- · 2020-06-03 03:50

Today Linux uses the Alsa infrastructure for sound. Check out Alsa documentation and tutorials (for instance this one).

查看更多
登录 后发表回答