Main Site Documentation

Midi and Fez Panda III


#1

I’m trryng to port an aurduino project to my new Fez Panda III.

The poject is intended to filters midi in Data trasforming them in a required output.

To simplify, let’say my project is an octavier: when the In message(from synth) is NoteOn (dec 144 extract with or logic to avoid channel number), i read the pictch of note (the data1 field) and then increment + 12. So for example a middle C, pitch 60,
pitch 72, exactly an octave upper, to send as output note on to midi output.

To do this, in arduino, i used a midi shield for arduino connected to synth, on a side, thru midi port by pentapolar din to a synth, by the other side using the uart to read midi in and send midi out.

I’m absolutey newbie to Ghi Products, having used only arduino products since today.

My questions are 3:

1)The midi shield being able to swith 3.3 to 5v,
can i use it with uart pin (panda’s pin are 3.3 but 5v tolerant).

  1. how can i read it, without the library midi.h present for arduino? How can i replace it? Must I? Or i can read directly the bytes from uart, and how? (i can interpret the right meaning of midi bites flow knowing well midi protocol.)

) it is possible to use, instead of a midi shield, simply a midi-to-usb converter,
connecting the usb side of the converter to the Panda usb? (i read that usb device not being mouse, keyboard or tipyvcal,device can be read declaring usb device as unknown).
In this case, how i read the incoming data (when playing the synth).

Thanks a lot.


#2

Welcome @postagb,
First what is your environnement: netmf, gadgeteer or TinyClr ? Which version of Visual Studio ? It could be a good idea to set a category for your message.

For your questions:
1/ I would first try to 3.3V, and test if can send and receive data.
2/ You have to reimplement in C# or other language you use. When you answer to first questions, it is eaiser to give you more precise instructions.
3/ Perhaps it can be used but it’s not what I can do (Perhaps other one ?)


#3

TinyClr in Visual Studio 2013 Express.
Other problem,i can’t find GHI library (i want to try
to refer to GHI.Usb.Host,
but “using GHI.Usb.Host;” give me an obvious error of
library missing.)

At this moment i’m programming with C#,
nevertheless, even experienced in C# programming, i’d prefer to
code using VB.net (weird?).

My OS is Windows 10.

Thanks a lot.


#4

I’t’s my first message and i still ignore how to categorize it in the forum.


#5

Are you sure is it TinyClr ?
GHI.Usb.Host is old one if you use TinyClr. It’s for netmf.


#6

Oh, ok, great confusion (having installed vs 2013 2015 and 2017 for desperate temptative to make work Netduino, always unsuccesfully, i made confusion between versions). No, actually i realize that i was working on netMF 4.4.(me idiot)

Now,on VS 2013 i tried to install TinyClr using the console, of Package Manager,
digiting
"PM> Install-Package TinyCLRTest -Version 0.17.4.1"

but got these errors:
Install-Package : Could not install package ‘TinyCLRTest 0.17.4.1’. You are trying to install this
package into a project that targets ‘.NETMicroFramework,Version=v4.4’, but the package does not
contain any assembly references or content files that are compatible with that framework. For more
information, contact the package author.
At line:1 char:1

  • Install-Package TinyCLRTest -Version 0.17.4.1
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackage 
     Command

#7

retried with pm>dotnet add package TinyCLRTest --version 0.17.4.1


#8

Ok so many board and many VS version… Not easy to avoid confusion.
I begin with Panda III and TinyClr as it states on title: to use TinyClr I think you need VS2017.
So begin to grab:

and as you work with panda III you just have to update firmware of board:

Now proceed with


#9

TinyCLR is still under development. Many features that are available with Micro Framework 4.3 are not yet available with TinyCLR.

http://docs.ghielectronics.com/tinyclr/roadmap.html

For example, USB client and host are not available yet. If you wanted to use USB, then 4.3 is the only choice at the moment.

Further, you are are more likely to find Midi code written for 4.3 than TinyCLR.


#10

@Mike, ach, oh, ok.

I go back to to 4.3.
Thanks a lot.


#11

@Mike.
Ok, tried nmf 4.3, found GHI.usb, compiling return me the message Ghi.usb
is obsolete.


#12

I got the impression initial setup will take much me more time than coding, hope not.
I really dont’t know how to work with midi, just for reading Midi In , not for the code, but for the initial setup difficulties.


#13

GUS (GHI) had something on MIDI
http://old.ghielectronics.com/community/codeshare/entry/500


#14

Ciao! I wrote a midi library for 4.3 so you’re welcome to use it (and anyone else for that matter)

I included a demo program which does your octave shift to get you going with the code. i.e. read the midi in port, if it’s a note on, transpose it up an octave, then re-transmit the midi to the midi out port.

Enjoy :slight_smile:
Guy


#15

@gwpt Genial! Going to try immediately.
Thanks.


#16

Good point. I forget this on first post. So => NetMF


#17

@Mike and @Bauland and @gwpt, to be clear, i’dont want to use Fez Panda as midiinterface between synth and pc.
No, my project in Arduino made the pitch shift (as expample, octavier)
standing alone, all the settings to arduino were controlled by synth via midi (switching arduino to setting mode and using the synth keys as setting modifiers/note depending on mode switched).
No pc.
I made it using a midi shield (olimex midi shield, https://www.olimex.com/Products/Duino/Shields/SHIELD-MIDI/open-source-hardware).

Now my hope is to be able to control not via uart directly (in arduino pin 0 and 1),
but by the usb converter, one side connected to the synth, one side to Panda III.

My hope was born when i read that in netmf or tinyclr and Ghi El Boards
the access to usb signals is possible also declaring the device “unknown”,
cause there in not yet something like “netfm.io.usb.midi” or "Tinyclr.usb.midi.

I have the original sketch code in C\c++ old style (required by arduino ide) if you want it, but it’s not commented and quite long.

To be prolix and explain better, the project and the “why” are these.

Most of pianobar man have to sing and play piano or synth at the same time, and in some difficult song, they cannot concentrate both on vocals and piano execution.

The midi files give an important .help (imagine the execution of a song by queen, where you have to simulate Mercury’s voice power and his extension, often you
play bad or play good and sing bad).

The problem with midibases is that the public is non too satisfied to hear a compolete orchestral base while watching you arping some note.

So i thought “If this could be reversed” that is, if the harmonic lines of pad (strings or piano)
would be silent but “magnetic”, to correct all the notes disharmonic in the current chord.

So i developped a program for pc that correct each note forwarding it to a note “previewed” by the midi base at correct time.

It’s very easy on a pc, but it’s not agreable to play with a pc by the side.
So, i ported on Arduino (some difficulties using the main loop in sync with the “permitted” notes).

But more or less the system on arduino, is functional.
Some variable on Arduino is hard to check(a very poor ide),
plus, the communication with a soft timer on an sd card
creates probles on sync, plus, the string that substitute the midibase (a big big string) almost all when the player must lower pitch if not arriving at original pitch, and this is to make it while playing, so that string must have features like insert, repeat, extract, shift to right etc.

Unfortunately Strings in C are not classes but char arrays(ok,fundamentally they are), and not have extended features that i can have in a string class.in C#.
The result is sometimes char of arrays are so big that the memory of sketch is at the limit and Arduino start to bug(i mean Arduino Mega)

So i’, trying to port the project to a bord with more memory and flexibility.


#18

Graphically the concept is simple


#19

Oh, it’s a parser…i take a look.