Go Down

Topic: openpipe with fluxamasynth (Read 2347 times) previous topic - next topic

Trazman001

Hi again!  :) :) :)

Remember my crying about the fluxamasynth bagpipe....well I am almost done with that project and it will be very simple fix
what I have for you all.

The openpipe works with the fluxamasynth, I programed the instrument to be set as 109 (bagpipe) but when I do some notes
it changes to 0 (piano).

this is what I think is the problem.

Code: [Select]
[
//byte note = 0; //The MIDI note value to be played
byte resetMIDI = 4; //Tied to VS1053 Reset line
byte ledPin = 13; //MIDI traffic inidicator
int instrument = 0;
/code]

the code was made for a music instrument shield from sparkfun dot com.
I had to change the rx (1) and tx (4) numbers for this code to get sound out of the fluxamasynth.
I think the problem lies in the VS1053 Reset line.

Grumpy_Mike

Quote
this is what I think is the problem.

Nothing wrong with that code. Mind you it doesn't do anything either so that is little surprise.

If you want help you have to post all your code.

Trazman001

#2
Feb 10, 2013, 11:23 pm Last Edit: Feb 11, 2013, 12:11 am by Trazman001 Reason: 1
The code is too long for the forum.. :smiley-mr-green:

I will give you a link to the code.

https://github.com/openpipelabs/openpipe-breakout/tree/master/openpipe_breakout_music_instrument_shield

here is a better link.....sorry

https://github.com/openpipelabs/openpipe-breakout/blob/master/openpipe_breakout_music_instrument_shield/openpipe_breakout_music_instrument_shield.ino

Grumpy_Mike

This code is wrong:-
Code: [Select]
int note_on(int note, int vel){
    t_midiMsg midiMsg;
   
    midiMsg.msg.command = MIDI_COMMAND_NOTE_ON;
    midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
    midiMsg.msg.data2 = note;
    midiMsg.msg.data3 = vel; /* Velocity */
   
    Serial.write(midiMsg.raw, sizeof(midiMsg));
}

Because you are sending 4 bytes of data instead of three.
The midi channel should be merged with the midi command not sent as a separate byte.
This applies to all the functions you do like this.

Why do you have this method of sending MIDI when you have a perfectly good set of functions to do this in the sketch?

Trazman001

#4
Feb 11, 2013, 01:05 am Last Edit: Feb 11, 2013, 03:32 am by Trazman001 Reason: 1
????

I don't know what you mean.

should I get rid of

Code: [Select]
midiMsg.msg.data3 = vel; /* Velocity */

Or program the code to handle it.

How much of this code do I have to change?

Oh I see merge command with channel..... but how?

Maybe every part where command and channel is piece it two gether. I still don't know how.

Grumpy_Mike

Quote
Oh I see merge command with channel..... but how?

By using the bit wise OR operation, then do not output all that structure but the first two bytes ORed together followed by the last two. Do that for all the routines that use that structure
I am guessing you did not write that code, point is do you understand it?

Trazman001

I didn't write the code but i have lillte or no understanding of the code.

Grumpy_Mike

Then look at every function that ends in
Code: [Select]
Serial.write(midiMsg.raw, sizeof(midiMsg));
And delete the whole of the function.

Any calls to these deleted functions should be replaced to the other set of midi out functions you have in that sketch.

Trazman001

Code: [Select]


Code:

Serial.write(midiMsg.raw, sizeof(midiMsg));
Quote
Then look at every function that ends in


did so... still don't know how to add a function that will work. I know you want me to learn this my self.
Can you give  me a link of functions that I can use?

johncc


Then look at every function that ends in
Code: [Select]
Serial.write(midiMsg.raw, sizeof(midiMsg));
And delete the whole of the function.

Any calls to these deleted functions should be replaced to the other set of midi out functions you have in that sketch.


None of those three errant functions are actually being called in the sketch anyway...

Trazman001

#10
Feb 12, 2013, 12:06 am Last Edit: Feb 12, 2013, 12:20 am by Trazman001 Reason: 1
Code: [Select]
[code   uint8_t raw[4];
} t_midiMsg;
]

should I delete this to?

the question really is, should I add any thing?

Code: [Select]
Serial.write(midiMsg.raw, sizeof(midiMsg));
every part where this was I deleted it and it still didn't work.

johncc



should I delete this to?

the question really is, should I add any thing?



I don't think that will matter.  Also, the instrument=0 will not matter because it is not being used anywhere either.

Sorry, I don't know anything about the shield or Midi.

And, what is your thinking about the "VS1053 reset line"?

Cheers,
John

Trazman001

#12
Feb 14, 2013, 09:47 pm Last Edit: Feb 14, 2013, 09:52 pm by Trazman001 Reason: 1
grumpy mike

If you would please show me the right code to use. ;)

this code was ment for the spark fun music instrument code.

Grumpy_Mike

These functions will work:-
Code: [Select]
void noteOn(byte channel, byte note, byte attack_velocity) {
  talkMIDI( (0x90 | channel), note, attack_velocity);
}

//Send a MIDI note-off message. Like releasing a piano key
void noteOff(byte channel, byte note, byte release_velocity) {
  talkMIDI( (0x80 | channel), note, release_velocity);
}

void soundsOff(byte channel){
  talkMIDI( (MIDI_COMMAND_SOUNDS_OFF | channel), 120, 0);
}


These functions will not work:-
Code: [Select]
int MIDI_sounds_off(void){
   t_midiMsg midiMsg;
   midiMsg.msg.command = MIDI_COMMAND_SOUNDS_OFF;
   midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
   midiMsg.msg.data2 = 120;
   midiMsg.msg.data3 = 0; /* Velocity */
   
   Serial.write(midiMsg.raw, sizeof(midiMsg));
}

int note_on(int note, int vel){
    t_midiMsg midiMsg;
   
    midiMsg.msg.command = MIDI_COMMAND_NOTE_ON;
    midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
    midiMsg.msg.data2 = note;
    midiMsg.msg.data3 = vel; /* Velocity */
   
    Serial.write(midiMsg.raw, sizeof(midiMsg));
}

int note_off(int note, int vel){
    t_midiMsg midiMsg;
   
    midiMsg.msg.command = MIDI_COMMAND_NOTE_OFF;
    midiMsg.msg.channel = MIDI_DEFAULT_CHANNEL;
    midiMsg.msg.data2 = note;
    midiMsg.msg.data3 = vel; /* Velocity */
   
    Serial.write(midiMsg.raw, sizeof(midiMsg));
}

Replace calls to the latter with the former with the appropriate calling parameters.

Trazman001

#14
Feb 17, 2013, 12:06 am Last Edit: Feb 17, 2013, 12:31 am by Trazman001 Reason: 1
will some of these work??
Code: [Select]
void noteOn(byte channel, byte pitch, byte velocity);
 void noteOff(byte channel, byte pitch);
 void programChange (byte bank, byte channel, byte value);
 void pitchBend(byte channel, int value);
 void pitchBendRange(byte channel, byte value);
 void midiReset();
 void setChannelVolume(byte channel, byte level);
 void allNotesOff(byte channel);
 void setMasterVolume(byte level);
 void setReverb(byte channel, byte program, byte level, byte delayFeedback);
 void setChorus(byte channel, byte program, byte level, byte feedback, byte chorusDelay);


Please please pretty please. tell me what to enter.

Go Up