Cov txheej txheem:

Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI: 6 Kauj Ruam (nrog Duab)
Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI: 6 Kauj Ruam (nrog Duab)

Video: Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI: 6 Kauj Ruam (nrog Duab)

Video: Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI: 6 Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image
Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI
Cov Txiv Hmab Txiv Ntoo Ceev Nrog MIDI

Nov yog qhov yooj yim tiag tiag capacitive-kov piano. Coj mus rhaub cov txiv hmab txiv ntoo, cov kaus poom dej qab zib, fwj dej, kab txaij ntawm txhuas ntawv ci, thiab lwm yam, thiab koj tau txais cov suab paj nruas polyphonic los ntawm koj lub computer. Tam sim no qhov software tau sau, txoj haujlwm yuav tsum tsis siv sijhawm ntau dua 10 feeb los tso ua ke nrog Arduino version.

Koj xav tau:

  • Arduino (Mega rau 8 tus yuam sij, Uno rau 6 tus yuam sij) lossis cov ntsiav tshuaj dub STM32F103C8 pawg thawj coj ($ 2 ntawm Aliexpress) ntxiv rau UART-rau-USB hloov pauv (piv txwv li, Arduino lossis CH340)
  • USB cable
  • qee cov ntawv txhuas
  • ntsuas cov yeeb yaj kiab zoo, tab sis cov dhia thiab cov ntawv kaw yuav ua (lub tswv yim rau qhov ntawd los ntawm no)
  • txiv hmab txiv ntoo, los yog playdough, los yog daim ntawv nrog cov xim uas muaj xim xaum
  • khoos phis tawj.

Tsis xav tau cov khoom siv ntxiv, vim qhov no siv cov cai los ntawm martin2250 qhov ci ntsa iab ADCTouch lub tsev qiv ntawv thiab Arduino xa MIDI cov lus txib hla mus rau lub khoos phis tawj. Arduino's audio playback yog ib qho ntawm cov ntawv suav nrog nab nab hauv computer lossis tsis muaj plaub-nruab nrab.

Yog tias koj siv pawg tswj hwm kev txhim kho STM32F103C8, tom qab ntawd nws tseem zoo dua: ntaus piano ua tus tswj hwm USB MIDI tiag, tsis tas yuav tsum muaj plaub hau-nruab nrab.

Nco tseg: Txhawm rau tiv thaiv kev puas tsuaj rau Arduino/STM32F1 los ntawm hluav taws xob zoo li qub, tshwj xeeb tshaj yog nyob rau hnub qhuav lossis ntawm cov ntaub pua plag, Kuv hais kom tsis txhob kov cov ntawv txhuas lossis cov ntawv ntsuas thaum lub cuab yeej ua haujlwm. Hloov chaw, kov cov txiv hmab txiv ntoo, cov khoom ua si, thiab lwm yam, nws qhov kev tiv thaiv yuav tsum muab qee qhov kev tiv thaiv ESD

Kauj ruam 1: Arduino Libraries

Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino

Hauv Arduino IDE, xaiv Sketch | Suav nrog Tsev Qiv Ntawv | Tus Thawj Saib Xyuas Tsev Qiv Ntawv. Nrhiav kuv ADCTouchSensor. Nruab lub tsev qiv ntawv.

Tom qab ntawv xaiv File | Piv txwv | ADCTouchSensor | CapacitivePiano.

Yog tias koj muaj Arduino, ntsaws koj Arduino rau hauv koj lub khoos phis tawj USB chaw nres nkoj thiab xa daim duab CapacitivePiano rau koj Uno lossis Mega. Cov duab kos yuav xa cov ntaub ntawv mus rau lub khoos phis tawj ntawm USB cov lej raws li qhov ntawm 8 (Mega) lossis 6 (Uno) lub peev xwm ntsuas tau tshwm sim.

Yog tias koj muaj STM32F103C8, xub teeb tsa lub bootloader thiab teeb tsa Arduino IDE rau nws (nrog kuv cov ceg ntawm addMidiHID ceg) ua raws li thawj peb kauj ruam ntawm no. Tom qab ntawd rov qab mus rau Tus Thawj Saib Xyuas Tsev Qiv Ntawv, thiab tshawb nrhiav kuv lub tsev qiv ntawv USBHID_stm32f1. Nruab nws.

Kauj Ruam 2: Txuas Cov Leads rau Piano Keys

Txuas Cov Leads rau Piano Keys
Txuas Cov Leads rau Piano Keys
Txuas Cov Leads rau Piano Keys
Txuas Cov Leads rau Piano Keys

Khiav cov xov hlau los ntawm A0-A7 (A0-A5 ntawm Uno) pins ntawm koj Arduino lossis STM32F103C8 rau txhua yam uas koj xav ua haujlwm li cov yuam sij piano. Piv txwv li, Kuv tau siv cov dhia nrog cov nab kuab lossis cov ntawv ntsuas mus rau hauv cov ntawv txhuas txhuas ntawm txhua qhov uas kuv tau muab ib lub peev xwm ntawm dej qab zib lossis txiv kab ntxwv ua qhov tseem ceeb. Cov ntawv txhuas tuaj yeem siv ua tus yuam sij ncaj qha. Lossis ib tus tuaj yeem xaim xaim rau hauv cov txiv hmab txiv ntoo lossis zaub los yog cov khoom ua si.

Kauj Ruam 3: Txhim Kho Software: Xaiv A: Arduino thiab Hairless MIDI rau Serial Bridge

Koj tuaj yeem rub tawm thiab teeb tsa Hairless MIDI rau Serial Bridge (Yeej/OSX/Linux) txhawm rau txuas Arduino's USB-serial output nrog koj lub khoos phis tawj lub tshuab ua ke.

Yog tias koj muaj Windows 7 lossis tshiab dua, koj tuaj yeem siv built-in Microsoft Wavetable GS Synth, yog li txhua yam koj xav tau los teeb tsa yog Hairless. Qee qhov software rov ua haujlwm yuav xav tau loopMIDI.

Ntawm lwm lub tshuab, koj yuav xav tau MIDI cov khoom sib xws xws li VirtualMidiSynth lossis Garageband. Koj kuj tseem tuaj yeem siv VirtualMidiSynth ntawm Windows yog tias koj nyiam.

Kauj Ruam 4: Nruab Software: Xaiv B: Arduino thiab Python

Nruab Software: Xaiv B: Arduino thiab Python
Nruab Software: Xaiv B: Arduino thiab Python

Koj kuj tseem tuaj yeem siv qhov yooj yim suav nrog Python tsab ntawv uas rov ua cov ntawv MIDI.

Nco ntsoov tias koj tau nruab Python hauv koj lub computer. Ib qho 2.7 lossis 3.x yuav ua.

Nco ntsoov tias koj tau nruab pob pygame Python. Yog tias tsis yog, khiav qhov no los ntawm kab hais kom ua:

nab hab sej -m pip nruab pygame

Nrhiav seb qhov chaw nyob koj Arduino qhov chaw nres nkoj txuas yog dab tsi. Koj Arduino IDE yuav muaj cov chaw nres nkoj txuas hauv qab Cov Cuab Yeej | Chaw nres nkoj.

Hauv CapacitivePiano pob uas koj rub tawm, koj yuav pom cov nkauj.py tsab ntawv uas yog PC sab ntawm txoj haujlwm.

Kauj Ruam 5: Nruab Software: Xaiv C: STM32F103C thiab MIDI Synthesizer Software

Nruab Software: Xaiv C: STM32F103C thiab MIDI Synthesizer Software
Nruab Software: Xaiv C: STM32F103C thiab MIDI Synthesizer Software

Yog tias koj muaj STM32F103C, koj tuaj yeem siv cov software uas ua haujlwm nrog MIDI cov keyboard tswj.

Ntawm lub khoos phis tawj, Kuv siv Virtual MIDI Piano Keyboard (VMPK). Nrog STM32F103C ntsaws rau hauv, xaiv Kho kom raug | MIDI Kev Sib Txuas | Tawm tswv yim MIDI Kev Sib Txuas, thiab tom qab ntawd xaiv Maple MIDI lossis Diro Synth.

Ntawm lub cuab yeej Android, Kuv tau ua tiav siv (nrog USB OTG cable) Common Analog Synthesizer thiab Synth DX7 Piano.

Kauj ruam 6: Ua si

Ua si!
Ua si!
Ua si!
Ua si!
Ua si!
Ua si!

Txuas lub Arduino nrog CapacitivePiano kos duab rau hauv lub computer. Tsis txhob kov ib qho ntawm "cov nyees khawm" kom txog thaum tsuas yog lub zog LED khiav, kom tso lub khawm muaj peev xwm los ntsuas.

Rau qhov tsis muaj kev xaiv, khiav Hairless MIDI choj, xaiv qhov chaw nres nkoj txuas los ntawm daim ntawv teev npe. Tom qab ntawd xaiv tus synthesizer. Ntawm Windows, yog tias koj xaiv Microsoft Wavetable GS Synth, txhua yam yuav tsum tsuas yog ua haujlwm.

Yog tias koj xav siv Python tsab ntawv hloov chaw, nco ntsoov tias koj nyob hauv cov npe uas koj muaj piano.py, thiab khiav:

nab hab sej piano.py serialport

qhov twg serialport yog qhov chaw nres nkoj ntawm Arduino IDE (piv txwv li, COMx ntawm Windows).

Yog tias koj siv STM32F103C8, tom qab ntawd siv qhov koj nyiam MIDI synthesizer software ntawm lub khoos phis tawj lossis xov tooj ntawm tes.

Tam sim no nias koj "khawm" thiab muaj kev lom zem!

Cov tswv yim kev kawm rau menyuam sim nrog:

  • Kev sim nrog cov khoom sib txawv ntawm cov ntawv txhuas thiab saib cov twg ua haujlwm thiab qhov twg tsis yog-thiab tom qab ntawd tham txog vim li cas cov haujlwm no thiab lwm tus tsis ua.
  • Playdough ua haujlwm tau zoo tiag tiag (thiab tom qab ntawd koj tsis txawm xav tau cov ntawv ci thiab cov ntawv nplaum-koj tuaj yeem tsuas yog lo xov hlau rau hauv playdough, txawm tias lees tias nws zoo li lub foob pob!).
  • Koj tseem tuaj yeem nqa ib daim ntawv thiab ntxoov ntxoo hauv thaj chaw uas muaj tus xaum (nws tsis tas yuav tsaus ntuj, tab sis hla-daug yog qhov zoo) thiab kaw cov ntawv hauv.
  • Koj tuaj yeem txuas tus nab kuab mus rau qhov khoom loj heev, zoo li lub npoo ntawm daim txiag ntoo, thiab ua cov yawm sij loj.
  • Ib qho kev sim sim yog kom muaj tus neeg me dua tuav tus nab kuab txuas rau ib qho ntawm cov xov hlau, thiab tom qab ntawd muaj tus neeg loj dua tuav tes nrog lossis siab-tsib tus neeg me dua, thiab saib yog tias sau npe. Tom qab ntawd sim dua nrog tus neeg loj dua tuav nws thiab tus me me kov lawv.

Tsuas yog xyuas kom tseeb tias tom qab txhua qhov kev hloov pauv ntawm dab tsi txuas rau Arduino, koj rov pib dua Arduino, txawm tias yog nias lub pob "rov pib dua" lossis los ntawm kev rov txuas lub USB txuas (thiab tom qab rov qhib cov nab npawb nab npawb, vim nws yuav zaum tsoo), txhawm rau txhawm rau txheeb xyuas cov sensors.

Ib tus tuaj yeem tham txog kev muaj peev xwm hluav taws xob thiab kev nkag siab zoo.

Pom zoo: