PHPackages                             bluemoehre/wave-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bluemoehre/wave-php

ActiveLibrary

bluemoehre/wave-php
===================

PHP class for native reading WAV (RIFF-WAVE) metadata and generating SVG-Waveforms. (PCM only)

61452[2 issues](https://github.com/bluemoehre/wave-php/issues)[1 PRs](https://github.com/bluemoehre/wave-php/pulls)PHP

Since Oct 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bluemoehre/wave-php)[ Packagist](https://packagist.org/packages/bluemoehre/wave-php)[ RSS](/packages/bluemoehre-wave-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

wave-php [![Build Status](https://github.com/bluemoehre/wave-php/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/bluemoehre/wave-php/actions/workflows/ci.yml)
====================================================================================================================================================================================

[](#wave-php-)

PHP class for native reading WAV (RIFF-WAVE) metadata and generating SVG-Waveforms. (PCM only)

Installation
------------

[](#installation)

This class can easily be installed via [Composer](https://getcomposer.org):

```
composer require bluemoehre/wave-php
```

Alternatively you may include it the old fashioned way of downloading and adding it via:

```
require 'Wave.php'
```

How to use
----------

[](#how-to-use)

Generate a single SVG:

```
use bluemoehre\Wave;

// load WAV file
$wave = new Wave('fooBar.wav');

// generate SVG and save to file
$wave->generateSvg('output.svg');
```

Generate multiple SVGs:

```
$files = array('foo.wav', 'bar.wav');
$wave = new Wave();

foreach ($files as $file){
  $wave->setFile($file);
  $wave->generateSvg(preg_replace('/\.wav$/', '.svg', $file);
}
```

Methods
-------

[](#methods)

- **generateSvg(** `string` $outputFile \[, `float` $resolution \] **)** : `string`
    Returns the waveform as SVG code. Optionally saves the output to the given filename.
- **getBitsPerSample()** : `integer`
    Returns the bits per sample count
- **getByteRate()** : `integer`
    Returns the audio byte rate
- **getChannels()** : `integer`
    Returns the audio channel count
- **getKiloBitPerSecond()** : `float`
    Returns the data rate of the audio
- **getSampleRate()** : `integer`
    Returns the audio sample rate
- **getTotalSamples()** : `integer`
    Returns the total audio sample count
- **getTotalSeconds(** `boolean` $float **)** : `integer` | `float`
    Returns the audio length in seconds. Rounded by default - optinonally precise

TODO
----

[](#todo)

- add support for hi-res wave files
- find solution for styling waveform via CSS (maybe allow setup of a style path)
- move SVG code to external file (so everyone can modify the code meeting all needs)
- configurable vertical SVG detail

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance23

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/151c6e8a10f6eb6fce709a8cfc84fd9c0be35e9490d44c54c5323b3939b041aa?d=identicon)[bluemoehre](/maintainers/bluemoehre)

---

Top Contributors

[![bluemoehre](https://avatars.githubusercontent.com/u/1735386?v=4)](https://github.com/bluemoehre "bluemoehre (21 commits)")[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (1 commits)")

### Embed Badge

![Health badge](/badges/bluemoehre-wave-php/health.svg)

```
[![Health](https://phpackages.com/badges/bluemoehre-wave-php/health.svg)](https://phpackages.com/packages/bluemoehre-wave-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
