Cov txheej txheem:

Ua Si Tib Lub Suab Nkauj hauv Ntau Chav: 3 Kauj Ruam
Ua Si Tib Lub Suab Nkauj hauv Ntau Chav: 3 Kauj Ruam

Video: Ua Si Tib Lub Suab Nkauj hauv Ntau Chav: 3 Kauj Ruam

Video: Ua Si Tib Lub Suab Nkauj hauv Ntau Chav: 3 Kauj Ruam
Video: Zoo Siab Nrog Koj - Paj Tsua Thoj [ Official MV ] Nkauj Tawm Tshiab 2022 2024, Hlis ntuj nqeg
Anonim
Ua Si Tib Lub Suab Nkauj hauv Ntau Chav
Ua Si Tib Lub Suab Nkauj hauv Ntau Chav

Nyob zoo sawv daws, Kuv tsis paub txog koj tab sis kuv nyiam muaj suab paj nruag tib yam thoob plaws hauv kuv chav tsev yam tsis tig lub suab nrov dhau. Yog li tom qab tshawb fawb me ntsis txog qhov teeb meem no, Kuv txiav txim siab tsim ob peb tus neeg hais lus sib txuas los ntawm wifi mus rau tib lub suab paj nruag server txhawm rau ua suab paj nruag tib lub sijhawm hauv ntau chav thiab tshwj xeeb hauv chav dej.

Lub kaw lus yog ua raws GStreamer thev naus laus zis uas yog lub hauv paus ntawm qee qhov software zoo li VLC thiab hais lus nrog wifi muaj peev xwm siv Raspberry Pi.

Kauj Ruam 1: Tsim Tus Hais Lus rau Chav Dej

Tsim Tus Hais Lus rau Chav Dej
Tsim Tus Hais Lus rau Chav Dej
Tsim Tus Hais Lus rau Chav Dej
Tsim Tus Hais Lus rau Chav Dej
Tsim Tus Hais Lus rau Chav Dej
Tsim Tus Hais Lus rau Chav Dej

Daim Ntawv Teev Npe:

  • tus hais lus pov thawj chav dej
  • 2W amplifier (ua haujlwm ntawm 12v)
  • Raspberry Pi Zero (ua haujlwm ntawm 5v)
  • ib Pimoroni Phat DAC
  • ib daim npav SD
  • ON/OFF khawm
  • 12v lub zog hloov hluav taws xob + lub ntsaws sib xws
  • DC/DC nqis qis (12v-> 5v)
  • lub thawv hluav taws xob
  • qee cov kab

Kev tsim kho yog qhov ncaj ncaj.

Ntawm sab hluav taws xob, ua raws daim duab ASCII no.

  • DC ntsaws ON/OFF khawm amplifier
  • ON/OFF khawm DC/DC nqis-nqis Raspberry Pi
  • Raspberry Pi Phat DAC amplifier speaker

Ntawm lub tshuab khoos phis tawm, txiav txhua lub qhov xav tau hauv lub thawv hluav taws xob, muab txhua yam tso rau hauv thiab qhov ntawd yog txhua yam.

Siv cov txheej txheem no, koj tuaj yeem tsim txhua hom neeg hais lus uas koj xav tau.

Kauj ruam 2: Software Sab

Txhua lub software sab yog ua raws qhov qhib qhov txheej txheem kev tshaj tawm xov xwm, GStreamer. Kuv tsuas yog siv Linux tab sis nws muaj nyob ntawm OS sib txawv, yog li kuv xav tias txhua yam tuaj yeem hloov kho rau lwm OS.

Txhawm rau pib, koj yuav tsum nruab Raspbian Lite ntawm Pi, PHAT DAC thiab GStreamer 1.0 nrog cov "zoo" plugins. Hauv lub khoos phis tawj siv ua lub server nkauj, koj xav tau GStreamer tib yam. Kuv yuav tsis nthuav qhia cov khoom ntawd vim tias lwm tus tau ua qhov no zoo dua kuv. Qhov kawg xav tau yog Pi thiab lub server nkauj yuav tsum txuas nrog tib lub network los ntawm cable lossis wifi.

Txhawm rau sim yog tias GStreamer raug teeb tsa raug, koj tuaj yeem siv cov kab hais kom ua ntawd.

Ntawm tus neeg hais lus:

$ gst-launch-1.0 udpsrc chaw nres nkoj = 5000 caps = 'application/x-rtp, media = (string) audio, moos-rate = (int) 44100, encoding-name = (string) L16, encoding-params = (hlua) 1, raws = (int) 1, payload = (int) 96 '! rtpL16depay! audioconvert! autoaudiosink

Hauv PC:

$ gst-launch-1.0 audiotestsrc! audioconvert! audio/x-raw, format = "(string) S16BE", layout = "(string) interleaved", channels = 1, tus nqi = 44100! rtp16 ua! udpsink host = RASPBERRYPI_IP chaw nres nkoj = 5000

Tom qab koj tso tus IP chaw nyob zoo es tsis yog "RASPBERRYPI_IP", koj yuav tsum hnov lub suab sinusoidal ntawm tus hais lus. Qhov ntawd tsis yog yam koj yuav nyiam hnov ntev, yog li tsis txhob tso lub suab nrov nrov.

Qee qhov kev piav qhia: lub PC tsim cov suab sinusoidal siv "audiotestsrc", "audioconvert! Audio/x-raw, format =" (string) S16BE ", layout =" (string) interleaved ", channels = 1, rate = 44100" convert lub suab hauv hom ntawv zoo nkag siab los ntawm "rtpL16pay" uas tsim cov pob ntawv suab thiab thaum kawg "udpsink" xa cov pob ntawv siv UDP raws tu qauv. Ntawm tus hais lus, nws zoo ib yam tab sis ntxeev, "udpsrc" rov qab tau lub suab nrov, "rtpL16depay" de-packets thiab "audioconvert! Autoaudiosink" hloov lub suab kom haum rau hom ntawv ntawm daim npav suab tsis siv neeg thiab tau kawg, ua si.

Yog li tam sim no tias cov khoom yooj yim ua haujlwm, nws yog lub sijhawm mus ntxiv. Lub hom phiaj yog txhawm rau cuam tshuam lub suab ntawm daim ntawv thov kom xa nws los ntawm lub network.

- Peb tsim cov khoom cuav

$ pactl load-module module-null-sink sink_name = multiHP

- Peb txuas cov tswv yim mus rau qhov tso tawm tsis raug (ntsiag to xaiv daim ntawv thov (nkag mus))

$ pacmd list-sinks (daim ntawv teev cov txiaj ntsig)

$ pacmd list-sink-inputs (cov npe nkag)

$ pacmd txav-dab dej-input %input %output (hloov %input thiab %output los ntawm ib qho ntawm cov npe sib xws)

- Peb muab daim npav suab tshaj plaws

$ pactl teeb-dab dej-ntim 0 100%

- Peb sim hauv PC txoj hauv kev kom rov qab tau cov khoom cuav (rov qab lub suab)

$ gst-launch-1.0 pulsesrc ntaus ntawv = multiHP.monitor! audioconvert! autoaudiosink

Koj yuav tsum hnov dua lub suab ntawm daim ntawv thov uas koj tau xaiv.

Zoo kawg! Tam sim no nws yog lub sijhawm mus rau kab hais kom ua zaum kawg. Nov yog kab hais kom ua nyob rau hauv rooj plaub ntawm 2 tus neeg hais lus nrog lub suab kuj tau ua los ntawm PC.

Ntawm txhua Tus Hais Lus:

$ gst-launch-1.0 udpsrc chaw nres nkoj = 5000 caps = 'daim ntawv thov/x-rtp, media = (hlua) suab, moos-tus nqi = (int) 44100, encoding-name = (hlua) L16, encoding-params = (hlua) 2, payload = (int) 96 '! rtpL16depay! audioconvert! autoaudiosink

Hauv PC:

$ gst-launch-1.0 pulsesrc ntaus ntawv = multiHP.monitor! audioconvert! audio/x-raw, format = "(string) S16BE", layout = "(string) interleaved", channels = 2, tus nqi = 44100! rtp16 ua! tee npe = t. ! kab! udpsink host =%addrpi1 chaw nres nkoj = 5000 t. ! kab! udpsink tus tswv =%addrpi2 chaw nres nkoj = 5000 t. ! kab! audioconvert! autoaudiosink

Kauj Ruam 3: Xaus

Cov lus qhia no tsuas yog thawj kauj ruam rau txoj haujlwm tiav. Nws tsuas yog piav qhia lub hauv paus ntsiab lus. Tam sim no koj tuaj yeem siv tus kheej los ntawm kev sau qee tsab ntawv ntawm Raspberry Pi khau raj thiab hauv PC. Koj tuaj yeem hloov kho GStreamer hais kom ua raws li koj xav tau. Kuv tus kheej tau hloov kho kuv cov ntawv qhia yav dhau los (QHOV TSHIAB TSHIAB OLD RADIO) txhawm rau siv nws ua tus hais lus. Muaj ntau yam tsis kawg uas yuav tsum tau ua txhawm rau txhim kho lub suab ntau chav no. Tshwj xeeb, txhua tus neeg hais lus tsis sib xyaw, yog li koj muaj qee qhov kev hloov pauv thaum koj hloov pauv ntawm ib chav mus rau lwm qhov.

Kuv vam tias koj yuav sim thiab txhim kho cov lus qhia no.

Tsis txhob ua siab deb nug cov lus nug yog tias koj xav tau cov ntsiab lus.

Zoo tinker!

Pom zoo: