LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > MrCode
User Name
Password

Notices


This is the first "blog" of any kind I've ever had, so it's probably not the greatest...

Just a little snippet about me:

I'd like to consider myself relatively tech-savvy; obviously I use Linux (Arch to be precise; K.I.S.S. FTW), and I enjoy learning new things about computers in general (both software and hardware-related).

This blog is mostly just for whenever I feel like telling the world about my experiences with computers/Linux (or just life in general), or just posting for the hell of it.
Rate this Entry

Something to do if you're REALLY bored...

Posted 01-02-2011 at 11:30 PM by MrCode
Updated 01-02-2011 at 11:40 PM by MrCode
Tags boredom

I've come up with a little something you can do with dd and SoX if you're really bored and can't think of anything else to do:

Code:
$ dd if=<whatever file here> of=<whatever output file here> bs=<1024/512>k skip=<# of MiB to skip through the file (or in increments of 0.5 MiB if you supplied 512k as the block size)> count=<MiB of content (or in increments of 0.5 MiB)>
$ play -q -t raw -s -b 16 -v 0.03125 -c 2 -r 48k <output file from dd> pad 0 2 reverb <whatever reverb parameters here; look at man page for details>
Go ahead and take a listen to the whole file (just put the name of your source file as the filename to play) to look for interesting parts, taking off the reverb and pad stuff if you want, and change dd's bs, skip, and count parameters to match, at least roughly. I don't have a good guide for translating MiB to seconds for 16-bit PCM data at a 48000Hz sample rate, but I'm sure it's calculable. I'm tired and kinda sleepy as I write this post, so I don't wanna bother with it.

Modify the last step with sox instead of play, supply a .wav filename after the inital one (the name of the snippet file you made from your image/whatever file using dd), and you'll have a signed, 16-bit PCM .wav file, playable with just about any media player, that consists of whatever you cut out of your binary...with a reverb filter applied.

I've bolded the volume option for a reason: this will be very loud if you don't decrease the volume! Seriously, if you don't want to suffer ear (or in extreme cases speaker) damage, please just set the volume really low (I've used 1/32 here). I also recommend that you alias the "play -q -t raw -s -b 16" part to something a little easier on the fingers (I use rawplay myself, and raw2wav for the same thing with sox).

I've also attached a sample of what this sounds like below for your listening enjoyment (lossily compressed to meet LQ's filesize limit). I used these exact commands to create the .wav (I was in my ISO image directory at the time):

Code:
[mrcode@compy386 MediaImages]$ dd if=ReactOS.iso of=~/Binaries/ReactOS_clip.bin bs=512k skip=6 count=3
3+0 records in
3+0 records out
1572864 bytes (1.6 MB) copied, 0.00965459 s, 163 MB/s
[mrcode@compy386 MediaImages]$ raw2wav -v 0.75 -c 2 -r 48k ~/Binaries/ReactOS_clip.bin ~/Sounds/isoexample1.wav pad 0 2 reverb -w 50 0 60 100 0 0
Some tips on what files are good for doing this with:
  • uncompressed image (picture) files, e.g. BMP
  • the one compressed pictorial image format that I'd recommend here is PCX...PNG and JPG are just static (due to the way they're compressed)
  • media image files, e.g. ISOs, VDI/VHD/VMDK (VirtualBox/Virtual PC/VMware disk images), IMG, etc.
  • swap space
Attached Files
File Type: txt isoechoexample1.oga.txt (159.2 KB, 7 views)
Views 31438 Comments 8
« Prev     Main     Next »
Total Comments 8

Comments

  1. Old Comment
    LOL. I had to download VLC just to play that file, but it was strangely worth it. Binary music! Very creative.

    Oh, and it's not terribly loud. 1/4 of my volume bar was just right for listening to it in a quiet bedroom. That's laptop speakers, though.
    Posted 01-03-2011 at 12:41 AM by lupusarcanus lupusarcanus is offline
    Updated 01-03-2011 at 12:43 AM by lupusarcanus
  2. Old Comment
    Just listened to your sample. Very nice. MrCode = Aphex Twin.
    Posted 01-03-2011 at 09:36 AM by brianL brianL is offline
  3. Old Comment
    even better? you can pipe the output of your video card into play using stdin, then you can listen to you moving the mouse around and other such things that affect the screen. Create your own musical symphony!
    Posted 01-03-2011 at 10:46 AM by lumak lumak is offline
  4. Old Comment
    There was a thread in non-*nix/general a while ago about this sort of stuff.
    Posted 01-03-2011 at 11:01 AM by brianL brianL is offline
  5. Old Comment
    Quote:
    Originally Posted by lumak
    you can pipe the output of your video card into play using stdin, then you can listen to you moving the mouse around and other such things that affect the screen.
    I would love to know how to do this.

    I've tried piping things like /dev/nvidia0 and /dev/video0 to /dev/dsp using cat (the "down-'n-dirty" method), but even as root, I get cat: /dev/<nvidia0/video0>: Invalid argument. Do I need to be using an open-source GPU driver to do this, or am I missing something here?
    Posted 01-03-2011 at 11:16 AM by MrCode MrCode is offline
    Updated 01-03-2011 at 11:19 AM by MrCode
  6. Old Comment
    <dupe>
    Posted 01-03-2011 at 11:16 AM by MrCode MrCode is offline
    Updated 01-03-2011 at 11:21 AM by MrCode
  7. Old Comment
    Err.. hrmmm... I thought you could cat or dd your video card...

    Just use /dev/random as that fills in random characters with mouse and keyboard as well :P
    Posted 01-04-2011 at 01:38 AM by lumak lumak is offline
    Updated 01-04-2011 at 01:47 AM by lumak
  8. Old Comment
    Yeah, I know this is kinda old, but I figured I should go ahead and respond to it...

    Quote:
    Originally Posted by leopard
    Oh, and it's not terribly loud. 1/4 of my volume bar was just right for listening to it in a quiet bedroom. That's laptop speakers, though.
    Mostly what I'm talking about is when you're playing raw files. Often times (in fact I'd say 99% of the time, unless it's uncompressed audio of the correct width (8/16/32-bit) and type (signed/unsigned int, float, etc.)) you'll get files that during the conversion to audio (real-time or not), max out the PCM values both ways, so it's basically non-stop clipping. Trust me, you don't want to have your volume turned up to any significant level when you're playing audio like that.
    Posted 01-07-2011 at 09:09 PM by MrCode MrCode is offline
    Updated 01-07-2011 at 09:12 PM by MrCode
 

  



All times are GMT -5. The time now is 10:05 AM.

Main Menu
Advertisement
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