this has to do with the firmware note_on() and note_off() functions
normally, there is enough time for the note to go off before the next one comes in (6 clock ticks ON, 6 clock ticks OFF)
there is however a case.. when writing notes in edit mode (this is both in the stock firmware, SokkOS and n0nx0x, at least i think so)
when holding NEXT - a note plays, but before you release it - you can press another note (to change it)
and this is what happens in the firmware:
note_off(); // immediately shut down the currently playing note
delay_ms(1); // wait 1 ms?
note_on(); // play the new note that was just pressed down...
this delay is for the analog part
but there is even more, one more thing in the note on/off functions themselves
i still haven't figured exactly how it works.. i think it has to do with some flipflops or whatever..
from synth.c
Code: Select all
/* Note On:
* This function takes a 6 bit 'note' (0x0 thru 0x3F), one bit of slide
* and one bit of accent and performs the proper low level gating. Changing
* this function can affect how the synth sounds.
* Note that accent is active low.
*/
void note_on(uint8_t note, uint8_t slide, uint8_t accent)
{
uint8_t i = 0;
cbi(NOTELATCH_PORT, NOTELATCH_PIN);
// Do not allow the note to go higher than the highest note (0x3F)
if (note > 0x3F)
note = 0x3F;
// Basically turn slide and accent flags into bit flags for the note port
if (slide != 0)
slide = 0x40;
if (accent == 0)
accent = 0x80;
else
accent = 0;
// output the note, set the latch, and strike the gate
if (note != REST)
{
NOTE_PORT = note | slide | accent;
// 30ns setup time?
sbi(NOTELATCH_PORT, NOTELATCH_PIN);
// 10 uS
while (i<40)
{
i++;
}
sbi(GATE_PORT, GATE_PIN);
}
else
{
// gate is not restruck during rest, and note is not latched, but one can
// slide to/from a rest and rests can have accent (tip to memology)
NOTE_PORT = slide | accent;
}
// Debugging: print out notes as they are played
/*
putstring("Note on: 0x");
putnum_uh(note); uart_putchar(' ');
if (accent == 0) {
putstring(" w/accent ");
}
if (slide) {
putstring(" w/slide ");
}
putstring("\n\r");
*/
}
/* Note off:
* This is essentially used to reset the gate/latch pins and also
* deals with the pecularities of sliding (gate is not reset on slide).
*/
void note_off(uint8_t slide)
{
/*
putstring("Note off\n\r");
*/
if (slide)
{
sbi(NOTE_PORT, 6);
}
else
{
cbi(GATE_PORT, GATE_PIN);
}
cbi(NOTELATCH_PORT, NOTELATCH_PIN);
}