Skip to content
Open
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
6 changes: 5 additions & 1 deletion packages/alphatab/src/exporter/Gp7Exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ export class Gp7Exporter extends ScoreExporter {
fileSystem.writeEntry(new ZipEntry('Content/LayoutConfiguration', layoutConfiguration));
fileSystem.writeEntry(new ZipEntry('Content/score.gpif', IOHelper.stringToBytes(gpifXml)));

if(gpifWriter.backingTrackAssetFileName) {
if (gpifWriter.backingTrackAssetFileName) {
fileSystem.writeEntry(new ZipEntry(gpifWriter.backingTrackAssetFileName!, score.backingTrack!.rawAudioFile!));
// Let Guitar Pro open the embedded audio panel by default.
fileSystem.writeEntry(
new ZipEntry('Content/Preferences.json', IOHelper.stringToBytes('{"view":{"backingTrackVisible":true}}'))
);
}

fileSystem.end();
Expand Down
12 changes: 12 additions & 0 deletions packages/alphatab/test/exporter/Gp7Exporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GpifParser } from '@coderline/alphatab/importer/GpifParser';
import { ScoreLoader } from '@coderline/alphatab/importer/ScoreLoader';
import { ByteBuffer } from '@coderline/alphatab/io/ByteBuffer';
import { IOHelper } from '@coderline/alphatab/io/IOHelper';
import { BackingTrack } from '@coderline/alphatab/model/BackingTrack';
import { TechniqueSymbolPlacement } from '@coderline/alphatab/model/InstrumentArticulation';
import { JsonConverter } from '@coderline/alphatab/model/JsonConverter';
import { MusicFontSymbol } from '@coderline/alphatab/model/MusicFontSymbol';
Expand All @@ -23,6 +24,17 @@ import { TestPlatform } from 'test/TestPlatform';
import { describe, expect, it } from 'vitest';

describe('Gp7ExporterTest', () => {
it('sets the backing track visibility preference only for embedded audio', () => {
const score = ScoreLoader.loadAlphaTex('3.3.4');
const entriesWithoutAudio = new ZipReader(ByteBuffer.fromBuffer(exportGp7(score)), new Settings().importer.maxDecodingBufferSize).read();
expect(entriesWithoutAudio.some(e => e.fileName.endsWith('Preferences.json'))).toBe(false);
score.backingTrack = new BackingTrack();
score.backingTrack.rawAudioFile = new Uint8Array([1, 2, 3, 4]);
const entries = new ZipReader(ByteBuffer.fromBuffer(exportGp7(score)), new Settings().importer.maxDecodingBufferSize).read();
const preferences = entries.find(e => e.fileName.endsWith('Preferences.json'));
expect(preferences).toBeDefined();
expect(JSON.parse(IOHelper.toString(preferences!.data, '')).view.backingTrackVisible).toBe(true);
});
async function loadScore(name: string): Promise<Score | null> {
try {
const data = await TestPlatform.loadFile(`test-data/${name}`);
Expand Down
4 changes: 3 additions & 1 deletion website/docs/formats/guitar-pro-8.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: The proprietary file format of the current Arobas Guitar Pro versio

The general file format of Guitar Pro 8 is the same as Guitar Pro 8 but with potentially additional files in the zip (e.g. for audio tracks) and with an extended `score.gpif` for new features.

When exporting a score with embedded backing audio, alphaTab includes a visibility preference so Guitar Pro opens the backing-track panel by default.

**Compatibility Level:** Mature and well tested (through GP7)


Expand Down Expand Up @@ -736,4 +738,4 @@ import { FileFormatFeatureTable, FileFormatFeatureGroup, FileFormatFeatureRow, F
audio={[FeatureStatus.Supported]}
tex={[FeatureStatus.Supported]} />
</FileFormatFeatureGroup>
</FileFormatFeatureTable>
</FileFormatFeatureTable>
5 changes: 5 additions & 0 deletions website/docs/releases/release1_10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { AlphaTab } from '@site/src/components/AlphaTab';

## 1.10.0

#### export: show embedded backing audio in Guitar Pro
https://github.com/CoderLine/alphaTab/pull/3024

Exported scores with embedded backing audio now request that Guitar Pro show its backing-track panel when opening the file.

### Music Notation

#### render: transposed tabs on playable strings
Expand Down
Loading