Offline
FRANCE

Might be of interest, a little enhancement about the note on/off handling smile
to avoid a note off to cut short any new playing note...
EDIT: I forgot to wrote channel check, added now  ^_^
SID effect have also been done...:)
In your Teensy board code >>
add a variable to keep track of the latest MIDI note on number

byte p_pitch;
byte p_channel;

then in the function : void doNoteon ()
add:
p_pitch = pitch;
p_channel = channel;
each time there is a check for velocity >0

then in : void doNoteOff()

if(pitch == p_pitch)   // avoid note cuts
        {
            velocityData[channel + (chip_select * 4)] = 0;
            writeAmplitude(0, channel, chip_select);
        }
        else if((pitch != p_pitch) && (channel != p_channel))
        {
            velocityData[channel + (chip_select * 4)] = 0;
            writeAmplitude(0, channel, chip_select);
        }

then in in the function : void doMidiIn ()
//note on

Line : else if((data < 0x80) && (flag_previous == 1))
add , p_pitch = data;

Line :if((data >= 0x90) && (data < 0xa0) && (flag_previous == 0))
add, p_channel =channel; 

this will keep track of the previous note played when there is a note off message next

//note off
else if((data < 0x80) && (flag_previous == -2)) 
    {
      velocity = data;
      
    if(pitch == previous_pitch)  // only if previous pitch is the same!...to avoid note cuts
      {
          doNoteOff(channel, pitch, velocity);
      }

      else if((pitch != p_pitch) && (channel != p_channel)) // if pitch is not the same BUT from another channel
      {
            velocityData[channel + (chip_select * 4)] = 0;
            writeAmplitude(0, channel, chip_select);
      }
      flag_previous = 0;
    } 

Last edited by Aly James (Nov 19, 2013 7:31 am)

Offline
Russia
little-scale wrote:

Firmware now supports up to four SN76489 chips.

Also added sample support.

http://little-scale.blogspot.com.au/201 … -quad.html

big_smile

I have problem with arduino and teensyduino version. arduino 1.0.6, 1.6.3, 1.6.9 and teensyduino 1.28 not work, I always see error. Please help and tell me what version of arduino and teensyduino are you use?

Error:
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 + Td: 1.28 (Windows NT (unknown)), Board: "Teensy 2.0"
sketch_jun22a.ino.ino: In function 'void setup()':
sketch_jun22a.ino.ino:221: error: invalid conversion from 'void (*)(byte, unsigned int)' to 'void (*)(uint8_t, int)'
sketch_jun22a.ino.ino:221: error:   initializing argument 1 of 'void usb_midi_class::setHandlePitchChange(void (*)(uint8_t, int))'

Last edited by stress_tn (Jun 22, 2016 8:46 pm)

Offline

Hey stress_tn,

Assuming you're using the firmware linked in the linked article - http://milkcrate.com.au/_other/download … DI_103.ino

Problem is, the function being passed to setHandlePitchChange has the wrong datatypes as arguments. Fix that function. It's less stuffing around than trying to install the "right" (out of date) version of Teensyduino.

Start by finding this line:
void doBend(byte channel, unsigned int bend_usb) {

And change it to:
void doBend(uint8_t channel, unsigned int bend_usb) {

Offline

Compiled under Arduino IDE 1.6.9 and Teensyduino 1.29 Beta #3 by editing the following lines:

line 51:
prog_char sample_space[13952] PROGMEM = {

changes to:
const char sample_space[13952] PROGMEM = {

line 221:
void doBend(byte channel, unsigned int bend_usb) {

changes to:
void doBend(uint8_t channel, int bend_usb) {

Haven't tested on hardware, since I have no SN76489.

Edit - link to Teensyduino https://forum.pjrc.com/threads/35068-Te … -Available

Last edited by Knife Crimes (Jun 23, 2016 12:26 pm)

Offline
Russia
Knife Crimes wrote:

Compiled under Arduino IDE 1.6.9 ...

Thank you!
P.S. now i have problem with incorrect cc notes, I think it's crystal problem

Offline
Russia

Project not work with other crystal, I think the error in code. Notes not play correct, they play but not correct, c, c#,d, d#, d, e...
I think

Knife Crimes wrote:

line 221:
void doBend(byte channel, unsigned int bend_usb) {

changes to:
void doBend(uint8_t channel, int bend_usb) {

not correct
Any ideas, or it's correct and I have problem with something else (chips, wireless etc)?