Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Drum detector (stream to midi)

Post any examples or modules that you want to share here

Drum detector (stream to midi)

Postby KG_is_back » 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.
Attachments
drum detector.fsm
(30.35 KiB) Downloaded 1140 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Drum detector (stream to midi)

Postby martinvicanek » Mon Sep 29, 2014 2:19 am

Hey, KG, that's quite cool! 8-)
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.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Drum detector (stream to midi)

Postby KG_is_back » Mon Sep 29, 2014 6:21 pm

martinvicanek wrote:Hey, KG, that's quite cool! 8-)
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.


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.

And also I do not know if I have the latency set right. The latency outputs time which takes to bufer in the frame into ruby, but the midi also may have an effect one asio buffer later, so the drum hit midi may still be 1 buffer late. I'll have to test that in the future...
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Drum detector (stream to midi)

Postby Perfect Human Interface » Mon Sep 29, 2014 7:11 pm

KG_is_back wrote:This one basically uses difference of two envelope followers with the same release but different attack.


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. :)
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Drum detector (stream to midi)

Postby Youlean » Tue Sep 30, 2014 2:44 pm

Cool, I was asking for audio to MIDI just to make drums trigger. Here is how I have solved MIDI on, and off. While on input is 1, MIDI will be on, and when it goes off, MIDI will be off.
If you connect square osc ( with modification to go from 0 to 1 ) on my schematics, you can get steam accurate triggers, but CPU usage is to big...
So, is there any way we can reduce CPU? Maybe to detection be less precise..?
Attachments
audio to midi fix.fsm
(21.82 KiB) Downloaded 1125 times
Youlean
 
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Drum detector (stream to midi)

Postby KG_is_back » Tue Sep 30, 2014 6:48 pm

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:
streamin in;
streamout out;
float previn;
hop(32){
out=1&(in>previn)+2&(in<previn);
previn=in;

}


and the ruby part would be modification of that yours:
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
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Drum detector (stream to midi)

Postby Youlean » Wed Oct 08, 2014 2:23 pm

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:
streamin in;
streamout out;
float previn;
hop(32){
out=1&(in>previn)+2&(in<previn);
previn=in;

}


and the ruby part would be modification of that yours:
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

Thanks KG!
BTW do you have some of your work, I would like to check it out?
Youlean
 
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Drum detector (stream to midi)

Postby KG_is_back » Thu Oct 09, 2014 10:34 am

Youlean wrote:Thanks KG!
BTW do you have some of your work, I would like to check it out?


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.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Drum detector (stream to midi)

Postby Youlean » Sat Oct 11, 2014 6:51 pm

KG_is_back wrote:
Youlean wrote:Thanks KG!
BTW do you have some of your work, I would like to check it out?


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.

Too bad, you seam like really skillful person...
What do you have in working form?
Youlean
 
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Drum detector (stream to midi)

Postby KG_is_back » Sat Oct 11, 2014 7:54 pm

Youlean wrote:Too bad, you seam like really skillful person...
What do you have in working form?

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).
Also I have made a "midi to multivoice-poly" module that instead of playing all valid voices just randomly picks one. That is very useful for creating drum samplers (where you need to partially randomize the samples but scale them by velocity) which I have not finished until today.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Next

Return to User Examples

Who is online

Users browsing this forum: Google [Bot] and 74 guests