Thank you both so much. @nau [poly 1 1] is much neater and more effective than what I was doing before. @Balwyn Unfortunately I think our approaches were so different that I couldn't quite make sense of yours, but based on the output I think the only real difference is that your patch truncates the note value to the nearest integer instead of rounding (which makes the midi output drop a semitone after the attack of every note I play on my guitar).
I tried loads of different complicated ways to get the <note off when silent> part working, but as I expected the solution was really simple, and in the end I kind of did it by accident.
So to anyone coming across this trying to make their own audio to midi patch, there are two things to bear in mind:
- You'll need to change the maximum and minimum values for your input instrument if it's not a guitar.
- You'll also need some way to apply a gate to your input audio source. I'm actually running my guitar signal into my DAW, Reaper, and then from Reaper into Pure Data using ReaRoute. This works really well for me because I can use the gate and EQ in my DAW. But the easiest way to implement the gate is probably to use the minpower flag with sigmund.
Now on to the challenge of (attempting) to make a polyphonic audio to midi patch. Wish me luck.
I'm fairly new to pd, trying to make a patch that converts audio from my guitar to midi to send to my daw (monophonic for the moment). This has been mentioned here before but I wasn't able to find a patch that did what I'm looking for. The obvious approach is to use sigmund with the notes flag.
This is great for creating note on messages for every new note, but doesn't create any note off messages (problem).
Is there an obvious fix for this?
I can't use makenote as I don't want note durations to be fixed. My approach so far has been to send a note off message for the previous note every time a new note is triggered (working but not reliably) and to send a note off message for the current note when it's envelope reaches 0 (don't have this working at all).