grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIDI imported in FL Studio turns out to be one octave higher

LilyStilson opened this issue · comments

commented

Using code from your example, extended with fs to save file

const MidiWriter = require('midi-writer-js')
const fs = require('fs')

// Start with a new track
const track = new MidiWriter.Track()

// Define an instrument (optional):
track.addEvent(new MidiWriter.ProgramChangeEvent({instrument: 1}))

// Add some notes:
const note = new MidiWriter.NoteEvent({pitch: ['C0', 'D0', 'E0', 'A0', 'B0'], duration: '4'})
track.addEvent(note)

// Generate a data URI
const write = new MidiWriter.Writer(track)

// Save file using fs
fs.writeFileSync("test.mid", write.buildFile(), function(err) {
    if(err) return console.log(err)
})

When you try to import generated file in the DAW, the notes are going to be one octave higher than provided pitches
image

Is there any base_note value that I can change or there is nothing I can do for now?

commented

Turns out, it's a DAW issue, oh well