Drawing easy wave graph for wave audio file with PHP

By

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

  • dekelev

    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.

  • Daniel

    Can you reupload file ?

    • mydons

      Hi Daniel !

      The file has been re-uploaded.

  • Jan

    Hi
    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

      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.