|
@@ -172,12 +172,16 @@ export default defineComponent({
|
|
|
// 生成wav
|
|
|
const productWav = async (isUrl = true) => {
|
|
|
return new Promise((resolve) => {
|
|
|
+ const subjectCode = props.item.subjectCode || "acoustic_grand_piano";
|
|
|
+ const _instruments = ABCJS.synth.instrumentIndexToName.indexOf(subjectCode);
|
|
|
+ const program = _instruments > -1 ? _instruments : 0;
|
|
|
+ console.log(program, "instrument");
|
|
|
const midiBuffer = new ABCJS.synth.CreateSynth();
|
|
|
midiBuffer
|
|
|
.init({
|
|
|
visualObj: props.item.visualObj,
|
|
|
options: {
|
|
|
- program: 0,
|
|
|
+ program,
|
|
|
soundFontUrl: "https://oss.dayaedu.com/musicSheet/",
|
|
|
// soundFontUrl: "https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/", // 默认 FluidR3_GM
|
|
|
// soundFontUrl: "https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/", // Musyng Kite
|
|
@@ -203,7 +207,6 @@ export default defineComponent({
|
|
|
if (err) {
|
|
|
return;
|
|
|
}
|
|
|
- console.log(props.item, "112");
|
|
|
if (!props.item.xml) {
|
|
|
message.error("没有生成xml文件");
|
|
|
handleClose();
|
|
@@ -221,6 +224,7 @@ export default defineComponent({
|
|
|
};
|
|
|
const handleSubmit = async () => {
|
|
|
// 判断是否有wav文件,如果没有则生成保存
|
|
|
+ console.log(props.item, "props.item");
|
|
|
if (!props.item.filePath) {
|
|
|
const url = await productWav(false);
|
|
|
props.item.filePath = url;
|