11.1 C
New York
Monday, March 4, 2024

Making a Distinctive Digital Musical Instrument: The Sound Wall – Open Electronics


 

We place metallic foil notes on a panel and play our music by touching them, making a melody from a really unique instrument.

Those that know slightly about music or have good reminiscences of the “music training” hours at secondary college (or secondary college, to place it in a contemporary means), will definitely do not forget that musical devices are divided into numerous classes based mostly on how the roughly erudite musician operates them to provide notes: we’ve wind devices (flute, oboe, clarinet, mouth organ, and so forth.) percussion devices (drums, piano, and so forth.), string devices (guitar, bass, violin, but in addition the traditional harpsichord might fall into this class), pipe devices and so forth. We’ve got wind devices (flute, oboe, clarinet, mouth organ, and so forth.), percussion devices (drums, piano, and so forth.), string devices (guitar, bass, violin, but in addition the traditional harpsichord might fall into this class), pipe devices and so forth. All of them have in frequent the truth that they work with out the necessity for contemporary know-how. It isn’t by probability that they had been created a few years in the past when electrical energy or electronics had been unknown, and based mostly on quite simple and primordial bodily ideas.

What we want to suggest to you in these pages is one thing a bit uncommon, as a result of it’s an digital musical instrument that we might place amongst these with a keyboard, however which is performed by touching keys (we name them that although they don’t seem to be) which aren’t pressed however are merely touched or touched. As you possibly can see within the pictures of the prototype on these pages, we’ve conceived it as a big panel (Fig. 1) with metallic plates formed like musical notes utilized to it (it’s no coincidence that we’ve determined to name it Sound Wall…), however anybody may give the “consumer” interface, and subsequently the keyboard, the form, and look they like.

 

Fig. 1

 

The venture

Let’s see what it’s all about, additionally with the assistance of the wiring diagram on these pages: our instrument is nothing greater than an Arduino Uno board interfaced to the plates (by touching them together with your fingers, the sound can be reproduced) via MPR121CAPTOUCH breakouts, that are contact sensors and which within the circuit are proportional in quantity to the notes. Each time we contact a metallic plate, the breakout board to which it’s electrically related will detect the switch of the quantity of electrical cost to our physique and can ship a sign to the Arduino Uno, which, based on the loaded firmware, will command the era of a sound utilizing the “collaboration” of the FT1414M board from Open Electronics, which we’ve already used within the venture.

The breakout board contact is mainly a board for the administration of contact sensors, then to every pin NOTE and SEL we’ve related some aluminum plates with any form (particularly musical notes and geometric shapes) in order that urgent the finger on them, can act as a button; every board reads a sure variety of plates-notes and to be actual 18, of which 14 for the notes (two octaves precisely …) and 4 to set the mode of execution, or simulated devices or “results” should you desire. These sound results are the Celesta (or celestial metallophone with hammers), the Carillon and two commonplace MIDI synthesizer sounds that are the FX2 (house weapon kind synthesizer) and the Sci-Fi FX8 (house sound synthesizer).

The breakout board for contact administration is predicated on Freescale’s MPR121QR2 chip, which is a capacitive contact sensor managed by way of an I²C interface. The chip can individually management as much as 12 electrodes and a most of 8 LEDs (when the pins are usually not configured as electrodes), which is why you see two of them in our design. On the backside of the PCB are 4 jumpers (pads with tracks), all of that are closed for the default setting. One among these jumpers connects the ADD pin to the bottom, so the I²C-Bus deal with of the chip can be 0x5A. Utilizing two breakouts, on the second this jumper needs to be opened, thus giving the board the deal with 0x5B. The jumpers additionally join the SDA, SCL and IRQ pins to 10 kohm pull-up resistors. The breakout doesn’t have a voltage regulator, so the facility provide have to be between 2.5 and three.6 Vdc, which the Arduino Uno does with its built-in regulator that gives voltage by way of pins 3V3 and GND.

The sound era is completed by the Arduino FT1414M protect based mostly on the Ogg Vorbis/MP3/AAC/WMA/MIDI audio decoder chip (VS1053B) produced by VLSI.

It permits a sure variety of musical notes to be generated by synthesizing the sounds of numerous musical devices, each melodic and percussive, following instructions given by an information channel; the instructions accepted will be in numerous codecs, together with the favored MIDI, which has been the usual used for many years to interface music synthesizers and digital keyboards to the PC.

 

 

For communication with the host gadget (the microcontroller governing the synthesizer), the VS1053B is used on this protect in serial mode.

The protect takes energy from the Arduino by way of the 5V pin and the frequent GND; 5 volts is equipped by the PAM8043 amplifier module, whereas 3.3 volts and 1.8 volts are equipped by the LDO linear regulators (MIC5504-1.8YM5-TR and MIC5504-3.3YM5-TR).

The VS1053B built-in amplifier has a stereo audio output related to a printed circuit jack to which headphones will be related. As well as, the identical output is related to a low-power BF amplifier (not included within the protect) with low-impedance outputs that raises the sign stage sufficient to drive a pair of 3-watt, 4-ohm impedance audio system.

The mini-amplifier code PAM8403POT is mounted by itself adapter board and plugged into the protect by way of a socket.

The electronics meeting is proven in Fig. 2 utilized to the panel from the entrance.

 

Fig. 2

 

 

The way it works

Now let’s see how the entire thing works, beginning with the digital keys: by putting your finger or hand on a sensor blade, we trigger the breakout board to output a string of information that’s learn from the corresponding Arduino I²C bus. This occasion causes the Arduino to play the corresponding observe, which is generated by driving the VS1053B’s inside MIDI synthesizer by way of serial, by means of the era of an information string on tx0, containing details about the corresponding observe. The info is in MIDI format and is subsequently decoded by the VS1053B. The VS1053B is a multistandard codec and decoder of many codecs, nevertheless it has the particularity of integrating a large-scale sound synthesizer based mostly on VLSI’s proprietary DSP (Digital Sign Processor) (i.e., the VS_DSP). It incorporates code and information reminiscence for the Ogg Vorbis, MP3, AAC, WMA and WAV PCM+ADPCM audio decoding codecs, in addition to an entire commonplace MIDI synthesizer; it communicates with the skin world by way of a serial interface, which will be configured as SPI.

Contained in the VS1053B is a multi-rate stereo DAC and audio preamplifier stage.

with a stereo model of the output filter. The built-in amplifier additionally helps PCM/ADPCM audio encoding, utilizing both a microphone amplifier or a high-level line enter with a built-in preamplifier for the enter sign to be encoded; the enter sign is shipped to a stereo A/D converter.

Due to software program plug-ins, the chip can even carry out lossless FLAC decoding like that of a high-quality recording in Ogg Vorbis format. The built-in sound synthesiser with a typical MIDI interface has two banks of “results” comparable to musical devices and referred to as GM1 (for melodic devices) and GM2 (for percussion devices); in our software, we use the GM1 financial institution, however by modifying the

firmware you possibly can change the instrument should you really feel prefer it and need to attempt it.

The musical notes produced are 12 per octave (i.e., the 7 notes plus halftones) and the potential octaves are 11, so the VS1053B covers an especially broad musical vary, effectively past that of the piano (which has 7 octaves plus a C). Desk 1 summarises the person notes by correlating them with the worth of the info obtained: as you possibly can see, 128 sounds are potential for every “register” or impact, every recognized by a numerical worth that’s handed from the Arduino to the VS1053B in serial type in binary format.

Desk 1

 

The primary prompts instrument 1, which is the Celesta (or hammer metallophone), the second the music field, the third the space-weapon synthesizer, and the fourth the Sci-Fi FX8 synthesizer (a sound from a science fiction movie). The above sounds and all these that may be developed inside the GM1 financial institution are described in Desk 2.

Desk 2.

 

The midi protect

Allow us to now take a more in-depth have a look at the guts of our musical instrument, specifically the protect based mostly on VLSI’s VS1053B built-in circuit, which is able to producing a sure variety of musical notes by synthesizing the sounds of numerous musical devices, each melodic (together with the harp and organ) and percussion, following instructions given by an information channel; the instructions accepted will be of assorted codecs, together with the favored MIDI, which has been the usual used for many years to interface musical synthesizers and digital keyboards to the PC.

For communication with the host gadget (the microcontroller that controls the

circuit, which in our case is Arduino) additionally in SPI-bus mode. Actually, the VS1053B integrates a serial interface complicated that has two interfaces: a management interface (SCI=Serial Command Interface) that’s used to regulate the operation of the chip and that in our case is the one by means of which Arduino provides its instructions, and an information switch interface (SDI=Serial Information Interface) due to which the VS1053B can switch or purchase information streams to or from one other exterior gadget.

Of the 2, the one that may be configured to function in TTL or SPI serial mode is the SCI, the management interface. The built-in sound synthesizer is predicated on a VLSI proprietary DSP (Digital Sign Processor), referred to as the VS_DSP. The synthesized sounds are transformed by a multi-rate stereo DAC, the output of which is a BF amplifier with a filter to chop down the conversion residues.

The built-in circuit additionally helps PCM/ADPCM audio coding, both by utilizing a microphone amplifier as an enter stage (for individuals who want to use a microphone as a supply) or by taking the sign from a line enter and sending it to a stereo A/D converter. In our protect, Arduino manages the VS1053B by means of the serial port used as UART, which within the U1 is related to pins 26 (RX) and 27 (TX), related respectively to digital pins D3 and D2 of the Arduino (that are subsequently reserved); the latter additionally manages the reset of the U1, by means of D4, in order to arrange it to obtain instructions.

 

Fig. 3

 

The three strains in query have pull-ups on the facet of the VS1053 and are managed by the Arduino pins utilizing resistors in collection; three jumpers (JRX, JTX and JRST) on the protect’s printed circuit board enable them to be disconnected, if vital, for instance if a distinct type of management is chosen, resembling SPI.

In any case, there are three strains to permit interfacing to SPI, since one acts as an information channel, one as a reset and the opposite as a clock; all it’s good to do is write the firmware accordingly.

The protect takes energy from the Arduino by way of the 5V pin and GND; on board it has LDO regulators to acquire 1.8 volts (MIC5504-1.8YM5-TR) and three.3 volts (MIC5504-3.3YM5-TR) to energy the varied levels of the VS1053B.

The VS1053B built-in amplifier has a stereo audio output situated on pins 39 (R channel) and 46 (L channel) referring to the frequent pin 42 (GBUF), which isn’t related to the analog floor, but in addition coupled, just like the sign strains, by way of R/C networks. The outputs of the U1 audio attain a stereo jack socket on the printed circuit board to which it’s potential to attach headphones since they’re related to a low-power BF amplifier with low-impedance outputs.

The identical R and L strains attain the inputs of the PAN8403 amplifier module, which raises the sign stage sufficient to drive a pair of 3-watt, 4-ohm impedance loudspeakers; the U4 module is the PAM8403, based mostly on the homonymous built-in amplifier already outfitted with all of the exterior parts it wants and the amount management potentiometer.

 

The firmware

Properly, now that we’ve defined what the {hardware} consists of, we will see how the sketch loaded into Arduino works to regulate our musical instrument, i.e., studying the standing of the contact sensors (metallic plates or foils) and producing the corresponding instructions to the MIDI protect.

On the code stage, we will see the “Play” operate, which is the one that enables the observe to be performed if finger contact is detected on some “Contact” plate, in flip by way of the “noteOn” operate. The “checkInterrupt1” and “checkInterrupt2” capabilities are the primary to determine the important thing pressed by the NOTE breakout and the second for the SEL breakout. If a pressed key’s detected I set the placement “i” within the “touchStates” array for the pressed key to the worth “1”, or “0” if not pressed. The sketch is structurally and conceptually easy, as a result of after initializing the strains and defining the variables it reads the state of the plates from the info offered by the 2 touch-sensitive breakout boards if a contact is detected. If this occurs, the firmware to begin with identifies the corresponding enter and distinguishes between observe instructions and register or instrument setting instructions: within the first case, it makes the protect execute the corresponding observe by sending a MIDI command string, whereas within the second case, it orders the VS1053B on the protect itself to set the corresponding instrument.

At any time when a brand new instrument is chosen from the 4, a observe of the brand new instrument is performed to determine the change.
Relating to the capabilities, there are mainly 4 completely different devices, though we solely used 4 of them, however they’ll fluctuate with out issues by altering the quantity to the fixed const int.
The selection of devices is linked to the second breakout the place we’ve indicated “SEL” within the wiring diagram:

const int INSTRUMENT1=9;const int
INSTRUMENT2=11;const
int INSTRUMENT3=98;
const int INSTRUMENT4=104.

The devices offered and set within the sketch are, based on Desk 2 which exhibits this system numbers of financial institution 0 of the midi VS1053B:

– 9 Celesta (or celestial metallophone);

– 11 Carillon;

– 98 FX2 soundtrack (house weapon-type synthesizer);

– 104 Sci-Fi FX8 (house sound synthesizer).

 

Relying on which metallic plate we contact, we’ll then acquire notes that can reproduce the sound of the corresponding instrument.

The sketch that manages our Sound Wall is relatively giant to have the ability to report it solely in these pages, so we present you three extracts which are probably the most vital: Itemizing 1 exhibits the setup for the 2 playing cards that purchase the indicators associated to metallic contacts, i.e., the contact sensors.

Itemizing 1

void mpr121_setup(void){
set_register(0x5A, ELE_CFG, 0x00);
// Part A - Controls filtering when information is > baseline.
set_register(0x5A, MHD_R, 0x01);
set_register(0x5A, NHD_R, 0x01);
set_register(0x5A, NCL_R, 0x00);
set_register(0x5A, FDL_R, 0x00);
// Part B - Controls filtering when information is < baseline.
set_register(0x5A, MHD_F, 0x01);
set_register(0x5A, NHD_F, 0x01);
set_register(0x5A, NCL_F, 0xFF);
set_register(0x5A, FDL_F, 0x02);
// Part C - Units contact and launch thresholds for every electrode
set_register(0x5A, ELE0_T, TOU_THRESH);
set_register(0x5A, ELE0_R, REL_THRESH);
set_register(0x5A, ELE1_T, TOU_THRESH);
set_register(0x5A, ELE1_R, REL_THRESH);
set_register(0x5A, ELE2_T, TOU_THRESH);
set_register(0x5A, ELE2_R, REL_THRESH);
set_register(0x5A, ELE3_T, TOU_THRESH);
set_register(0x5A, ELE3_R, REL_THRESH);
set_register(0x5A, ELE4_T, TOU_THRESH);
set_register(0x5A, ELE4_R, REL_THRESH);
set_register(0x5A, ELE5_T, TOU_THRESH);
set_register(0x5A, ELE5_R, REL_THRESH);
set_register(0x5A, ELE6_T, TOU_THRESH);
set_register(0x5A, ELE6_R, REL_THRESH);
set_register(0x5A, ELE7_T, TOU_THRESH);
set_register(0x5A, ELE7_R, REL_THRESH);
set_register(0x5A, ELE8_T, TOU_THRESH);
set_register(0x5A, ELE8_R, REL_THRESH);
set_register(0x5A, ELE9_T, TOU_THRESH);
set_register(0x5A, ELE9_R, REL_THRESH);
set_register(0x5A, ELE10_T, TOU_THRESH);
set_register(0x5A, ELE10_R, REL_THRESH);
set_register(0x5A, ELE11_T, TOU_THRESH);
set_register(0x5A, ELE11_R, REL_THRESH);
// Part D
// Set the Filter Configuration
// Set ESI2
set_register(0x5A, FIL_CFG, 0x04);
// Part E
// Electrode Configuration
// Set ELE_CFG to 0x00 to return to standby mode
set_register(0x5A, ELE_CFG, 0x0C); // Allows all 12 Electrodes
set_register(0x5A, ELE_CFG, 0x0C);
//***************** seconda scheda con indirizzo 0x5B ************************
set_register(0x5B, ELE_CFG, 0x00);
// Part A - Controls filtering when information is > baseline.
set_register(0x5B, MHD_R, 0x01);
set_register(0x5B, NHD_R, 0x01);
set_register(0x5B, NCL_R, 0x00);
set_register(0x5B, FDL_R, 0x00);
// Part B - Controls filtering when information is < baseline.
set_register(0x5B, MHD_F, 0x01);
set_register(0x5B, NHD_F, 0x01);
set_register(0x5B, NCL_F, 0xFF);
set_register(0x5B, FDL_F, 0x02);
// Part C - Units contact and launch thresholds for every electrode
set_register(0x5B, ELE0_T, TOU_THRESH);
set_register(0x5B, ELE0_R, REL_THRESH);
set_register(0x5B, ELE1_T, TOU_THRESH);
set_register(0x5B, ELE1_R, REL_THRESH);
set_register(0x5B, ELE2_T, TOU_THRESH);
set_register(0x5B, ELE2_R, REL_THRESH);
set_register(0x5B, ELE3_T, TOU_THRESH);
set_register(0x5B, ELE3_R, REL_THRESH);
set_register(0x5B, ELE4_T, TOU_THRESH);
set_register(0x5B, ELE4_R, REL_THRESH);
set_register(0x5B, ELE5_T, TOU_THRESH);
set_register(0x5B, ELE5_R, REL_THRESH);
set_register(0x5B, ELE6_T, TOU_THRESH);
set_register(0x5B, ELE6_R, REL_THRESH);
set_register(0x5B, ELE7_T, TOU_THRESH);
set_register(0x5B, ELE7_R, REL_THRESH);
set_register(0x5B, ELE8_T, TOU_THRESH);
set_register(0x5B, ELE8_R, REL_THRESH);
set_register(0x5B, ELE9_T, TOU_THRESH);
set_register(0x5B, ELE9_R, REL_THRESH);
set_register(0x5B, ELE10_T, TOU_THRESH);
set_register(0x5B, ELE10_R, REL_THRESH);
set_register(0x5B, ELE11_T, TOU_THRESH);
set_register(0x5B, ELE11_R, REL_THRESH);
// Part D
// Set the Filter Configuration
// Set ESI2
set_register(0x5B, FIL_CFG, 0x04);
// Part E
// Electrode Configuration
// Set ELE_CFG to 0x00 to return to standby mode
set_register(0x5B, ELE_CFG, 0x0C); // Allows all 12 Electrodes
set_register(0x5B, ELE_CFG, 0x0C);

 

In Itemizing 2 you’ll find the portion of the sketch that offers with the precise administration of the MPR121 breakout bar, i.e., the touch-sensor management. Lastly, we report, in Itemizing 3, a final piece of code in regards to the management of notes replica by the protect with VS1053B, during which the fixed int observe assumes the worth of the observe to be performed every time.

Itemizing 2

void readTouchInputs()
{
if(!checkInterrupt1())
{
//learn the contact state from the MPR121
Wire.requestFrom(0x5A,2);
byte LSB = Wire.learn();
byte MSB = Wire.learn();
uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the contact states
for (int i=0; i < 12; i++)
{ // Test what electrodes had been pressed
if(touched & (1<<i))
{
touchStates[i] = 1;
}
else
{
touchStates[i] = 0;
}
}
}
if(!checkInterrupt2())
{
//learn the contact state from the MPR121
Wire.requestFrom(0x5B,2);
byte LSB = Wire.learn();
byte MSB = Wire.learn();
uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the contact states
for (int i=0; i < 12; i++)
{ // Test what electrodes had been pressed
if(touched & (1<<i))
{
touchStates[i+12] = 1;
}
else
{
touchStates[i+12] = 0;
}
}
}
for (int i=0; i<24; i++)
{
Serial.print(touchStates[i]);
}
Serial.println();
}

 

Itemizing 3

void Play()
{
int observe=30;
for (int i=0; i<20; i++)
{
if ((touchStates[i]==1) && (touchPres[i]==false))
{
noteOn(0, observe, 127);
touchPres[i]=true;
}
if ((touchStates[i]==0) && (touchPres[i]==true))
{
noteOff(0, observe, 127);
touchPres[i]=false;
}
observe++;
}
delay(100);
}

 

Conclusions

Properly, we predict we’ve defined sufficient to arrange our musical instrument with contact and to configure it so as to acquire the specified sounds; as defined, the venture lends itself to a number of gildings and provides you most freedom of expression by way of sensible implementation and selection of “keyboard”, whereas respecting the foundations indicated.  The model proposed within the pictures on these pages is a suggestion, however every of you may give free rein to your creativeness by arranging the plates on the help you contemplate best suited and shaping the plates as you want.

 

OpenStore

Arduino UNO R3

Defend MIDI with VS1053B

MPR121 – Capacitive Contact Sensor Breakout

Micro amplifier 3 + 3 watt



Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles