Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/guides/exporter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ After alphaTab has loaded a full [`Score`](/docs/reference/score) object from an
Supported export formats:

- Guitar Pro 7 (alphaTab.exporter.Gp7Exporter) <span className="badge badge--info">since 1.2.0</span>
- alphaTex (alphaTab.exporter.AlphaTexExporter) <span className="badge badge--info">since 1.7.0</span>

To export a `Score` object the corresponding exporter needs to be created and called. Then the resulting binary array can be used further to
trigger a download, send it to a server, save it to a file etc.

## Guitar Pro 7 (since 1.2.0)

<Tabs
defaultValue="js"
Expand Down Expand Up @@ -56,3 +58,28 @@ using(var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Create))

</TabItem>
</Tabs>

## alphaTex Exporter (since 1.7.0)

Starting with 1.7.0 alphaTab can also export the data model to its own music notation language [alphaTex](/docs/alphatex/introduction).
The exporter supports all features which the importer can also handle. If you find something, please open a feature request.

Via the exporter settings [`settings.exporter`](/docs/reference/settings#Exporter) the format of the exported code can be adjusted.
Especially the `comments` can be quite useful for alphaTex beginners to learn about the syntax.

While you can use the standard `export` to export the code into a byte array, you can also use `exportToString` to get the alphaTex code
back as plain string.

```js
const exporter = new alphaTab.exporter.AlphaTexExporter();
const data = exporter.export(api.score, api.settings); // will return a Uint8Array
const texCode = exporter.exportToString(api.score, api.settings); // will return a string

// trigger download
const a = document.createElement('a');
a.download = api.score.title.length > 0 ? api.score.title + '.atex' : 'Untitled.atex';
a.href = URL.createObjectURL(new Blob([data]));
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
```
4 changes: 2 additions & 2 deletions docs/reference/api/exportaudio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Starts the audio export for the currently loaded song."
sidebar_custom_props:
kind: method
category: Methods - Player
since: 1.5.0
since: 1.6.0
---

import { ParameterTable, ParameterRow } from '@site/src/components/ParameterTable';
Expand All @@ -16,7 +16,7 @@ import { SinceBadge } from '@site/src/components/SinceBadge';
import DynHeading from '@site/src/components/DynHeading';
import Link from '@docusaurus/Link';

<SinceBadge since="1.5.0" />
<SinceBadge since="1.6.0" />

### Description
Starts the audio export for the currently loaded song. This will not export or use any backing track media but will always use the synthesizer to generate the output.
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/settings/core/smuflfontsources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ they are available for rendering the music sheet. The sources can be set to any
CSS compatible URL which can be passed into `url()`.
See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url

If you customize the SmuFL font used in alphaTab, you will also need to provide
the respective SMuFL Metadata information to alphaTab.
Set the metadata via <code style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><Link style={{"color":"#36acaa"}} to={"/docs/reference/types/engravingsettings/fillfromsmufl"}>{"fillFromSmufl"}</Link></code> on the rendering resources.

<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"smuflFontSources"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><Link style={{"color":"#36acaa"}} to={"/docs/reference/types/fontfileformat"}>{"Map"}</Link><span style={{"color":"#393A34"}}>{"<"}</span><Link style={{"color":"#36acaa"}} to={"/docs/reference/types/fontfileformat"}>{"FontFileFormat"}</Link><span style={{"color":"#393A34"}}>{","}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"string"}</span><span style={{"color":"#393A34"}}>{">"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"|"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"null"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Bravura files located at <code style={{\"color\":\"#393A34\",\"backgroundColor\":\"#f6f8fa\"}}><Link style={{\"color\":\"#36acaa\"}} to={\"/docs/reference/settings/core/fontdirectory\"}>{\"fontDirectory\"}</Link></code> ."}</span><span style={{"color":"#393A34"}}>{";"}</span></code></pre></div></div>

37 changes: 37 additions & 0 deletions docs/reference/settings/display/effectbandpaddingbottom.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: display.effectBandPaddingBottom
description: "The padding between individual effect bands."
sidebar_custom_props:
jsOnParent: true
category: Display
since: 1.7.0
---

import { ParameterTable, ParameterRow } from '@site/src/components/ParameterTable';
import CodeBlock from '@theme/CodeBlock';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import { CodeBadge } from '@site/src/components/CodeBadge';
import { SinceBadge } from '@site/src/components/SinceBadge';
import DynHeading from '@site/src/components/DynHeading';
import Link from '@docusaurus/Link';

import { SettingsHeader } from '@site/src/components/SettingsHeader';

<SettingsHeader />

### Description
The padding between individual effect bands.

<Tabs defaultValue="js" values={[{label: "JavaScript", value: "js"},{label: "C#", value: "cs"},{label:"Kotlin", value: "kt"}]}>
<TabItem value="js">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"effectBandPaddingBottom"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"number"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span><span style={{"color":"#393A34"}}>{";"}</span></code></pre></div></div>
</TabItem>
<TabItem value="cs">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"double"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"EffectBandPaddingBottom"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"{"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"get"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"set"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"}"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span></code></pre></div></div>
</TabItem>
<TabItem value="kt">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#00009f"}}>{"var"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"effectBandPaddingBottom"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Double"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span></code></pre></div></div>
</TabItem>
</Tabs>

36 changes: 36 additions & 0 deletions docs/reference/settings/exporter/comments.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: exporter.comments
description: "Whether to write extended comments into the exported file (e.g. to in alphaTex to mark where certain metadata or bars starts)"
sidebar_custom_props:
category: Exporter
since: 1.7.0
---

import { ParameterTable, ParameterRow } from '@site/src/components/ParameterTable';
import CodeBlock from '@theme/CodeBlock';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import { CodeBadge } from '@site/src/components/CodeBadge';
import { SinceBadge } from '@site/src/components/SinceBadge';
import DynHeading from '@site/src/components/DynHeading';
import Link from '@docusaurus/Link';

import { SettingsHeader } from '@site/src/components/SettingsHeader';

<SettingsHeader />

### Description
Whether to write extended comments into the exported file (e.g. to in alphaTex to mark where certain metadata or bars starts)

<Tabs defaultValue="js" values={[{label: "JavaScript", value: "js"},{label: "C#", value: "cs"},{label:"Kotlin", value: "kt"}]}>
<TabItem value="js">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"comments"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"boolean"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"false"}</span><span style={{"color":"#393A34"}}>{";"}</span></code></pre></div></div>
</TabItem>
<TabItem value="cs">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"bool"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Comments"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"{"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"get"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"set"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"}"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"false"}</span></code></pre></div></div>
</TabItem>
<TabItem value="kt">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#00009f"}}>{"var"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"comments"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Boolean"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"false"}</span></code></pre></div></div>
</TabItem>
</Tabs>

37 changes: 37 additions & 0 deletions docs/reference/settings/exporter/indent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: exporter.indent
description: "How many characters should be indented on formatted outputs. If set to negative values"
sidebar_custom_props:
category: Exporter
since: 1.7.0
---

import { ParameterTable, ParameterRow } from '@site/src/components/ParameterTable';
import CodeBlock from '@theme/CodeBlock';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import { CodeBadge } from '@site/src/components/CodeBadge';
import { SinceBadge } from '@site/src/components/SinceBadge';
import DynHeading from '@site/src/components/DynHeading';
import Link from '@docusaurus/Link';

import { SettingsHeader } from '@site/src/components/SettingsHeader';

<SettingsHeader />

### Description
How many characters should be indented on formatted outputs. If set to negative values
formatted outputs are disabled.

<Tabs defaultValue="js" values={[{label: "JavaScript", value: "js"},{label: "C#", value: "cs"},{label:"Kotlin", value: "kt"}]}>
<TabItem value="js">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"indent"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"number"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span><span style={{"color":"#393A34"}}>{";"}</span></code></pre></div></div>
</TabItem>
<TabItem value="cs">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"double"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Indent"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"{"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"get"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#00009f"}}>{"set"}</span><span style={{"color":"#393A34"}}>{";"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"}"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span></code></pre></div></div>
</TabItem>
<TabItem value="kt">
<div className="codeBlockContainer"><div className="codeBlockContent"><pre className="codeBlock"><code className="codeBlockLines" style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#00009f"}}>{"var"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"indent"}</span><span style={{"color":"#393A34"}}>{":"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"Double"}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#393A34"}}>{"="}</span><span style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}>{" "}</span><span style={{"color":"#36acaa"}}>{"2"}</span></code></pre></div></div>
</TabItem>
</Tabs>

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"generate-alphatabdoc": "tsx scripts/generate-alphatabdoc.mts"
},
"dependencies": {
"@coderline/alphatab": "^1.6.0-alpha.1416",
"@coderline/alphatab": "^1.7.0-alpha.1515",
"@docusaurus/core": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@docusaurus/theme-mermaid": "^3.7.0",
Expand Down
10 changes: 5 additions & 5 deletions scripts/generate-common.mts
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ function tryGetSettingsUrl(
.name!.getText()
.toLowerCase()}/${symbol.name.toLowerCase()}`;
} else {
cconsole.warn(
"Could not find a property of type ",
parentSymbol.name,
" in Settings"
);
// cconsole.warn(
// "Could not find a property of type ",
// parentSymbol.name,
// " in Settings"
// );
return undefined;
}
}
Expand Down
23 changes: 19 additions & 4 deletions src/components/ReferenceTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "@docusaurus/plugin-content-docs";
import { useDocById } from "@docusaurus/plugin-content-docs/client";
import { MarkdownString } from "../MarkdownString";
import { useLocation } from "@docusaurus/router";

function buildPropertyUrl(property: Page) {
let url = "";
Expand All @@ -24,12 +25,12 @@ type ReferenceRowProps = { property: Page; showJson: boolean };
const ReferenceRow: React.FC<ReferenceRowProps> = ({ property, showJson }) => {
const { mainName, javaScriptOnly } =
buildNames(property);

return (
<tr>
<td>
<a href={buildPropertyUrl(property)}>
<CodeBadge name={mainName} type={javaScriptOnly ? 'js' : 'all' } />
<CodeBadge name={mainName} type={javaScriptOnly ? 'js' : 'all'} />
</a>
</td>
<td><MarkdownString content={property.prop("description", "")} /></td>
Expand Down Expand Up @@ -70,7 +71,7 @@ const ReferenceCategory: React.FC<ReferenceCategoryProps> = ({
return (
<>
<tr>
<th colSpan={4}>{name}</th>
<th colSpan={4} id={name}>{name}</th>
</tr>
{rows}
</>
Expand Down Expand Up @@ -103,7 +104,7 @@ export const ReferenceTable: React.FC<ReferenceTableProps> = ({
const existingKeys = new Map<string, Page[]>();
const pages: { key: string; items: Page[] }[] = [];
for (const page of allPages) {
if(page.type === "link" && page.docId?.startsWith('_') === true) {
if (page.type === "link" && page.docId?.startsWith('_') === true) {
continue;
}

Expand Down Expand Up @@ -131,6 +132,20 @@ export const ReferenceTable: React.FC<ReferenceTableProps> = ({
/>
));

const { hash } = useLocation();
useEffect(() => {
const id = hash.replace('#', '');
const element = document.getElementById(id);
if (element) {
setTimeout(() => {
element.scrollIntoView({
behavior: 'auto',
block: 'center',
});
}, 100);
}
}, []);

return (
<table className="table table-striped table-condensed reference-table">
<thead>
Expand Down