0

I can do soxi -d * to get audio length information in hours, minutes, and seconds.

However it would only give me info on the individual audio length.

If I wanted to see the audio length for the entire folder, how can I accomplish such task?

like when you do "wc -w" it shows the sum of everything at the end. Is there a flag or something I can integrate with soxi?

Jirr Sawaf
  • 133
  • 9

3 Answers3

2

soxi -T *

from the man file

-T Used with multiple files; changes the behaviour of -s, -d and -D to display the total across all given files. Note that when used with -s with files > with different sampling rates, this is of questionable value.

Joe
  • 399
  • 2
  • 7
0

Assume you have .wav files in directory.

For single file use soxi -D ..., and then sum values with bc (how to) Use any of this commands to get total in seconds:

# in seconds
soxi -D *.wav | awk '{s+=$1}END{print s}' | bc

# in seconds 
soxi -D *.wav | paste -sd+ - | bc

# in minutes
soxi -D *.wav | awk '{s+=$1}END{print s/60}' | bc

# in hours
soxi -D *.wav | awk '{s+=$1}END{print s/60/60}' | bc
SolomidHero
  • 149
  • 2
  • 10
0

does it have to be soxi ? if you're willing to use ffprobe as part of ffmpeg, here's how it scanned a folder of mine with different file types - .mp3, AAC in .m4a, and FLAC :

making the lazy assumption that your filenames don't contain the equal sign ("=") in their names. if they do, adjust the csv=s= option accordingly

   gfind . -type f -not -name ".*" -print0 |

   parallel -0 --bar -N 1 -j 8 

     'ffprobe -hide_banner   -v 0 
              -select_streams a:0
             
      -show_entries format=format_long_name,size,filename,duration
      -of csv=s="=":p=0:nk=0
      -i {}'

./genieaudio_93508443_.lossless.mp3
MP2/3 (MPEG audio layer 2/3)
232.150204
9287144

./genieaudio_16277926_.aac.flac.m4a
QuickTime / MOV
232.181000
63572859

./genieaudio_16277926_.lossless.mp3
MP2/3 (MPEG audio layer 2/3)
232.280816
92923682/3)
250.096327
10004990

./genieaudio_79412303_.lossless.mp3
MP2/3 (MPEG audio layer 2/3)
250.383673
10016483

./genieaudio_16108705_.192k.mp3.flac
raw FLAC
251.122000
55480793

./backupgenieaudio_16108705_test1.192k.mp3
MP2/3 (MPEG audio layer 2/3)
251.928000
6046272

./genieaudio_16108705_test1.192k.mp3
MP2/3 (MPEG audio layer 2/3)
251.928000
6046893

./genieaudio_16108705_test2.192k.mp3
MP2/3 (MPEG audio layer 2/3)
251.928000
6046848

./genieaudio_16254360_192_b.mp3
MP2/3 (MPEG audio layer 2/3)
255.111837
6123354

./genieaudio_16268888_.192k.mp3.flac
raw FLAC
259.442979
55115022
RARE Kpop Manifesto
  • 2,453
  • 3
  • 11