fbpx
Skip to main content

MIDI Forum

Spreadsheet to Midi...
 
Notifications
Clear all

Spreadsheet to Midi conversion?

8 Posts
4 Users
0 Reactions
5,001 Views
bu
 bu
Posts: 4
Active Member
Topic starter
 

Hello everyone, first post on this forum!

What would be the best way to convert a simple spreadsheet-file (consisting of time, frequency and amplitude information) to Midi?
The result would include not only note-on/off numbers, but also scaled pitchbend (preferably with an optional range of 2-24) and volume (cc7). This is a pretty straightforward operation - I've been messing with it in Max and Pure Data (where Midi-files can be imported and read in spreadsheet format), but I am not much of a programmer and thought there might be better quirks out there..

and ooh I am on a Mac 🙂

Any suggestions are very much appreciated

bu

 
Posted : 28/11/2022 12:34 pm
Bavi_H
Posts: 266
Reputable Member
 

Do you want to create a MIDI file, or do you want to send MIDI messages directly to a MIDI device?

Can you give a small example or tell us more about the simple spreadsheet file consisting of time, frequency and amplitude information? For example, I'm unclear about the following:

• Do you want one long note that is pitch bent (and volume changed) each time there is a new frequency (and volume)?
OR
• If you want multiple notes, how does the spreadsheet data indicate where a note ends?

Possible idea - MIDICSV

I am on a Windows computer, but here is a possible idea. When I have a spreadsheet of data I want to convert into a MIDI file, I use spreadsheet formulas and manipulation to get the data into the MIDICSV file format.

Rough overview:

Using MIDI sequencer software, I create a starter MIDI file with the desired tracks, instruments, tempo, and time signature, and some dummy notes. Then I use the MIDICSV tool to convert that MIDI file to a CSV file.

In my spreadsheet of data, I use spreadsheet formulas to build up note data in the MIDICSV file format. Then I copy the MIDICSV-format text generated by the formulas.

I open the CSV file in a text editor, select the dummy note data and remove it, then paste in the formula-generated text. Then I save the modified CSV file.

I use the CSVMIDI tool to convert the modified CSV file back to a MIDI file.

Advanced Note: I use the text editor Notepad++ because it can do advanced Find and Replace functions like converting a specific character I choose to an Enter. To generate a note end (for the previous row's pitch), pitch bend, volume controller, and note beginning (for the current row's pitch) all at the same time position, I would generate multiple columns in the spreadsheet that each end with a special character. After I paste the text into Notepad++, I'd use Find and Replace to convert the special character to an Enter.

Disadvantages:

On a Mac, it looks like the MIDICSV tools would need to be compiled from the source code.

This kind of process doesn't exactly involve programming, but it does need a programmer-like mindset to design appropriate spreadsheet formulas (and, possibly, advanced Find and Replace commands in a text editor).

If you plan to do this conversion process many times, you might want to keep looking for a more automated conversion method -- or maybe even learn how to create a program or script to make the conversion exactly the way you want.

 
Posted : 28/11/2022 11:03 pm
Pedro Lopez-Cabanillas
Posts: 154
Estimable Member
 

On a Mac, it looks like the MIDICSV tools would need to be compiled from the source code.

It is available for mac at Homebrew:

https://formulae.brew.sh/formula/midicsv

 
Posted : 29/11/2022 12:40 am
bu
 bu
Posts: 4
Active Member
Topic starter
 

Ok, thanks!

Yes, I am looking for an automated conversion method to create Midi files including multiple notes.
I am using a program called Praat to generate frequency and amplitude data from wav-files.
Simple example of the spreadsheet format, sampled at every 10th millisecond.

The first audio-note ends at 0.05 and the second starts at 0.23. The dB values has to be scaled to 1-127 and the frequences to 0-16383 after the closest Midi-note´s been set. So this value depends on the pitchbend range chosen by the user. A note also might end (and the next one up or down chosen) if a glissando overides the pitchbend range (eg. 2 semitones). It would be convinient if the script looks at all frequency values in the timespan of an audio-note to decide a Midi-note based upon the median of thees values.. if that makes sense.

Anyway, the MIDICSV-tools, like you say might not be suitable for my workflow..

 
Posted : 29/11/2022 1:42 pm
Geoff
Posts: 1039
Noble Member
 

Seems to me that what you're REALLY trying to do is to convert a .WAV audio file (or similar) into a midi file. You've got something to do the first step, or part of the first step - what does your process do with multiply track/instrument music?

This is somewhat like seeking the proverbial Holy Grail?

There seem to be lots of systems about that SAY they do something, but I suspect that many can do only a bit of the job, and only with the very simplest of audio.

There is one much more complex system that I've seen reference to (something called WidiSoft, there's a web site about it), this admits that this is a VERY complex process, and any 'automatic' system will need a LOT of help - i.e. a lot of post-process tweaking - to get any sort of viable result, so this system may actually to talking sense. It also talk about needing a lot of supporting data, and multiple runs, each time refining the supporting data each time to gradually refine the result. Again, this sounds to me like sense.

Personally, I suspect that even the ultimate system will need a LOT of tweaking, and a lot of work, to complete the process, i.e. to get a viable midi file.

I'd love to see a midi file that has been created in such a way.

I suspect that nothing can beat the old fashioned method. Someone with real musical talent listens to the piece over and over again, breaks the piece down into component, plays the components into a sequences one by one, assigns instruments etc to tracks, and even then tweaks the result step-by-step until is sounds enough like the original to suit. Sheer leg-work! But I've got some pretty great midi files that MUST have been done that way.

Best of luck with whay you're trying?

Geoff

 
Posted : 30/11/2022 4:46 pm
bu
 bu
Posts: 4
Active Member
Topic starter
 

Right, what I'm really trying to do is converting Audio to Midi! And like you say, there is a lot of talk about it that ends in a mess.

But the above mentioned program Praat is only one of several (Melodyne, AutoTune…) that does a very good job of translating pitch into Hz/frequency. There are also an abundance of tuning apps available. And converting frequency to Midi has never been a problem. It really puzzles me that it is so hard to find convertion all the way to Midi decently implemented. I figure in Midi-comunities this would be of interest!

Doing Audio to Midi in real time is a problem though, since any pitched sound has an unpitched onset/attack and a Midi-note carries its pitch/note# at the start by definition. So then there is bound to be a delay and miscalculations. This is why I prefer working with non-realtime (often called offline) analysis.

Well, this is a subject that I find very exiting and elusive. Technology is always in progress, and I don't think the old fashioned way is going to be the most accurate way for long. Analysis shows that what humans mostly considers the pitch of a sound sometimes is an overtone or may not even be present! Our brain makes mistakes 🙂

 
Posted : 01/12/2022 6:47 am
Pedro Lopez-Cabanillas
Posts: 154
Estimable Member
 

what I'm really trying to do is converting Audio to Midi!

Then my advice to you is to try a more specialized tool to analyze and annotate the audio recordings. Praat was created for speech analysis in phonetics.

On the other hand, Sonic Visualiser was designed for "visualisation, analysis, and annotation of music audio recordings". It is free software as well, and available for Linux, Windows and Mac. It works with specialized plugins: Vamp Plugins, to fulfill a number of analysis.

You may find that the Vamp Aubio plugin "Aubio Note Tracker" estimates note onset positions, pitches and durations, while the Queen Mary plugin "Polyphonic Transcription" estimates a note transcription using MIDI pitch values from its input audio, returning a feature for each note (with timestamp and duration).

 
Posted : 01/12/2022 12:59 pm
bu
 bu
Posts: 4
Active Member
Topic starter
 

Hello Pedro!

Yes, thank you,
I actually have Sonic Visualiser installed along with its minor sibling Tony. Several interesting Vamp-plugins are dedicated to notetracking and can export Midi. However, correct me if I am wrong, none of these will print pitchbend or cc-volumedata. So the Midi will not mirror vibrato, nor glissandos or crescendos..

 
Posted : 01/12/2022 5:36 pm
Share: