Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
/ wave-d Public archive

WAV file loader/emitter. This is deprecated in favor of the "audio-formats" DUB package.

License

Notifications You must be signed in to change notification settings

d-gamedev-team/wave-d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What's this?

wave-d is a tiny library to load/save WAV audio files.

Licenses

See UNLICENSE.txt

Usage

import std.stdio;
import waved;

void main()
{
    // Loads a WAV file in memory
    Sound input = decodeWAV("my_wav_file.wav");
    writefln("channels = %s", input.channels);
    writefln("samplerate = %s", input.sampleRate);
    writefln("samples = %s", input.samples.length);

    // Only keep the first channel (left)
    input = input.makeMono(); 

    // Multiply the left channel by 2 in-place
    foreach(i; 0..input.lengthInFrames)
        input.sample(0, i) *= 2.0f;

    // Duplicate the left channel, saves a two channels WAV file out of it
    float[][] channels = [input.channel(0), input.channel(0)];
    Sound(input.sampleRate, channels).encodeWAV("amplified-2x.wav");
}

About

WAV file loader/emitter. This is deprecated in favor of the "audio-formats" DUB package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages