{"id":2475,"date":"2026-02-16T23:11:04","date_gmt":"2026-02-16T21:11:04","guid":{"rendered":"https:\/\/science-x.net\/?page_id=2475"},"modified":"2026-02-16T23:35:22","modified_gmt":"2026-02-16T21:35:22","slug":"doppler-effect-calculator-sound","status":"publish","type":"page","link":"https:\/\/science-x.net\/?page_id=2475","title":{"rendered":"Doppler Effect Calculator (Sound)"},"content":{"rendered":"\n<div class=\"eco-tool wp-block-group\" id=\"eco-tool-doppler\">\n  <div class=\"eco-tool__header\">\n    <h2 class=\"eco-tool__title\">Doppler Effect Calculator (Sound)<\/h2>\n    <p class=\"eco-tool__lead\">\n      Estimate the observed frequency when a sound source and\/or observer is moving (1D, along the line of sight).\n    <\/p>\n  <\/div>\n\n  <form class=\"eco-tool__form\" novalidate>\n    <div class=\"eco-tool__grid3\">\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Original frequency (f)<br>(Hz)<\/label>\n        <input class=\"eco-tool__input\" data-dop=\"f\" type=\"number\" step=\"any\" placeholder=\"e.g., 440\" inputmode=\"decimal\" \/>\n        <div class=\"eco-tool__hint\">Example: A4 note is 440 Hz.<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Speed of sound (v)<br>(m\/s)<\/label>\n        <input class=\"eco-tool__input\" data-dop=\"v\" type=\"number\" step=\"any\" value=\"343\" inputmode=\"decimal\" \/>\n        <div class=\"eco-tool__hint\">343 m\/s \u2248 air at 20\u00b0C.<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Observer speed (v\u2092)<br>(m\/s)<\/label>\n        <input class=\"eco-tool__input\" data-dop=\"vo\" type=\"number\" step=\"any\" value=\"0\" inputmode=\"decimal\" \/>\n        <div class=\"eco-tool__hint\">Positive = moving toward the source.<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Source speed (v\u209b) (m\/s)<\/label>\n        <input class=\"eco-tool__input\" data-dop=\"vs\" type=\"number\" step=\"any\" value=\"0\" inputmode=\"decimal\" \/>\n        <div class=\"eco-tool__hint\">Positive = moving toward the observer.<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Built-in examples<\/label>\n        <select class=\"eco-tool__input\" data-dop=\"preset\">\n          <option value=\"\" selected>Choose an example\u2026<\/option>\n          <option value=\"ambulance\">Ambulance siren (700 Hz), source 30 m\/s toward observer<\/option>\n          <option value=\"train\">Train horn (500 Hz), source 20 m\/s toward observer<\/option>\n          <option value=\"runner\">Runner toward source: 440 Hz, observer 5 m\/s<\/option>\n        <\/select>\n        <div class=\"eco-tool__hint\">Quick test to verify buttons work.<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__field\">\n        <label class=\"eco-tool__label\">Formula<\/label>\n        <div class=\"eco-tool__noteBox\">\n          f&#8217; = f \u00b7 (v + v\u2092) \/ (v \u2212 v\u209b)<br>\n          +v\u2092 = observer moves toward source<br>\n          +v\u209b = source moves toward observer\n        <\/div>\n        <div class=\"eco-tool__hint\">Valid for sound when speeds are well below v.<\/div>\n      <\/div>\n    <\/div>\n\n    <div class=\"eco-tool__actions\">\n      <button type=\"button\" class=\"wp-element-button eco-tool__btn\" data-dop=\"calc\">Calculate<\/button>\n      <button type=\"button\" class=\"wp-element-button eco-tool__btn eco-tool__btn--ghost\" data-dop=\"reset\">Reset<\/button>\n      <div class=\"eco-tool__error\" data-dop=\"error\" aria-live=\"polite\"><\/div>\n    <\/div>\n  <\/form>\n\n  <div class=\"eco-tool__result\" data-dop=\"result\" hidden>\n    <h3 class=\"eco-tool__subtitle\">Result<\/h3>\n\n    <div class=\"eco-tool__cards\">\n      <div class=\"eco-tool__card\">\n        <div class=\"eco-tool__metric-label\">Observed frequency (f&#8217;)<\/div>\n        <div class=\"eco-tool__metric-value\" data-dop=\"out\">\u2014<\/div>\n        <div class=\"eco-tool__metric-sub\">Hz<\/div>\n      <\/div>\n\n      <div class=\"eco-tool__card\">\n        <div class=\"eco-tool__metric-label\">Shift<\/div>\n        <div class=\"eco-tool__metric-value\" data-dop=\"shift\">\u2014<\/div>\n        <div class=\"eco-tool__metric-sub\">Hz and %<\/div>\n      <\/div>\n    <\/div>\n\n    <div class=\"eco-tool__card eco-tool__card--wide\">\n      <div class=\"eco-tool__metric-label\">Equation used<\/div>\n      <div class=\"eco-tool__metric-sub\" data-dop=\"eq\">\u2014<\/div>\n      <div class=\"eco-tool__metric-sub eco-tool__muted\">If v \u2212 v\u209b gets too small, the model breaks (near Mach speeds).<\/div>\n    <\/div>\n\n    <p class=\"eco-tool__note\">\n      This is the classical Doppler effect for sound along a straight line (1D). For light, use relativistic Doppler.\n    <\/p>\n  <\/div>\n<\/div>\n\n<style>\n<style>\n\/* ---------- Base container safety ---------- *\/\n#eco-tool-doppler, #eco-tool-doppler *{\n  box-sizing:border-box;\n}\n#eco-tool-doppler{\n  max-width:100%;\n  overflow:hidden; \/* prevents tiny 1-2px bleed from rounding *\/\n}\n#eco-tool-doppler img,\n#eco-tool-doppler svg,\n#eco-tool-doppler video,\n#eco-tool-doppler canvas{\n  max-width:100%;\n  height:auto;\n}\n\n\/* ---------- Your existing look (kept) ---------- *\/\n#eco-tool-doppler.eco-tool{border:1px solid rgba(0,0,0,.12);border-radius:12px;padding:16px}\n\n\/* IMPORTANT FIX:\n   Use minmax(0,1fr) so content can shrink and wrap inside the grid *\/\n#eco-tool-doppler .eco-tool__grid3{\n  display:grid;\n  grid-template-columns:repeat(3, minmax(0, 1fr));\n  gap:16px;\n}\n@media (max-width: 860px){\n  #eco-tool-doppler .eco-tool__grid3{grid-template-columns:1fr;}\n}\n\n\/* Fields *\/\n#eco-tool-doppler .eco-tool__field{display:flex;flex-direction:column;gap:6px;min-width:0;}\n#eco-tool-doppler .eco-tool__label{font-weight:600}\n\n\/* Inputs & selects must not exceed column width *\/\n#eco-tool-doppler .eco-tool__input{\n  height:44px;\n  padding:0 12px;\n  border:1px solid rgba(0,0,0,.2);\n  border-radius:10px;\n  background:#fff;\n  font:inherit;\n  width:100%;\n  max-width:100%;\n}\n\n\/* Hints and text blocks should wrap instead of expanding layout *\/\n#eco-tool-doppler .eco-tool__hint{\n  font-size:.92em;\n  opacity:.78;\n  min-height:34px;\n  overflow-wrap:anywhere;\n  word-break:break-word;\n}\n#eco-tool-doppler .eco-tool__noteBox{\n  border:1px solid rgba(0,0,0,.12);\n  border-radius:12px;\n  padding:12px;\n  background:rgba(0,0,0,.02);\n  overflow-wrap:anywhere;\n  word-break:break-word;\n}\n\n\/* Actions *\/\n#eco-tool-doppler .eco-tool__actions{display:flex;gap:10px;margin-top:16px;align-items:center;flex-wrap:wrap}\n#eco-tool-doppler .eco-tool__btn{padding:10px 22px}\n#eco-tool-doppler .eco-tool__btn--ghost{background:transparent!important;border:1px solid rgba(0,0,0,.2)!important}\n#eco-tool-doppler .eco-tool__btn--ghost:hover,\n#eco-tool-doppler .eco-tool__btn--ghost:focus{background:rgba(0,0,0,.06)!important;border-color:rgba(0,0,0,.35)!important}\n#eco-tool-doppler .eco-tool__error{font-weight:600;min-height:1.2em;flex:1 1 240px}\n\n\/* Result cards *\/\n#eco-tool-doppler .eco-tool__result{margin-top:16px}\n#eco-tool-doppler .eco-tool__subtitle{margin:0 0 10px}\n#eco-tool-doppler .eco-tool__cards{display:grid;gap:10px;grid-template-columns:repeat(2, minmax(0, 1fr))}\n@media (max-width: 860px){\n  #eco-tool-doppler .eco-tool__cards{grid-template-columns:1fr}\n}\n#eco-tool-doppler .eco-tool__card{border:1px solid rgba(0,0,0,.12);border-radius:12px;padding:12px;min-width:0}\n#eco-tool-doppler .eco-tool__card--wide{margin-top:10px}\n#eco-tool-doppler .eco-tool__metric-label{opacity:.85;font-weight:600}\n#eco-tool-doppler .eco-tool__metric-value{font-size:1.6em;font-weight:800;margin-top:6px;line-height:1.1;overflow-wrap:anywhere}\n#eco-tool-doppler .eco-tool__metric-sub{opacity:.85;margin-top:6px;overflow-wrap:anywhere}\n#eco-tool-doppler .eco-tool__muted{opacity:.8}\n#eco-tool-doppler .eco-tool__note{margin-top:10px;opacity:.9;overflow-wrap:anywhere}\n\n\/* Optional extra safety: prevent horizontal scroll due to long tokens *\/\n#eco-tool-doppler code, \n#eco-tool-doppler pre{\n  white-space:pre-wrap;\n  overflow-wrap:anywhere;\n}\n<\/style>\n\n<\/style>\n\n<script>\n(function(){\n  const root = document.getElementById(\"eco-tool-doppler\");\n  if(!root) return;\n\n  const $ = (k)=>root.querySelector('[data-dop=\"'+k+'\"]');\n\n  const fEl = $(\"f\");\n  const vEl = $(\"v\");\n  const voEl = $(\"vo\");\n  const vsEl = $(\"vs\");\n  const presetEl = $(\"preset\");\n\n  const calcBtn = $(\"calc\");\n  const resetBtn = $(\"reset\");\n  const errEl = $(\"error\");\n\n  const resEl = $(\"result\");\n  const outEl = $(\"out\");\n  const shiftEl = $(\"shift\");\n  const eqEl = $(\"eq\");\n\n  function setError(msg){ errEl.textContent = msg || \"\"; }\n  function fmt(n){\n    if(!Number.isFinite(n)) return \"\u2014\";\n    const a=Math.abs(n);\n    if(a===0) return \"0\";\n    if(a<0.001 || a>=1e9) return n.toExponential(3);\n    return n.toLocaleString(undefined,{maximumFractionDigits:6});\n  }\n\n  function applyPreset(){\n    const p = presetEl.value;\n    if(!p) return;\n\n    if(p===\"ambulance\"){\n      fEl.value = \"700\";\n      vEl.value = \"343\";\n      voEl.value = \"0\";\n      vsEl.value = \"30\";\n    } else if(p===\"train\"){\n      fEl.value = \"500\";\n      vEl.value = \"343\";\n      voEl.value = \"0\";\n      vsEl.value = \"20\";\n    } else if(p===\"runner\"){\n      fEl.value = \"440\";\n      vEl.value = \"343\";\n      voEl.value = \"5\";\n      vsEl.value = \"0\";\n    }\n\n    setError(\"\");\n    resEl.hidden = true;\n  }\n\n  function calculate(){\n    setError(\"\");\n\n    const f = Number(fEl.value);\n    const v = Number(vEl.value);\n    const vo = Number(voEl.value);\n    const vs = Number(vsEl.value);\n\n    if(!Number.isFinite(f) || f <= 0){\n      setError(\"Enter a valid original frequency (f).\");\n      resEl.hidden = true; return;\n    }\n    if(!Number.isFinite(v) || v <= 0){\n      setError(\"Enter a valid speed of sound (v).\");\n      resEl.hidden = true; return;\n    }\n    if(!Number.isFinite(vo) || !Number.isFinite(vs)){\n      setError(\"Enter valid speeds for observer and source (can be 0).\");\n      resEl.hidden = true; return;\n    }\n\n    const denom = v - vs;\n    if(denom <= 0){\n      setError(\"Invalid case: v \u2212 v\u209b must be greater than 0 (source speed too high).\");\n      resEl.hidden = true; return;\n    }\n\n    const fObs = f * (v + vo) \/ denom;\n\n    outEl.textContent = fmt(fObs);\n\n    const delta = fObs - f;\n    const pct = (delta \/ f) * 100;\n    const sign = delta >= 0 ? \"+\" : \"\u2212\";\n    shiftEl.textContent = `${sign}${fmt(Math.abs(delta))} Hz (${sign}${fmt(Math.abs(pct))}%)`;\n\n    eqEl.textContent = `f' = f\u00b7(v+v\u2092)\/(v\u2212v\u209b) = ${fmt(f)}\u00b7(${fmt(v)}+${fmt(vo)})\/(${fmt(v)}\u2212${fmt(vs)})`;\n\n    resEl.hidden = false;\n  }\n\n  function reset(){\n    fEl.value = \"\";\n    vEl.value = \"343\";\n    voEl.value = \"0\";\n    vsEl.value = \"0\";\n    presetEl.value = \"\";\n    setError(\"\");\n    resEl.hidden = true;\n  }\n\n  presetEl.addEventListener(\"change\", applyPreset);\n  calcBtn.addEventListener(\"click\", calculate);\n  resetBtn.addEventListener(\"click\", reset);\n})();\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Doppler Effect Calculator (Sound) Estimate the observed frequency when a sound source and\/or observer is moving (1D, along the line of sight). Original frequency (f)(Hz) Example: A4 note is 440&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":2354,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"_links":{"self":[{"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/pages\/2475"}],"collection":[{"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/science-x.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2475"}],"version-history":[{"count":5,"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/pages\/2475\/revisions"}],"predecessor-version":[{"id":2497,"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/pages\/2475\/revisions\/2497"}],"up":[{"embeddable":true,"href":"https:\/\/science-x.net\/index.php?rest_route=\/wp\/v2\/pages\/2354"}],"wp:attachment":[{"href":"https:\/\/science-x.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}