如何管道/ dev / urandom到linux声音输出?

时间:2023-02-04 14:04:44

This doesn't seem to work at all:

这似乎根本不起作用:

cat /dev/urandom > /dev/dsp    #from wikipedia.org

Is it because of pulseaudio? or I need to do some settings?

是因为pulseaudio?或者我需要做一些设置?

3 个解决方案

#1


27  

I'm not sure there is a simple device you can just send the bytes to these days - the /dev/dsp device is an old OSS thing and probably won't exist on a modern ALSA based system where the sound card is controlled by the devices in /dev/snd.

我不确定有没有一个简单的设备你可以发送字节到现在 - / dev / dsp设备是一个旧的OSS的东西,可能不会存在于现有的基于ALSA的系统,其中声卡由/ dev / snd中的设备。

You're probably better off using aplay or something to "play" the data from /dev/random though you will probably need to give it a load of switches to tell it what format to assume the data is in. To make it play as if it were WAV data you want something like:

你可能最好使用aplay或某些东西来“播放”来自/ dev / random的数据,虽然你可能需要给它一大堆开关来告诉它假设数据在哪种格式。让它像如果它是WAV数据你想要的东西:

aplay -c 2 -f S16_LE -r 44100 /dev/random

#2


3  

pacat /dev/urandom Works on ubuntu without any additional installation.

pacat / dev / urandom无需任何额外安装即可在ubuntu上运行。

#3


-1  

cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '0-9' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '0-9' | fold -w 10 | sed 1000000000q |aplay



cat /dev/urandom | tr -dc '&*(&(^)' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '&*(&(^)' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '~`!@#$%^&*()' | fold -w 1 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc "0-9a-z" |aplay

cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 |aplay -r 192000

#1


27  

I'm not sure there is a simple device you can just send the bytes to these days - the /dev/dsp device is an old OSS thing and probably won't exist on a modern ALSA based system where the sound card is controlled by the devices in /dev/snd.

我不确定有没有一个简单的设备你可以发送字节到现在 - / dev / dsp设备是一个旧的OSS的东西,可能不会存在于现有的基于ALSA的系统,其中声卡由/ dev / snd中的设备。

You're probably better off using aplay or something to "play" the data from /dev/random though you will probably need to give it a load of switches to tell it what format to assume the data is in. To make it play as if it were WAV data you want something like:

你可能最好使用aplay或某些东西来“播放”来自/ dev / random的数据,虽然你可能需要给它一大堆开关来告诉它假设数据在哪种格式。让它像如果它是WAV数据你想要的东西:

aplay -c 2 -f S16_LE -r 44100 /dev/random

#2


3  

pacat /dev/urandom Works on ubuntu without any additional installation.

pacat / dev / urandom无需任何额外安装即可在ubuntu上运行。

#3


-1  

cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '0-9' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '0-9' | fold -w 10 | sed 1000000000q |aplay



cat /dev/urandom | tr -dc '&*(&(^)' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '&*(&(^)' | fold -w 10 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc '~`!@#$%^&*()' | fold -w 1 | sed 1000000000q |aplay

cat /dev/urandom | tr -dc "0-9a-z" |aplay

cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 |aplay -r 192000