User Tools

Site Tools


korg_wavedrum_midification

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
korg_wavedrum_midification [2014/03/24 19:50]
midisaron changed structure
korg_wavedrum_midification [2015/02/09 17:55] (current)
midisaron [MIDIfying the Wavedrum - Software] Updated Software download
Line 39: Line 39:
  
 ====MIDIfying the Wavedrum - Software==== ====MIDIfying the Wavedrum - Software====
-{{:​wavedrum_midi:​wavedrummidi_1_0.zip|Download the source code here}} This does not include the FFT stuff yetI will share it here, but I do have to tidy it up first.LOL+{{:​wavedrum_midi:​wavedrummidi.zip|Download the source code here}} This does include the FFT stuff. ​Still haven'​t tidied ​it up.m(
 ==Capturing the head's and the rim's signals== ==Capturing the head's and the rim's signals==
 The ADC takes a sample every 50 microseconds. When idle, the head piezo, the rim piezos and the force sensor are sampled in turns. When a trigger on the head or on the rim is detected, i. e. a threshold is crossed, the force sensor is temporarily not sampled until 64 samples on the triggered channel (head or rim) are recorded and the event is processed. During that time the non-triggered channel (i. e. head if rim is triggered and vice versa) can still be triggered, so "​simultaneous"​ triggers on head and rim are possible. Because the force sensor is not sampled while the head or rim signal is recorded, the sample rate here is 10 kHz. The ADC takes a sample every 50 microseconds. When idle, the head piezo, the rim piezos and the force sensor are sampled in turns. When a trigger on the head or on the rim is detected, i. e. a threshold is crossed, the force sensor is temporarily not sampled until 64 samples on the triggered channel (head or rim) are recorded and the event is processed. During that time the non-triggered channel (i. e. head if rim is triggered and vice versa) can still be triggered, so "​simultaneous"​ triggers on head and rim are possible. Because the force sensor is not sampled while the head or rim signal is recorded, the sample rate here is 10 kHz.
Line 58: Line 58:
 ===Processing the signals=== ===Processing the signals===
 After 64 samples of the head or rim signal have been captured, a FFT (Fast Fourier Transform) on these samples is performed. This results in 33 (usable) frequency bins representing the spectrum of the signal. I did not program the FFT myself but took it from NXP'​s ​ After 64 samples of the head or rim signal have been captured, a FFT (Fast Fourier Transform) on these samples is performed. This results in 33 (usable) frequency bins representing the spectrum of the signal. I did not program the FFT myself but took it from NXP'​s ​
-[[http://​www.nxp.com/​documents/​application_note/​AN10913_CM3_DSP_library_v1_0_0.zip|AN10913]]. ​This ZIP archive contains several files, the library which has to be linked ​to the MIDIBOX project is CodeRed/​cr_dsplibFFTbin_cm3/​libcr_dsplibFFT_cm3.a. To link this library to the project, the line <​code>​ LIBS = libcr_dsplibFFT_cm3.a</​code>​ is added to the makefile. A short yet comprehensible introduction into the concept of the FFT including examples on how to use NXP's DSP library is given in [[http://​www.nxp.com/​documents/​application_note/​AN10943.zip|AN10943]].+[[http://​www.nxp.com/​documents/​application_note/​AN10913_CM3_DSP_library_v1_0_0.zip|AN10913]]. ​See below [[korg_wavedrum_midification#​How ​to add the DSP library to the project]]. A short yet comprehensible introduction into the concept of the FFT including examples on how to use NXP's DSP library is given in [[http://​www.nxp.com/​documents/​application_note/​AN10943.zip|AN10943]].
 I think it's amazing that the humble LPC1769 can calculate a 64-points-FFT so quickly that the delay is not noticable (at least to me). There are countless ways how the result of a FFT can be used. For the head signal, the high frequency components are stronger when the head is hit with a harder object (drumstick rather than hand), and when it's hit closer to the rim. This way a crude position detection is possible.\\ I think it's amazing that the humble LPC1769 can calculate a 64-points-FFT so quickly that the delay is not noticable (at least to me). There are countless ways how the result of a FFT can be used. For the head signal, the high frequency components are stronger when the head is hit with a harder object (drumstick rather than hand), and when it's hit closer to the rim. This way a crude position detection is possible.\\
 Only the absolute values of the complex frequency bin values are used. The correct formula would be Only the absolute values of the complex frequency bin values are used. The correct formula would be
Line 69: Line 69:
  
 ===Processing the force sensor=== ===Processing the force sensor===
-When the voltage at the force sensor changes, a MIDI Control Change, Aftertouch or Pitch Bend message can be generated. ​It's thinkable that the note number of drum trigger events ​is varied depending on pressure, but this is not implemented yet.+When the voltage at the force sensor changes, a MIDI Control Change, Aftertouch or Pitch Bend message can be generated. ​Also the note number of drum trigger events ​can be varied depending on pressure.
  
 ===MIDI=== ===MIDI===
-When hit at the head or at the rim, a Note On message is sent. The note number can be influenced by the //center frequency// of the FFT output (higher frequencies give higher note numbers). The velocity can be taken from the //​amplitude//​ of the FFT output. Alternatively,​ the absolute maximum of the signal can be used. The MIDI channel can be set individually for the head and for the rim. If there'​s a pending note with that number and channel, a Note Off message is sent first. In addition to the Note On message a CC# message representing the //​variance//​ is sent. As mentioned above, the force sensor is able to generate Control Change, Aftertouch or Pitch Bend messages.\\+This picture shows how the signals from the sensors are processed and converted to MIDI messages. At the same time this is how the SoundDiver editor window looks like: 
 + 
 +{{:​wavedrum_midi:​sd_screenshot.jpg?​600|Signal flow}} 
 + 
 +==Note On== 
 +When the drum is hit at the head or at the rim, a Note On message is sent. The note number can be influenced by the //center frequency// of the FFT output (higher frequencies give higher note numbers), and by the pressure applied to the force sensor.\\ 
 +The velocity can be taken from the //​amplitude//​ of the FFT output. Alternatively,​ the absolute maximum of the signal can be used.\\ 
 +The MIDI channel can be set individually for the head and for the rim. 
 + 
 +==Note Off== 
 +If there'​s a pending note with that number and channel, a Note Off message is sent first. ​At the moment this is the only case where Note Off messages are sent, so a note sounds infinitely until it is replaced by the same note. A programmable fixed or even velocity-dependent note length certainly would be nice, but this is not implemented yet. 
 + 
 +==Control Change, Aftertouch and Pitch Bend messages== 
 +In addition to the Note On message a CC# message representing the //​variance//​ is sent. As mentioned above, the force sensor is able to generate Control Change, Aftertouch or Pitch Bend messages. 
 + 
 +==System Exclusive==
 Various user-settable parameters can be transmitted to the software via MIDI Sysex messages. The bulk dump format is as follows: Various user-settable parameters can be transmitted to the software via MIDI Sysex messages. The bulk dump format is as follows:
  
-$F0 $7D $57 $44 $4D $49 $20 $02 $00 $00 //$0h $0l....$0h $0l// $F7+$F0 $7D $57 $44 $4D $49 $20 $02 $00 $00 //$0l $0h....$0l ​$0h// $F7
  
-The //$0h $0l....$0h $0l// part designates a block of 512 MIDI bytes. These represent 256 parameter bytes ((as in SYSEX_FORMAT 1 in tutorial 025)) which are listed in the table below (numbered from 0 to 255). Some parameters are 16-bit, in these cases the LSByte is sent first.\\+The //$0l $0h....$0l ​$0h// part designates a block of 512 MIDI bytes. These represent 256 parameter bytes ((as in SYSEX_FORMAT 1 in tutorial 025)) which are listed in the table below (numbered from 0 to 255). Some parameters are 16-bit, in these cases the LSByte is sent first.\\
 When the software receives such a message, the parameters are updated. The internal settings can be requested with a dump request: When the software receives such a message, the parameters are updated. The internal settings can be requested with a dump request:
  
Line 110: Line 125:
 |191|ADC from which the waveform was recorded; 0=Rim, 1=Head|0, 1| |191|ADC from which the waveform was recorded; 0=Rim, 1=Head|0, 1|
 |192..255|waveform buffer|0..255((scaled down from 0..4095))| |192..255|waveform buffer|0..255((scaled down from 0..4095))|
 +
 +===How to add the DSP library to the project===
 +The FFT algorithm is taken from NXP'​s ​
 +[[http://​www.nxp.com/​documents/​application_note/​AN10913_CM3_DSP_library_v1_0_0.zip|AN10913]]. This ZIP archive contains several files, the library which has to be linked to the MIDIBOX project is CodeRed/​cr_dsplibFFTbin_cm3/​libcr_dsplibFFT_cm3.a. To link this library to the project, the line <​code>​ LIBS = libcr_dsplibFFT_cm3.a</​code>​ is added to the makefile.
  
  
-===MIDIfying the Wavedrum - Future plans====+====MIDIfying the Wavedrum - Future plans====
 ===Replacing the force sensor=== ===Replacing the force sensor===
 It's sometimes mentioned that the rebound of the Wavedrum is not great (playing with sticks, rebound helps when playing snare rolls etc). Some say this is because the force sensor pushes against the bottom side of the drum head. I think it should be possible to replace the mechanical sensor with a reflective optical sensor like the CNY70. This would not be in touch with the drum head at all, hence no impact on rebound. The sensitivity of the head pickup might be improved too. Regarding the Wavedrum'​s internal sounds, it might become tricky to get the same response as with the old sensor, but for the MIDI extension any desired response can be realized in software. It's sometimes mentioned that the rebound of the Wavedrum is not great (playing with sticks, rebound helps when playing snare rolls etc). Some say this is because the force sensor pushes against the bottom side of the drum head. I think it should be possible to replace the mechanical sensor with a reflective optical sensor like the CNY70. This would not be in touch with the drum head at all, hence no impact on rebound. The sensitivity of the head pickup might be improved too. Regarding the Wavedrum'​s internal sounds, it might become tricky to get the same response as with the old sensor, but for the MIDI extension any desired response can be realized in software.
korg_wavedrum_midification.1395690611.txt.gz · Last modified: 2014/03/24 19:50 by midisaron