alexkay / spek

Acoustic spectrum analyser
http://spek.cc
GNU General Public License v3.0
2.57k stars 257 forks source link

Batch process files #9

Open alexkay opened 12 years ago

alexkay commented 12 years ago

Moved from https://code.google.com/p/spek/issues/detail?id=6

harddiskdrive commented 9 years ago

I'd love to see a pure cmd functionality following a scheme like "--i inputFile --o OutputFile", maybe with further options for the image scale and range as already implemented in the gui. Any chances?

robertmassaioli commented 9 years ago

This would be great to have.

My use case: http://robertmassaioli.bitbucket.org/alphabet-upload.html

I have a great many audio files and I would love it if spek could do this, however, looking at the code it seems that you are grabbing the data right from the wxWidgets screen and then saving the file into a PNG based on that. That means that you probably need to open and render a window before you can write the output to a file. Quite heavyweight for such a simple "feature".

I must admit, if I was in your shoes I would probably mark this issue as Won't Fix and tell people to write another program to do this job. But ultimately it is up to you; if you are willing to let this be merged in that would be awesome.

Otherwise I'm going to try and write a command line program that has no UI but will write this output straight to a file of your choice. It'll probably work better for my use case. Cheers!

robertmassaioli commented 9 years ago

For anybody else that finds this issue: see SpekSpectrogram::save if you want to see how files are saved currently.

m0r0n commented 9 years ago

I'd love to see this feature, too. Batch is bonus as you can loop it yourself, but pure command line usage would be really cool for web app purposes.

twobob commented 8 years ago

Hmm I took a look. https://github.com/alexkay/spek/blob/master/src/spek.cc#L40 is the insertion point for the new param and help bits' info. https://github.com/alexkay/spek/blob/master/src/spek.cc#L81 test need updating to expect more than one param to be valid https://github.com/alexkay/spek/blob/master/src/spek.cc#L73 onwards is where some additional strapping code could be massaged in. Need to check if the underlying read/export implementation 'requires' this->window = new SpekWindow(this->path); to be available or not.

The https://github.com/alexkay/spek/blob/5b24d780ba4e9638f29f22ee5a62c0a2749a8c77/src/spek-spectrogram.cc section where client dimension are used could be rigged to a hard value or param, with the path being passed and directly used to save, rather than using the Save helper.

A guide to building with Wx under windows would be helpful, I only ever used the widget set once before - on a kindle, no really - but the code looks just the same. If creating via python libs is too painful I may give this a go. After a whole 600 seconds looking at the problem it currently looks "doable": with greater analysis MMMV...

Is the list of required libs:

  • [wxWidgets]
  • [FFmpeg]
  • [pthreads-win32]
  • [libjpeg]
  • [libpng]
  • [libtiff]
  • [expat]

or is that because wxWidgets and FFmpeg use them? Windows build instructions are a bit thin on the ground. Would I be better off just building under linux (I'll box one) and shoving my pull across and letting you build? Thanks.

vjandrea commented 8 years ago

Definitely a +1! This feature would be brilliant, possibly with two options: fixed width and variable width. Fixed where the whole spectrum is shrunk or expanded to fit a certain pixel width Variable where each 1px of width reflects a given time duration

thanks

KoalaBear84 commented 7 years ago

As long as this is still not supported, we can use ffmpeg which Spek is also using underneath. The spectogram almost looks the same, the rest looks not that nice, but it's a workaround. Lookout when changing the size, a height of 513 pixels will cutoff a lot of the higher frequencies.

ffmpeg -y -i "input.mp3" -lavfi showspectrumpic=s=1000x512:mode=combined:color=rainbow:gain=0.5 "output.png"

I still hope it will be natively supported by Spek itself! :)

int-ua commented 6 years ago

@KoalaBear84 for me it didn't work because somehow I don't have the showspectrumpic filter, but examples from https://trac.ffmpeg.org/wiki/Waveform did.

nurupo commented 6 years ago

I'd like to generate a spectrogram using command line, but fmmpeg and others either error or produce not as good images as Spek does. Would be great to be able to use spek as spek -i <input> -w <width> -h <height> -o <output> and if it didn't have any GUI dependencies. This could be done by moving the main functionality into a library and making the existing GUI and a new command-line tool without GUI dependencies use that library.