LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-01-2011, 02:41 PM   #1
hd_pulse
Member
 
Registered: Dec 2010
Posts: 35

Rep: Reputation: 0
Cant hear sound from "cat /dev/urandom > /dev/audio"


Hello,

I found this command somewhere which claims to produce sounds
Quote:
cat /dev/urandom > /dev/audio
Quote:
cat /vmlinuz > /dev/audio
But it generates error:
Quote:
~$ cat /dev/urandom > /dev/audio
bash: /dev/audio: Permission denied
Quote:
cat /vmlinuz > /dev/audio
bash: /dev/audio: Permission denied
I tried it from root even then also :
Quote:
# cat vmlinuz > /dev/audio
cat: vmlinuz: No such file or directory

Is the above command fake?
Or I don't know to make it run?!?

Kindly teach me if its so.
 
Old 06-01-2011, 03:36 PM   #2
andywebsdale
Member
 
Registered: Jan 2005
Location: Lewisham,London,UK
Distribution: Debian Wheezy AMD64
Posts: 87
Blog Entries: 2

Rep: Reputation: 23
cat /dev/urandom > /dev/audio
should produce an annoying random noise. I would think you have to be a member of the 'audio' group to do this (on my Debian Wheezy system anyway)
When you submit a question, its probably a good idea to mention what Linux distro you're using(as the answer to your question could be very different depending on your distro) & perhaps some hardware details if relevant.
If you 'ls -l ' the file you've been denied access to, it will tell you which user & group owns the file (or device like /dev/audio )
e.g.
crw-rw----+ 1 root audio 14, 4 Jun 1 19:57 /dev/audio
 
Old 06-01-2011, 03:38 PM   #3
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
The issue is that you need to have root permissions to write directly to any of the /dev "files". Get to a root shell (or use sudo, if it's installed/configured, or if you're using Ubuntu ), and then try the command.

What the command should do is produce white noise at an 8000 Hz sample rate. Make sure you turn your speakers way down before you do it, though…it's really loud.

EDIT: Ninja'd.

Last edited by MrCode; 06-01-2011 at 03:39 PM.
 
Old 06-02-2011, 03:29 PM   #4
hd_pulse
Member
 
Registered: Dec 2010
Posts: 35

Original Poster
Rep: Reputation: 0
I am using Ubuntu 10.10
I supplied the above command from root but nothing happened.
The prompt just went to the next line.

Quote:
root@hemant-G41M-Combo:/home/hemant# cat /vmlinuz > /dev/audio
root@hemant-G41M-Combo:/home/hemant#
do i need to download any package to run this?
Why ain't working then ?
 
Old 06-02-2011, 04:12 PM   #5
andywebsdale
Member
 
Registered: Jan 2005
Location: Lewisham,London,UK
Distribution: Debian Wheezy AMD64
Posts: 87
Blog Entries: 2

Rep: Reputation: 23
I'm not too sure about the "cat /vmlinuz" version - I just tried it and it scrolled the binary down the screen accompanied by system beeps. I'd never heard of anyone using that command before.
However the "cat /dev/urandom > /dev/audio " version should as MrCode says, produce white noise. I presume your sound works OK for "normal" stuff, like playing music or YouTube etc. If it does, then you haven't got much to worry about on the audio front, believe me.
The cat <file> >/dev/audio command plays *.au sound files I believe, but that type of sound file probably isn't even on your system.
 
Old 06-02-2011, 06:09 PM   #6
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
Quote:
The cat <file> >/dev/audio command plays *.au sound files I believe, but that type of sound file probably isn't even on your system.
Actually, AFAIK, cat <file> > /dev/audio (or /dev/dsp, if applicable) will play any uncompressed PCM audio file (*.au, *.wav) at 8000 Hz. I'm not sure if it has to be signed or unsigned, though.

EDIT: /vmlinuz should yield similar white noise (although it won't be perfect), as the kernel image is compressed, and hence the entropy is higher (it would probably be more interesting uncompressed )…did you remember to redirect output to /dev/audio or /dev/dsp?

Last edited by MrCode; 06-02-2011 at 06:13 PM.
 
Old 06-03-2011, 10:06 AM   #7
andywebsdale
Member
 
Registered: Jan 2005
Location: Lewisham,London,UK
Distribution: Debian Wheezy AMD64
Posts: 87
Blog Entries: 2

Rep: Reputation: 23
I thought so too, although /dev/urandom is the only version that produces white noise for me. I tried re-directing a wav file but that produced the same result as /vmlinuz did. I have got pulseaudio installed, though - to use the dsp device the sound file has to be processed by 'padsp' for example, so I'm not suprised at these results. As long as my 7.1 sound works OK I'm happy,anyway
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Stupidly ran "cat /dev/urandom > /dev/mem", worried I broke firmware crosstalk Linux - Hardware 2 10-25-2010 05:27 PM
Startup Hang after "Using /etc/random-seed to initialize /dev/urandom" DotMatrix Slackware 5 02-26-2010 12:34 AM
V4L: "cat /dev/video0: no such device"; to be sure not supported? jago25_98 Linux - Hardware 1 01-27-2005 04:04 PM
What is adsp0? and why cat /dev/urandom >/dev/adsp0 give me "no such device"? haimeltjnfg Linux - Hardware 2 05-09-2004 10:54 PM
why did cat /dev/urandom send my printer insane ? qwijibow Linux - Newbie 1 12-01-2003 03:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration