1
1
Fork
You've already forked hound
0
A wav encoding and decoding library in Rust https://github.com/ruuda/hound
  • Rust 100%
Find a file
Ruud van Asseldonk fd2787fb5b Add LLM policy to the contribution guide
I made this policy update in the RCL repository first. It applies to
Hound for the same reasons, below is the commit message I used in the
RCL repository:
Now that "vibe coding" is starting to become a thing, and there are some
tasks in RCL that presumably could be vibe-coded, like support for more
editors, I think it's a real risk that people start making pull requests
for code that was primarily written by an LLM and not by a human.
I don't use such tools myself, but based on what I've seen, this
technology is at a level where it is able to write a (mostly) working
solution, but it is not nearly at a level where it produces acceptable
code. Output is far too verbose, and even when humans are driving, if
it's so easy to generate more code, then instead of thinking "how can I
abstract this so I don't have to duplicate it", you just accept the
generated duplicates. Kind of the antithesis of RCL itself.
Aside from that, there is still the legal grey zone of whether LLMs
enable mass copyright infringement by repeating snippets verbatim from
other codebases without attribution. I don't want to argue about where
the boundary is, I want to stay far away from the boundary.
In short, I don't want any AI slop in this codebase, so it's better to
warn people ahead of time to prevent disappointment.
2025年04月06日 19:29:52 +02:00
examples Add example based on into_header_for_infinite_file 2019年09月12日 22:28:07 +03:00
fuzz Bump version to v3.4.0 2018年04月07日 21:45:43 +02:00
src Document Ambisonic subtypes 2024年02月21日 19:21:01 +01:00
testsamples Work around for 0 valid bits 2021年02月19日 13:11:06 -08:00
.gitignore Gitignore append test output 2018年04月07日 20:59:39 +02:00
Cargo.lock Document Ambisonic subtypes 2024年02月21日 19:21:01 +01:00
Cargo.toml Delete references to Travis CI 2022年09月09日 23:42:02 +02:00
changelog.md Link GitHub pull requests in changelog 2023年09月25日 22:44:20 +02:00
contributing.md Add LLM policy to the contribution guide 2025年04月06日 19:29:52 +02:00
license change licence to Apache 2.0 2015年07月21日 15:13:40 +02:00
readme.md Delete references to Travis CI 2022年09月09日 23:42:02 +02:00

Hound

A wav encoding and decoding library in Rust.

Crates.io version Changelog Documentation

Hound can read and write the WAVE audio format, an ubiquitous format for raw, uncompressed audio. The main motivation to write it was to test Claxon, a FLAC decoding library written in Rust.

Examples

The following example renders a 440 Hz sine wave, and stores it as a mono wav file with a sample rate of 44.1 kHz and 16 bits per sample.

usestd::f32::consts::PI;usestd::i16;usehound;letspec=hound::WavSpec{channels: 1,sample_rate: 44100,bits_per_sample: 16,sample_format: hound::SampleFormat::Int,};letmutwriter=hound::WavWriter::create("sine.wav",spec).unwrap();fortin(0..44100).map(|x|xasf32/44100.0){letsample=(t*440.0*2.0*PI).sin();letamplitude=i16::MAXasf32;writer.write_sample((sample*amplitude)asi16).unwrap();}

The file is finalized implicitly when the writer is dropped, call writer.finalize() to observe errors.

The following example computes the root mean square (RMS) of an audio file with at most 16 bits per sample.

usehound;letmutreader=hound::WavReader::open("testsamples/pop.wav").unwrap();letsqr_sum=reader.samples::<i16>().fold(0.0,|sqr_sum,s|{letsample=s.unwrap()asf64;sqr_sum+sample*sample});println!("RMS is {}",(sqr_sum/reader.len()asf64).sqrt());

Features

Read Write
Format PCMWAVEFORMAT, WAVEFORMATEX, WAVEFORMATEXTENSIBLE PCMWAVEFORMAT, WAVEFORMATEXTENSIBLE
Encoding Integer PCM, IEEE Float Integer PCM, IEEE Float
Bits per sample 8, 16, 24, 32 (integer), 32 (float) 8, 16, 24, 32 (integer), 32 (float)

Contributing

Contributions in the form of bug reports, feature requests, or pull requests are welcome. See contributing.md.

License

Hound is licensed under the Apache 2.0 license. It may be used in free software as well as closed-source applications, both for commercial and non-commercial use under the conditions given in the license. If you want to use Hound in your GPLv2-licensed software, you can add an exception to your copyright notice. Please do not open an issue if you disagree with the choice of license.