Topic: Batch export (convert) MIDI files to WAV using Pianoteq

Hi
I'm a relative newcomer to Pianoteq, and am enjoying its amazing array of instruments. I have a couple of hundred of my own MIDI piano recordings I'd like to have in WAV format using one of Pianoteq's instruments, but I don't know enough about DAWs, sequencers, etc. to figure out how to do this easily.

I have a Mac running the latest version of OS X, but also have a virtual version of Windows 7 running on Virtual Box, so either OS should be okay (but I'd prefer to do it under the Mac OS).

Is there a program (preferably for Mac) that will let me use Pianoteq as a VST plugin, and then batch export my MIDIs as WAV files? The only tutorial I could find about exporting from Garage Band showed how to export a single file.

Freeware is best, but I'm prepared to pay something if this is the only way to avoid hours of manual exporting.

Any help will be greatly appreciated.

Thanks
Tablabroke

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Hi,

In OS X you can easily write a shell script that does the job. Something like:

#!/bin/bash
for dir in "$@"; do
  for file in "$dir"/*.[Mm][Ii][Dd]; do
    wavfile="${file%.mid}"
    wavfile="${wavfile%.MID}"
    wavfile="${wavfile%.Mid}"
    wavfile="${wavfile}.wav"
    "/Applications/Pianoteq 5/Pianoteq 5.app/Contents/MacOS/Pianoteq 5" --headless  --midi "$file" --wav "$wavfile"
  done
done

The folder name "/Applications/Pianoteq 5/..." should be okay for a default install, but if you installed Pianoteq to another location, just change it to that location. Change the permissions of the script to include "executable". Now you should be able to just drag and drop folders containing MIDI files onto this script, and the WAV files should be generated right beside the MIDI files. Or, optionally, from a terminal window, run the script with folder names as arguments.

If you want to see the pianoteq window appear for each midi->wav conversion, just remove the --headless option.


/* edit */ Never mind, i tested with a simple shell script and it doesn't work (can't pass arguments by drag and drop) ...see other reply below.

Last edited by delt (15-08-2015 08:50)
http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Hi delt

Thanks for your quick reply. This is my first attempt at writing a shell script, so I have some very basic questions (I hope you don't mind answering).

What I just tried was copying and pasting your script without changes into TextEdit, saving it as a text-only file with .sh as the extension (which I got from a pretty basic youtube tutorial), and then tried dragging a folder containing some midi files onto the .sh file on the desktop. This didn't work. Was this what you meant by dragging a folder of MIDI files onto the script?

If it's better to do it from the terminal window, are you able to explain to me how to run the script from the terminal window (with whatever the correct extension for the script file is) please? I know how to open a terminal window, but that's about it.

If it's easier, can you recommend a good online tutorial for writing a basic shell script?

Many thanks again.

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Sorry, i tested with a simple shell script and it doesn't work (can't pass arguments by drag and drop) ...so i created a small "Automator" project, just extract the app and drag-n-drop folders to it containing the MIDI files you want to render to WAV.

http://www.deimos.ca/miscjunk/pianoteq-midi2wav.zip

The only thing is that if you need to change the script, you have to open the app in Automator. If you don't have Automator, you can still find and edit the script text in the file "Contents/document.wflow" but that's a bit harder.

Hope this helps


/* edit */ oops, got postjumped ...yeah, you did exactly what i though would work (plain text file, .sh suffix at the end is optional, but clarifies that it's a shell script)

If for some reason the automator .app doesn't work and you need to run the shell script directly from a terminal window, the simplest thing would be to move the script to your desktop (plain text file, let's say you call it pianoteq-midi2wav.sh) then open a terminal window and type:

bash ~/Desktop/pianoteq-midi2wav.sh (followed by a space, make sure the cursor is here)

(The ~ is simply a shorthand for your home folder, which in OS X is normally under /Users) Now just drag the folder(s) you want to the term window, this will auto-type them (by full pathname) and it will add a space between each, necessary to tell that they're different folders. It will also take care of quoting/escaping folder names which have spaces or weird characters. When done typing the command, just press Enter to run it. The .wav files should be generated in each folder beside the corresponding .midi files.

Last edited by delt (15-08-2015 10:11)
http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Batch export (convert) MIDI files to WAV using Pianoteq

That seems to work brilliantly -- thank you so much!! I tried a test conversion of 10 MIDI files, and they seem to have converted perfectly.

There's one last question: can you think of a way of allowing me to specify which Pianoteq instrument gets used for the conversion? I tried having PT open with different instruments selected, but this didn't seem to make any difference to the conversion.

If this gets too complicated/time consuming for you, that's fine -- you've already done much more than I could have hoped for!

cheers from Australia

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Glad it helped

Tablabroke wrote:

There's one last question: can you think of a way of allowing me to specify which Pianoteq instrument gets used for the conversion? I tried having PT open with different instruments selected, but this didn't seem to make any difference to the conversion.

Yeah, i just noticed that pianoteq doesn't use the preset you selected previously, and always uses the default D4 preset. To fix that, you need to change the script (if you're using the Automator app i posted above, just open it in Automator) and in the line that says "/Applications/Pianoteq/...." just after --headless, add --preset "name of your preset" - once again, putting quotes around the name of your preset if it contains spaces or weird characters. Save the script or Automator app, that should do the trick. Note that you're adding the name of a preset, not an instrument.

I really wish there was a more "user friendly" way, but there doesn't seem to be

Last edited by delt (15-08-2015 12:17)
http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Batch export (convert) MIDI files to WAV using Pianoteq

That seems to work perfectly -- thanks!

I'd like to learn a bit more about the Automator, and how I might be able to use it for music-related activities. Can you recommend a good online tutorial that might get me started?

Again, thanks for being so happy to help.

cheers

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Tablabroke wrote:

That seems to work perfectly -- thanks!

All right, glad it worked!

Tablabroke wrote:

I'd like to learn a bit more about the Automator, and how I might be able to use it for music-related activities. Can you recommend a good online tutorial that might get me started?

Not really, since i just learned how to use automator the other day from a google search.... so google is the only "online tutorial" i could recommend at the moment (:

http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Batch export (convert) MIDI files to WAV using Pianoteq

That's fine -- I've already found some useful websites, so am making slow but steady progress...

Thanks again!

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Hi delt. I'm not sure if you're still monitoring this thread, but if you are, I've been having success with your Automator script for batch-converting MIDI to WAV via Pianoteq (thanks again!), but I'm now trying to do the same thing but with a modified version of one of Pianoteq's presets. I've tweaked the "Scale" and "Keymap" options in the "Tuning" section of Pianoteq, saved my own preset with these changes, and changed the script in Automator to reflect the name I gave my preset.. But if I then try to convert a batch of MIDIs with this preset selected in Pianoteq, it just seems to use the unmodified Pianoteq instrument. Any suggestions about how I might be able to do this? I tried guessing that I might need to insert parameters called "Scale" and "Keymap" in the script, but this didn't help...

Many thanks again for any help you can give me.


delt wrote:

Glad it helped

Tablabroke wrote:

There's one last question: can you think of a way of allowing me to specify which Pianoteq instrument gets used for the conversion? I tried having PT open with different instruments selected, but this didn't seem to make any difference to the conversion.

Yeah, i just noticed that pianoteq doesn't use the preset you selected previously, and always uses the default D4 preset. To fix that, you need to change the script (if you're using the Automator app i posted above, just open it in Automator) and in the line that says "/Applications/Pianoteq/...." just after --headless, add --preset "name of your preset" - once again, putting quotes around the name of your preset if it contains spaces or weird characters. Save the script or Automator app, that should do the trick. Note that you're adding the name of a preset, not an instrument.

I really wish there was a more "user friendly" way, but there doesn't seem to be

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Sorry for the later answer, yet I think it should be a better way to convert your files to wav. I have used this program: http://www.videoconverterfactory.com/ti...erter.html It can convert batches of audio to wav files at the same time. Even you update the Pianoteq version, there is no any problem.

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Pitcherpear wrote:

Sorry for the later answer, yet I think it should be a better way to convert your files to wav. I have used this program: http://www.videoconverterfactory.com/ti...erter.html It can convert batches of audio to wav files at the same time. Even you update the Pianoteq version, there is no any problem.

I don't see how your suggestion is related to Pianoteq. To convert MIDI files to WAV files using Pianoteq's quality pianosound, you must use Pianoteq.
It is possible to convert MIDI to WAV with other programs, but you will not use the Pianoteq soundengine in that case. Updating Pianoteq is no problem? Of course not: you are not using it this way! The MIDI file itself does NOT contain the Pianoteq sound. In fact it does not contain any sound at all.

(On the other hand, if you have GM compatible multitrack MIDI files with other tracks than just a pianotrack you should not use (just) Pianoteq to do conversion to WAV. You don't want your drums, basses, and violins to sound like grand pianos.)

As a Linux user I frequently use Pianoteq from the commandline or from a shell script to convert batches of MIDI piano recordings to WAV. Similar to the Windows and OSX solutions posted earlier in this thread. Works like a charm. Sometimes I convert directly to MP3, OGG, or FLAC, and add descriptive ID3 tags in the same script.

Last edited by m.tarenskeen (25-08-2017 17:52)

Re: Batch export (convert) MIDI files to WAV using Pianoteq

Tablabroke wrote:

There's one last question: can you think of a way of allowing me to specify which Pianoteq instrument gets used for the conversion? I tried having PT open with different instruments selected, but this didn't seem to make any difference to the conversion.

Yeah, i just noticed that pianoteq doesn't use the preset you selected previously, and always uses the default D4 preset. To fix that, you need to change the script (if you're using the Automator app i posted above, just open it in Automator) and in the line that says "/Applications/Pianoteq/...." just after --headless, add --preset "name of your preset" - once again, putting quotes around the name of your preset if it contains spaces or weird characters. Save the script or Automator app, that should do the trick. Note that you're adding the name of a preset, not an instrument.

I really wish there was a more "user friendly" way, but there doesn't seem to be

Important: --preset "name of your preset" needs the exact, case-sensitive, name of the preset. On the commandline you can check possible preset names with the --list-presets option.

Re: Batch export (convert) MIDI files to WAV using Pianoteq

About a possible Pianoteq playlist and batch render feature, please review my very first Pianoteq forum post.  It was posted May 11, 2017 to the thread, "New features you want to Pianoteq (not instruments)."

Currently, a freebie that may help you to export a wave from several midi files recorded indeed within Pianoteq sequentially on a Mac is the freeware MidiPipe.  It allows you to load multiple midi files a playlist into a MidiPipe SMF Player and from its virtual output, as though it were a connected keyboard, connect to Pianoteq.  With MidiPipe Output chosen as your midi input, in Pianoteq, you record your playlist via the MidiPipe SMF Player and the Pianoteq record button and export to wave as usual.

To distinguish the separate piano midi performances in the resultant wave, inside MidiPipe you will have assigned the same midi channel (such as midi channel #1) to each of the performances; which you'll have also separated by a four (4) count or any other count drumbeat midi file (assigned another midi channel, such as midi channel #10).

In MidiPipe, you insert your drumbeat file, repeatedly, separating the piano performance files that are within the MidiPipe SMF Player. 

In Pianoteq, you set it to recognize midi channel #1 that is your assigned piano channel.

After you record and export from the Pianoteq interface, and, as you import your wave into an audio editor like Audacity, your individual performances appear separated by silences —easily enough for you to export each piano performance from the audio editor, individually.

MidiPipe is available: https://midipipe.en.softonic.com

Last edited by Amen Ptah Ra (12-09-2017 21:00)
Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.