Drawing easy wave graph for wave audio file with PHP


June 2, 2011Tools5 Comments

PHP is becoming more stable languages for audio manipulation stuffs. PHP can easily convert the wave audio file to an image format by the vibration in wave audio file. In this demo PHP script opens a given sound sample file in the WAVE format and extracts the variation of the volume of the sample over time. And PHP script renders an image that represents the sound sample wave form. The input for this demo PHP script should be .wav file. The script first split the wave file into chunks and then draw function will be instantiated.

This draw function is having some features like,

  1. Channel alignment
  2. Width of the image
  3. Height of the image
  4. Background color of the image
  5. Line color
  6. Image color


Requirement :-  PHP, *.wav file
Demo :- http://mydons.com/viewer/php/wav/example_draw.php
Download :- Wav2ImagePHP

5 Responses to “Drawing easy wave graph for wave audio file with PHP”
  1. dekelev says:

    Great Code! Thanks!

    I was wandering how did you build & paint this example image in php?
    The example code doesn’t seems to have this functionality.

  2. Daniel says:

    Can you reupload file ?

  3. Jan says:

    This scrips works very nice. Was wondering though. Is there any way to store the generated image on a server – as a physical PNG? Thanks in advance

    • mydons says:

      Hi Jan!
      Yes you can save to physically as PNG. use PHP header method to save the image. Let us know if you have trouble we will help you solving this.