auxpartition.pl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/perl
  2. if($#ARGV<0){
  3. &usage;
  4. }
  5. $|=1;
  6. $bands=0;
  7. foreach $arg (@ARGV){
  8. ($entries[$bands],$file[$bands])=split(/,/,$arg);
  9. $bands++;
  10. }
  11. # no time to deal with globs right now
  12. if($bands>0){
  13. die unless open(ONE,"<".$file[0]);
  14. }
  15. if($bands>1){
  16. die unless open(TWO,"<".$file[1]);
  17. }
  18. if($bands>2){
  19. die unless open(THREE,"<".$file[2]);
  20. }
  21. while (<ONE>) {
  22. my@nums = ();
  23. @nums = split(/,/);
  24. my$cols=$#nums;
  25. for($i=0;$i<$cols;$i++){
  26. print 0+$nums[$i].", ";
  27. }
  28. if($bands>1){
  29. $_=<TWO>;
  30. @nums = ();
  31. @nums = split(/,/);
  32. $cols=$#nums;
  33. for($i=0;$i<$cols;$i++){
  34. print $nums[$i]+$entries[0].", ";
  35. }
  36. if($bands>2){
  37. $_=<THREE>;
  38. @nums = ();
  39. @nums = split(/,/);
  40. $cols=$#nums;
  41. for($i=0;$i<$cols;$i++){
  42. print $nums[$i]+$entries[0]+$entries[1].", ";
  43. }
  44. }
  45. }
  46. print "\n";
  47. }
  48. if($bands>0){
  49. close ONE;
  50. }
  51. if($bands>1){
  52. close TWO;
  53. }
  54. if($bands>2){
  55. close THREE;
  56. }
  57. sub usage{
  58. print "\nOggVorbis auxbook spectral partitioner\n\n";
  59. print "auxpartition.pl <part_entries>,file [<part_entries>,file...]\n\n";
  60. exit(1);
  61. }