FartRater API

A WAV link for any fart you can build on fartrater.com. Free, no key. v1

What it is

One URL gives one WAV file. It uses the same three engines as the Fart Builder page (Sculpted, Real and Physics). It also uses the same voice check. The same settings always give the same sound, so browsers and CDNs can cache it for ever.

Phase 1 is read-only: you make sounds. You cannot post to the Community Wall from the API.

Try it

<audio controls src="https://fartrater.com/api/v1/fart.wav?preset=thunder"></audio>

GET /api/v1/fart.wav

Returns a 16-bit mono PCM WAV. Give one of: code, preset, or slider values. All answers allow any origin (CORS), so fetch works from a web page.

# a preset
curl -o thunder.wav "https://fartrater.com/api/v1/fart.wav?preset=thunder"

# a share code from a fartrater.com/f/... link
curl -o mine.wav "https://fartrater.com/api/v1/fart.wav?code=l19p105t35r12f0w4s10v65"

# sliders, on the Physics engine
curl -o rip.wav "https://fartrater.com/api/v1/fart.wav?len=1.4&pitch=70&rattle=90&power=85&engine=physics"
ParameterMeaning
codeA share code, with an optional name: l19p105...v65~My%20Name. Use it alone.
presetA preset key such as silent-sneaker, its full name, or one word of it (sneaker). Not case sensitive. List them at /api/v1/presets. You can add sliders to change it.
enginesculpted (default), real or physics.
nameOptional. A name for the sound (40 characters). It changes the headers and JSON only, not the audio.

Sliders

A missing slider takes the default. A value outside the range is moved to the nearest end of the range.

NameRangeDefaultEffect
len0.2 to 4 (seconds)1.9How long it lasts
pitch40 to 300 (Hz)105Base buzz of the valve
tight0 to 10035Relaxed blat to tight squeal
rattle0 to 10012Smooth tone to ragged rip
flutter0 to 30 (per second)0Flaps per second, 0 is steady
wet0 to 1004Dry to swampy
squeak0 to 10010Pitch climbs as it closes
power0 to 10065Silent hiss to seismic. Below 20 you get air only.

Answer headers: Content-Type: audio/wav, X-Fart-Name and X-Fart-Score (the Bean Scale, 0.5 to 10), ETag, and Cache-Control: public, max-age=31536000, immutable.

Embed a fart

Put a small player on any page. It has the fart name, the score, a play button and a waveform. It loads no outside scripts.

<iframe src="https://fartrater.com/embed/l16p120t10r20f0w10s0v6" width="360" height="130"
  style="border:0;max-width:100%" loading="lazy" title="A fart on FartRater"></iframe>

Engines

GET /api/v1/fart.json

Takes the same inputs. It tells you the name and score and gives ready links. It does not make the sound.

curl "https://fartrater.com/api/v1/fart.json?preset=swamp&engine=real"

{
  "code": "l13p70t15r55f9w90s0v55",
  "name": "The Swamp Bubbler",
  "title": "The judges asked for a moment alone. Please check your chair.",
  "score": 5.9,
  "engine": "real",
  "params": { "len": 1.3, "pitch": 70, "tight": 15, ... },
  "wav": "https://fartrater.com/api/v1/fart.wav?code=l13p70t15r55f9w90s0v55&engine=real",
  "share": "https://fartrater.com/f/l13p70t15r55f9w90s0v55",
  "credits": "..."
}

title is the one-line verdict from the rating card.

GET /api/v1/presets

A list of {key, name, code}. GET /api/v1/health answers ok.

No human voice

Fart Rater has one hard rule: no human voice in any sound. Each sound from the API is checked by the YAMNet model, the same check the page runs. If it hears a voice, the API makes the sound again with a new seed, up to 4 tries in total, exactly as the page does. If every try has a voice, you get an error (422) and no sound.

Caching and limits

Errors

Errors are JSON: {"error": "..."}.

StatusMeaning
400The input is not valid (bad code, unknown preset or engine, a slider that is not a number).
404Unknown path.
422No voice-free sound for these settings. Change a slider.
429Too many new sounds from your address. Wait a minute.
503Busy. Try again soon.

Discord bot

Add the bot to your server. Type /fart and it posts a WAV file with the name, the score and a share link. With no options you get a random fart. Options: preset, engine, power, pitch, length and random. The "Make another" button makes a new random one. Each person can make 20 per minute. The bot needs only Send Messages and Attach Files, and it does not read your messages.

Credits and licences

Please link back to fartrater.com where you use the sounds. The credits field of the JSON answer has a short text for this.