Yenza isilawuli sakho se-MIDI nge-Arduino

MIDI

Uma ungumthandi womculo noma ngqo umculi we-amateur noma okhokhelwayo, ngokuqinisekile ekhaya lakho uqoqe iqoqo elikhulu lezinsimbi zomculo. Ukwenza konke lokhu kuhlanganiswa kahle, kungcono ukuthola i- Isilawuli se-MIDI. Ngeshwa, lezi zinhlobo zezinto zivame ukubiza kakhulu ukuze umuntu ongenazo izinsiza eziningi akwazi ukufinyelela kunzima kukho konke angakunikeza.

Ukuze uqonde kangcono ukuthi isilawuli se-MIDI siyini, ikutshele ukuthi igama MIDI livela Isixhumanisi Somculo Sedijithali, okungukuthi, uhlobo lwesilawuli elenza amadivayisi womculo we-elektroniki akwazi ukuxhumana. Uma unekhibhodi ye-elektroniki ekhaya, isibonelo, kungenzeka ukuthi ine-interface ye-MIDI. Ngaphambi kokuqhubeka nokuthuthuka, ngaphandle kokuthi kunemininingwane ethile yezobuchwepheshe engaholela ekutheni umuntu akholelwe ngenye indlela, kufanele kucace bha ukuthi I-MIDI ayiwona umsindo.

Dala isilawuli sakho se-MIDI ngalesi sifundo esilula

Lapho sesicacile ngalokhu, ngokuqinisekile kuzoba lula kakhulu kuwe ukuqonda ukuthi i-MIDI ilula nje isethi yokufundisa ekwazi ukuxhasa iziteshi ezizimele ezifika ku-16, okusho ukuthi kungaba nemishini ehlukene efinyelela ku-16 exhumana ngokuzimela komunye nomunye. Lawa madivayisi kufanele axhunywe ngekhebula le-5-pin DIN, okuyikhebula elinezikhonkwane ezinhlanu ngaphakathi kwesixhumi. Njengemininingwane, kuvamile ukusebenzisa i-USB esikhundleni se-5-pin DIN, uma kwenzeka sisebenzisa i-USB kumele sakhe isikhombimsebenzisi se-USB-MIDI.

Ngaphandle kokuqhubeka, ngikushiya nesixhumanisi lapho ungathola khona i- Ukufundisa igxathu negxathu nge izithombe ezichazayo lapho singenza khona zonke izenzo ezidingekayo ukudala isilawuli sethu se-MIDI.

I-athikili ehlobene:
Ungaliguqula kanjani igama lomsebenzisi le-Pi nephasiwedi ku-Raspberry Pi yethu

Ungasenza kanjani isilawuli sakho se-MIDI nge-Arduino

isixhumi se-midi

Baningi abantu abadinga, ngezizathu ezahlukahlukene ezomuntu siqu nezomsebenzi, ukusebenzisa i isilawuli se-MIDI ngokwezifiso ngokugcwele Ngoba mhlawumbe futhi njengesibonelo, ngesikhathi esithile sempilo yakho njengomculi, ukuthenga isilawuli se-MIDI esingabizi kakhulu kungahle kungahlangabezani nokulindelwe noma izidingo zakho ngenkathi, lapho kufika isikhathi, ukukhetha inguqulo yobungcweti kungaba ngokweqile kuzo zombili izinsizakusebenza zezezimali. need, Kanye nenani elikhulu lezici abangazinikeza.

Ngenxa yalokhu, namhlanje ngifuna ukukukhombisa konke okudingayo ukuze uzenzele isilawuli sakho se-MIDI esibonisa konke okudingayo ekwakhiweni kwaso futhi sikunikeze isoftware oyodinga ukuyifaka. Njengemininingwane, kule phrojekthi ukusetshenziswa kwebhodi le-Arduino kubalulekile, isilawuli esinamandla anele okwenza lo msebenzi.

I-athikili ehlobene:
Uyenza kanjani irobhothi: Izinketho ezi-3 ezihlukile

Yini isilawuli se-MIDI?

midi

Ngokuyisisekelo, isilawuli se-MIDI sinesibopho, uma sikhuluma kabanzi, sokuxhuma amadivayisi womculo ahlukile komunye nomunye. Ziningi izinsimbi ezifaka isikhombimsebenzisi se-MIDI noma kunjalo, lokhu kufanele kucace bha ngoba kunabasebenzisi abaningi abavame ukudideka, i-MIDI ayilona ifayela elilalelwayo, kepha isethi elula kakhulu yemiyalo insimbi engayithola ukwenza ukulawula okuhlukile noma izilungiselelo zomsindo.

Ngaphakathi kwe-MIDI kunezinhlobo ezimbili ezihlukeneNgakolunye uhlangothi sinalolo olubizwa ngokuthi yi-Change Control lapho lunenombolo yesilawuli nenani eliphakathi kuka-0 no-127. Ngenxa yalokhu, imiyalezo ingakhishwa lapho imingcele ehlukahlukene efana nevolumu noma ithoni ingashintshwa. Izinsimbi ezahlukahlukene ezemukela i-MIDI kufanele zilethe imanuwali nazo ezichaza ukuthi iziphi iziteshi nemiyalezo esethwe ngokuzenzakalela nokuthi ingayishintsha kanjani.

Endaweni yesibili sine-Program Change, uchungechunge lwemiyalezo elula kakhulu kunaleyo eyakha i-Change Control. Lezi zinhlobo zemilayezo zisetshenziselwa ukushintsha ukusetha kabusha noma isichibi sedivayisi. Njengaku-Change Control, kanye nethuluzi lakho umenzi kufanele afake ibhukwana elibonisa ukuthi yikuphi ukusethwa kwangaphambili okushintshwa ngomyalezo othile.

Izingxenye Ziyadingeka Ukwakha Isilawuli Sakho Sokuzenzela se-MIDI

Isixhumanisi se-Midi sihlelekile

Ukuze ukwazi ukwakha isilawuli sakho se-MIDI uzodinga uchungechunge lwezingcezu ngokungeziwe, njengoba sesishilo, ebhodini le-Arduino. Ngaphambi kokuqhubeka, vele ukutshele ukuthi mhlawumbe, ngokuzayo ngoba ufuna ukwandisa iphrojekthi, udinga izinto eziningi, yize ngalesi sikhathi nezicucu ezimbalwa uzoba nokuningi.

Sizodinga ikhebula lesifazane le-5-pole DIN, ama-2 220 ohm resistors, ama-switch wesikhashana ama-2, ama-2 10k ohm resistors, izintambo zokuxhuma, ibhodi lesifunda, ikhebula le-MIDI nedivayisi ye-MIDI noma i-USB interface. Ngalezi zingcezu ungaqala, ulandele izinyathelo zami, ukwenza isilawuli sakho se-MIDI.

Izinyathelo zokuqala

I-Arduino midi ehlelekile

Ngaphambi kokuqala ngikushiyela isithombe lapho ungabona khona izikhonkwane zekhebula lakho le-MIDI, ngale ndlela singazikhomba kahle izikhonkwane futhi ikakhulukazi lapho kufanele kuxhumeke khona ngayinye. Ngokubanzi, konke okumele ukwenze kuleli qophelo ukuxhuma iphini 5 yekhebuli ku-resistor engu-220 ohm futhi ukusuka lapho uye ku-Arduino Transmit 1, phina u-4 uye ku-220 ohm resistor futhi usuke lapho uye kusokhethi engu-5V ye-Arduino ngenkathi uphina 2 kufanele ixhunywe ku-Ground connection yesilawuli sakho.

Uma lesi sinyathelo sesenziwe, awunawo umdwebo oningiliziwe esithombeni esitholakala ngaphansi kwale migqa, sekuyisikhathi sokuxhuma izinkinobho. Umqondo okulesi sigaba ukufeza, usebenzisa iphinikhodi ye-digitalRead (ekwazi ukuthola lapho i-voltage efinyelela kuyo ishintsha) ukwazi ukusebenzisa i-transistor ukufeza, ngokucindezela inkinobho. Ukuze senze lokhu kufanele sisebenzise inkinobho nje, ukuze uhlangothi lwayo lwesobunxele siluxhume ku-5V, uhlangothi olungakwesokudla lube ukumelana no-220 ohm futhi ukusuka lapho kuye emhlabathini ngenkathi, nathi, sixhuma ohlangothini lwesokunene ukuphina u-6 Inkinobho yesibili izofakwa ngendlela efanayo yize, njengoba ubona kumdwebo, esikhundleni sephini 6 siyixhuma ku-7.

Isoftware ezosetshenziselwa isilawuli se-midi yasekhaya

Lapho sesiqedile ngayo yonke i-hardware, sekuyisikhathi sokuxhuma insimbi yethu nokuhlola. Ngaphambi kwalokho sidinga ukuba ne- Isibonisi se-USB-MIDI nentambo ye-MIDI ukuxhuma ibhodi, elithumela idatha, nekhompyutha yethu. Ukufeza lokhu, sikhethe umtapo wezincwadi we-MIDI v4.2 owenziwe ngabafana abavela ku-Forty Seven Effects okumele ngabe siyifakile ku-Arduino yethu futhi safakwa kuphrojekthi.

Endabeni yekhompyutha, sizodinga uhlelo olukwazi ukwengamela yonke idatha ye-MIDI efika kulo ivela ku-Arduino. Kulokhu sinamathuba ahlukile afana ne-MIDI Monitor (OS X), MIDI-OX (Windows) noma iKmidimon (Linux)

Ukwenza isivivinyo esincane kufanele sixhume i-Arduino kwikhompyutha yethu bese senza ikhodi elandelayo:

#include
#include
#include
#include
#include

MIDI_CREATE_INSTANCE(HardwareSerial,Serial, midiOut); // crear objeto de salida MIDI llamado midiOut

void setup() {
Serial.begin(31250); // configuracion de serial para MIDI
}

void loop() {
midiOut.sendControlChange(56,127,1); // envío de señal MIDI CC -- 56 = nota, 127 = velocidad, 1 = canal
delay(1000); // retraso
midiOut.sendProgramChange(12,1); // envío de una señal MIDI PC -- 12 = valor, 1 = canal
delay(1000); // retraso de 1 segundo
}

Uma konke kuhambe kahle, ungaya ekuhlolweni kwenkinobho, uma ngabe lokhu kuhlolwa kungakusebenzelanga kufanele uqiniseke ukuthi konke ukuxhumana kuqondile, isekethe lifana ncamashi nomdwebo wangaphambilini, isifunda ixhunywe kusixhumi esibonakalayo se-USB-MIDI ngentambo ye-MIDI, izintambo ze-MIDI port zixhunywe kahle, ikhebula le-MIDI lixhunywe kokufakwayo kwesixhumi esibonakalayo se-USB-MIDI, ibhodi le-Arduino lixhunywe kahle kunethiwekhi kagesi futhi linamandla anele ...

Ukuhlola ukuthi izinkinobho zisebenza kahle

Ngaphambi kokuqhubeka nokondla uhlelo lwethu ngokusebenza okusha kanye nekhodi esingalahleka kuyo, kufanelekile ukuma isikhashana bese hlola ukuthi izinkinobho zisebenza kahle yini. Kubo kufanele silayishe ikhodi elandelayo:

const int boton1 = 6; // asignacion del boton a una variable
const int boton2 = 7; // asignacion del boton a una variable

void setup() {
Serial.begin(9600); // configuracion del serial
pinMode(boton1,INPUT); // configuracion del boton1 como entrada
pinMode(boton2,INPUT); // configuracion del boton2 como entrada
}

void loop() {

if(digitalRead(boton1) == HIGH) { // prueba de estado del boton1
delay(10); // retraso
if(digitalRead(boton1) == HIGH) { // prueba de estado de nuevo
Serial.println("Boton 1 funciona correctamente!"); // log
delay(250);
}
}

if(digitalRead(boton2) == HIGH) { // prueba de boton 2
delay(10); // retraso
if(digitalRead(boton2) == HIGH) { // prueba de estado de nuevo
Serial.println("Boton 2 funciona correctamente!"); // log
delay(250);
}
}

}

Le khodi kufanele nje ihlanganiswe futhi isetshenziswe ukuze ikhebula le-USB lixhunywe, lolu hlelo lusitshele uma ngabe kukhona izinkinobho ezicindezelwe.

Sakha isilawuli sethu se-MIDI esizenzele

Lapho nje sesikwenzile lokhu kuhlolwa, sekuyisikhathi sokuhlanganisa isilawuli sethu se-MIDI sokwenza lokho, kuzodingeka uhlanganise ikhodi elandelayo:

#include
#include
#include
#include
#include

const int boton1 = 6; // asignamos boton a la variable
const int boton2 = 7; // asignamos boton a la variable

MIDI_CREATE_INSTANCE(HardwareSerial,Serial, midiOut); // create a MIDI object called midiOut

void setup() {
pinMode(boton1,INPUT); // configuracion del boton1 como una entrada
pinMode(boton2,INPUT); // configuracion del boton2 como una entrada
Serial.begin(31250); // configuracion MIDI de salida
}

void loop() {
if(digitalRead(buttonOne) == HIGH) { // comprobacion de estado
delay(10); // retraso
if(digitalRead(buttonOne) == HIGH) { // comprobacion de estado de nuevo
midiOut.sendControlChange(56,127,1); // envío un MIDI CC -- 56 = nota, 127 = velocidad, 1 = canal
delay(250);
}
}

if(digitalRead(buttonTwo) == HIGH) { // comprobacion de estado
delay(10); // retraso
if(digitalRead(buttonTwo) == HIGH) { // nueva comprobacion de estado
midiOut.sendControlChange(42,127,1); // envío un MIDI CC -- 42 = nota, 127 = velocidad, 1 = canal
delay(250);
}
}
}

Njengemininingwane, ngikutshele ukuthi awukwazi ukusebenzisa umyalo weSerial.println () ngokukhipha kwe-MIDI ngalesi sikhathi, uma ufuna ukukhombisa uhlobo oluthile lomlayezo kukhompyutha, vele ushintshe:

midiOut.sendControlChange(42,127,1);

ngu:

midiOut.sendControlChange(value, channel);

lapho inani nesiteshi kufanele kube namanani owafunayo ofuna ukuwabonisa

Isibonelo sokusebenza:


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-4, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   Alfred kusho

    I-Arduino ikunikeza amathuba amaningi okwenza amaphrojekthi uwedwa https://www.juguetronica.com/arduino . Enye yezinto ezinhle kakhulu ukuthi ungaqala ngaphandle kokuba yingcweti bese uqhubeka nokufunda, ngaleyo ndlela uzikhuthaze ukuthi uzifundise.

  2.   UDaneli Roman kusho

    Ukubingelela

    Ngizama ukuqhuba lesi sifundo esihle… kepha ama- # includes awaphelele….

    Ungangitshela ukuthi iziphi ezidingekayo?

    Ngiyabonga kakhulu

  3.   Uel kusho

    Sawubona!
    Ngingathanda ukwenza imodyuli yesigubhu se-elekthronikhi ngokufaka esikhundleni sezinkinobho okokufaka kwe-jack okuzofika khona isiginali ye-piezoelectric.
    Ngabe kungenzeka ukukwenza?

  4.   U-Eduardo Valenzuela kusho

    Ngiyacela uma unganikeza okubandakanya le khodi, nginentshisekelo kule phrojekthi.