Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Yes—you can create a spec-targeted 16-bit, mono, uncompressed WAV using only browser Web Audio APIs, but Web Audio does not save that file format for you. The browser gives you an AudioBuffer containing floating-point samples; your code must choose a sample rate, reduce the signal to one channel, convert each sample to signed 16-bit PCM, and write a RIFF/WAVE container around the bytes.

This workflow works for generated sound, decoded uploads, HTML media, and microphone streams. A microphone is optional. The important controls are the output sample rate, explicit mono policy, integer conversion, little-endian WAV serialization, and independent validation of the downloaded file.

What does “16-bit mono uncompressed WAV” require?

The requested file has four separate properties. Treating them independently prevents the common mistake of exporting a floating-point Web Audio buffer and merely changing its filename.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Mono: one channel of sample frames. Stereo or multichannel input must be selected or mixed down deliberately.
  • 16-bit: each sample is a signed integer PCM value, not a JavaScript Float32Array value.
  • Uncompressed: linear PCM sample data rather than a codec such as MP3, AAC, or Opus.
  • WAV: a RIFF/WAVE container whose format and data chunks describe the payload.

An AudioBuffer stores a number of sample frames, one or more channels, and a sample rate. Its channel data is exposed as floating-point arrays, and Web Audio uses planar storage: each channel has a separate array. A WAV PCM payload is normally serialized as interleaved frames, so the representation must be transformed before download.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Which audio sources can be recorded?

Any Web Audio source can feed this export path. Use a microphone only when you need live acoustic capture; generated nodes, decoded files, media elements, and microphone streams can all become input to the same rendering or capture pipeline.

  • Generated audio: oscillators, buffers, effects, and automation can be connected to a destination used for recording or offline rendering.
  • Decoded files: read an uploaded file into an ArrayBuffer, then call decodeAudioData().
  • HTML media: route an audio or video element through createMediaElementSource().
  • Microphone: request permission with getUserMedia() and pass the resulting stream to createMediaStreamSource().

Web Audio’s overview of these building blocks is documented by MDN at Basic concepts behind Web Audio API. Microphone permission, secure-context requirements, and user-device behavior are separate concerns from WAV encoding.

How should I choose the output sample rate?

Choose the rate required by the receiving system, not simply the rate of the source file. A normal AudioContext has a fixed sample rate, and decoded audio is resampled to that context’s rate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For controlled rendering, create an OfflineAudioContext with the desired rate and one output channel. MDN documents support for rates from 8,000 through 96,000 Hz, with wider support possible; 44,100 Hz is common but is not a universal requirement. See the OfflineAudioContext constructor documentation.

For a target duration in seconds, calculate the frame count from the rate:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const frameCount = Math.ceil(durationSeconds * targetRate);

The context’s sample rate cannot be changed after creation. If you decode through an existing context, inspect the resulting buffer rather than assuming it retained the source file’s rate. The behavior is described in MDN’s decodeAudioData() documentation and the sampleRate property reference.

Offline rendering example

const targetRate = 44100;
const durationSeconds = 3;
const frameCount = Math.ceil(durationSeconds * targetRate);
const offline = new OfflineAudioContext({
  numberOfChannels: 1,
  length: frameCount,
  sampleRate: targetRate
});

// Connect your source graph to offline.destination here.
const renderedBuffer = await offline.startRendering();
console.log(renderedBuffer.numberOfChannels, renderedBuffer.sampleRate);

The rendered buffer should report one channel and the requested rate. Always check those properties before encoding, especially when the graph contains imported material.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I make stereo or multichannel audio truly mono?

Do not rely on an implicit channel conversion for a format-constrained export. Read the source channels and choose a documented policy: select one channel, average channels, or apply a mix designed for your application.

Selecting one channel

Use this when one microphone or track is authoritative. For example, buffer.getChannelData(0) exports the first channel. This avoids creating a new mix, but it discards every other channel.

Averaging stereo channels

A simple equal mix is:

const left = buffer.getChannelData(0);
const right = buffer.getChannelData(1);
const mono = new Float32Array(buffer.length);
for (let i = 0; i < buffer.length; i++) {
  mono[i] = (left[i] + right[i]) * 0.5;
}

For more than two channels, extend the policy explicitly and consider whether equal averaging can cause cancellation or an unexpectedly quiet result. Channel interpretation and graph configuration can affect automatic mixing, so validate the actual buffer you receive. The channel model is covered in MDN’s AudioBuffer reference and Web Audio concepts.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

How do I convert Web Audio floats to signed 16-bit PCM?

Web Audio sample values are floating-point values normally centered around the range -1 to 1. A 16-bit PCM payload requires signed integers from -32,768 to 32,767. Clamp out-of-range values, then apply a stated scaling and rounding policy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
function floatToInt16(value) {
  const x = Math.max(-1, Math.min(1, value));
  return x < 0 ? Math.round(x * 0x8000) : Math.round(x * 0x7fff);
}

This asymmetric mapping reaches the full negative endpoint while keeping the positive endpoint at 32,767. Other deliberate mappings are possible, but the choice must be consistent and documented. Never write the raw bytes of a Float32Array; those bytes are neither 16-bit PCM nor a WAV payload. Clipping policy, rounding behavior, byte order, and frame order should be treated as part of your encoder’s contract.

How do I write the WAV container in JavaScript?

A PCM WAV file needs a RIFF header, a WAVE identifier, a PCM format chunk, and a data chunk whose length matches the emitted sample bytes. The following encoder writes one-channel, 16-bit PCM from a mono floating-point array. Confirm the exact RIFF/WAVE field requirements against the primary specification used by your receiving system before declaring formal conformance.

function writeAscii(view, offset, text) {
  for (let i = 0; i < text.length; i++) {
    view.setUint8(offset + i, text.charCodeAt(i));
  }
}

function encodeMono16Wav(samples, sampleRate) {
  const channels = 1;
  const bitsPerSample = 16;
  const blockAlign = channels * bitsPerSample / 8;
  const byteRate = sampleRate * blockAlign;
  const dataSize = samples.length * blockAlign;
  const buffer = new ArrayBuffer(44 + dataSize);
  const view = new DataView(buffer);

  writeAscii(view, 0, 'RIFF');
  view.setUint32(4, 36 + dataSize, true);
  writeAscii(view, 8, 'WAVE');
  writeAscii(view, 12, 'fmt ');
  view.setUint32(16, 16, true);          // PCM format chunk size
  view.setUint16(20, 1, true);           // PCM format code
  view.setUint16(22, channels, true);
  view.setUint32(24, sampleRate, true);
  view.setUint32(28, byteRate, true);
  view.setUint16(32, blockAlign, true);
  view.setUint16(34, bitsPerSample, true);
  writeAscii(view, 36, 'data');
  view.setUint32(40, dataSize, true);

  let offset = 44;
  for (let i = 0; i < samples.length; i++, offset += 2) {
    view.setInt16(offset, floatToInt16(samples[i]), true);
  }
  return new Blob([buffer], { type: 'audio/wav' });
}

const wavBlob = encodeMono16Wav(mono, renderedBuffer.sampleRate);
const url = URL.createObjectURL(wavBlob);
const link = document.createElement('a');
link.href = url;
link.download = 'recording-mono-16bit.wav';
link.click();
setTimeout(() => URL.revokeObjectURL(url), 0);

The encoder’s important invariants are that the channel count is one, the sample size is 16 bits, the byte rate and block alignment agree with those values, and the data-chunk length equals the actual payload. The true arguments to DataView methods request little-endian integers, as required by the usual PCM WAV layout.

How do I capture live microphone audio before encoding?

For live recording, request a media stream, connect it to an audio graph, and collect samples with an audio-processing design appropriate to your browser targets. The microphone itself does not produce a WAV file; it supplies a stream that must still be converted and serialized.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  1. Call navigator.mediaDevices.getUserMedia({ audio: true }) from a secure context and handle permission denial.
  2. Create an AudioContext and a MediaStreamAudioSourceNode from the stream.
  3. Capture or render the samples into a buffer. For modern processing, evaluate an AudioWorklet; MDN documents the model at Background audio processing using AudioWorklet.
  4. Stop the media tracks when recording ends, concatenate the captured frames, and apply the mono policy.
  5. Encode the resulting mono float samples with the WAV function, using the actual capture rate or a deliberate resampling stage.

Long recordings require a memory plan: keeping every frame in JavaScript arrays and then creating a second WAV buffer temporarily duplicates data. For lengthy sessions, process chunks, monitor memory, and finalize only after the capture length is known.

What should I check when an exported WAV will not open?

Most failures come from a mismatch between header fields and payload bytes, an unexpected sample rate, or an incorrect channel conversion. Use an independent parser or player rather than trusting the browser download alone.

  • File is reported as corrupt: verify the four-character identifiers, little-endian integer writes, RIFF size, and data size.
  • Playback is too fast or too slow: compare the header’s sample rate with the buffer’s actual sampleRate.
  • Playback sounds noisy: confirm that float bytes were not written directly and that each PCM sample occupies exactly two bytes.
  • Audio has two channels: inspect numberOfChannels and ensure the encoder uses one channel and a mono payload.
  • Audio is unexpectedly quiet: check the downmix policy for cancellation and verify that source values are not being scaled twice.
  • Clicks occur at boundaries: ensure captured chunks are concatenated in frame order without dropped or duplicated frames.

Also compare the saved file’s duration with dataSize / (sampleRate * blockAlign). A disagreement points to a length, rate, or block-alignment error rather than a microphone problem.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What are the practical limits of a Web Audio WAV encoder?

The browser can perform the conversion without a third-party library, but “using only Web Audio” does not mean every stage is automatic. You still own resampling decisions, channel policy, integer quantization, container serialization, download handling, and validation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Requirement Where it is enforced What to verify
Sample rate AudioContext or OfflineAudioContext Read buffer.sampleRate; do not infer it from the source filename.
Mono output Channel selection or explicit downmix numberOfChannels === 1 and one sample per frame in the payload.
16-bit PCM Float-to-integer conversion Every payload sample is a signed 16-bit little-endian integer.
Uncompressed data WAV format code and payload PCM declaration and payload length match; no codec step is present.
Valid container RIFF/WAVE serialization Chunk sizes, byte rate, block alignment, and data length agree.

For imported files, remember that decodeAudioData() can resample into the receiving context. For deterministic output, decode or render in a context created at the target rate, then inspect the returned buffer before encoding.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Should I use an OfflineAudioContext or a real-time AudioContext?

Use OfflineAudioContext when the duration, source graph, channel count, and target rate are known and you want a deterministic render that never goes to speakers. Use a real-time AudioContext when you are capturing a live stream or responding to user interaction.

Offline rendering makes the frame count explicit and is convenient for generated tones, effects, and decoded clips. Real-time capture introduces permission, device-rate, latency, and chunk-management concerns. Either path ends with the same mono extraction, 16-bit conversion, and WAV serialization.

How can I make the workflow reproducible?

Record the decisions that affect the bytes, not just the filename. A small metadata record alongside each export can include the requested rate, measured buffer rate, source channel count, downmix policy, clipping policy, and encoder version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Define the recipient’s required rate, channel count, bit depth, and file type.
  2. Create the context at the chosen rate whenever possible.
  3. Inspect channel count, length, and sample rate after rendering or decoding.
  4. Apply an explicit mono policy and document it.
  5. Clamp and quantize floats using one tested function.
  6. Write header values from the actual payload length instead of hard-coded duration assumptions.
  7. Open the saved file with an independent WAV reader and check duration, channels, rate, and audible content.

This checklist catches errors that a successful Blob download cannot reveal.

Frequently Asked Questions

Can I create a WAV without asking for microphone permission?

Yes. Permission is needed only for a live microphone stream. Generated nodes, decoded uploads, and media-element sources can be rendered and exported without accessing the microphone.

Does changing a file extension to .wav convert the audio?

No. An extension changes only the name. A valid WAV needs PCM sample bytes plus a RIFF/WAVE header whose fields describe those bytes.

Why does my decoded file have a different sample rate than the original?

decodeAudioData() resamples decoded material to the sample rate of the context receiving it. Read the returned AudioBuffer.sampleRate and create a context at the desired rate when deterministic output matters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can a 16-bit WAV contain floating-point samples?

Not when it is declared as ordinary 16-bit PCM. Floating-point samples require a different format declaration and payload representation; convert them to signed 16-bit integers for this target.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.