Offline
Newbie
Karma: 0
Posts: 44
|
 |
« on: February 10, 2013, 04:18:07 pm » |
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. [ //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.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #1 on: February 10, 2013, 04:26:55 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #2 on: February 10, 2013, 05:23:18 pm » |
|
|
|
|
« Last Edit: February 10, 2013, 06:11:40 pm by Trazman001 »
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #3 on: February 10, 2013, 06:39:22 pm » |
This code is wrong:- 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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #4 on: February 10, 2013, 07:05:24 pm » |
???? I don't know what you mean. should I get rid of 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.
|
|
|
|
« Last Edit: February 10, 2013, 09:32:25 pm by Trazman001 »
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #5 on: February 11, 2013, 03:10:59 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #6 on: February 11, 2013, 06:05:42 am » |
I didn't write the code but i have lillte or no understanding of the code.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #7 on: February 11, 2013, 08:29:07 am » |
Then look at every function that ends in 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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #8 on: February 11, 2013, 05:21:10 pm » |
Code:
Serial.write(midiMsg.raw, sizeof(midiMsg));
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?
|
|
|
|
|
Logged
|
|
|
|
|
Temple, Texas
Offline
Sr. Member
Karma: 14
Posts: 354
|
 |
« Reply #9 on: February 11, 2013, 05:48:12 pm » |
Then look at every function that ends in 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...
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #10 on: February 11, 2013, 06:06:41 pm » |
[code uint8_t raw[4]; } t_midiMsg; ] should I delete this to? the question really is, should I add any thing? Serial.write(midiMsg.raw, sizeof(midiMsg)); every part where this was I deleted it and it still didn't work.
|
|
|
|
« Last Edit: February 11, 2013, 06:20:29 pm by Trazman001 »
|
Logged
|
|
|
|
|
Temple, Texas
Offline
Sr. Member
Karma: 14
Posts: 354
|
 |
« Reply #11 on: February 11, 2013, 06:27:48 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #12 on: February 14, 2013, 03:47:53 pm » |
grumpy mike If you would please show me the right code to use.  this code was ment for the spark fun music instrument code.
|
|
|
|
« Last Edit: February 14, 2013, 03:52:10 pm by Trazman001 »
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #13 on: February 14, 2013, 04:15:05 pm » |
These functions will work:- 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:- 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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 44
|
 |
« Reply #14 on: February 16, 2013, 06:06:47 pm » |
will some of these work?? 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.
|
|
|
|
« Last Edit: February 16, 2013, 06:31:19 pm by Trazman001 »
|
Logged
|
|
|
|
|
|