Posted: . At: 8:11 AM. This was 3 years ago. Post ID: 14875
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



Create a nice spectrum display of an audio file. This is very easy to do.


Creating a very nice spectrum display of an audio file is very simple to do. The FFmpeg utility is the best way to generate such a useful audio waveform demonstration.

This command will generate a 2560×1080 resolution waveform display of the file underground_01.ogg

ffplay -f lavfi 'amovie=undergrnd_01.ogg, asplit [a][out1]; [a] showspectrum=size=2560x1080:overlap=1:slide=scroll:scale=cbrt:legend=true,setdar=dar=21/9 [out0]'

This is the command in action below.

┌──[jason@192.168.1.2][~/Videos]
└──╼  ╼ $ ffplay -f lavfi 'amovie=undergrnd_01.ogg, asplit [a][out1]; [a] showspectrum=size=2560x1080:overlap=1:slide=scroll:scale=cbrt:legend=true,setdar=dar=21/9 [out0]'
ffplay version 4.2.4-1ubuntu0.1 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, lavfi, from 'amovie=undergrnd_01.ogg, asplit [a][out1]; [a] showspectrum=size=2560x1080:overlap=1:slide=scroll:scale=cbrt:legend=true,setdar=dar=21/9 [out0]':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
    Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p, 2842x1208 [SAR 604:609 DAR 7:3], 21.53 tbr, 21.53 tbn, 21.53 tbc
    Stream #0:1: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s
[swscaler @ 0x7f5f6c005500] Warning: data is not aligned! This can lead to a speed loss
  18.79 A-V: -0.015 fd=   0 aq=    0KB vq=20116KB sq=    0B f=0/0

The display is monochrome and displays the audio frequency and the loudness in dB. This could be very useful for analyzing the audio recordings of engines to get the approximate engine RPM.

Nice spectrum display of a lovely song.
Nice spectrum display of a lovely song.

This looks very cool indeed. I still need to work out how to connect the output of a pulseaudio microphone to the input of this, but you could always pre-record and then feed it in.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.