Skip to content

spyn1k/WAV-Audio-Processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 

Repository files navigation

                                                          SOUNDWAVE.C

The soundwave program is a command line tool for basic editing of PCM WAV files.

Supports displaying metadata, changing sample rate, and extracting channels

info Shows the info of the WAV header

rate Multiplies the sample rate by a real factor

channel <left|right>Extracts the left or right channel from a stereo file and produces a mono file

                                                          COMPILE WITH

gcc -Ofast -Wall -Wextra -Werror -pedantic -o soundwave soundwave.c -lm

                                                          COMMAND GUIDE

Show info

./soundwave info < input.wav

Change sample rate

./soundwave rate 0.5 < input.wav > out.wav

./soundwave rate 2.0 < input.wav > out.wav

Extract channel

./soundwave channel left < stereo.wav > left.wav

./soundwave channel right < stereo.wav > right.wav

                                                        WAV Validity Checks

The program checks:

RIFF and WAVE tags

fmt chunk (μέγεθος 16)

audio_format == 1

mono or stereo

bits per sample (8 or 16)

block alignment & bytes/sec

existence "data" chunk

In case of an error, it displays a message on stderr.

                                                             TEST FILE

PATH -----> soundwave/test/

                                                              SOURCES

1. Wikipedia – WAVE PCM Format https://en.wikipedia.org/wiki/WAV#RIFF_WAVE_chunks

Block_Align = channels × BitsPerSample / 8

Byte_Rate = sample_rate × block_align

Subchunk1Size = 16 (PCM)

AudioFormat = 1


2. RIFF Specification (Microsoft) https://learn.microsoft.com/en-us/windows/win32/xaudio2/resource-interchange-file-format--riff-

RIFF Header order

file_size = 36 + data_size


3. Microsoft – WAVEFORMATEX structure https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatex

FormatTag = 1 , PCM

channels → mono/stereo = 1/2

nSamplesPerSec → sample_rate

BitsPerSample = 8, 16, …

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages