Monday, April 18, 2016

Musical Instrument Shield Quickstart Guide

Short description
Believe it or not, the music sounds of a variety of small chips on the Shield device capable of generating. Ever Saiful at a department store (or other brand) synthesizer, played with? Shield instruments can sound just as many on the VS1053 chip! It's just how you talk to, which is the subject of this tutorial is here.


Necessity
To start working with the slope, you'll need a few things.
  • Arduino Uno or Arduino board to shield
  • Heading paretabe
  • Music Instrument Shield
  • Headphones or a 3.5mm (headphone-size) active speaker with plug
It Is Set Up


Rally
Right out of the box, an Arduino shield musical instruments need a way to connect to the main board. This means that some headers welded on. If you do not know how to solder, or the need for a review, do not forget to check out our welded 101 tutorials. Once you've welded on the header, Arduino to connect with your shield.

Software / Firmware
For example, using the code NewSoftSerial libraries. Your Arduino IDE version 1.0 or later, then you have to install this library automatically. If you use a previous version of the IDE, you will need to either upgrade or install the library manually.
  • Page Arduino 1.0
  • Page NewSoftSerial Library

Example code to use
Before we actually dig the MIDI specification, let's make some noise shield. Download and load it into your Arduino IDE example sketch.
  • Examples of music sketches Shield (Arduino 1.0 and newer)
  • Examples of music sketches Shield (Arduino 0023 and older)
Some of the statements in this example the output terminal at 57600 baud. 31250 baud statement is true now at the pin 3 and 4 of the MIDI communication through the use of NewSoftSerial library. Once loaded onto your Arduino code, for example, active speaker audio jack to plug in some headphones or on a slope, and reset. You kind of like an old sound-effects tape to hear a string of seemingly random percussion sounds.
What is actually going on in the code? Basically, a device code "Bank" chooses, and then all the "notes" that the bank, one drama after another. In this case, we have chosen a Sound Bank, and separate different words correspond to each note, even though they do not follow a set scale, like a piano key. To start working with a variety of instruments, we need to know a little bit more about the MIDI protocol.

MIDI is now easier and example code
We are doing everything thoroughly explained in this section, and is sourced from these two documents:
  • Full specification of the MIDI Tutorial
  • VS1053 datasheet
Now a set of MIDI protocol basically a serial protocol byte order. MIDI messages to one, two, or three bytes formed, and some messages are more common than others. Different types of data, the MIDI message to be conveyed in the system-level information to the manufacturer notes from turning on and off. If you did not work with MIDI in front of you right now, this will seem daunting and you may not understand it right away. MIDI is now a full run-down, please read the link at the top of the MIDI specification section of this tutorial.
For example, take a look at the sketch. Setup function, Arduino MIDI reset to a known state line to start using the device toggles. Loop function, there are three test loops, which are two comment. Take a look at the comments that does not loop. The first function call, these are:

                     talkMIDI(0xB0, 0, 0x78);

A common example of a MIDI message with these three bytes. The first byte, 0xB0, indicates that the message "Change control" message. The second byte, 0, indicates that we value zero with the "controller" would like to change. There are 127 "controllers" and the value of the controller 0, "the Bank," which means that the next value, 0x78, device we choose the "bank" is. In this case, 0x78 percussion refers to the bank.

See the loop in the next MIDI message:

                     talkMIDI(0xC0, instrument, 0);

The first byte, 0xC0, indicates that the instruction is a program to change the MIDI channel 0 (confused yet?). We have to change the program basically means "bank" to indicate that we are past the point of the instrument to a specific set of chip samples are telling. This function call "machine" that we want to load a specific set of variable sample materials. To change the bank of a variety of materials, we have "machine" will change dynamically. For example, in the code, we know that the "machine" to add confusion to the value of 30, the Bank has elected only one instrument, so it really does not matter what is the value of the instrument. Now we want to play MIDI channel to call this function which are required to be set. VS1053 is discussed on page 30 of this datasheet.

By this point you should be thoroughly confused and frustrated. The "machine" that we're actually dealing with a look at the table. The "notes" that we are the first bank selected with the MIDI commands are included in a table.

Sixty of the "Note" from 27 to 87 that the bank will be played, so that the value of a note with the "game" is, we note that we want to play with the value of the command to send the note. In this example, the following code to MIDI instructions are as follows:

                   noteOn(0, note, 60);

Note on the (...) function to turn on a function that sends a note to indicate MIDI. It is note Off (..) function changed slightly, but both functions are used often enough that it is useful to have separate functions. The first parameter, 0, MIDI channel to call this function, we want to play. Since we last point initialized with the channel 0 of us, we'll play. Note that the parameters we want to play. This value corresponds to the value of the bank table. For example, 27 of the 87 notes standard looping code, we're playing all the notes just once. The value of the "velocity" is called. That's how "hard" is an indication of the note should be played. If it is a low number, short notes, which will be played if it is a high number of instruments will be held louder and more forcefully. How hard you push a piano key note velocity. If the issue were lightly hurt, you get a note to the speed of light. If it is hit hard, loud and percussive notes are.

Note on () call after a period of 50 milliseconds delay. This means that whatever notes we chose to play in 50 milliseconds. After the delay, we would have to chip off note. Hence, () function call on the note:

                  noteOff(0, note, 60);

The concept of function calls (), on the contrary, with the exception that the third parameter is called "escape velocity." Release velocity to understand, so we like to keep it a little harder on the velocity of the notes. Please read the link at the top of the MIDI specification section of this tutorial.

The cycle continues through the loop percussion band, playing one note at a time. Banks and musical sounds with the quality of the game to get more. Remember that the value of the bank is as follows:
  • Bank of percussion instruments is 0x78
  • Banks are 0x79 melodic instruments (note: with melodic instrument, you must select the number of materials, not just the number of notes)
Page 30 Start the banks and all the values it contains the MIDI section VS1053 datasheet. Now, MIDI is now a complex protocol, and the first to understand, then read through the tutorial section at the top of the MIDI specification is hard to be sure.

Resources
  • Full specification of the MIDI Tutorial
  • VS1053 datasheet
  • Examples of music sketches Shield
  • Wikipedia's article on the MIDI
Conclusion
Fortune, and have fun making noise! If you have any problems, feel free to contact technical support Take support@electronics-tutor-shahin.blogspot.com SparkFun


2 comments:

  1. A new atomic watch needs to be reset in order for it to function properly. Interested to know more about Musical Instrument? Browse this website.

    ReplyDelete
  2. These headphones will allow you to hear the audio without having to raise your head too high and will allow you to still hear as well as see while you are playing games or watching TV. Check out this site to know more about student headphones.

    ReplyDelete