• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

ASR calculators?

ChatGPT, can you do this for free, it's for science, you know... :cool:
 
create that
HTML + JS

<div style="max-width: 400px; margin: auto; padding: 15px; border: 1px solid #ccc; border-radius: 8px; font-family: sans-serif;">
<h3 style="text-align: center;">Headphone Sensitivity Converter</h3>

<label>Impedance (Ohms):</label>
<input type="number" id="impedance" value="32" style="width: 100%; margin-bottom: 10px;">

<label>Sensitivity in dB/mW:</label>
<input type="number" id="dbmw" placeholder="Enter dB/mW" style="width: 100%; margin-bottom: 10px;">

<label>Sensitivity in dB/V:</label>
<input type="number" id="dbv" placeholder="Enter dB/V" style="width: 100%; margin-bottom: 10px;">

<button onclick="convertFrommW()" style="width: 48%; margin-right: 4%;">Convert from dB/mW</button>
<button onclick="convertFromV()" style="width: 48%;">Convert from dB/V</button>

<p id="result" style="margin-top: 15px; font-weight: bold;"></p>
</div>

<script>
function convertFrommW() {
const z = parseFloat(document.getElementById('impedance').value);
const dbmw = parseFloat(document.getElementById('dbmw').value);
if (isNaN(z) || isNaN(dbmw)) return alert("Please enter valid numbers.");

const dbv = dbmw + 10 * Math.log10(1000 / z);
document.getElementById('dbv').value = dbv.toFixed(2);
document.getElementById('result').textContent = `Converted to dB/V: ${dbv.toFixed(2)} dB/V`;
}

function convertFromV() {
const z = parseFloat(document.getElementById('impedance').value);
const dbv = parseFloat(document.getElementById('dbv').value);
if (isNaN(z) || isNaN(dbv)) return alert("Please enter valid numbers.");

const dbmw = dbv - 10 * Math.log10(1000 / z);
document.getElementById('dbmw').value = dbmw.toFixed(2);
document.getElementById('result').textContent = `Converted to dB/mW: ${dbmw.toFixed(2)} dB/mW`;
}
</script>



Version with icons;

<div style="max-width: 500px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 8px; font-family: sans-serif;">
<h2 style="text-align: center;"> Headphone Sensitivity Converter</h2>

<label> Impedance (Ohms):</label>
<input type="number" id="impedance" value="32" style="width: 100%; margin-bottom: 10px;">

<label> Sensitivity in dB/mW:</label>
<input type="number" id="dbmw" placeholder="Enter dB/mW" style="width: 100%; margin-bottom: 10px;">

<label> Sensitivity in dB/V:</label>
<input type="number" id="dbv" placeholder="Enter dB/V" style="width: 100%; margin-bottom: 10px;">

<button onclick="convertFrommW()" style="width: 48%; margin-right: 4%;">Convert from dB/mW</button>
<button onclick="convertFromV()" style="width: 48%;">Convert from dB/V</button>

<p id="result" style="margin-top: 15px; font-weight: bold;"></p>
</div>

<script>
function convertFrommW() {
const z = parseFloat(document.getElementById('impedance').value);
const dbmw = parseFloat(document.getElementById('dbmw').value);
if (isNaN(z) || isNaN(dbmw)) return alert("Please enter valid numbers.");

const dbv = dbmw + 10 * Math.log10(1000 / z);
document.getElementById('dbv').value = dbv.toFixed(2);
document.getElementById('result').textContent = `Converted to dB/V: ${dbv.toFixed(2)} dB/V`;
}

function convertFromV() {
const z = parseFloat(document.getElementById('impedance').value);
const dbv = parseFloat(document.getElementById('dbv').value);
if (isNaN(z) || isNaN(dbv)) return alert("Please enter valid numbers.");

const dbmw = dbv - 10 * Math.log10(1000 / z);
document.getElementById('dbmw').value = dbmw.toFixed(2);
document.getElementById('result').textContent = `Converted to dB/mW: ${dbmw.toFixed(2)} dB/mW`;
}
</script>


Does this work at your end? I tried it here in a browser as a .html file;

1752736811285.png


1752736817217.png



JSmith
 
In "Volts ⇄ dBu / dBV" there are:
  • Volts ➞ dBu / dBV
  • Volts ➞ dBu
  • Volts ➞ dBV
The last two seem redundant. Personally I'd also change "/" to "," or "and".

The:
  • dBu ➞ Volts
  • dBV ➞ Volts
could be changed to also include the other unit in the output:
  • dBu ➞ Volts, dBV
  • dBV ➞ Volts, dBu

And maybe "Volts" could be split into "Volts_rms" and "Volts_peak"?
 
conversion from 'xV to produce 94dB' into dB/V = ((20 x (LOG(10) (1/voltage))) + 94)
 
Last edited:
Back
Top Bottom