Does MIDI Library 2.6 work with Teensy3.0?

Status
Not open for further replies.
@foam_FORM - You absolutely are doing something incorrectly. I just went through this process and created a few screenshots, entirely for your benefit. I hope this helps?

First, I installed MIDI 3.2 to a clean copy of Arduino 1.0.4. Here is a screenshot of the error.

screen1.png

Click any of these images to see if at full size.

An important point, which I want to make absolutely clear, it you CAN post screenshots on this forum. In fact, you should do so. You are asking other people to spend time and effort helping you. The least you can do is put the effort into posting accurate information.

If you are unfamiliar with how to save your screen to a file, use google to find numerous tutorials.

Earlier in this thread you said you were unable to copy and paste the actual error messages. You can indeed. This next screenshot is meant to demonstrate:

screen2.png

Click and drag your cursor to select the text. If more text is in the window, it will automatically scroll as your cursor drags over the edge. You can also change the size of the black section by clicking and dragging the bar that separates the 2 error and editor, to make the error portion larger and easily to select text. Once the entire message is selected, use the Edit menu, or press CTRL-C (or Cmd-C on a Mac) to copy the text to the clipboard.

Now, reading the edit. I commented out line 65 in MIDI.h and clicked Verify again. Here is the result:

screen3.png

This is the same window, still configured for Teensy 3.0. Just commenting out that one line makes it compile for Teensy 3.0. Nantonos already confirmed this, and I'm confirming he is indeed correct.

Screenshots and exact copy-and-paste really are valuable. They often show numerous small details. For example, if you suspected I was actually compiling for Teensy 2.0, there are multiple visual indications in this screenshot that I did indeed use Teensy 3.0. On the bar on the bottom on the window, you can see Arduino is configured for Teensy 3.0. You can also see the memory report. Teensy 3.0 is the only board which has 131072 bytes of flash memory and 16384 bytes of RAM. If I compiled for Teensy 2.0, it would show the max is 32256 and 2560, and Teensy++ 2.0 would show 130048 and 8192.

I'd like to help you get MIDI working, but first, you really need to improve your approach to using this forum. You've posted numerous messages, resisting requests for specific error message text (which often has subtle details that experts can use to figure out what's wrong). You've speculated we're giving you incorrect or even intentionally wrong information, all the while insisting you've an extreme novice. Every single day I answer numerous technical questions, and a common theme is people do not provide enough information. Probably half the time I spend on support is begging people to actually post enough information (or the code which reproduces the problem). I see if over and over, yet this thread is really an exceptional case.

Really, truly, we want to help you. Please, help us to do that by posting detailed enough information. Also, as "an extreme novice", rather than second guessing expert opinion (Nantonos is indeed an expert who's proved himself over and over again), please try to earnestly follow advice and if it it isn't fruitful, try to respond with specific and detailed information about exactly what you did try and what results you got.
 
@foam_FORM - You absolutely are doing something incorrectly. I just went through this process and created a few screenshots, entirely for your benefit. I hope this helps?

First, I installed MIDI 3.2 to a clean copy of Arduino 1.0.4. Here is a screenshot of the error.

View attachment 379

Click any of these images to see if at full size.

An important point, which I want to make absolutely clear, it you CAN post screenshots on this forum. In fact, you should do so. You are asking other people to spend time and effort helping you. The least you can do is put the effort into posting accurate information.

If you are unfamiliar with how to save your screen to a file, use google to find numerous tutorials.

Earlier in this thread you said you were unable to copy and paste the actual error messages. You can indeed. This next screenshot is meant to demonstrate:

View attachment 380

Click and drag your cursor to select the text. If more text is in the window, it will automatically scroll as your cursor drags over the edge. You can also change the size of the black section by clicking and dragging the bar that separates the 2 error and editor, to make the error portion larger and easily to select text. Once the entire message is selected, use the Edit menu, or press CTRL-C (or Cmd-C on a Mac) to copy the text to the clipboard.

Now, reading the edit. I commented out line 65 in MIDI.h and clicked Verify again. Here is the result:

View attachment 381

This is the same window, still configured for Teensy 3.0. Just commenting out that one line makes it compile for Teensy 3.0. Nantonos already confirmed this, and I'm confirming he is indeed correct.

Screenshots and exact copy-and-paste really are valuable. They often show numerous small details. For example, if you suspected I was actually compiling for Teensy 2.0, there are multiple visual indications in this screenshot that I did indeed use Teensy 3.0. On the bar on the bottom on the window, you can see Arduino is configured for Teensy 3.0. You can also see the memory report. Teensy 3.0 is the only board which has 131072 bytes of flash memory and 16384 bytes of RAM. If I compiled for Teensy 2.0, it would show the max is 32256 and 2560, and Teensy++ 2.0 would show 130048 and 8192.

I'd like to help you get MIDI working, but first, you really need to improve your approach to using this forum. You've posted numerous messages, resisting requests for specific error message text (which often has subtle details that experts can use to figure out what's wrong). You've speculated we're giving you incorrect or even intentionally wrong information, all the while insisting you've an extreme novice. Every single day I answer numerous technical questions, and a common theme is people do not provide enough information. Probably half the time I spend on support is begging people to actually post enough information (or the code which reproduces the problem). I see if over and over, yet this thread is really an exceptional case.

Really, truly, we want to help you. Please, help us to do that by posting detailed enough information. Also, as "an extreme novice", rather than second guessing expert opinion (Nantonos is indeed an expert who's proved himself over and over again), please try to earnestly follow advice and if it it isn't fruitful, try to respond with specific and detailed information about exactly what you did try and what results you got.

Sorry, I should be better with my communication skills. The reason for the last comment is that I am concluding that we are not on the same page-- and that seems to be due to me not providing enough info. That was because I was unable to copy for some reason and didn't realize the importance of that particular information. I have no doubt that Nantonos is a skilled expert. That is where my frustration comes out of because of a couple of comments that basically demonstrated that he was able to do what I wanted (and that I simply was not), which was frustrating and didn't address the problem. From there I concluded that we were maybe living in parallel universes (me- novice, Nantonos- wizard) or that my "novice-ness" was so appalling that I didn't deserve much help...now I know it was my own doing-- not providing the neccessary info.

I once had luck with commenting out line 65 before typedef uint16_t word; but now it won't compile again. I am wondering now if it may be due to me making registry changes in 'CCleaner', which included files involving the Arduino loader. I have loaded a fresh copy of Arduino 1.04 and the MIDI library. Here is the error message after commenting out the line and verifying the code:


In file included from C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\hardware\teensy\cores\teensy3/WProgram.h:15:0,
from C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\hardware\teensy\cores\teensy3/Arduino.h:1,
from simple_midi_sequence___pjrc.ino:3:
C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\hardware\teensy\cores\teensy3/wiring.h:89:22: error: conflicting declaration 'typedef unsigned int word'
In file included from simple_midi_sequence___pjrc.ino:1:0:
C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI/MIDI.h:65:18: error: 'word' has a previous declaration as 'typedef uint16_t word'


BASICALLY THE EXACT SAME ONE THAT HAPPENED BEFORE I COMMENTED OUT THE CODE!!! Now maybe you see why I am frustrated...Also I am not used to coping with this code stuff and working it all out...Arduino made it sound like all this was easier than it is...but I like challenges and these electronics are just so damn interesting. Sorry for spilling my shit all over the forum, truly. I will try and be a better PJRC citizen because you guys rock!! Keep up the good work
 
and that is after I made the necessary comment-out...so is there a reason why that change would not be updated?
 
In the folder where you keep your sketches, is there a subfolder called libraries and is there another copy of the midi library in there?
When you edit arduino-1.0.4\libraries\MIDI\MIDI.h are you saving the edited file back in that directory (so it overwrites the original) and not, say, in My Documents or some other default location?
 
In the folder where you keep your sketches, is there a subfolder called libraries and is there another copy of the midi library in there?
When you edit arduino-1.0.4\libraries\MIDI\MIDI.h are you saving the edited file back in that directory (so it overwrites the original) and not, say, in My Documents or some other default location?

MIDI.h is in the folder desktop/arduino1.04/libraries/MIDI ...when I edited it I right-clicked and hit edit. This brought me into notepad. I should note that in notepad the lines were not organized the same (they were re-formatted). I had to use 'find" to get the line with typedef and word up since it was not neccessarily line 65. Could this make a difference? After I made my edit I clicked save. This should have saved it into the exact same place. Instead of save, should I save as a new file in the MIDI folder?
 
also, when I go back to MIDI.h and open it (from the MIDI folder in libraries) it shows that the edit was indeed saved. It seems like Arduino is not reading or accepting it.
 
Thanks for checking that the edits have been saved. (Notepad doesn't know about some sorts of line endings so the formatting is displayed all messed up, but that should not affect anything. So yes, it seems that Arduino is not reading that copy of the file. Which brings me back to my earlier question about libraries in your sketches directory?
 
No, the folder that the actual sketch (.ino file) is in does not have a seperate library sub-folder. The only libraries folder on my entire computer (verified by search in the start menu) is in desktop/arduino-1.04/
 
also, when I go back to MIDI.h and open it (from the MIDI folder in libraries) it shows that the edit was indeed saved. It seems like Arduino is not reading or accepting it.

From that screenshot, the compiler is claiming the file in C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI/MIDI.h does indeed still have the typedef on line 65. Are you really, truly, absolutely sure you edited that particular copy of MIDI.h... the one which is in the directory "C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI".

I know you've said you edited the file and even reopened it again and saw your change was present. I just can't see how that's possible, but when the compiler reads the file, the change is not there.


There is a way to get more info about how Arduino is running the compiler. If File > Preferences, there is an option to turn on verbose info while compiling. That will cause a lot more to be printed in the console window. It will be far too much to capture with a screenshot, so you'll have to use copy and paste to share it here.

Two important pieces of information that will appear in the verbose info are the actual compiler commands Arduino is using to build the code, and a message that indicates if it is skipping the compile because it believe the already compiled copy is up to date.

It should never skip the compile if you've restarted Arduino. After changing the board, usb type, cpu speed or keyboard layout, all files should always be recompiled (they can't possibly be considered up to date, because settings were changed).


However, that specific error message in the screenshot would only appear after the compiler did read the file. If the compiler were not running and the Arduino IDE was using previously compiled files, you would see a different type of error. That specific error is from the stage where the .c and .cpp files are turned into .o files. If the code is being used from a previous file, the .cpp to .o step is skipped (the verbose info will tell you this). In such a circumstance, the error would be different, because the errors from the stage where all the .o files are combined into the final executable image are distinctly different.

The compiler is a separate program inside the arduino-1.0.4 directory structure. When you click Verify, the Arduino IDE runs the compiler several times. The compiler does NOT remain running. It can't somehow keep an old copy of the file in memory. The compiler starts, compiles the code from a specific file (and all the other files it includes), and quits. It's run many times for the many files, each time starting, doing its work, then quitting. There is no copy of the compiler still running after Verify or Upload finishes. It simply can't retain an old copy of the .cpp file. When the compiler runs, it must read the files from your hard drive.

The only plausible explanation if you've editing a different copy of MIDI.h, not the one in C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI.

Microsoft Windows does a terrible job of making the filesystem structure clear. There are lots of special places, like My Documents and the Desktop which aren't clearly presented with a clear indication of where they actually are on the filesystem.

I know you've checked the file and you're sure you've checked the right one, so sure that you believe the software is retaining an old copy of the file. But the software simply does not have that capability. The only plausible explanation is you've actually edited and double checked a different copy of MIDI.h.
 
From that screenshot, the compiler is claiming the file in C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI/MIDI.h does indeed still have the typedef on line 65. Are you really, truly, absolutely sure you edited that particular copy of MIDI.h... the one which is in the directory "C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI".

I know you've said you edited the file and even reopened it again and saw your change was present. I just can't see how that's possible, but when the compiler reads the file, the change is not there.


There is a way to get more info about how Arduino is running the compiler. If File > Preferences, there is an option to turn on verbose info while compiling. That will cause a lot more to be printed in the console window. It will be far too much to capture with a screenshot, so you'll have to use copy and paste to share it here.

Two important pieces of information that will appear in the verbose info are the actual compiler commands Arduino is using to build the code, and a message that indicates if it is skipping the compile because it believe the already compiled copy is up to date.

It should never skip the compile if you've restarted Arduino. After changing the board, usb type, cpu speed or keyboard layout, all files should always be recompiled (they can't possibly be considered up to date, because settings were changed).


However, that specific error message in the screenshot would only appear after the compiler did read the file. If the compiler were not running and the Arduino IDE was using previously compiled files, you would see a different type of error. That specific error is from the stage where the .c and .cpp files are turned into .o files. If the code is being used from a previous file, the .cpp to .o step is skipped (the verbose info will tell you this). In such a circumstance, the error would be different, because the errors from the stage where all the .o files are combined into the final executable image are distinctly different.

The compiler is a separate program inside the arduino-1.0.4 directory structure. When you click Verify, the Arduino IDE runs the compiler several times. The compiler does NOT remain running. It can't somehow keep an old copy of the file in memory. The compiler starts, compiles the code from a specific file (and all the other files it includes), and quits. It's run many times for the many files, each time starting, doing its work, then quitting. There is no copy of the compiler still running after Verify or Upload finishes. It simply can't retain an old copy of the .cpp file. When the compiler runs, it must read the files from your hard drive.

The only plausible explanation if you've editing a different copy of MIDI.h, not the one in C:\Users\Spartan's Lounge\Desktop\arduino-1.0.4\libraries\MIDI.

Microsoft Windows does a terrible job of making the filesystem structure clear. There are lots of special places, like My Documents and the Desktop which aren't clearly presented with a clear indication of where they actually are on the filesystem.

I know you've checked the file and you're sure you've checked the right one, so sure that you believe the software is retaining an old copy of the file. But the software simply does not have that capability. The only plausible explanation is you've actually edited and double checked a different copy of MIDI.h.

Really, truly. There is only one copy on my entire computer and I have triple-checked that possibility at least three times over already. Here is a screenshot of the edit I made (commented out line 65) in a screenshot: typedef edit.jpg that is the edit that remains in MIDI.h in the MIDI folder in the libraries folder in the arduino folder on my desktop. So apparently there is something going on that neither of us are aware of.
 
OK and I am trying to copy the error message with verbose info and it WONT LET ME AGAIN. Seriously...I am not insane or have a paper bag over my head. I am highlighting the whole error message, clicking edit and copy...and nothing is in the clipboard when I try to paste in the forum. I can however paste as html or for forus if that helps....like I said...parallel universes? Registry edits in CCleaner? Idk what is going on here.

<pre>
#include <<span style="color: #CC6600;">MIDI</span>.h>

<span style="color: #CC6600;">const</span> <span style="color: #CC6600;">int</span> channel = 1;

<span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><b>setup</b></span>() {
  <span style="color: #CC6600;">MIDI</span>.<span style="color: #CC6600;">begin</span>();
}

<span style="color: #CC6600;">void</span> <span style="color: #CC6600;"><b>loop</b></span>() {
    <span style="color: #CC6600;">MIDI</span>.<span style="color: #CC6600;">sendNoteOn</span>(62, 100, channel);
    <span style="color: #CC6600;">delay</span>(200);
    <span style="color: #CC6600;">MIDI</span>.<span style="color: #CC6600;">sendNoteOff</span>(62, 100, channel);
  <span style="color: #CC6600;">delay</span>(2000);
}


</pre>
 
It occurs to me that the type of commenting-out you are using ( // ) could be hard to use because the editor you are using displays everything on one line. // only comments out the rest of the current line. Perhaps you are actually typing the // at the end of the previous line?

Go to this site
http://notepad-plus-plus.org/
and download a free text editor that will show the file correctly.
After you install it, go to where MIDI.h is, right click, and select "Edit in Notepad++".
Then check that // is at the start of the line containing the line you want to comment out, like this

Code:
// typedef uint16_t word;

If it isn't, then make it like that and save (in the same directory).
 
It occurs to me that the type of commenting-out you are using ( // ) could be hard to use because the editor you are using displays everything on one line. // only comments out the rest of the current line. Perhaps you are actually typing the // at the end of the previous line?

Go to this site
http://notepad-plus-plus.org/
and download a free text editor that will show the file correctly.
After you install it, go to where MIDI.h is, right click, and select "Edit in Notepad++".
Then check that // is at the start of the line containing the line you want to comment out, like this

Code:
// typedef uint16_t word;

If it isn't, then make it like that and save (in the same directory).

OK! I think we're onto something here. I will check that tomorrow.
 
It occurs to me that the type of commenting-out you are using ( // ) could be hard to use because the editor you are using displays everything on one line. // only comments out the rest of the current line. Perhaps you are actually typing the // at the end of the previous line?

Yes, I was just about to write exactly this, when I saw that screenshot. The // added probably comments the end of the previous line, having no effect. It's impossible to tell what text is actually commented without seeing the lines displayed correctly.

I'd recommend commenting that line using /* */ style commenting, rather than // which depends on the end of line which Notepad doesn't handle properly.

Alternately, you can edit the file with Wordpad (or download a good text editor rather than using Microsoft's lame stuff). If you use Wordpad, you must be careful to save as plain text. If you save as a conventional word processing document, Wordpad will add lots of binary data about the document formatting like fonts, colors, etc. The compiler only works with plain text.
 
Yes, I was just about to write exactly this, when I saw that screenshot. The // added probably comments the end of the previous line, having no effect. It's impossible to tell what text is actually commented without seeing the lines displayed correctly.

I'd recommend commenting that line using /* */ style commenting, rather than // which depends on the end of line which Notepad doesn't handle properly.

Alternately, you can edit the file with Wordpad (or download a good text editor rather than using Microsoft's lame stuff). If you use Wordpad, you must be careful to save as plain text. If you save as a conventional word processing document, Wordpad will add lots of binary data about the document formatting like fonts, colors, etc. The compiler only works with plain text.

Yep!! The edit worked in Notepad++ ...looks like a very useful program! It will now compile as Serial board, but not MIDI. I am assuming that is normal since someone said that setting is for usbMIDI only. Am I on the right track now? I have to get my hardware back in order to test but I have a good feeling about that solution. Thanks alot!!
 
I have personally tested the MIDI 3.2 library with Teensy 3.0 today.

A known good copy is now available at this page:

http://www.pjrc.com/teensy/td_libs_MIDI.html

I added a note below the schematic with resistor value changes. I have a Teensy 3.0 on my desk right now transmitting MIDI to a Roland synth using a pair of 47 ohm resistors. It's working perfectly.
 
I have personally tested the MIDI 3.2 library with Teensy 3.0 today.

A known good copy is now available at this page:

http://www.pjrc.com/teensy/td_libs_MIDI.html

I added a note below the schematic with resistor value changes. I have a Teensy 3.0 on my desk right now transmitting MIDI to a Roland synth using a pair of 47 ohm resistors. It's working perfectly.

I just compiled successfully and tested it but still no signal on my 2.0...I will try my 3.0 out here shortly. I was using 220 ohm resistors with the 2.0. Did you use serial as your board type? Also, does it matter what the CPU speed is set to? Mine seems to want to default to overclock when I have a 3.0 plugged in. Otherwise all I can think of is that the solder connections may not be 100% pristine and insulated properly. So now it looks like there may be a hardware issue as well.
 
I am trying to upload pictures of the hardware setup but it keeps failing...is there a size limit? its about a 3mb pic
 
I added a note below the schematic with resistor value changes. I have a Teensy 3.0 on my desk right now transmitting MIDI to a Roland synth using a pair of 47 ohm resistors. It's working perfectly.

Teensy 3.0: Use two 47 ohm resistors on MIDI OUT, with the pin 4 resistor to +3.3 volts. For MIDI IN, connect the 270 ohm resistor to +3.3 volts.

For Teensy 3.0 MIDI IN, is it still a 220R from pin 4 or does that change to 47R as well? Also, if adding the optional Zener diode, is that still a 5V6 or some other type?
 
For Teensy 3.0 MIDI IN, is it still a 220R from pin 4 or does that change to 47R as well?

MIDI IN should have a 220 ohm resistor between pin 4 on the connector and pin 1 on the PC900, regardless of the voltage used for Teensy.

Also, if adding the optional Zener diode, is that still a 5V6 or some other type?

A zener diode can optionally be added to the MIDI OUT, between the Teensy TX pin and ground. On Teensy 3.0, that would be pin 1. To better protect Teensy 3.0, that would probably be best as a 3.6 volt zener diode.
 
Status
Not open for further replies.
Back
Top