GithubHelp home page GithubHelp logo

beschulz / wav2png Goto Github PK

View Code? Open in Web Editor NEW
281.0 22.0 46.0 3.15 MB

Creates waveform pngs out of audio files.

License: GNU General Public License v2.0

Objective-C 5.51% Objective-C++ 36.31% C++ 38.68% Makefile 10.44% Python 9.06%

wav2png's Introduction

wav2png

Build Status

Author: Benjamin Schulz

email: beschulz[the a with the circle]betabugs.de

License: GPL, v2 or later http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

create waveform pngs out of audio files.

Note: if youre looking for a way to generate waveformjs.org compatible json out of audio file, take a look at wav2json

all audio formats, that are readable by libsndfile are supported.

The generated images look like the ones you can find on soundcloud. They are ment to be used in webpages. They are not anti-aliased, but look really good when scaled down by the browser.

Examples

On Mac OS X, there is a little application you can drop your audio files into. The images are either saved in the same directory as the audio file (autosave checkbox) or can be drag'n'droped into photoshop (or what ever). You can select foreground and background colors and set the dimensions of the generated image.

DropletScreenshot

The binary can be downloaded here.

You can supply a foreground and background color in rgba

wav2png --foreground-color=ffb400aa --background-color=2e4562ff -o ../examples/example0.png ../music.wav

example0

Transparency works nicely with html.

wav2png --foreground-color=ffb400aa --background-color=2e4562ff -o ../examples/example1.png ../baked.wav

example1

You can make the waveform fully transparent and stick another image in the background. Hint: try a gradient here.

wav2png --foreground-color=00000000 --background-color=2e4562ff -o ../examples/example2.png ../music.wav

example2

Or you can just use the foreground color and make the background transparent

wav2png --foreground-color=2e4562ff --background-color=00000000 -o ../examples/example3.png ../music.wav

example3

wav2png also works nicely with short samples…

wav2png --foreground-color=2e4562ff --background-color=00000000 -o ../examples/example4.png ../short.wav

example4

…and with very short samples. In this case, the audio file had only 12 samples

wav2png --foreground-color=2e4562ff --background-color=00000000 -o ../examples/example5.png ../sine.wav

example5

You can also use decibels as units.

wav2png --foreground-color=ffb400aa --background-color=2e4562ff -d -o ../examples/example7.png ../music.wav

example7

And you can supply min and max values when using the db scale to better visualize you content.

wav2png --foreground-color=ffb400aa --background-color=2e4562ff -d --db-min -40 --db-max 3 -o ../examples/example8.png ../music.wav

example8

In case, that you need co convert mp3s, you can pipe the output of sox like this:

sox ../song.mp3 -c 1 -t wav - | wav2png -o ../examples/example9.png /dev/stdin

example9

Note, that you can easily adjust the color of the waveform by changing the background behind it. But you can also specify colors via --foreground-color and --background-color.

Also gradient overlays and backgrounds look nice.

Color format

The colors specified via --foreground-color and --background-color are in the following format:

rrggbbaa in hexadecimal form.

a few examples:

ff0000ff = 100% red, 100% opaque ff00007f = 100% red, ~50% opaque 00ff00ff = 100% green, 100% opaque 0000ffff = 100% blue, 100% opaque

I usually pick a color in photoshop or some online color picker, copy the values for rrggbb and calculate (or guess) the alpha I want.

Performance

Performance was one of the main goals, because all the other solutions I've tried where incredibly slow.

I'd say, wav2png is as fast as it gets :D

The only idea I've left to improve performance is to use multiple threads. I've decided not to do that because of the following reasons:

  • At the current state, we're already way faster than a hard disk - and the data has to come from somewhere
  • It would increase code complexity
  • You can easily run multiple instances on different audio files in parallel
  • I've better things to do :D

It takes about 1.8 seconds to convert a mono 16bit wav file of 2 hours and 11 minutes.

Thus on a 2.4 Ghz i5, the conversion rate was about 1 hour and 10 Minutes of audio per second and core (running inside a VM). Your Milage may vary.

If you have suggestions for performance improvements, please drop a line.

Installation

if you're using a Linux distributing, that supports apt-get or you're on OSX and have homebrew installed, you
might want to try:
	cd build
	make install_dependencies

On Linux (Ubuntu, Debian)

install dependencies

apt-get install make g++ libsndfile1-dev libpng++-dev libpng12-dev libboost-program-options-dev

Build

	cd build
	make all

On Max OS

install dependencies

  • Get the Xcode command line tools
    • Starting with Xcode 4.3, Apple does not install command line tools by default anymore, so after Xcode installation, go to Preferences > Downloads > Components > Command Line Tools and click Install. You can also directly download Command Line Tools for Xcode without getting Xcode.
  • Install homebrew
  • install libsndfile: in the shell: brew install libsndfile
  • install png++
    • put the headers in dependencies/include, so that dependencies/include/png++/png.hpp can be found.
    • alternatively, you can install it anywhere else, where the compiler can find it.

Build

  • either open build/macosx/wav2png.xcodeproj in Xcode to build it there, or
  • in the shell: cd build && make all

On CentOS

	yum install libsndfile-devel boost-devel libpng-devel gcc-c++
	cd wav2png/dependencies/include
	wget http://download.savannah.gnu.org/releases/pngpp/png++-0.2.5.tar.gz
	tar zxvf png++-0.2.5.tar.gz && rm png++-0.2.5.tar.gz
	mv png++-0.2.5 png++
	cd ../../build
	make # (you might have to remove -Werror in the Makefile)

Usage

> wav2png --help

wav2png version 0.6
written by Benjamin Schulz (beschulz[the a with the circle]betabugs.de)

usage: wav2png [options] input_file_name
example: wav2png my_file.wav

Allowed options:

Generic options:
  -v [ --version ]      print version string
  --help                produce help message

Configuration:
  -w [ --width ] arg (=1800)            width of generated image
  -h [ --height ] arg (=280)            height of generated image
  -b [ --background-color ] arg (=efefefff)
                                        color of background in hex rgba
  -f [ --foreground-color ] arg (=00000000)
                                        color of background in hex rgba
  -o [ --output ] arg                   name of output file, defaults to <name 
                                        of inputfile>.png
  -c [ --config-file ] arg (=wav2png.cfg)
                                        config file to use
  -d [ --db-scale ]                     use logarithmic (e.g. decibel) scale 
                                        instead of linear scale
  --db-min arg (=-48)                   minimum value of the signal in dB, that
                                        will be visible in the waveform
  --db-max arg (=0)                     maximum value of the signal in dB, that
                                        will be visible in the waveform. 
                                        Usefull, if you now, that your signal 
                                        peaks at a certain level.

TODO

  • add channel interpolation. Currently the max of all channels is used. for stereo signals, it would be cool to be able use the Mid, Side, Left or Right channel.

Donations

If you find wav2png incredibly usefull nd use it a lot, feel free to make a small donation via paypal. While it is highly appreciated, it is absolutely not necessary to us the software.

If you find any issues, feel free to contact me. and most important: enjoy and have fun :D

wav2png's People

Contributors

beschulz avatar danrossi avatar herrold avatar mkilling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wav2png's Issues

can't get it to work, command not found

On Debian I can't get wav2png to work.

when I try to compile it, it returns this:

root@sabrina:/usr/local/share/wav2png/build# make all
echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo "  namespace version {" >> ../src/version.hpp
echo "      static const std::string date=\"`date`\";" >> ../src/version.hpp
echo "      static const std::string platform=\"Linux\";" >> ../src/version.hpp
echo "      static const std::string version=\"`cat version.txt`\";" >> ../src/version.hpp
echo "  }; /* namespace version */" >> ../src/version.hpp
echo "} /* anonymous namespace */" >> ../src/version.hpp
echo "#endif /* VERSION_HPP__ */" >> ../src/version.hpp
mkdir -p `dirname ../bin/Linux/wav2png`
g++ -O3 -Wall -Werror ../src/*.cpp  `libpng-config --ldflags` -lsndfile  -lboost_program_options -o ../bin/Linux/wav2png
root@sabrina:/usr/local/share/wav2png/build# 

I don't know if it's supposed to show that, but after that:

root@sabrina:/usr/local/share/wav2png/build# wav2png
bash: wav2png: command not found

I'm a real noob when it comes to compiling/installing stuff on a linux server, so maybe i'm doing something wrong?

I did install all the dependencies

fatal error: 'png.h' file not found — on a try to compile / OS X 10.6.8

Recently get up and running wav2png on CentOS server and very glad with result — great library, thanks!
Now I'm trying to compile it on Snow Leopard machine and encountering some difficulties. I've installed dependencies — png++ by hand, libsndfile and libpng via homebrew. I also got clang++ binary.

Nevertheless I'm keep getting the following error on attempt to compile:

$ make
echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo "  namespace version {" >> ../src/version.hpp
echo "      static const std::string date=\"`date`\";" >> ../src/version.hpp
echo "      static const std::string platform=\"Darwin\";" >> ../src/version.hpp
echo "      static const std::string version=\"`cat version.txt`\";" >> ../src/version.hpp
echo "  }; /* namespace version */" >> ../src/version.hpp
echo "} /* anonymous namespace */" >> ../src/version.hpp
echo "#endif /* VERSION_HPP__ */" >> ../src/version.hpp
mkdir -p `dirname ../bin/Darwin/wav2png`
echo -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
-I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
clang++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/ `libpng-config --ldflags` -lsndfile  -lboost_program_options-mt -o ../bin/Darwin/wav2png
In file included from ../src/main.cpp:2:
../dependencies/include/png++/png.hpp:34:10: fatal error: 'png.h' file not found
#include <png.h>
         ^
1 error generated.
make: *** [../bin/Darwin/wav2png] Error 1

More build errors

Hi, I'm on CentOS 5.9, I followed your instructions and everything went ok until the build. This is the output:

echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo " namespace version {" >> ../src/version.hpp
echo " static const std::string date="date";" >> ../src/version.hpp
echo " static const std::string platform="Linux";" >> ../src/version.hpp
echo " static const std::string version="cat version.txt";" >> ../src/version.hpp
echo " }; /* namespace version /" >> ../src/version.hpp
echo "} /
anonymous namespace /" >> ../src/version.hpp
echo "#endif /
VERSION_HPP__ /" >> ../src/version.hpp
mkdir -p dirname ../bin/Linux/wav2png
echo -I../dependencies/include
-I../dependencies/include
g++ -O3 -Wall -Werror ../src/
.cpp -I../dependencies/include libpng-config --ldflags -lsndfile -lboost_program_options -o ../bin/Linux/wav2png
cc1plus: warnings being treated as errors
../dependencies/include/png++/info.hpp: In member function 'void png::info::read()':
../dependencies/include/png++/info.hpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:66: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:67: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:68: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:69: warning: dereferencing type-punned pointer will break strict-aliasing rules
cc1plus: warnings being treated as errors
../dependencies/include/png++/info.hpp: In member function 'void png::info::read()':
../dependencies/include/png++/info.hpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:66: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:67: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:68: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:69: warning: dereferencing type-punned pointer will break strict-aliasing rules
../src/wav2png.cpp: In function 'void compute_waveform(const SndfileHandle&, png::image<png::basic_rgba_pixel >&, const png::rgba_pixel&, const png::rgba_pixel&, bool, float, float, bool ()(int))':
../src/wav2png.cpp:136: warning: converting to 'size_t' from 'float'
make: *
* [../bin/Linux/wav2png] Error 1

I suspect that removing -Werror in the Makefile might help, but I went through the file, removed it in its both appearances and no luck (I removed JUST '-Werror', not the arguments). Maybe I did something wrong. What should I change, exactly?

Windows support?

Is there any plan to compile this on Windows? Or do you know of a similar utility on Windows? I haven't found anything yet.

wav2png: error while loading shared libraries: libboost_program_options.so.1.62.0: cannot open shared object file: No such file or directory

install dependencies

```apt-get install make g++ libsndfile1-dev libpng++-dev libpng12-dev libboost-program-options-dev``

libpng12-dev is no longer available. Installed libpng-dev

make all
echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo "  namespace version {" >> ../src/version.hpp
echo "          static const std::string date=\"`date`\";" >> ../src/version.hpp
echo "          static const std::string platform=\"Linux\";" >> ../src/version.hpp
echo "          static const std::string version=\"`cat version.txt`\";" >> ../src/version.hpp
echo "  }; /* namespace version */" >> ../src/version.hpp
echo "} /* anonymous namespace */" >> ../src/version.hpp
echo "#endif /* VERSION_HPP__ */" >> ../src/version.hpp
mkdir -p `dirname ../bin/Linux/wav2png`
echo -I../dependencies/include
-I../dependencies/include
# -Wno-unused-local-typedefs
g++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include -lboost_program_options `libpng-config --ldflags` -lsndfile -o ../bin/Linux/wav2png

How to fix?

batch_process.py yeilds no output

When I run batch process.py on a set of files that worked with wav2png the program silently fails. I have tried changing directorys, using different files and even multiple image options however it doesn't seem to begin processing. However no errors are reported. Am I dont something wrong here?

Getting 'File contains data in an unknown format.' error

I'm trying to get wav2png to work inside a Docker container but could not create a wav-png from any input file I give it (I tried WAV and MP3).

This is my Dockerfile so far: https://gist.github.com/ifischer/16e3427dc9e36499c62283199438eb0e
I always get an error like this:

Error opening audio file '/media/ifischer/backup_a/music/Elektro/sets/Magdalena/STEREO JACK @ STOCKADE 2H ESSENTIAL.wav'
Error was: 'File contains data in an unknown format.'

Am I missing any requirement in my Dockerfile?

-bash: -o: command not found

Hi

I am getting the issue

-bash: -o: command not found

i am trying to run it with sox i have sox installed

[root@example 5]# which sox
/usr/bin/sox
sox Drum_and_Bass_Reggae_Mix.mp3 -c 1 -t wav - | -o test.png /dev/stdin

when i do the above i get

-bash: -o: command not found

any suggestions?

The thing is with my code i am downloading the file as a mp3 but having to convert to wav and then run wav2png and then normalise etc etc i am getting 504 gateway timeout errors when doing this with large files, so if i could get above working that would be amazing.

Thanks

Build errors

Hi Beschulz,

I can't get past some compile errors. Any hints as to what I need to do?

Server is Ubuntu. No directory is created in ../bin/Linux.

Output below:

root@domU-12-31-39-0A-34-87:/usr/bin/wav2png-master/build# make
mkdir -p dirname ../bin/Linux/wav2png
echo -I../dependencies/include
-I../dependencies/include
g++ -O3 -Wall ../src/_.cpp -I../dependencies/include libpng-config --ldflags -lsndfile -lboost_program_options -o ../bin/Linux/wav2png
/tmp/ccbQ4TKR.o: In function progress_callback(int)': main.cpp:(.text+0x153): undefined reference tostd::basic_ostream<char, std::char_traits >& std::ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const, long)'
main.cpp:(.text+0x171): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' /tmp/ccbQ4TKR.o: In functionstd::basic_string<char, std::char_traits, std::allocator > boost::detail::lexical_cast<std::basic_string<char, std::char_traits, std::allocator >, float, false, char>(boost::call_traits::param_type, char
, unsigned long) [clone .constprop.316]':
main.cpp:(.text+0xa5a): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<double>(double)' /tmp/ccbQ4TKR.o: In functionOptions::Options(int, char__)':
main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x14d0): undefined reference to std::basic_istream<char, std::char_traits<char> >& std::basic_istream<char, std::char_traits<char> >::_M_extract<unsigned int>(unsigned int&)' main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x17ae): undefined reference tostd::basic_istream<char, std::char_traits >& std::basic_istream<char, std::char_traits >::_M_extract(unsigned int&)'
main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x1e52): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const_, long)' main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x1f48): undefined reference to std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, long)'
main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x1ff1): undefined reference tostd::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const_, long)' main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x204d): undefined reference to std::basic_ostream<char, std::char_traits >& std::_ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const, long)'
main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x2061): undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' /tmp/ccbQ4TKR.o:main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x2073): more undefined references tostd::basic_ostream<char, std::char_traits >& std::_ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const, long)' follow
/tmp/ccbQ4TKR.o: In function Options::Options(int, char__)': main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x20d3): undefined reference to std::ctype::_M_widen_init() const'
main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x20ee): undefined reference tostd::ctype<char>::_M_widen_init() const' main.cpp:(.text._ZN7OptionsC2EiPPc[_ZN7OptionsC5EiPPc]+0x2109): undefined reference to std::ctype::_M_widen_init() const'
main.cpp:(.text.ZN7OptionsC2EiPPc[ZN7OptionsC5EiPPc]+0x2138): undefined reference tostd::ctype<char>::_M_widen_init() const' /tmp/ccbQ4TKR.o: In function void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, unsigned int, long)':
main.cpp:(.text.ZN5boost15program_options8validateIjcEEvRNS_3anyERKSt6vectorISbIT0_St11char_traitsIS5_ESaIS5_EESaIS9_EEPT_l[void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, unsigned int, long)]+0x170): undefined reference to std::basic_istream<char, std::char_traits<char> >& std::basic_istream<char, std::char_traits<char> >::_M_extract<unsigned int>(unsigned int&)' /tmp/ccbQ4TKR.o: In functionvoid boost::program_options::validate<float, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, float
, long)':
main.cpp:(.text.ZN5boost15program_options8validateIfcEEvRNS_3anyERKSt6vectorISbIT0_St11char_traitsIS5_ESaIS5_EESaIS9_EEPT_l[void boost::program_options::validate<float, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, float, long)]+0x170): undefined reference to std::basic_istream<char, std::char_traits<char> >& std::basic_istream<char, std::char_traits<char> >::_M_extract<float>(float&)' /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libboost_program_options.so: undefined reference tostd::basic_ostream<char, std::char_traits >& std::_ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const, long)@GLIBCXX_3.4.9'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libboost_program_options.so: undefined reference to `std::ctype::_M_widen_init() const@GLIBCXX_3.4.11'
collect2: ld returned 1 exit status
make: *** [../bin/Linux/wav2png] Error 1

Thanks.

Reading from stdin does not work, but from file does

This gives the output as expected:-

$ ffmpeg -i Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.mp3 -acodec pcm_u8 -ar 22050 Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.wav
$ wav2png --foreground-color=ffb400aa --background-color=2e4562ff Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.wav -o Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.mp3.png

However this results in an image that is completely blank:-
$ ffmpeg -i Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.mp3 -acodec pcm_u8 -ar 22050 -f wav - | wav2png -o Zombies_Ate_My_Neighbors_Panic_of_the_Undead_OC_ReMix.mp3.png /dev/stdin

wav2png does not give any error for either command.

error while loading shared libraries: libboost_program_options.so.1.42.0

after installation (i tried both apt.get and homebrew) by executing command

./libs/wav2png-master/bin/Linux/wav2png --foreground-color=2e4562ff --background-color=00000000 -o public/uploads/3gwl5n6wv9557v0r1f.wav ../short.wav

i get this error

./libs/wav2png-master/bin/Linux/wav2png: error while loading shared libraries: libboost_program_options.so.1.42.0: cannot open shared object file: No such file or directory

i run ubuntu

LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

mac os x - ld: library not found for -lpng15

Hello,

I've installed all the dependencies and trying to compile in Xcode.

However it fails on "clang: error: linker command failed with exit code 1 (use -v to see invocation)"
I have libpng1.5 installed already.

Thanks!
/ Daniel

Could you add a top directory 'make' target, and LICENSE ?

Today, a person has come into the CentOS IRC support channels wanting to build this package. Under CentOS, the build requirement seems to be: boost-devel, although he was confused.

Also in attempting to build it, there is not a ./configure file, or an INSTALL file. A top directory Makefile would help in the alternative

The License seems to be: License: GPL
and the convention has become to say, for example: License: GPL 2 or later
or such

Could you consider adding a top directory LICENSE with the version of the GPL you intend to apply. Some choices are at:
http://www.gnu.org/licenses/license-list.html..

Thank you

-- Russ herrold

Error after compile on ubuntu 20.04 aarch64

i have followed the instructions here and created a binary, yet when i try to run it i get:
wav2png/bin/Linux/wav2png: cannot execute binary file: Exec format error

from what i found this indicates that the binary is not in the architecture expected. i have used only ubuntu official arm64 repos to get all the dependencies working. the only thing changed is using libpng-dev instead of libpng12-dev which is not available on arm64 repos.

what am i doing wrong? is there something i'm missing?

Build Error: missing libboost_program_options-mt.a & libsndfile.a

Hello and thank you for generously sharing your project. I'm new to building/compiling from source so I apologize if this issue I'm raising is due to naive user error.

I have installed X-Code, the associated command line tool, homebrew, libsndfile and png++. My first attempt to build via Terminal line went like this:

mkdir -p `dirname ../bin/Darwin/wav2png`
echo -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
-I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
# -Wno-unused-local-typedefs
clang++ -mmacosx-version-min=10.7 -stdlib=libc++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/ /usr/local/lib/libboost_program_options-mt.a /usr/local/lib/libsndfile.a /usr/local/lib/libpng.a /usr/local/lib/libogg.a /usr/local/lib/libvorbis.a /usr/local/lib/libvorbisenc.a /usr/local/lib/libFLAC.a -lz -o ../bin/Darwin/wav2png
clang: error: no such file or directory: '/usr/local/lib/libboost_program_options-mt.a'
clang: error: no such file or directory: '/usr/local/lib/libsndfile.a'
make: *** [../bin/Darwin/wav2png] Error 1

I was able to resolve the first clang: error: message by doing
brew install boost

I'm still missing libsndfile.a. I've looked /usr/local/Cellar/lib but only see .dylib files.

I tried make install-dependencies:

brew update
Already up-to-date.
ls  /usr/local/lib/libsndfile.a || brew install libsndfile
ls: /usr/local/lib/libsndfile.a: No such file or directory
Warning: libsndfile 1.2.2 is already installed and up-to-date.
To reinstall 1.2.2, run:
  brew reinstall libsndfile
ls /usr/local/lib/libboost_program_options-mt.a || brew install boost
/usr/local/lib/libboost_program_options-mt.a
ls ../dependencies/include/png++/png.hpp || (\
		wget http://download.savannah.gnu.org/releases/pngpp/png++-0.2.5.tar.gz && \
		tar -xvf png++-0.2.5.tar.gz && \
		rm png++-0.2.5.tar.gz && \
		rm -Rf ../dependencies/include/png++ && \
		mv png++-0.2.5/ ../dependencies/include/png++ \
	)
ls: ../dependencies/include/png++/png.hpp: No such file or directory
/bin/sh: wget: command not found
make: *** [install_dependencies_Darwin] Error 127

I also tried brew reinstall --build-from-source libsndfile but still no static libraries.

I would appreciate any guidance you have time to offer. Thanks.

Support for BWF (Broadcast WAVE)?

I'm currently using this tool to process a lot of WAV files from different sources. One of the problems it that our sources sometimes use BWF files. This means the WAV has additional meta-data in the header. I believe this tool is using libsndfile, but that library has support for BWF chunks in the header.

The problem is: when I try to use the tool on a BWF file, I get:

Not a valid error number (-1).
Segmentation fault

If I try on normal WAV files, without the extra metadata, it works great.

Build failed

I used make to compile but failed.
I also add #include<string.h> at the very beginning of main.cpp and wav2png.cpp as suggested in this but also failed.
I use ubuntu 16.04 and this is the error information:

echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo "	namespace version {" >> ../src/version.hpp
echo "		static const std::string date=\"`date`\";" >> ../src/version.hpp
echo "		static const std::string platform=\"Linux\";" >> ../src/version.hpp
echo "		static const std::string version=\"`cat version.txt`\";" >> ../src/version.hpp
echo "	}; /* namespace version */" >> ../src/version.hpp
echo "} /* anonymous namespace */" >> ../src/version.hpp
echo "#endif /* VERSION_HPP__ */" >> ../src/version.hpp
mkdir -p `dirname ../bin/Linux/wav2png`
echo -I../dependencies/include
-I../dependencies/include
# -Wno-unused-local-typedefs
g++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include -lboost_program_options `libpng-config --ldflags` -lsndfile -o ../bin/Linux/wav2png
In file included from /usr/include/png++/png.hpp:38:0,
                 from ../src/main.cpp:2:
/usr/include/png++/error.hpp: In constructor ‘png::std_error::std_error(const string&, int)’:
/usr/include/png++/error.hpp:77:67: error: ‘strerror’ was not declared in this scope
             : std::runtime_error((message + ": ") + strerror(error))
                                                                   ^
In file included from /usr/include/png++/png.hpp:38:0,
                 from ../src/wav2png.hpp:2,
                 from ../src/wav2png.cpp:1:
/usr/include/png++/error.hpp: In constructor ‘png::std_error::std_error(const string&, int)’:
/usr/include/png++/error.hpp:77:67: error: ‘strerror’ was not declared in this scope
             : std::runtime_error((message + ": ") + strerror(error))
                                                                   ^
Makefile:42: recipe for target '../bin/Linux/wav2png' failed
make: *** [../bin/Linux/wav2png] Error 1

Thanks!

Works in terminal but not via php exec

Thanks for your library and detailed instructions! I´m almost at the point where I can use it from a server.

The thing is that when I run the script in Terminal I can get it to work. It reads the file and creates the image where I want it. But when I run it from php exec I get this result:

dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: wav2png
Reason: Incompatible library version: wav2png requires version 29.0.0 or later, but libpng15.15.dylib provides version 23.0.0

Do you have any idea what´s going on. I posted this question on Stackoverflow (http://stackoverflow.com/questions/13603689/wav2png-works-in-terminal-but-not-via-php-exec) in case you are on a vacation :)

Cheers and thanks.

hi i followed you install instructions step by step for install all work till i tried to run make

Here was my output

make
mkdir -p `dirname ../bin/Linux/wav2png`
echo -I../dependencies/include
-I../dependencies/include
g++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include `libpng-config --ldflags` -lsndfile  -lboost_program_options -o ../bin/Linux/wav2png
In file included from ../src/main.cpp:8:
../src/options.hpp:4:37: error: boost/program_options.hpp: No such file or directory
cc1plus: warnings being treated as errors
../dependencies/include/png++/info.hpp: In member function ‘void png::info::read()’:
../dependencies/include/png++/info.hpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:66: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:67: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:68: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:69: warning: dereferencing type-punned pointer will break strict-aliasing rules
../src/options.hpp: In constructor ‘Options::Options(int, char**)’:
../src/options.hpp:13: error: expected primary-expression before ‘namespace’
../src/options.hpp:13: error: expected `;' before ‘namespace’
../src/options.hpp:15: error: ‘po’ has not been declared
../src/options.hpp:15: error: expected `;' before ‘generic’
../src/options.hpp:16: error: ‘generic’ was not declared in this scope
../src/options.hpp:21: error: ‘po’ has not been declared
../src/options.hpp:21: error: expected `;' before ‘config’
../src/options.hpp:22: error: ‘config’ was not declared in this scope
../src/options.hpp:23: error: ‘po’ has not been declared
../src/options.hpp:23: error: expected primary-expression before ‘unsigned’
../src/options.hpp:25: error: ‘po’ has not been declared
../src/options.hpp:25: error: expected primary-expression before ‘unsigned’
../src/options.hpp:27: error: ‘po’ has not been declared
../src/options.hpp:27: error: expected primary-expression before ‘>’ token
../src/options.hpp:27: error: ‘struct std::string’ has no member named ‘default_value’
../src/options.hpp:29: error: ‘po’ has not been declared
../src/options.hpp:29: error: expected primary-expression before ‘>’ token
../src/options.hpp:29: error: ‘struct std::string’ has no member named ‘default_value’
../src/options.hpp:31: error: ‘po’ has not been declared
../src/options.hpp:31: error: expected primary-expression before ‘>’ token
../src/options.hpp:31: error: ‘struct std::string’ has no member named ‘default_value’
../src/options.hpp:33: error: ‘po’ has not been declared
../src/options.hpp:33: error: expected primary-expression before ‘>’ token
../src/options.hpp:33: error: ‘struct std::string’ has no member named ‘default_value’
../src/options.hpp:35: error: ‘po’ has not been declared
../src/options.hpp:37: error: ‘po’ has not been declared
../src/options.hpp:39: error: ‘po’ has not been declared
../src/options.hpp:44: error: ‘po’ has not been declared
../src/options.hpp:44: error: expected `;' before ‘hidden’
../src/options.hpp:45: error: ‘hidden’ was not declared in this scope
../src/options.hpp:46: error: ‘po’ has not been declared
../src/options.hpp:46: error: expected primary-expression before ‘>’ token
../src/options.hpp:49: error: ‘po’ has not been declared
../src/options.hpp:49: error: expected `;' before ‘p’
../src/options.hpp:50: error: ‘p’ was not declared in this scope
../src/options.hpp:53: error: ‘po’ has not been declared
../src/options.hpp:53: error: expected `;' before ‘cmdline_options’
../src/options.hpp:54: error: ‘cmdline_options’ was not declared in this scope
../src/options.hpp:56: error: ‘po’ has not been declared
../src/options.hpp:56: error: expected `;' before ‘config_file_options’
../src/options.hpp:57: error: ‘config_file_options’ was not declared in this scope
../src/options.hpp:59: error: ‘po’ has not been declared
../src/options.hpp:59: error: expected `;' before ‘visible’
../src/options.hpp:60: error: ‘visible’ was not declared in this scope
../src/options.hpp:62: error: ‘po’ has not been declared
../src/options.hpp:62: error: expected `;' before ‘vm’
../src/options.hpp:67: error: ‘po’ has not been declared
../src/options.hpp:67: error: ‘po’ has not been declared
../src/options.hpp:68: error: ‘vm’ was not declared in this scope
../src/options.hpp:69: error: ‘po’ has not been declared
../src/options.hpp:83: error: ‘po’ has not been declared
../src/options.hpp:83: error: ‘po’ has not been declared
../src/options.hpp:83: error: expected primary-expression before ‘char’
../src/options.hpp:84: error: ‘po’ has not been declared
../src/options.hpp:88: error: ‘po’ has not been declared
../src/options.hpp:88: error: ‘po’ has not been declared
../src/options.hpp:90: error: ‘po’ has not been declared
../src/options.hpp:130: error: ‘vm’ was not declared in this scope
../src/options.hpp:142: error: ‘vm’ was not declared in this scope
../src/options.hpp: In static member function ‘static png::rgba_pixel Options::parse_color(const std::string&)’:
../src/options.hpp:169: error: variable ‘std::stringstream is’ has initializer but incomplete type
cc1plus: warnings being treated as errors
../dependencies/include/png++/info.hpp: In member function ‘void png::info::read()’:
../dependencies/include/png++/info.hpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:66: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:67: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:68: warning: dereferencing type-punned pointer will break strict-aliasing rules
../dependencies/include/png++/info.hpp:69: warning: dereferencing type-punned pointer will break strict-aliasing rules
../src/wav2png.cpp: In function ‘void compute_waveform(const SndfileHandle&, png::image<png::basic_rgba_pixel<unsigned char> >&, const png::rgba_pixel&, const png::rgba_pixel&, bool, float, float, bool (*)(int))’:
../src/wav2png.cpp:136: warning: converting to ‘size_t’ from ‘float’
make: *** [../bin/Linux/wav2png] Error 1

segmentation fault ./wav2png ?

wav2png used to work perfectly but suddenly when i try to use it i get the following error:

[1]    13806 segmentation fault  ./wav2png

the funny thing is that this error happened on my desktop computer and then when i moved onto my laptop i found out the same error is happening too, but theoretically nothing has changed in both machines since the last time i used it successfully.

any ideas?

Would not comiple for me on Fedora 25

I followed the instructions exactly as given for CentOS. However that didn't work for me (I removed -Werror aswell)
The Problem I get is

$ sudo make
mkdir -p dirname ../bin/Linux/wav2png
echo -I../dependencies/include
-I../dependencies/include

-Wno-unused-local-typedefs

g++ -O3 -Wall -Werror ../src/*.cpp -I../dependencies/include -lboost_program_options libpng-config --ldflags -lsndfile -o ../bin/Linux/wav2png
In file included from ../dependencies/include/png++/png.hpp:38:0,
from ../src/main.cpp:2:
../dependencies/include/png++/error.hpp: In constructor ‘png::std_error::std_error(const string&, int)’:
../dependencies/include/png++/error.hpp:77:67: error: ‘strerror’ was not declared in this scope
: std::runtime_error((message + ": ") + strerror(error))
^
In file included from ../dependencies/include/png++/png.hpp:38:0,
from ../src/wav2png.hpp:2,
from ../src/wav2png.cpp:1:
../dependencies/include/png++/error.hpp: In constructor ‘png::std_error::std_error(const string&, int)’:
../dependencies/include/png++/error.hpp:77:67: error: ‘strerror’ was not declared in this scope
: std::runtime_error((message + ": ") + strerror(error))
^
Makefile:42: recipe for target '../bin/Linux/wav2png' failed
make: *** [../bin/Linux/wav2png] Error 1

What I did was simply to comment out the "+ strerror(error)" part, after which everything works fine.

Colors - ?

Hey y'all. Got it all setup and working. My main problem, is that I'm trying to get a color for the background and I just don't understand something I guess cause it keeps getting spit out at me as the wrong color.

I'm trying to get #000039 which is the normal HEX value. I use HEX + alpha and I get 0xFF000039 and I use FF000039 but it's totally wrong. Then I tried 390000FF with no success either. I'm just quite confused. Even tried RBGA and that definitely wasn't right. I don't use a mac so I can't use the color picker in the binary. Wondering if someone can help me and if you can add proper documentation for people confused like me. This isn't really a bug, but more of a request for documentation and a little help :P

Thanks!

libpng15.15.dylib not loaded

Hello,

I was just trying out your program on Mac OS X, but can't get it to run. I get this error:

/opt/local/bin/lame --decode -f -m m --silent '/path/to/my.mp3' - | /path/to/lib/wav2png/beschulz-wav2png-a03eb7b/bin/Darwin/wav2png -o /path/to/my.mp3.png /dev/stdin
dyld: Library not loaded: /usr/X11/lib/libpng15.15.dylib
Referenced from: /path/to/lib/wav2png/beschulz-wav2png-a03eb7b/bin/Darwin/wav2png
Reason: image not found
Trace/BPT trap

When I try to compile, I get this error:

make clean
rm -f ./bin/Darwin/wav2png
rm -f gmon.out
rm -f ./src/version.hpp
make
mkdir -p dirname ./bin/Darwin/wav2png
clang++ -O3 -Wall -Werror -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/ -I./dependencies/include libpng-config --ldflags -lsndfile -lboost_program_options-mt ./src/.cpp -o ./bin/Darwin/wav2png
/bin/sh: libpng-config: command not found
/bin/sh: clang++: command not found
make: *
* [bin/Darwin/wav2png] Error 127

Any thoughts? Thank you.

Are generated images not subject to the GPL-2?

Hello, I was wondering if I could use images generated by wav2png in my other non-GPL project, would it comply with the GPL-2 license?
My binary & source code won't include wav2png code (both dynamically and statically), just images.

Reduce requirements

Hello again,

I was wondering if there is anyway to simplify the dependency requirements of this tool so that it can be compiled more easily.

Alternatively, is it possible for you to compile your binary version to include all the libraries as a self-contained package? I still get libpng15 errors when I download an try to run the mac os binary. I considering porting your wav2png to java.

Please let me know, because this is a great tool, and I think it could get more use if it was slightly easier to use.

PS.
I was inspired to create a tool called audio2video (https://github.com/rcaceres/audio2video), which utilizes this library to generate a video from an mp3 with the audio waveform as the image

Illegal instruction: 4

I've followed installation guide lines and all is ok, but when i type "wav2png" or "wav2png --help" into terminal returns me " Illegal instruction: 4 ". I'm running OS X 10.7.5.

How can i fix it?

Thanks

error: unknown warning option '-Wno-unused-local-typedefs' [-Werror,-Wunknown-warning-option]

make all is yielding the following error, any ideas ?

repo/build [ make                                                                                                                                                                                                                                                                                                                                                master ] 7:06 pm
repo/build [ make all                                                                                                                                                                                                                                                                                                                                            master ] 7:06 pm
echo "#ifndef VERSION_HPP__" > ../src/version.hpp
echo "#define VERSION_HPP__" >> ../src/version.hpp
echo "namespace {" >> ../src/version.hpp
echo "  namespace version {" >> ../src/version.hpp
echo "      static const std::string date=\"`date`\";" >> ../src/version.hpp
echo "      static const std::string platform=\"Darwin\";" >> ../src/version.hpp
echo "      static const std::string version=\"`cat version.txt`\";" >> ../src/version.hpp
echo "  }; /* namespace version */" >> ../src/version.hpp
echo "} /* anonymous namespace */" >> ../src/version.hpp
echo "#endif /* VERSION_HPP__ */" >> ../src/version.hpp
mkdir -p `dirname ../bin/Darwin/wav2png`
echo -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
-I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/
clang++ -mmacosx-version-min=10.7 -stdlib=libc++ -O3 -Wall -Werror -Wno-unused-local-typedefs ../src/*.cpp -I../dependencies/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/ /usr/local/lib/libboost_program_options-mt.a /usr/local/lib/libsndfile.a /usr/local/lib/libpng.a /usr/local/lib/libogg.a /usr/local/lib/libvorbis.a /usr/local/lib/libvorbisenc.a /usr/local/lib/libFLAC.a -lz -o ../bin/Darwin/wav2png
error: unknown warning option '-Wno-unused-local-typedefs' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-unused-local-typedefs' [-Werror,-Wunknown-warning-option]
make: *** [../bin/Darwin/wav2png] Error 1

How to use

Ben,

Hi, forgive the newness. I've downloaded your wav2png program. I've installed homebrew and had some linking issues with libsndfile and boost linking to /usr/local/lib

but overall, is there a way to do a demonstration of the download and build process. I'd love to use your app but I'm not a programmer with compiling experience. And, the droplet keeps failing when trying to open it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.