Speak math formulas aloud
CosyVoice converts mathematical formulas embedded in text to natural speech for audiobooks, online education, and other audio content in mathematics and physics.
Wrap the formulas in your text with specific separators, and then call the speech synthesis API.
The currently supported tags and symbols are listed below.
Units must be wrapped with
The backslash (
This feature only supports Chinese. Formulas may not be pronounced correctly in other languages. Pronunciation examples in this guide are English translations and do not represent actual synthesis performance.
Steps
Wrap the formulas in your text with specific separators, and then call the speech synthesis API.
1
Mark formulas with separators
Wrap formulas with any of these separators (all produce identical results):
$...$$$...$$\(...\)\[...\]
2
Call the API to request speech synthesis
Call the speech synthesis API with your marked formulas. In JSON or string literals, the backslash (
\) is an escape character — write it as \\.Example call (in Python):Supported tags and symbols
The currently supported tags and symbols are listed below.
Basic mathematics
| Tag or symbol | Function | Formula content example | Formula input example | Pronunciation |
|---|---|---|---|---|
| + | Add | 2 + 3 = 5 | $2 + 3 = 5$ | Two plus three equals five |
| - | Subtract | 3 - 2 = 1 | $3 - 2 = 1$ | Three minus two equals one |
| \pm | Plus or minus / Positive or negative | \pm 1 \pm 2 | $\pm 1\pm 2$ | Plus or minus one, plus or minus two |
| \times | Multiply | 2 \times 3 = 6 | $2 \times 3 = 6$ | Two times three equals six |
| × | Multiply | 2 × 3 = 6 | $$2 × 3 = 6$$ | Two times three equals six |
| * | Multiply | 2 * 3 = 6 | \(2 * 3 = 6\) | Two times three equals six |
| \div | Divide | 6\div2=3 | \[6\div2=3\] | Six divided by two equals three |
| ÷ | Divide | 6÷2=3 | $6÷2=3$ | Six divided by two equals three |
| / | Divide | 6/2=3 | $6/2=3$ | Six divided by two equals three |
| = | Equals | 3+5=8 | $3+5=8$ | Three plus five equals eight |
| < | Less than | 1< 2 | $1< 2$ | One is less than two |
| ≤ | Less than or equal to | 3≤5 | $3≤5$ | Three is less than or equal to five |
| <= | Less than or equal to | 3<=5 | $3<=5$ | Three is less than or equal to five |
| \leq | Less than or equal to | 3\leq5 | $3\leq 5$ | Three is less than or equal to five |
| \le | Less than or equal to | 3\le5 | $3\le 5$ | Three is less than or equal to five |
| \leqq | Less than or equal to | 3\leqq5 | $3\leqq 5$ | Three is less than or equal to five |
| \leqslant | Less than or equal to | 3\leqslant5 | $3\leqslant 5$ | Three is less than or equal to five |
| > | Greater than | 2>1 | $2>1$ | Two is greater than one |
| ≥ | Greater than or equal to | 5≥3 | $5≥3$ | Five is greater than or equal to three |
| >= | Greater than or equal to | 5>=3 | $5>=3$ | Five is greater than or equal to three |
| \geq | Greater than or equal to | 5\geq3 | $5\geq 3$ | Five is greater than or equal to three |
| \ge | Greater than or equal to | 5\ge3 | $5\ge 3$ | Five is greater than or equal to three |
| \geqq | Greater than or equal to | 5\geqq3 | $5\geqq 3$ | Five is greater than or equal to three |
| \geqslant | Greater than or equal to | 5\geqslant3 | $5\geqslant 3$ | Five is greater than or equal to three |
| \frac | Fraction | 2\frac3 | $\frac {2}{3}$ | Two-thirds |
| ^ | Power | 2^1 | $2^{1}$ | Two to the first power |
| \sqrt | Root | \sqrt{9} = 3 | $\sqrt {9} = 3$ | The square root of nine equals three |
| \sqrt | Root | \sqrt[3]{8} = 2 | $\sqrt[3]{8} = 2$ | The cube root of eight equals two |
| % | Percentage | 5\% | $5\%$ | Five percent |
| | | Absolute value | ∣3∣=3 | $|3| =3$ | The absolute value of three equals three |
| \vert | Absolute value | 3\vert=3 | $\vert 3\vert =3$ | The absolute value of three equals three |
| \lg | Logarithm | lg {10} | $\lg {10}$ | log ten |
| \log | Logarithm | \log{5} | $\log{5}$ | log five |
| \ln | Natural logarithm | \lnX | $ln {10}$ | LN 10 |
| ! | Factorial | 5! | $5!$ | Five factorial |
| () | Parentheses | (2+1) | $(2+1)$ | Two plus one in parentheses |
\{ \} | Braces | \{2+1\} | $\{2+1\}$ | Open brace two plus one close brace |
Special mathematical symbols
| Tag or symbol | Transform | Formula content example | Formula input example | Pronunciation |
|---|---|---|---|---|
| \alpha | alpha | \alpha | $\alpha$ | alpha |
| \Alpha | alpha | \Alpha | $\Alpha$ | alpha |
| \beta | beta | \beta | $\beta$ | beta |
| \Beta | beta | \Beta | $\Beta$ | beta |
| \gamma | gamma | \gamma | $\gamma$ | gamma |
| \Gamma | gamma | \Gamma | $\Gamma$ | gamma |
| \delta | delta | \delta | $\delta$ | delta |
| \Delta | delta | \Delta | $\Delta$ | delta |
| \infty | infinity (Chinese) | \infty | $\infty$ | Infinity |
| ∞ | infty (English) | ∞ | $∞$ | Infinity |
Geometry
| Tag or symbol | Function | Formula content example | Formula input example | Pronunciation |
|---|---|---|---|---|
| \pi | Pi | \pi=3.14159 | $\pi =3.14159$ | Pi equals 3.14159 |
| \sin | Trigonometric function | \sin 30^\circ=\frac{1}{2} | $\sin 30^\circ =\frac {1}{2}$ | The sine of 30 degrees equals 1/2 |
| \cos | Trigonometric function | \cos 30^\circ=\frac{\sqrt{2}}{2} | $\cos 30^\circ =\frac {\sqrt {2}}{2}$ | The cosine of 30 degrees equals the square root of two over two |
| \tan | Trigonometric function | \tan 30^\circ=\frac{\sin 30^\circ}{\cos 30^\circ} | $\tan 30^\circ =\frac {\sin 30^\circ}{\cos 30^\circ}$ | The tangent of 30 degrees equals the sine of 30 degrees over the cosine of 30 degrees |
| \csc | Trigonometric function | \csc A | $\csc A$ | cosecant A |
| \sec | Trigonometric function | \sec A | $\sec A$ | secant A |
| \cot | Trigonometric function | \cot A | $\cot A$ | cotangent A |
| \angle | Angle | \angle AB | $\angle AB$ | Angle AB |
| ∠ | Angle | ∠AB | $∠AB$ | Angle AB |
| ^\circ | Degree | ∠AB = 30^\circ | $∠AB = 30^\circ$ | Angle AB equals 30 degrees |
| \odot | Circle | \odot | $\odot$ | Circle |
\overset\frown | Arc | \overset\frown {BC} | $\overset\frown {BC}$ | Arc BC |
\rm{Rt} | Right angle | \because \rm{Rt}\triangle ABC | $\because \rm{Rt}\triangle ABC$ | Because triangle ABC is a right triangle |
\mathrm{Rt} | Right angle | \therefore AB \perp BC | $\therefore AB \perp BC$ | Therefore, AB is perpendicular to BC |
| \triangle | Triangle | \triangle ABC | $\triangle ABC$ | Triangle ABC |
| △ | Triangle | △ABC | $△ABC$ | Triangle ABC |
| \parallelogram | Parallelogram | \parallelogram ABCD | $\parallelogram ABCD$ | Parallelogram ABCD |
| \perp | Perpendicular | AB \perp BC | $AB \perp BC$ | AB is perpendicular to BC |
| \bot | Perpendicular | AB \bot BC | $AB \bot BC$ | AB is perpendicular to BC |
| ⊥ | Perpendicular | AB ⊥ BC | $AB ⊥ BC$ | AB is perpendicular to BC |
| \parallel | Parallel | A\parallel B | $A\parallel B$ | A is parallel to B |
| \equalparallel | Parallel and equal to | A\equalparallel B | $A\equalparallel B$ | A is parallel and equal to B |
| \cong | Congruent | △ABC\cong△DEF | $△ABC\cong△DEF$ | Triangle ABC is congruent to triangle DEF |
Conditions
| Tag or symbol | Function | Formula content example | Formula input example | Pronunciation |
|---|---|---|---|---|
| \implies | Implies | \implies 1+1=2 | $\implies 1+1=2$ | This implies that one plus one equals two |
| \iff | Equivalent to | p\iffq | $p\iffq$ | p is equivalent to q |
| \because | Because | \because a = b \therefore b=a | $\because a = b \therefore b=a$ | Because a equals b, b equals a |
| \therefore | Therefore | \because a = b \therefore b=a | $\because a = b \therefore b=a$ | Because a equals b, b equals a |
Units
Units must be wrapped with \unit, \quantity, \mathit, \mathrm, or \rm tags (such as \unit{cm}).
| Tag or symbol | Pronunciation | Formula content example | Formula input example | Example pronunciation |
|---|---|---|---|---|
| mm | millimeter | 5\quantity{mm} | $5\quantity{mm}$ | 5 millimeters |
| cm | centimeter | 5\quantity{cm} | $5\quantity{cm}$ | 5 centimeters |
| dm | decimeter | 5\quantity{dm} | $5\quantity{dm}$ | 5 decimeters |
| m | meter | 5\quantity{m} | $5\quantity{m}$ | 5 meters |
| km | kilometer | 5\quantity{km} | $5\quantity{km}$ | 5 kilometers |
| g | gram | 5\quantity{g} | $5\quantity{g}$ | 5 grams |
| kg | kilogram | 5\quantity{kg} | $5\quantity{kg}$ | 5 kilograms |
| t | ton | 5\quantity{t} | $5\quantity{t}$ | 5 tons |
| mm^2 | square millimeter | 5\quantity{mm^2} | $5\quantity{mm^2}$ | 5 square millimeters |
| cm^2 | square centimeter | 5\quantity{cm^2} | $5\quantity{cm^2}$ | 5 square centimeters |
| dm^2 | square decimeter | 5\quantity{dm^2} | $5\quantity{dm^2}$ | 5 square decimeters |
| m^2 | square meter | 5\quantity{m^2} | $5\quantity{m^2}$ | 5 square meters |
| km^2 | square kilometer | 5\quantity{km^2} | $5\quantity{km^2}$ | 5 square kilometers |
| mm^3 | cubic millimeter | 5\quantity{mm^3} | $5\quantity{mm^3}$ | 5 cubic millimeters |
| cm^3 | cubic centimeter | 5\quantity{cm^3} | $5\quantity{cm^3}$ | 5 cubic centimeters |
| dm^3 | cubic decimeter | 5\quantity{dm^3} | $5\quantity{dm^3}$ | 5 cubic decimeters |
| m^3 | cubic meter | 5\quantity{m^3} | $5\quantity{m^3}$ | 5 cubic meters |
| km^3 | cubic kilometer | 5\quantity{km^3} | $5\quantity{km^3}$ | 5 cubic kilometers |
| ml | milliliter | 5\quantity{ml} | $5\quantity{ml}$ | 5 milliliters |
| s | second | 5\quantity{s} | $5\quantity{s}$ | 5 seconds |
| min | minute | 5\quantity{min} | $5\quantity{min}$ | 5 minutes |
| h | hour | 5\quantity{h} | $5\quantity{h}$ | 5 hours |
| km/h | kilometers per hour | 5\quantity{km/h} | $5\quantity{km/h}$ | 5 kilometers per hour |
| g/l | grams per liter | 5\quantity{g/l} | $5\quantity{g/l}$ | 5 grams per liter |
Limitations
- Chinese only: Other languages are not supported
- Content limits:
- Use only the tags and symbols in Supported tags and symbols
- Markdown math blocks (
```math ... ```) are not supported - Include only formulas within separators - other content may cause inaccurate synthesis
- Compatible models:
cosyvoice-v3-flash,cosyvoice-v3-plus
FAQ
Why is the formula I entered not read?
- Separators: Confirm the formula is wrapped in
$...$,$$...$$,\(...\), or\[...\] - Formula complexity: Ensure the formula uses only supported tags and symbols
- Escape characters: Confirm backslashes (
\) are escaped as\\in API requests
How do I handle backslash (\) in my code?
The backslash (\) is an escape character in string literals and JSON. Escape it as \\. Example: write \frac as \\frac in Python, Java, JavaScript, and similar languages.