Cov txheej txheem:

Raspberry Pi Nruas Tshuab: 5 Kauj Ruam
Raspberry Pi Nruas Tshuab: 5 Kauj Ruam

Video: Raspberry Pi Nruas Tshuab: 5 Kauj Ruam

Video: Raspberry Pi Nruas Tshuab: 5 Kauj Ruam
Video: Yasmi - Txiv Nraug Ntsuag ft. JN Vang (Music Video) 2024, Kaum ib hlis
Anonim
Raspberry Pi Nruas Tshuab
Raspberry Pi Nruas Tshuab

Qauv Sequencer, ntawm Raspberry Pi + Python.

Lub sequencer muaj 4 polyphony thiab tso cai rau tus neeg siv khaws thiab cue txog 6 ntu sib txawv uas lawv tuaj yeem hloov pauv ntawm lub sijhawm tiag, thiab txhawb kev muaj peev xwm hloov pauv ntawm cov qauv sib txawv.

Kuv tau sau tsab ntawv hauv txoj hauv kev uas ua haujlwm tau zoo nrog MIDI tus tswj thiab suab tiag tiag. Kuv siv 18 lub txhab nyiaj sib txawv, 16 qhov piv txwv txhua, txawm li cas los xij ntxiv lossis rho tawm cov txhab nyiaj thiab cov qauv yog yooj yim thiab tsis xav tau ntau yam kev hloov kho. Yog tias koj muaj teeb meem tua kuv tus email: [email protected]

Nrhiav tus lej ntawm GitHub ntawm:

Thov qhia rau kuv paub yog tias koj siv nws, thiab tshwj xeeb tshaj yog yog tias koj ua yeeb yaj kiab nrog nws!

Kauj ruam 1: Dependancies

Txoj haujlwm no xav tau cov hauv qab no (tsis tsim hauv) Python Modules:

mido

paj

xov

Txawm li cas los xij, Mido cuam tshuam qee qhov teeb meem raws li Mido nws tus kheej xav tau ob peb qhov kev cia siab. Txhawm rau kom ntseeg tau tias lawv txhua tus tau teeb tsa, tsuas yog ntaus cov lus txib hauv qab no rau hauv lub davhlau ya nyob twg ntawm koj li Raspberry Pi (rho tawm '$') thiab txhua yam yuav zoo. Lwm qhov modules tuaj yeem teeb tsa ib txwm.

$ sudo apt-tau hloov tshiab

$ sudo apt-tau nruab tsim tsim-qhov tseem ceeb

$ sudo apt-tau nruab libasound-dev lossis libasound2-dev

$ sudo apt-tau nruab libjack0

$ sudo apt-tau nruab libjack-dev

$ sudo apt-tau nruab sej-pip

$ sudo apt-tau nruab sej-dev

$ sudo pip nruab sej-rtmidi

$ sudo pip nruab nruab nrab

Kauj Ruam 2: Txheeb Xyuas Midi Cov Lus Taw Qhia Qhov Tseem Ceeb

Txhim Kho Midi Cov Lus Qhia Tawm
Txhim Kho Midi Cov Lus Qhia Tawm

Hauv ntu Python Script tseem ceeb muaj cov kab ntawv hu ua noteList uas suav nrog 16 tus lej (kab 165.) Cov no yog MIDI cov ntawv ceeb toom qhov tseem ceeb uas peb tus tswj hwm xa mus rau Pi kom ua rau muaj suab nrov. Txhua tus tswj hwm nruab nrab yog qhov sib txawv txawm li cas los xij, tshwj tsis yog tias koj tseem muaj Akai LPD8 koj yuav zoo li yuav hloov pauv qhov txiaj ntsig no kom haum koj lub cuab yeej.

Github repo tseem suav nrog lwm tsab ntawv hu ua "midihelp.py" uas tau ua tshwj xeeb rau lub hom phiaj no! Txhua yam nws ua yog luam tawm cov txiaj ntsig nkag los ntawm thawj MIDI tus tswj hwm lub khoos phis tawj lees paub rau lub console. Txhua yam koj yuav tau ua yog hloov cov txiaj ntsig no hauv kab ntawv yog tias lawv txawv ntawm qhov uas suav nrog hauv noteList.

Qhov kev txiav txim rau cov ntawv kuj tseem cuam tshuam nrog lub suab zoo li cas rau ib daim nplaub tshev, yog li nco ntsoov tias hauv siab ib yam.

Kauj Ruam 3: Ntxiv Cov Ntawv Ntxiv Nrog Cov Qauv

Cov khoom siv piv txwv hauv tsab ntawv tau khaws cia ntawm cov ntawv tais ceev tseg hauv tib phau ntawv teev npe, teeb tsa raws nraim li cas 808 cov khoom siv nyob hauv GitHub cov ntaub ntawv. Txoj kev no kuv tuaj yeem muaj txhua yam ntawm cov qauv sib txawv sib txawv khaws cia hauv cov ntawv tais ceev tseg uas tau yooj yim teeb tsa thiab hloov pauv.

Tsuas yog qhov hloov pauv hauv tsab ntawv nws tus kheej yog qhov sib txawv foldNum uas tsuas yog qhia rau tsab ntawv muaj pes tsawg daim nplaub tshev ntawm cov qauv muaj. Tam sim no tsab ntawv muaj foldNum teeb tsa rau ib qho vim tias tsuas muaj ib qho subfolder nyob hauv tib phau ntawv (808 cov khoom siv.) Cov nplaub tshev siab tshaj plaws uas tsab ntawv tuaj yeem tuav tau tam sim no yog 18, uas yog pes tsawg kuv tab tom siv, txawm li cas los xij nws tsis ncaj ncees rau hloov qhov no, qhia rau kuv paub yog tias koj xav tau kev pab.

Cov npe ntawm cov ntawv tsis muaj teeb meem tiag tiag (tsuav yog lawv txhua tus sib txawv) raws li Tsab Ntawv tsuas yog nyeem cov ntawv tais ceev tseg hauv tib phau ntawv teev npe thiab nkag mus rau txoj hauv kev ntawd. Cov npe ntawm cov ntaub ntawv lawv tus kheej tseem ceeb dua, ntau ntxiv txog qhov ntawd hauv cov kauj ruam tom ntej.

Kauj Ruam 4: Ntxiv thiab Kho Cov Qauv Ntxiv Hauv Cov Ntawv Tshiab

Ntxiv thiab teeb tsa Cov Qauv Ntxiv Hauv Cov Ntawv Tshiab
Ntxiv thiab teeb tsa Cov Qauv Ntxiv Hauv Cov Ntawv Tshiab

Lub suab tau thauj mus rau tus piv txwv ntawm cov ntawv tais ceev tseg hauv tib phau ntawv teev npe uas muaj.wav cov ntaub ntawv nrog cov npe suav sau nruab nrab ntawm 0-15. Saib cov ntawv suav nrog 808 rau qhov piv txwv ntawm qhov no. Txhua lub subfolder nrog cov qauv yuav tsum zoo ib yam rau ib leeg.

Qhov ntsuas ntawm MIDI cov tswv yim hauv kab ntawv sau cov npe sib xws raws nraim rau.wav cov ntaub ntawv npe.

Piv txwv li:

  • thaum koj ua rau MIDI ceeb toom khaws cia hauv noteList [0] cov ntaub ntawv wav 0.wav yuav ua si.
  • thaum koj ua rau MIDI ceeb toom khaws cia hauv noteList [8] cov ntaub ntawv wav 8.wav yuav ua si.

Kuv tau ua qhov no ib feem kom txhua tus tswj MIDI tuaj yeem teeb tsa tau yooj yim los ua haujlwm nrog tsab ntawv, thiab tseem yog li kuv tuaj yeem yooj yim ncua lossis txwv tus qauv thiab tus lej nkag, nrog rau teeb tsa cov ntaub ntawv thiab tsab ntawv kom ncaws tawm nruas suab, piv txwv li, ib txwm yuav raug khaws tseg raws li 0.wav thiab yuav tshwm sim los ntawm thawj MIDI ceeb toom.

Kuv tau xaiv 16 qhov txiaj ntsig me ntsis raws li qhov xav tau kom sib haum rau 16 cov tswv yim ntawm kuv tus tswj, yog li yog tias koj xav ua tus lej nrog tsuas yog 1 tus qauv, lossis nrog ntau ntxiv, txhua yam koj yuav tsum tau ua yog suav cov suab ntaub ntawv raws li thiab rho tawm lossis ntxiv cov lej khaws cia hauv qhov noteList array kom phim.

Yog tias suav nrog 808 cov khoom ua haujlwm kom raug tab sis koj muaj teeb meem nrog koj tus kheej cov qauv kev daws teeb meem feem ntau yuav hloov pauv tus qauv piv txwv ntawm cov ntaub ntawv kom phim PyGame's 22, 050khz tus qauv tus nqi thiab qhov tob ntawm 16. Koj tuaj yeem ua qhov no hauv Audacity lossis lwm yam Audio editing software. Lawv yuav tsum ua haujlwm zoo los ntawm qhov ntawd!

Kauj Ruam 5: Tus lej Naj Npawb Siv

Ok muaj ntau yam khoom mus rau hauv ntu ntu, ntau dua qhov kuv tau muaj hauv siab, yog li kuv crammed me ntsis mus rau Number Pad kom haum rau kev ua haujlwm ntau ntxiv. Qhov no hauv siab, Lub Hnub Qub * thiab Lub Sijhawm. ob leeg ua haujlwm raws li cov yuam sij.

NTAWV

MAINFUNCTIONS

[8] - Toggle Metronome qhib thiab tawm

[9] - Toggle Cov Ntaub Ntawv Kaw thiab qhib

[Nkag mus] - Ua si/Ncua ntu

[0] - Rho Tawm Cov Lus Cim Tam Sim No

[Num Xauv thiab *] - Kaw

[MIDI Nco Ntsoov thiab.] - Tsis txhob suav rau tus lej

TEMPO FUNCTIONS

[+] - Kawm kom nrawm BPM

[-] - Kev Kawm qeeb BPM

[+ thiab *] - Ceev nrawm BPM

[- thiab *] - Ceev ceev qeeb BPM

[+ thiab.] - Ua kom nrawm dua BPM

[- thiab.] - Ua Kom qeeb qeeb BPM

SEQUENCE FUNCTIONS

[1-6] Nco Ntsoov 1-6

[1-6 thiab.] Khaws Sequence 1-6

[0 thiab.] Ntsib Tam Sim No

Hloov Cov Ntawv Qub

[1-9 thiab *]-Hloov mus rau Qauv Pob hauv Cov Ntawv 1-9

[1-9 thiab * thiab.]-Hloov mus rau Qauv Pob hauv Cov Ntawv 10-18

ZOO TSHAJ PLAWS:

-Clear cov ntu tam sim no [0 thiab.] Thiab khaws nws rau txhua ntu uas koj xav tau tshem tawm ntawm kev nco.

-Sau ib ntu zuj zus thiab khaws nws mus rau tus lej sib txawv los theej nws.

Pom zoo: