fbpx
Skip to main content

MIDI Forum

Programming the SAM...
 
Notifications
Clear all

Programming the SAM2695

10 Posts
4 Users
0 Reactions
6,224 Views
Christoph
Posts: 38
Trusted Member
Topic starter
 

I'm about to build a midified organ bass pedal using the SAM2695SAM2695.
I've setup an arduino nano from which I'm able to send Midi commands.

Since I'm a beginner midi-wise, I'd like to ask which commands I have to send to the device to

1. Initialize it, on which midi channel it will be sending
2. select the Midi voice (e.g. String Bass)
3. set the device to monophonic mode (if the midi controller doesn't yet provide for this)
4. play a note.

(as the controller I'm using a board that is supplied by midi-hardware.com). Maybe I could later program the arduino such that it performs the task of keyboard scanning.

Thanks for your help in advance.

 
Posted : 21/09/2022 3:34 am
Eddie Lotter
Posts: 295
Reputable Member
 

Starting on page 26 is a list of all MIDI messages recognised and what their function is.

 
Posted : 21/09/2022 6:55 am
Christoph
Posts: 38
Trusted Member
Topic starter
 

[quotePost id=16002]Starting on page 26 is a list of all MIDI messages recognised and what their function is.[/quotePost]

Thanks. I saw this table, but my first attempt gives a terrible noise together rather with some kind of shatter echo than a bass note.

[code type=markup]
char bass33[]= { 0xC0,33,0};
char note_on[] = { 0x90,12,127,0 };

midiSerial.write(bass33),midiSerial.write(note_on);

[/code]

EDIT: I found that the bass note was too low. The amp/spkr could not cope with the low frequency (12). I rose it in the range of 46 and it gives the sound of an acoustic bass. OTOH, the analogue output of the device is terribly noisy.

Further editing:
From the docs I read:

[code type=markup]
2-1 SPECIAL MIDI MESSAGES
(received on serial MIDI in serial mode or on 8-bit data port in parallel mode)
Special midi messages are sent using midi Nrpn messages. These NRPN messages are mainly using NRPN
high=037h. For example, master volume can be set using NRPN "3707h", which means:
- NRPN high = 037h: midi control 99 (63h) = 55 (37h) --> midi message = 0B0h 063h 037h
- NRPN low = 07h: midi control 98 (62h) = 07 (07h) --> midi message = 0B0h 062h 07h
- NRPN value=vv: midi control 6 (06h) =vv ---> midi message = 0B0h 006h vv
vv being master volume value in range 0 to 127 (0 to 7Fh)
[/code]

How do I have to understand this? Why are the hex numbers have a leading 0? E.g. 037h in the NRPN declaration as well as in the midi message? Then again "(63h)" without the leading 0? Leading 0 I know from octal numbers in C.

 
Posted : 23/09/2022 1:21 am
Jason
Posts: 424
Honorable Member
 

Leading 0 is just a notation standard. 037h is 37 in hex. It is strange that they were inconsistant with their notation style.

 
Posted : 23/09/2022 5:59 am
Christoph
Posts: 38
Trusted Member
Topic starter
 

Thanks. Thought so, too. Nonetheless I don't understand the construction of a special midi (NRPN) message.

[code type=markup]
or example, master volume can be set using NRPN "3707h", which means:
- NRPN high = 037h: midi control 99 (63h) = 55 (37h) --> midi message = 0B0h 063h 037h
- NRPN low = 07h: midi control 98 (62h) = 07 (07h) --> midi message = 0B0h 062h 07h
- NRPN value=vv: midi control 6 (06h) =vv ---> midi message = 0B0h 006h vv

[/code]

I have no clue how to follow this example. 99 = 55? And then where comes the B0?

 
Posted : 23/09/2022 7:23 am
Clemens Ladisch
Posts: 321
Reputable Member
 

Here, "=" does not really mean "equals".

NRPNs (and RPNs) use an additional indirection to allow more control numbers.
You use controls 98 and 99 to set the NRPN number, and control 6 to set the NRPN value. So you send three control messages to set a single NRPN value.

 
Posted : 23/09/2022 9:15 am
Christoph
Posts: 38
Trusted Member
Topic starter
 

Ok, I see. And B0 is the lead in code to build the message. Is B0 special in this sense?

 
Posted : 23/09/2022 1:55 pm
Clemens Ladisch
Posts: 321
Reputable Member
 

No; Bx cc vv is the standard controller change message (set controller cc on channel x to value vv).

 
Posted : 23/09/2022 10:58 pm
Christoph
Posts: 38
Trusted Member
Topic starter
 

OK, thanks. It's clearer now to me.

 
Posted : 24/09/2022 12:50 am
Eddie Lotter
Posts: 295
Reputable Member
 

You can ignore the leading zeroes here. I'm guessing they are a vestige of changing from the coding notation (0xB0) to the documentation notation (B0h).
You can have a look at my RPN and NRPN Tutorial to get an idea of how to use NRPN messages.

 
Posted : 24/09/2022 6:35 am
Share: