* Creates a new audio exporter, initialized with the given data. * @param options The export options to use. * The track volume and transposition pitches must lists must be filled with midi channels. * @param midi The midi file to use. * @param syncPoints The sync points to use
(
options: AudioExportOptions,
midi: MidiFile,
syncPoints: BackingTrackSyncPoint[],
mainTranspositionPitches: Map<number, number>
)
| 720 | * @param transpositionPitches The initial transposition pitches to apply. |
| 721 | */ |
| 722 | public exportAudio( |
| 723 | options: AudioExportOptions, |
| 724 | midi: MidiFile, |
| 725 | syncPoints: BackingTrackSyncPoint[], |
| 726 | mainTranspositionPitches: Map<number, number> |
| 727 | ): IAlphaSynthAudioExporter { |
| 728 | const exporter = new AlphaSynthAudioExporter(options); |
| 729 | |
| 730 | exporter.loadMidiFile(midi); |
| 731 | if (options.useSyncPoints) { |
| 732 | exporter.updateSyncPoints(syncPoints); |
| 733 | } |
| 734 | exporter.applyTranspositionPitches(mainTranspositionPitches); |
| 735 | |
| 736 | for (const [channel, semitones] of options.trackTranspositionPitches) { |
| 737 | exporter.setChannelTranspositionPitch(channel, semitones); |
| 738 | } |
| 739 | |
| 740 | for (const [channel, volume] of options.trackVolume) { |
| 741 | exporter.channelSetMixVolume(channel, volume); |
| 742 | } |
| 743 | |
| 744 | if (options.soundFonts) { |
| 745 | for (const f of options.soundFonts!) { |
| 746 | exporter.loadSoundFont(f); |
| 747 | } |
| 748 | } else { |
| 749 | exporter.loadPresets((this.synthesizer as TinySoundFont).presets); |
| 750 | } |
| 751 | |
| 752 | if (options.playbackRange) { |
| 753 | exporter.limitExport(options.playbackRange); |
| 754 | } |
| 755 | |
| 756 | exporter.setup(); |
| 757 | |
| 758 | return exporter; |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | /** |