Drum detector (stream to midi)
Posted: Sun Sep 28, 2014 9:42 pm
The title says it all... a module that can detect transients in signal and play midi notes. It's just a prototype.
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
https://dsprobotics.com/support/
Exactly... I got inspired by TS audio to midi converter which also uses similar algorithm to extract and detect transient. This one basically uses difference of two envelope followers with the same release but different attack. That is then also highpassed to minimize the long sustaining differences. That is then passed through a detector which sends impulse when the modified envelope crosses the threshold upwards.martinvicanek wrote:Hey, KG, that's quite cool!![]()
I believe the main challenge is the DSP drum detection part. There is some material on the Web regarding onset detection algos, although yours works quite well already if you adjust the parameters right.
I had a similar idea. I don't think you need more than one envelope follower though. Basically subtract the envelope follower from the abs of the original signal (without actually performing abs of course), and with the attack time set right you should get only the peaks. Not sure but I think this would be a better solution.KG_is_back wrote:This one basically uses difference of two envelope followers with the same release but different attack.
and the ruby part would be modification of that yours:streamin in;
streamout out;
float previn;
hop(32){
out=1&(in>previn)+2&(in<previn);
previn=in;
}
Code: Select all
def event i,v,t
siz=@fram.size/32
for j in 0...siz #check all samples
x=j*32
if @fram[x]==1
then
on=Midi.new 144,1,60,100 #midi note on
output 0,on,t+x/@SR
end
if @fram[x]==2
then
off=Midi.new 128,1,60,100 #midi note off
output 0,off,t+x/@SR
end
end
endThanks KG!KG_is_back wrote:Maybe using hop in the stream part and checking the buffer in bigger jumps might be less CPU heavy.
like the stream part would be:and the ruby part would be modification of that yours:streamin in;
streamout out;
float previn;
hop(32){
out=1&(in>previn)+2&(in<previn);
previn=in;
}Code: Select all
def event i,v,t siz=@fram.size/32 for j in 0...siz #check all samples x=j*32 if @fram[x]==1 then on=Midi.new 144,1,60,100 #midi note on output 0,on,t+x/@SR end if @fram[x]==2 then off=Midi.new 128,1,60,100 #midi note off output 0,off,t+x/@SR end end end
Unfortunately I'm one of those guys who implement really awesome idea into working form, but are too lazy to finish it into a product xD I literally have several projects with the "core" stuff fully working but I'm lazy to finish gui and stuff.Youlean wrote: Thanks KG!
BTW do you have some of your work, I would like to check it out?
Too bad, you seam like really skillful person...KG_is_back wrote:Unfortunately I'm one of those guys who implement really awesome idea into working form, but are too lazy to finish it into a product xD I literally have several projects with the "core" stuff fully working but I'm lazy to finish gui and stuff.Youlean wrote: Thanks KG!
BTW do you have some of your work, I would like to check it out?
For example this string modeler. I have improved the algorithm drastically (now it calculates the stuff practically instantaneously), but it still has no GUI and I'm struggling with creating the DWG-synth that would use the measured models (the model file format is also improved).Youlean wrote: Too bad, you seam like really skillful person...
What do you have in working form?