![]() ![]() |
Mar 14 2012, 03:19 AM
Post
#1
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
For the GNU/Linux users in AcDec, or the nonexistent Windows or Mac users who both have and are capable of using bash...
I did a very crude hack several weeks ago that creates random 15-second-clips of the AcDec music (assuming the folder containing the music only contains that, and the files are in Ogg Vorbis format), and it's pretty much only capable of doing that, though I do plan on adapting it to be a bit more general. The script also concatenates all the clips into one. If you want the script and man page, run (as root, or insert "sudo" before the "mv" parts): CODE #wget http://dl.dropbox.com/u/31495710/acdecrcg; mv acdecrcg /usr/bin; wget http://dl.dropbox.com/u/31495710/acdecrcg.1.gz; mv acdecrcg.1.gz /usr/share/man/man1 The script itself is: CODE #!/bin/sh mkdir ./Random cp *.ogg ./Random cd ./Random for ((n=1; n<=10; n++)) do for ((c=1; c<=9; c++)) do sox "0$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 0$c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15 done for ((c=10; c<=14; c++)) do sox "$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 $c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15 done done sox ?????.ogg "Random.ogg" mkdir ./Clips; mv ?????.ogg ./Clips for ((c=1; c<=9; c++)) do rm 0$c*.ogg done for ((c=10; c<=14; c++)) do rm $c*.ogg done cd to the AcDec music directory, and run it. CODE $acdecrcg If you want the command form: CODE $mkdir ./Random; cp *.ogg ./Random; cd ./Random; for ((n=1; n<=10; n++)); do for ((c=1; c<=9; c++)); do sox "0$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 0$c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15; done; for ((c=10; c<=14; c++)); do sox "$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 $c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15; done; done; sox ?????.ogg "Random.ogg"; mkdir ./Clips; mv ?????.ogg ./Clips; for ((c=1; c<=9; c++)); do rm 0$c*.ogg; done; for ((c=10; c<=14; c++)); do rm $c*.ogg; done Again, cd to the music directory and run that. Bugs include VLC media player thinking it's a good 30% or more shorter than it actually is, though it will still play the entire thing, and mplayer does not have any of those problems, so it's more of a cosmetic problem. Furthermore, sometimes it will output 139 or 138 clips instead of 140. To adjust the time, adjust the red-coloured portions: #!/bin/sh mkdir ./Random cp *.ogg ./Random cd ./Random for ((n=1; n<=10; n++)) do for ((c=1; c<=9; c++)) do sox "0$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 0$c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15 done for ((c=10; c<=14; c++)) do sox "$c*.ogg" "$((20000+(`od -An -N2 -i /dev/random` )%(99999-20000+1) )).ogg" trim $(((`od -An -N2 -i /dev/random` )%(($(mplayer -ao null -identify -frames 0 $c*.ogg 2>&1 | gawk -F= '/ID_LENGTH/{printf("%d",$2)}'))-15+1) )) 15 done done sox ?????.ogg "Random.ogg" mkdir ./Clips; mv ?????.ogg ./Clips for ((c=1; c<=9; c++)) do rm 0$c*.ogg done for ((c=10; c<=14; c++)) do rm $c*.ogg done If your music files are in a format other than Ogg Vorbis, you'll have to either convert the files (easy enough to do if you're using a GNU/Linux distro), or adjust the script (I dunno how/if sox and mplayer work with mp3s, though). I do plan on making some changes to this, though. Anyway, this is licensed under the GNU GPLv3, i.e., if you distribute this, you must distribute source, and allow modifications and redistribution. For details on how the script itself works, see http://leiswaronstupidity.blogspot.com/201...ake-random.html This requires sox and mplayer to work, but most distros come with those pre-installed. End result: You should have a subdirectory in your AcDec Music folder called "Random" that contains a 35-minute-long clip called "Random.ogg", along with a folder called "Clips" which contain 140 150-second-clips with random five-digit names between 20000 and 99999 in Ogg Vorbis format. No, this will not work on Windows. And I don't think it will work on a Mac. If you want to use this, either install a GNU/Linux distro or find someone who has a distro already installed. I hope this helps. |
|
|
|
Mar 14 2012, 03:38 AM
Post
#2
|
|
![]() Master of Speaking About Nonsensical Things ![]() ![]() ![]() Group: Soylent Greens Posts: 306 Joined: 24-May 10 From: Houston, Texas Member No.: 638 |
Orrrrrrr you could use Audacity, play the music and record 15 second clips. That's how the non-technologically advanced people do it. =D
-------------------- "And you thought us Varsities were illiterate!"
Tad Walters J. Frank Dobie High School '11 Varsity Loyola University- Naw'lins Class of 2015 |
|
|
|
Mar 14 2012, 03:50 AM
Post
#3
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Red Herrings Posts: 434 Joined: 22-December 11 From: Formerly Red Mountain Member No.: 207,578 |
What is this?? oO
-------------------- Once a Polar Bear, Always a Polar Bear
|
|
|
|
Mar 14 2012, 03:54 AM
Post
#4
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
Orrrrrrr you could use Audacity, play the music and record 15 second clips. That's how the non-technologically advanced people do it. =D But that would be 1) less random, and 2) more time consuming. What is this?? oO A script for making 10 15-second-clips of the AcDec music, for 140 clips, or 35 minutes, total. |
|
|
|
Mar 14 2012, 03:54 AM
Post
#5
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Soylent Greens Posts: 149 Joined: 3-December 10 From: Dobie HS → Brandeis University Member No.: 747 |
A thing to play random clips of the AcDec selections. I sort of want to do this in Java and get it to run on Windows at least... Maybe a project for the summer.
-------------------- Jessica Huynh
J. Frank Dobie High School honors 2009-2011 Brandeis University, class of 2015 |
|
|
|
Mar 14 2012, 03:57 AM
Post
#6
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
Eh. In a situation like this, bash scripts are much more superior than actual code. Versatility, adaptability, ease of use, no compilation, etc.
|
|
|
|
Mar 14 2012, 04:07 AM
Post
#7
|
|
![]() Master of Speaking About Nonsensical Things ![]() ![]() ![]() Group: Soylent Greens Posts: 306 Joined: 24-May 10 From: Houston, Texas Member No.: 638 |
Orrrrrrr you could use Audacity, play the music and record 15 second clips. That's how the non-technologically advanced people do it. =D 2) more time consuming. Well I'd rather do that than install an entirely new OS. Just sayin'. -------------------- "And you thought us Varsities were illiterate!"
Tad Walters J. Frank Dobie High School '11 Varsity Loyola University- Naw'lins Class of 2015 |
|
|
|
Mar 14 2012, 04:12 AM
Post
#8
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
Orrrrrrr you could use Audacity, play the music and record 15 second clips. That's how the non-technologically advanced people do it. =D 2) more time consuming. Well I'd rather do that than install an entirely new OS. Just sayin'. Well, it's less time consuming for anyone who is using GNU/Linux. And non-technologically-advanced people are not necessarily unable to use a GNU/Linux distro. |
|
|
|
Mar 14 2012, 04:19 AM
Post
#9
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Soylent Greens Posts: 149 Joined: 3-December 10 From: Dobie HS → Brandeis University Member No.: 747 |
Definitely faster if you have Linux, but the not-running on Windows and Macs is a problem. I could write some code over Passover break, compile, debug, compile, pray it works, etc. and then give out the files (or make it an applet and upload to the web). Java is basically universal, so that's convenient. The run-time is a bit slower because of the JVM, but it shouldn't matter too much. Installing Linux is a bit much just to be able to randomly generate music clips for AcDec.
-------------------- Jessica Huynh
J. Frank Dobie High School honors 2009-2011 Brandeis University, class of 2015 |
|
|
|
Mar 14 2012, 04:23 AM
Post
#10
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
|
|
|
|
Mar 14 2012, 04:31 AM
Post
#11
|
|
![]() Connoisseur of Cheese ![]() ![]() ![]() Group: Soylent Greens Posts: 1,581 Joined: 1-May 09 From: McDowell Member No.: 13 |
A thing to play random clips of the AcDec selections. I sort of want to do this in Java and get it to run on Windows at least... Maybe a project for the summer. The only Java library I know of that would possibly allow something like this would require you to have the clips stored in a .wav format, iirc. A CD ripped in decent quality .wav and a 35 minute output file in .wav? Your poor hard drive... Then again, there's probably third party libraries for other data formats, but the bash script is easier, and a few extra lines should enable you to convert to/from formats like .mp3, but would probably further limit the number of computers capable of using it. Something like that... EDIT: I forgot to mention that Tad is lame. Gotta mention that. This post has been edited by JBroms: Mar 14 2012, 04:33 AM -------------------- Good varsities simply are; I'm honestly not sure there's any sort of rubric or trend. "Soda" is the "Acadeca" of slang terms for carbonated beverages. McDowell RECORD Varsity I was the third-highest varsity in pa history for all of a month and a half. ....and now I'm just a washed up old gamer. twitch.tv steam: http://twitch.tv/jbroms (Self-Proclaimed) Patron Saint of the Varsities |
|
|
|
Mar 14 2012, 04:36 AM
Post
#12
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Soylent Greens Posts: 149 Joined: 3-December 10 From: Dobie HS → Brandeis University Member No.: 747 |
Yeah, the hard drive would not survive 35 minutes of that. Hmm.
QUOTE deleting system32 Always the first thing I recommend. ̶D̶o̶n̶'̶t̶ ̶a̶c̶t̶u̶a̶l̶l̶y̶ ̶d̶o̶ ̶t̶h̶i̶s̶.̶ -------------------- Jessica Huynh
J. Frank Dobie High School honors 2009-2011 Brandeis University, class of 2015 |
|
|
|
Mar 14 2012, 04:37 AM
Post
#13
|
|
![]() Connoisseur of Cheese ![]() ![]() ![]() Group: Soylent Greens Posts: 1,581 Joined: 1-May 09 From: McDowell Member No.: 13 |
Yeah, the hard drive would not survive 35 minutes of that. Hmm. QUOTE deleting system32 Always the first thing I recommend. ̶D̶o̶n̶'̶t̶ ̶a̶c̶t̶u̶a̶l̶l̶y̶ ̶d̶o̶ ̶t̶h̶i̶s̶.̶ do this instead: sudo rm -rf /* -------------------- Good varsities simply are; I'm honestly not sure there's any sort of rubric or trend. "Soda" is the "Acadeca" of slang terms for carbonated beverages. McDowell RECORD Varsity I was the third-highest varsity in pa history for all of a month and a half. ....and now I'm just a washed up old gamer. twitch.tv steam: http://twitch.tv/jbroms (Self-Proclaimed) Patron Saint of the Varsities |
|
|
|
Mar 14 2012, 04:39 AM
Post
#14
|
|
![]() Pagan god of varsity math and wtf's wrong with you ![]() ![]() ![]() Group: Soylent Greens Posts: 2,887 Joined: 2-May 09 From: Pearland, TX Member No.: 97 |
Yeah, the hard drive would not survive 35 minutes of that. Hmm. QUOTE deleting system32 Always the first thing I recommend. ̶D̶o̶n̶'̶t̶ ̶a̶c̶t̶u̶a̶l̶l̶y̶ ̶d̶o̶ ̶t̶h̶i̶s̶.̶ Speaking of code, try formatting your text with [ s ] [ /s ] (but without the spaces) instead of that sloppy strikethrough text you keep using. -------------------- |
|
|
|
Mar 14 2012, 04:42 AM
Post
#15
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Soylent Greens Posts: 149 Joined: 3-December 10 From: Dobie HS → Brandeis University Member No.: 747 |
This board has that markup? I thought the <strike> tag was deprecated a while back.
-------------------- Jessica Huynh
J. Frank Dobie High School honors 2009-2011 Brandeis University, class of 2015 |
|
|
|
Mar 14 2012, 04:43 AM
Post
#16
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
The only Java library I know of that would possibly allow something like this would require you to have the clips stored in a .wav format, iirc. A CD ripped in decent quality .wav and a 35 minute output file in .wav? Your poor hard drive... Then again, there's probably third party libraries for other data formats, but the bash script is easier, and a few extra lines should enable you to convert to/from formats like .mp3, but would probably further limit the number of computers capable of using it. Something like that... EDIT: I forgot to mention that Tad is lame. Gotta mention that. The relevant line of code to add in the beginning: CODE soundconverter -b *.mp3 And then, in the end, maybe CODE rm *.ogg do this instead: sudo rm -rf /* I've done this. On a Kubuntu virtual machine. Turns out it's fun to trash imaginary computers. And if someone does delete system32, they have the elegant solution of installing a GNU/Linux distro. |
|
|
|
Mar 14 2012, 04:46 AM
Post
#17
|
|
![]() Connoisseur of Cheese ![]() ![]() ![]() Group: Soylent Greens Posts: 1,581 Joined: 1-May 09 From: McDowell Member No.: 13 |
The only Java library I know of that would possibly allow something like this would require you to have the clips stored in a .wav format, iirc. A CD ripped in decent quality .wav and a 35 minute output file in .wav? Your poor hard drive... Then again, there's probably third party libraries for other data formats, but the bash script is easier, and a few extra lines should enable you to convert to/from formats like .mp3, but would probably further limit the number of computers capable of using it. Something like that... EDIT: I forgot to mention that Tad is lame. Gotta mention that. The relevant line of code to add in the beginning: CODE soundconverter -b *.mp3 And then, in the end, maybe CODE rm *.ogg do this instead: sudo rm -rf /* I've done this. On a Kubuntu virtual machine. Turns out it's fun to trash imaginary computers. And if someone does delete system32, they have the elegant solution of installing a GNU/Linux distro. Is soundconverter a standard program? I've never converted any audio files via command line. (Though, I've converted way too many video files with console commands) -------------------- Good varsities simply are; I'm honestly not sure there's any sort of rubric or trend. "Soda" is the "Acadeca" of slang terms for carbonated beverages. McDowell RECORD Varsity I was the third-highest varsity in pa history for all of a month and a half. ....and now I'm just a washed up old gamer. twitch.tv steam: http://twitch.tv/jbroms (Self-Proclaimed) Patron Saint of the Varsities |
|
|
|
Mar 14 2012, 04:54 AM
Post
#18
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
Hmmm. On second thought, I don't think so. It's in the Fedora repos, though.
|
|
|
|
Mar 14 2012, 05:12 AM
Post
#19
|
|
![]() Connoisseur of Cheese ![]() ![]() ![]() Group: Soylent Greens Posts: 1,581 Joined: 1-May 09 From: McDowell Member No.: 13 |
Hmmm. On second thought, I don't think so. It's in the Fedora repos, though. I'd check on Ubuntu but I recently reinstalled Windows (>.<) and am yet to repair my bootloader. However, it looks to be a downloadable program in the Ubuntu repos as well. Still, that means you need even more installed for that to work, so it definitely shouldn't be part of the script. -------------------- Good varsities simply are; I'm honestly not sure there's any sort of rubric or trend. "Soda" is the "Acadeca" of slang terms for carbonated beverages. McDowell RECORD Varsity I was the third-highest varsity in pa history for all of a month and a half. ....and now I'm just a washed up old gamer. twitch.tv steam: http://twitch.tv/jbroms (Self-Proclaimed) Patron Saint of the Varsities |
|
|
|
Mar 14 2012, 05:17 AM
Post
#20
|
|
|
Member ![]() ![]() Group: Blue Man Group Posts: 13 Joined: 14-March 12 From: Mesa, AZ Member No.: 230,692 |
Yep. It is a fairly simple step, anyway.
Oh, also, it's possible to just run this all from a virtual machine, if anyone here doesn't have a GNU/Linux distro installed and are unwilling to do so. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 18th June 2013 - 07:24 AM |