All Projects → thecodrr → vave

thecodrr / vave

Licence: MIT license
🌊 A crazy simple library for reading/writing WAV files in V. Zero dependencies, 100% cross-platform.

Programming Languages

V
68 projects

Projects that are alternatives of or similar to vave

v-mode
🌻 An Emacs major mode for the V programming language.
Stars: ✭ 49 (+40%)
Mutual labels:  v, vlang
vredis
Redis client for V, written in V
Stars: ✭ 43 (+22.86%)
Mutual labels:  v, vlang
vbf
A brainfuck interpreter/compiler written in V.
Stars: ✭ 17 (-51.43%)
Mutual labels:  v, vlang
discord.v
Discord Bot Framework written in V
Stars: ✭ 83 (+137.14%)
Mutual labels:  v, vlang
kate-syntax-highlight-v
Syntax highlighting of V files for the Kate editor
Stars: ✭ 17 (-51.43%)
Mutual labels:  v, vlang
minesweeper-v
Minesweeper Written in Vlang
Stars: ✭ 19 (-45.71%)
Mutual labels:  v, vlang
v2048
A simple game of 2048, written in V.
Stars: ✭ 19 (-45.71%)
Mutual labels:  v, vlang
registry
Package registry for vpkg
Stars: ✭ 13 (-62.86%)
Mutual labels:  v, vlang
jni
V wrapper around the C Java Native Interface
Stars: ✭ 15 (-57.14%)
Mutual labels:  v, vlang
vinix
Vinix is an effort to write a modern, fast, and useful operating system in the V programming language
Stars: ✭ 1,512 (+4220%)
Mutual labels:  v, vlang
vargs
Simple argument parsing library for V.
Stars: ✭ 36 (+2.86%)
Mutual labels:  v, vlang
vast
A simple tool for vlang, generate v source file to AST json file
Stars: ✭ 23 (-34.29%)
Mutual labels:  v, vlang
termtable
Simple and highly customizable library to display tables in the terminal.
Stars: ✭ 41 (+17.14%)
Mutual labels:  v, vlang
boundstone
High Performance / Fast Compilation / Lightweight MCBE Server
Stars: ✭ 42 (+20%)
Mutual labels:  v, vlang
vspeech
📢 Complete V bindings for Mozilla's DeepSpeech TensorFlow based Speech-to-Text library. 📜
Stars: ✭ 38 (+8.57%)
Mutual labels:  v, deepspeech
v-shopware-api-client
The reliable way to import and update a bazillion products.
Stars: ✭ 20 (-42.86%)
Mutual labels:  v
ReSampler
High quality command-line audio sample rate converter
Stars: ✭ 120 (+242.86%)
Mutual labels:  sample-rate
vtl
The V Tensor Library
Stars: ✭ 58 (+65.71%)
Mutual labels:  v
vls
V language server
Stars: ✭ 267 (+662.86%)
Mutual labels:  v
vproto
Protobuf compiler and runtime in V
Stars: ✭ 42 (+20%)
Mutual labels:  v

🌊 Vave

A crazy simple library for reading/writing WAV files written in V!

Installation:

Install using vpkg

vpkg get https://github.com/thecodrr/vave

Install using V's builtin vpm (you will need to import the module with: import thecodrr.vave with this method of installation):

v install thecodrr.vave

Install using git:

cd path/to/your/project
git clone https://github.com/thecodrr/vave

Then in the wherever you want to use it:

import thecodrr.vave //OR simply vave depending on how you installed

And that's it!

Usage

This library is in use in the vspeech (V Bindings for DeepSpeech) utility that uses Mozilla's DeepSpeech for Speech-to-Text. Do check that out as well.

vave.open(path,mode)

Open a new WAV file in the specified mode. All mode supported by C.fopen are supported (e.g. r, rb etc.)

mut wav := vave.open("/path/to/vave/file", "r") //open for reading

NOTES: The data is read into a byteptr and needs to be manually freed each and everytime or it will cause a huge memory leak. This library has been tested with valgrind and after freeing there is no other memory leak (if you find any, do report). I haven't implemented writing samples yet due to lack of time but its in my future plans.

WavFile struct

WavFile struct is used for reading/writing samples and other metadata. It is returned by vave.open.

Read:

WavFile.read_raw()

Read all the samples from the file in their raw form.

WaveFile.read_samples(count)

Read a specific amount of samples from the file.

WaveFile.read_sample()

Read only one sample from the file.

Write:

TODO

WaveFile.close()

Close the file and free all associated resources.

Metadata Methods:

WaveFile.total_samples()

Get total number of audio samples in the file.

WaveFile.duration()

Get total duration of the audio file.

WaveFile.data_len()

Get the total length of sample bytes in the file.

WaveFile.bytes_per_sample()

Get total bytes per each sample.

WaveFile.sample_rate()

Get the sample rate (samples per second).

WaveFile.sample_size()

Get the size of one sample()

WaveFile.format()

Get the format of the WAV audio. Either PCM, IEEE, ALAW,MULAW or EXTENSIBLE.

WaveFile.num_channels()

Get the total number of channels in the audio stream.

WaveFile.valid_bits_per_sample()

Get the bits per each sample.

Supported Formats:

Currently only the following formats are supported:

  1. PCM

  2. IEEE

  3. ALAW

  4. MULAW

  5. EXTENSIBLE

Find this library useful? ❤️

Support it by joining stargazers for this repository. or buy me a cup of coffee And follow me for my next creations! 🤩

License

MIT License

Copyright (c) 2019 Abdullah Atta

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].