mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-06 01:20:12 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
12cc07c11e
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12473-1.html)
|
||||
[#]: subject: (Defining cloud native, expanding the ecosystem, and more industry trends)
|
||||
[#]: via: (https://opensource.com/article/20/7/cloud-native-expanding-and-more-industry-trends)
|
||||
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
> 每周关注开源社区和行业趋势。
|
||||
|
||||
![Person standing in front of a giant computer screen with numbers, data][1]
|
||||

|
||||
|
||||
我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员、经理和其他相关人定期发布有关开源社区、市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的几篇文章。
|
||||
|
@ -1,81 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (GNU Health expands Raspberry Pi support, Megadeth's guitarist uses open source principles, and more open source news.)
|
||||
[#]: via: (https://opensource.com/article/20/6/news-june-23)
|
||||
[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo)
|
||||
|
||||
GNU Health expands Raspberry Pi support, Megadeth's guitarist uses open source principles, and more open source news.
|
||||
======
|
||||
Catch up on the biggest open source headlines from the past two weeks.
|
||||
![][1]
|
||||
|
||||
In this week’s edition of our open source news roundup, GNU Health expands to Raspberry Pis, how Megadeth's guitarist uses open source principles, and more open source news.
|
||||
|
||||
### GNU Health expands its support for Raspberry Pi
|
||||
|
||||
The GNU Health project, designed to help hospitals run on low-cost software and hardware, expanded its support for Rapsberry Pi models in its recent release [according to CNX][2]. The GNU Health Embedded version that runs on Raspberry Pis is "especially suited for remote areas without internet, academic Institutions, domiciliary units, home nursing, and laboratory stations."
|
||||
|
||||
> *"GNU Health (GH) is a free and open-source Health and Hospital Information System (HIS) that can manage the internal processes of a health institution, such as financial management, electronic medical records (EMR), stock & pharmacies or laboratories (LIMS)." *
|
||||
|
||||
GNU Health is a free and open source health and hospital information system (HIS) to help healthcare systems manage finances, pharmacies, electronic medical records (EMRs), and more. The Raspberry Pi solution supports real-time monitoring of vital signs in hospitals, and retrieve information from labs.
|
||||
|
||||
More details may be found on [the official website][3].
|
||||
|
||||
### Megadeth's guitarist brings OSS approaches to music
|
||||
|
||||
Heavy metal fans likely know Kiko Loureiro as Megadeth's guitarist. Loureiro is less known in the OSS world, but that might change soon: His new solo album is called _Open Source_.
|
||||
|
||||
"By definition, 'open source' is related to softwares [in] which the original source code is made freely available and may be redistributed and modified," Loureiro shared [in a recent interview.][4] "It brings us a higher sense of community, enhances our creativity and creates new possibilities."
|
||||
|
||||
In true open source fashion, Loureiro is running an Indiegogo fundraiser to [keep his album][5] independent. His fundraiser emphasizes the "Open Source Mentality," which includes making his song's stems available for listeners to remix.
|
||||
|
||||
### The Linux Foundation partners with Harvard for a FOSS contributor security survey
|
||||
|
||||
The Linux Foundation's Core Infrastructure Initiative (CII) launched [a survey for FOSS contributors][6] addressing security concerns in open source. CII developed the survey in partnership with the Laboratory for Innovation Science at Harvard (LISH). FOSS contributors can [take the survey][7] through early August.
|
||||
|
||||
This new survey follows [the Census II analysis and report][8], which assessed popular FOSS components for vulnerabilities. David A. Wheeler, The Linux Foundation's director of open source supply chain security, said the survey is essential since open source solutions are used so widely now.
|
||||
|
||||
Along with its reports and surveys, CII built a [Best Practices badge program][9] that encourages developers to audit their solutions for security threats.
|
||||
|
||||
### In other news
|
||||
|
||||
* [OpenStack adds the StarlingX edge computing stack to its top-level projects][10]
|
||||
|
||||
* [OpenSAFELY is a new secure analytics platform for electronic health records in the NHS][11]
|
||||
|
||||
* [Linux Kernel 5.6 Reached End of Life, Upgrade to Linux Kernel 5.7 Now][12]
|
||||
|
||||
|
||||
|
||||
|
||||
Thanks, as always, to Opensource.com staff members and [Correspondents][13] for their help this week.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/news-june-23
|
||||
|
||||
作者:[Lauren Maffeo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lmaffeo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd
|
||||
[2]: https://www.cnx-software.com/2020/06/15/gnu-health-embedded-open-source-health-platform-works-on-raspberry-pi-3-4-and-soon-olimex-sbcs
|
||||
[3]: https://www.gnuhealth.org/#/embedded
|
||||
[4]: https://www.blabbermouth.net/news/megadeths-kiko-loureiro-unveils-cover-art-for-open-source-solo-album/
|
||||
[5]: https://www.indiegogo.com/projects/kiko-loureiro-new-open-source-album#/
|
||||
[6]: https://www.linuxfoundation.org/blog/2020/06/linux-foundation-harvard-announce-free-libre-and-open-source-software-foss-contributor-survey/?SSAID=389818&sscid=61k4_isd0j
|
||||
[7]: https://hbs.qualtrics.com/jfe/form/SV_enfu6tjRM0QzwQB
|
||||
[8]: https://www.coreinfrastructure.org/programs/census-program-ii/
|
||||
[9]: https://www.linuxfoundation.org/blog/2020/06/why-cii-best-practices-gold-badges-are-important/?SSAID=389818&sscid=61k4_isyv5
|
||||
[10]: https://techcrunch.com/2020/06/11/openstack-adds-the-starlinkx-edge-computing-stack-to-its-top-level-projects/
|
||||
[11]: https://opensafely.org/
|
||||
[12]: https://9to5linux.com/linux-kernel-5-6-reached-end-of-life-upgrade-to-linux-kernel-5-7-now
|
||||
[13]: https://opensource.com/correspondent-program
|
@ -1,68 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (The ultimate guide to contributing to open source, an unparallelled reliance on Linux, and more industry trends)
|
||||
[#]: via: (https://opensource.com/article/20/6/linux-industry-trends)
|
||||
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
|
||||
|
||||
The ultimate guide to contributing to open source, an unparallelled reliance on Linux, and more industry trends
|
||||
======
|
||||
A weekly look at open source community and industry trends.
|
||||
![Person standing in front of a giant computer screen with numbers, data][1]
|
||||
|
||||
As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update.
|
||||
|
||||
## [How to Contribute to Open Source: The Ultimate Guide][2]
|
||||
|
||||
> “The biggest challenge for most people is that they don’t identify their areas of interest and where they can help us. They come to the project and ask, ‘How can I help?’” he said. “Instead, they could say, ‘This is the skill set I’d like to achieve.’ For example, ‘I’d like to develop some specific functionality for this piece of the project.’”
|
||||
|
||||
**The impact**: Saying "I want to contribute to open source" is a bit like saying "I want to work in the not-for-profit sector". Open source is a means to an end, and there is almost certainly a project working toward the end you care about that could use the skills you have.
|
||||
|
||||
## [Vulnerability Scoring Struggles to Remain Viable in the Era of Cloud Native Computing][3]
|
||||
|
||||
> To this claim, Danen said, “It was designed to indicate the severity of a flaw relative to other flaws. Nowhere will you see it described, by FIRST who created it, as a means of assessing risk. So yes, reliable to describe the mechanics of a vulnerability, but wholly inadequate to describe the risk of the vulnerability to a particular organization or environment.”
|
||||
|
||||
**The impact**: Using the [Common Vulnerability Scoring System][4] (CVSS) classification systems for vulnerabilities is becoming more difficult. Non-experts will usually use a number that describes something in the easiest possible way. The challenge is for experts is to make sure that the easiest possible way is also the right way.
|
||||
|
||||
## [The rise of parallel serverless compute][5]
|
||||
|
||||
> So why isn’t everything fast, amazing, and running this way already? One of the challenging parts about this today is that most software is designed to run on single machines, and parallelization may be limited to the number of machine cores or threads available locally. Because this architecture & “serverless compute” is so new (_cough cough 2014_), most software is not designed to leverage this approach. I see this changing in the future as more become aware of this approach.
|
||||
|
||||
**The impact**: It is actually hard to think scalably and takes a lot of practice to mentally understand what can be done alongside other things and what has to be done sequentially.
|
||||
|
||||
## [From Earth to orbit with Linux and SpaceX][6]
|
||||
|
||||
> Ordinary? Yes, ordinary. You see, spacecraft CPUs are far from the newest and greatest. They're developed for spacecraft, which takes years -- even decades -- to go from the drafting board to launch. For example, the International Space Station (ISS) runs on 1988-vintage 20 MHz Intel 80386SX CPUs. We don't know, however, what chips the Falcon 9 uses. Chances are, though, their design is at least a decade older than what you'd buy at a Best Buy now.
|
||||
|
||||
**The impact**: If your time horizon is measured in decades, there is a good chance Linux is your best option for a stable operating system.
|
||||
|
||||
## [Why the Success of Edge Computing Relies on a Linux Legacy][7]
|
||||
|
||||
> For edge computing innovation, we need to be thinking more about how we create sustainable solutions and technologies given how many deployments will require a longer life cycle and are more tightly bound to hardware and equipment refreshes. The path of innovation leads from Linux to and through the network edge. Companies that follow this approach will be better positioned to leverage the promise and power of the edge while avoiding fragmentation and lock-in.
|
||||
|
||||
**The impact**: Edge devices can't (shouldn't?) be ephemeral; to get the value we're promised by cheap, always on, always monitoring, always streaming devices they really need to be reliable over time. Linux = sustainability.
|
||||
|
||||
_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/linux-industry-trends
|
||||
|
||||
作者:[Tim Hildred][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/thildred
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data)
|
||||
[2]: https://builtin.com/software-engineering-perspectives/open-source-contribution
|
||||
[3]: https://thenewstack.io/cvss-struggles-to-remain-viable-in-the-era-of-cloud-native-computing/
|
||||
[4]: https://www.first.org/cvss/
|
||||
[5]: https://davidwells.io/blog/rise-of-embarrassingly-parallel-serverless-compute
|
||||
[6]: https://www.zdnet.com/article/from-earth-to-orbit-with-linux-and-spacex/
|
||||
[7]: https://devops.com/why-the-success-of-edge-computing-relies-on-a-linux-legacy/
|
76
sources/talk/20200731 Linux dominates supercomputing.md
Normal file
76
sources/talk/20200731 Linux dominates supercomputing.md
Normal file
@ -0,0 +1,76 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Linux dominates supercomputing)
|
||||
[#]: via: (https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
Linux dominates supercomputing
|
||||
======
|
||||
The Linux operating system runs all 500 of the world’s fastest supercomputers, which help to advance artificial intelligence, machine learning and even COVID-19 research.
|
||||
Wikipedia
|
||||
|
||||
In addition to all its other successes, Linux dominates supercomputing: All 500 of the worlds fastest supercomputers run Linux, and that has been the case since November 2017, according to the [TOP500][1] organization, which has been ranking the 500 most powerful computer systems since 1993. (A graph of Linux' ascension is available on [here][2].)
|
||||
|
||||
How did this happen?
|
||||
|
||||
[[Get regularly scheduled insights by signing up for Network World newsletters.]][3]
|
||||
|
||||
### A little history
|
||||
|
||||
Linux began life in 1991 as the personal project of 21-year-old Finnish student Linus Torvalds. I first became aware of it several years later while working at Johns Hopkins University’s physics and astronomy department where I managed the department’s network and a number of servers with the help of a couple grad students.
|
||||
|
||||
At the time, I was intrigued by Linux, but couldn’t imagine how dominant the OS would become simply because its source code was available to anyone who wanted to work with it. I could not forsee that a significant group of large companies would grasp its value, work together and innovate to make Linux what it is today. Intense collaboration was key to this success, including contributions from countless individuals and organizations that includes IBM, Intel, NVIDIA, Red Hat, Samsung, SUSE and many others. (Browsing the [corporate members of the Linux Foundation][4] is likely to make your jaw drop.)
|
||||
|
||||
The success of Linux can also be attributed to the fact that it is open source, non-proprietary, and extendable.
|
||||
|
||||
### The TOP500
|
||||
|
||||
Twice a year, in June and November, TOP500 releases it a list of the 500 most powerful computer systems ranked by their performance on something called the [LINPACK Benchmark][5], which calls for the computer being tested to solve a dense system of linear equations.
|
||||
|
||||
I have heard it said, though not been able to verify, that Linux runs on more than 90% of public clouds, more than 60% of embedded systems and IoT devices, as much as 99% of supercomputers and more than 80% of smartphones. If these claims are even close to the truth, it attests to the success and versatility of Linux
|
||||
|
||||
In [the most recent TOP500 ranking][6], a Japanese supercomputer name [Fugaku][7] (derived from an alternate name for Mount Fuji) has taken the top spot and pushed the former leaders down a rank. Fugaku was co-developed by Riken and Fujitsu and uses Fujitsu's 48-core A64FX ARM chip. This is the first time a computer based on ARM processors has topped the list.
|
||||
|
||||
The computer was fully assembled only in May but has already helped fight COVID-19 by sorting through more than 2,000 drugs that might effectively block the virus and found a dozen that show promise.
|
||||
|
||||
### Containerization, AI and ML
|
||||
|
||||
Recently I had a chance to discuss Linux with Stefanie Chiras, vice president and general manager of the Red Hat Enterprise Linux business unit. She sees Linux as tightly linked to supercomputing because it provides the scale and flexibility to support high-performance computing and exascale computing systems – those that are capable of calculating at least 1,018 floating point operations per second (1 exaFLOPS). She also sees Linux as adding to the ongoing development of artificial intelligence and machine learning.
|
||||
|
||||
Chiras expects that containerization will enable more and more researchers and analysts to benefit from supercomputing power. And, as someone who has provided support to both scientists and analysts over the past few decades, I can appreciate what a difference this will make in their work.
|
||||
|
||||
In discussing supercomputers, Chiras pointed out that, beyond having a Linux operating system, the top three fastest – Fugaku, Summit and Sierra – are all built from commercial hardware. Summit and Sierra are Power Systems-based, while Fugaku is the first Arm-powered supercomputer to top the list. The days of purpose-built, custom hardware and software in supercomputing could be over even though new and demanding workloads like AI and complex modeling require greater and greater power.
|
||||
|
||||
(Chiras also wasn’t shy about mentioning that [Red Hat Enterprise Linux][8] is running on four of the top 10 supercomputers: the top three plus number nine, [Marconi-100][9].)
|
||||
|
||||
The character of open source and the willingness of many companies to recognize its value and work together to develop it have made Linux the top OS for both supercomputers and micro-devices. We can expect continued improvements in how the OS is deployed – including getting supercomputing into the hands of a lot more scientists and engineers – as we move forward. As a person who has spent close to 40 years working with Unix and Linux systems, I couldn’t be more pleased.
|
||||
|
||||
Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: http://TOP500.org
|
||||
[2]: https://www.top500.org/statistics/details/osfam/1/
|
||||
[3]: https://www.networkworld.com/newsletters/signup.html
|
||||
[4]: https://www.linuxfoundation.org/membership/members/
|
||||
[5]: https://www.top500.org/project/linpack
|
||||
[6]: https://www.networkworld.com/article/3563766/the-10-fastest-supercomputers-are-led-by-one-28x-faster-than-the-rest.html
|
||||
[7]: https://www.fujitsu.com/global/about/innovation/fugaku/
|
||||
[8]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
|
||||
[9]: https://www.hpc.cineca.it/hardware/marconi100
|
||||
[10]: https://www.facebook.com/NetworkWorld/
|
||||
[11]: https://www.linkedin.com/company/network-world
|
105
sources/talk/20200731 Why we open sourced our Python platform.md
Normal file
105
sources/talk/20200731 Why we open sourced our Python platform.md
Normal file
@ -0,0 +1,105 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why we open sourced our Python platform)
|
||||
[#]: via: (https://opensource.com/article/20/7/why-open-source)
|
||||
[#]: author: (Meredydd Luff https://opensource.com/users/meredydd-luff)
|
||||
|
||||
Why we open sourced our Python platform
|
||||
======
|
||||
Open source development philosophy makes Anvil's entire solution more
|
||||
useful and trustworthy.
|
||||
![neon sign with head outline and open source why spelled out][1]
|
||||
|
||||
The team at Anvil recently open sourced the [Anvil App Server][2], a runtime engine for hosting web apps built entirely in Python.
|
||||
|
||||
The community reaction has been overwhelmingly positive, and we, at Anvil, have already incorporated lots of that feedback into our [next release][3]. But one of the questions we keep getting asked is, "Why did you choose to open source such a core part of your product?"
|
||||
|
||||
### Why we created Anvil
|
||||
|
||||
[Anvil][4] is a tool that makes it as simple as possible to build a web app. We do that by enabling you to build the whole application in one language—Python.
|
||||
|
||||
Before Anvil, if you wanted to build a web app, you'd have to write code using a bunch of technologies like HTML, Javascript, CSS, Python, SQL, React, Redux, Bootstrap, Sass, Webpack, etc. That's a lot to learn. And that's just for a simple app; trust me, it can get [way more complicated][5].
|
||||
|
||||
![A complex framework of development tools needed for a simple web app][6]
|
||||
|
||||
Yes, really. All of these, for a simple web app.
|
||||
|
||||
But even then, you're not done! You need to know all about Git and cloud hosting providers, how to secure the (most-likely) Linux operating system, how to tune the database, and then you're on call to keep it running. Forever.
|
||||
|
||||
So, instead, we built Anvil, an online IDE where you can build your UI with a [drag-and-drop designer][7] and write all your [logic in Python][8], then Anvil takes care of the rest. We replace that whole teetering stack with "just write Python."
|
||||
|
||||
### Simple web hosting is important, but not enough
|
||||
|
||||
Anvil can also host your apps for you. And why not? There is so much complexity in deploying a web app, so running our own cloud hosting service was the only way to provide the simplicity we need. Build an app in the Anvil editor, [click a button][9], and it's live on the Internet.
|
||||
|
||||
But we kept hearing from people who said, "That's great, but…"
|
||||
|
||||
* "I need to run this on an offshore platform without reliable internet access."
|
||||
* "I want to package my app into an IoT device I sell."
|
||||
* "If I'm putting my eggs in this basket, how can I be sure I can still run my app in ten years?"
|
||||
|
||||
|
||||
|
||||
These are all good points! A cloud service isn't the right solution for everyone. If we want to serve these users, there's got to be some way for them to get their apps out of Anvil and run them locally, under their own complete control.
|
||||
|
||||
### Open source is an escape hatch, not an ejector seat
|
||||
|
||||
At conferences, we sometimes get asked, "Can I export this as a Flask+JS app?" Sure, it would be possible to export an Anvil project into its respective Python and JavaScript—we could generate a server package, compile the client-side Python to Javascript, and spit out a classic web app. But it would have serious drawbacks, because: **code generation is an ejector seat.**
|
||||
|
||||
![Code generation is an ejector seat from a structured platform][10]
|
||||
|
||||
([Image][11] licensed as public domain)
|
||||
|
||||
Generated code is better than nothing; at least you can edit it! But the moment you've edited that code, you've lost all the benefits of the system that generated it. If you're using Anvil because of its [drag-and-drop editor][12] and [Python in the browser][13], why should you have to use vim and Javascript in order to host your app locally?
|
||||
|
||||
We believe in [escape hatches, not ejector seats][14]. So we did it the right way—we [open-sourced Anvil's runtime engine][2], which is the same code that serves your app in our hosted service. It's a standalone app; you can edit your code with a text editor and run it locally. But you can also `git push` it right back into our online IDE. It's not an ejector seat; there's no explosive transition. It's an escape hatch; you can climb out, do what you need to do, and climb right back in.
|
||||
|
||||
### If it's open, is it reliable?
|
||||
|
||||
A seeming contradiction in open source is that its free availability is its strength, but also sometimes creates a perception of instability. After all, if you're not charging for it, how are you keeping this platform up and healthy for the long term?
|
||||
|
||||
We're doing what we always have—providing a development tool that makes it drastically simpler to build web applications, though the apps you build using Anvil are 100% yours. We provide hosting for Anvil apps and we offer the entire development and hosting platform onsite for [enterprise customers][15]. This enables us to offer a free plan so that everyone can use Anvil for hobby or educational purposes, or to start building something and see where it goes.
|
||||
|
||||
### More to gain, little to lose
|
||||
|
||||
Open sourcing our runtime engine isn't a detractor from our business—it makes our online IDE more useful and more trustworthy, today and in the future. We've open-sourced the Anvil App Server for the people who need it, and to provide the ultimate insurance policy. It's the right move for our users—now they can build with confidence, knowing that the open source code is [right there][3] if they need it.
|
||||
|
||||
If our development philosophy resonates with you, why not try Anvil yourself?
|
||||
|
||||
|
||||
\-----
|
||||
|
||||
_This post is an adaptation of [Why We Open Sourced the Anvil App Server][16] and is reused with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/7/why-open-source
|
||||
|
||||
作者:[Meredydd Luff][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/meredydd-luff
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_OSwhy_520x292_ma.png?itok=lqfhAs8L (neon sign with head outline and open source why spelled out)
|
||||
[2]: https://anvil.works/blog/open-source
|
||||
[3]: https://github.com/anvil-works/anvil-runtime
|
||||
[4]: https://anvil.works/
|
||||
[5]: https://github.com/kamranahmedse/developer-roadmap#introduction
|
||||
[6]: https://opensource.com/sites/default/files/uploads/frameworks.png (A complex framework of development tools needed for a simple web app)
|
||||
[7]: https://anvil.works/docs/client/ui
|
||||
[8]: https://anvil.works/docs/client/python
|
||||
[9]: https://anvil.works/docs/deployment
|
||||
[10]: https://opensource.com/sites/default/files/uploads/ejector-seat-opensourcecom.jpg (Code generation is an ejector seat from a structured platform)
|
||||
[11]: https://commons.wikimedia.org/wiki/File:Crash.arp.600pix.jpg
|
||||
[12]: https://anvil.works/docs/editor
|
||||
[13]: https://anvil.works/docs/client
|
||||
[14]: https://anvil.works/blog/escape-hatches-and-ejector-seats
|
||||
[15]: https://anvil.works/docs/overview/enterprise
|
||||
[16]: https://anvil.works/blog/why-open-source
|
@ -1,4 +1,3 @@
|
||||
//translating by messon007
|
||||
Systemd Services: Monitoring Files and Directories
|
||||
======
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (messon007)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (jrglinux)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,76 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ()
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Use this script to find a Raspberry Pi on your network)
|
||||
[#]: via: (https://opensource.com/article/20/6/find-raspberry-pi)
|
||||
[#]: author: (Chris Collins https://opensource.com/users/clcollins)
|
||||
|
||||
Use this script to find a Raspberry Pi on your network
|
||||
======
|
||||
Identify a specific Raspberry Pi in your cluster with a script that
|
||||
triggers an LED to flash.
|
||||
![Raspberries with pi symbol overlay][1]
|
||||
|
||||
We've all been there. "I'm going to get this [Raspberry Pi][2] to try out. They look kinda cool." And then, like tribbles on an Enterprise, suddenly you have [Kubernetes clusters][3] and [NFS servers][4] and [Tor proxies][5]. Maybe even a [hotel booking system][6]!
|
||||
|
||||
Pis cover the desk. They spill out onto the floor. Carrier boards for Raspberry Pi compute modules installed into lunchboxes litter the shelves.
|
||||
|
||||
…or maybe that's just me?
|
||||
|
||||
I'll bet if you have one Raspberry Pi, you've got _at least_ two others, though, and gosh darn it, they all look the same.
|
||||
|
||||
This was the situation I found myself in recently while testing a network filesystem (NFS) server I set up on one of my Raspberry Pis. I needed to plug in a USB hard drive, but … to which one? Ol' Lingonberry Pi was the chosen host, and I was SSH'd into her, but which actual, _physical_ RPi was she? There was no way of knowing…
|
||||
|
||||
Or was there?
|
||||
|
||||
![Raspberry Pis stacked up in cluster cases][7]
|
||||
|
||||
So, so many Raspberry Pis. Which one is Lingonberry? (Chris Collins, [CC BY-SA 4.0][8])
|
||||
|
||||
At a previous job, I sometimes worked on servers in our data centers, and some of them had a neat feature: an ID button on the front of the server that, when pressed, started an LED flashing on the front and back of the server. If I needed to deal with the other side of the server, I could press the ID button, then walk _allllll_ the way around to the other side of the rack, and easily find the right server.
|
||||
|
||||
I needed something like this to find Lingonberry.
|
||||
|
||||
There aren't any buttons on the Pis, but there are LEDs, and after a quick Google search, I learned that [one of them is _controllable_][9]. _Cue maniacal laughter._
|
||||
|
||||
There are three important bits to know. First, the LED path: on Raspberry Pis, at least those running Ubuntu 20.04, the front (and user-controllable) LED is found at `/sys/class/leds/led0`. If you navigate to it, you'll find it is a symlink to a directory that has a number of files in it. The two important files are `trigger` and `brightness`.
|
||||
|
||||
The `trigger` file controls what lights up the LED. If you `cat` that file, you will find a list:
|
||||
|
||||
```
|
||||
none usb-gadget usb-host rc-feedback rfkill-any
|
||||
rfkill-none kbd-scrolllock kbd-numlock kbd-capslock
|
||||
kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock
|
||||
kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock
|
||||
kbd-ctrlrlock timer oneshot disk-activity disk-read
|
||||
disk-write ide-disk mtd nand-disk heartbeat backlight
|
||||
gpio cpu cpu0 cpu1 cpu2 cpu3 default-on input panic
|
||||
mmc1 [mmc0] bluetooth-power rfkill0
|
||||
unimac-mdio--19:01:link unimac-mdio--19:01:1Gbps
|
||||
unimac-mdio--19:01:100Mbps unimac-mdio--19:01:10Mbps
|
||||
```
|
||||
|
||||
|
||||
The item in brackets indicates what triggers the LED; in the example above, it's [mmc0]—the disk activity for when the SD card plugged into the Raspberry Pi. The trigger file isn't a normal file, though. Rather than editing it directly, you change the trigger by echoing one of the triggers into the file.
|
||||
|
||||
|
||||
To identify Lingonberry, I needed to temporarily disable the [mmc0] trigger, so I could make the LED work how I wanted it to work. In the script, I disabled all the triggers by echoing "none" into the trigger file:
|
||||
|
||||
[code]
|
||||
|
||||
```
|
||||
# You must be root to do this
|
||||
$ echo none >trigger
|
||||
|
||||
$ cat trigger
|
||||
[none] usb-gadget usb-host rc-feedback rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot disk-activity disk-read disk-write ide-disk mtd nand-disk heartbeat backlight gpio cpu cpu0 cpu1 cpu2 cpu3 default-on input panic mmc1 mmc0 bluetooth-power rfkill0 unimac-mdio--19:01:link unimac-mdio--19:01:1Gbps unimac-mdio--19:01:100Mbps unimac-mdio--19:01:10Mbps
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
In the contents of the trigger file above, you can see [none] is now the selected trigger. Now the LED is off and not flashing.
|
||||
|
||||
|
||||
Next up is the brightness file. You can control whether the LED is on (1) or off (0) by echoing either 0 or 1 into the file. Alternating
|
@ -0,0 +1,273 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Bring your Mycroft AI voice assistant skill to life with Python)
|
||||
[#]: via: (https://opensource.com/article/20/7/mycroft-voice-skill)
|
||||
[#]: author: (Steve Ovens https://opensource.com/users/stratusss)
|
||||
|
||||
Bring your Mycroft AI voice assistant skill to life with Python
|
||||
======
|
||||
Put the final polishes on your Mycroft skill by managing dependencies,
|
||||
debugging, collecting user-specific data, and getting everything into
|
||||
your Python code.
|
||||
![Hands on a keyboard with a Python book ][1]
|
||||
|
||||
In the first two articles of this series on [Mycroft][2], an open source, privacy-focused digital voice assistant, I covered the [background behind voice assistants][3] and some of Mycroft's [core tenets][4]. In Part 3, I started [outlining the Python code][5] required to provide some basic functionality to a skill that adds items to [OurGroceries][6], a grocery list app. And in Part 4, I talked about the different types of [intent parsers][7] (and when to use each) and expanded the Python code so Mycroft could provide audible feedback while working through the skill.
|
||||
|
||||
In this fifth article, I will walk through the remaining sections required to build this skill. I'll talk about project dependencies, logging output for debugging purposes, working with the Mycroft web UI for setting values (such as usernames and passwords), and how to get this information into your Python code.
|
||||
|
||||
### Dealing with project dependencies
|
||||
|
||||
There are generally three sources for project dependencies when writing a Mycroft skill:
|
||||
|
||||
* Python packages from [PyPI][8]
|
||||
* System-level packages pulled from a repository
|
||||
* Other Mycroft skills
|
||||
|
||||
|
||||
|
||||
There are a couple of ways to deal with dependencies in Mycroft. You can use "requirements" files, or you can use the `manifest.yml` file.
|
||||
|
||||
Since most of the skills in the Mycroft store use requirement files, I will merely touch on the `manifest.yml` file. The `manifest.yml` file is pretty straightforward. There is a `dependencies:` section, and under this are three options: `python:`, `system:`, and `skill:`. Under each heading, you should specify the names of required dependencies. An example file could look like this:
|
||||
|
||||
|
||||
```
|
||||
dependencies:
|
||||
# Pip dependencies on PyPI
|
||||
python:
|
||||
- requests
|
||||
- gensim
|
||||
|
||||
system:
|
||||
# For simple packages, this is all that is necessary
|
||||
all: pianobar piano-dev
|
||||
|
||||
# Require the installation of other skills before installing this skill
|
||||
skill:
|
||||
- my-other-skill
|
||||
```
|
||||
|
||||
However, since the majority of skills use requirement files, I'll use that option for this project, so you can use it as an example for other skills you may wish to use or create.
|
||||
|
||||
In Python, the `requirements.txt` file, which lists all the Python dependencies a project requires, is very common. This file is pretty simple; it can either be a list of packages or a list with specific versions. I will specify a minimal version with some code I submitted to the `ourgroceries` project. There are three options for this project's `requirements.txt`:
|
||||
|
||||
* `ourgroceries==1.3.5`: Specifies that the package must be version 1.3.5
|
||||
* `ourgroceries>=1.3.5`: Specifies that the package must be version 1.3.5 or higher
|
||||
* `ourgroceries`: Allows any version of the package
|
||||
|
||||
|
||||
|
||||
My `requirements.txt` uses `ourgroceries>=1.3.5` to allow for future updates. Following this same logic, your `requirements.txt` could list different packages instead of specifying a single package.
|
||||
|
||||
The entirety of my `requirements.txt` file is one line:
|
||||
|
||||
|
||||
```
|
||||
`ourgroceries>=1.3.5`
|
||||
```
|
||||
|
||||
You can also opt to use `requirements.sh`. This is a shell script that can be used to install packages, download modules from Git, or do any number of things. This file executes while installing a new skill. The [Zork skill][9] has an example of a `requirements.sh` script. However, while you can use this, if you want to submit your skill to the store, the `requirements.sh` will be scrutinized fairly heavily to mitigate security issues.
|
||||
|
||||
### Debug your skill
|
||||
|
||||
There are a couple of ways to debug your skill. You can use the Mycroft logger, or you can use standard Python debugging tools. Both methods are available in the Mycroft command-line interface (CLI), which is very handy for debugging.
|
||||
|
||||
#### Use Mycroft logger
|
||||
|
||||
To get started with the Mycroft logger, you just need to have the `MycroftSkill` imported because logger is part of the base class. This means that as long as you are working inside the class for your skill, logger is available. For example, the following code demonstrates how to create a very basic skill with a log entry:
|
||||
|
||||
|
||||
```
|
||||
from mycroft import MycroftSkill
|
||||
|
||||
class MyFakeSkill(MycroftSkill):
|
||||
def __init__(self):
|
||||
self.log.info("Skill starting up")
|
||||
|
||||
def create_skill():
|
||||
return MyFakeSkill()
|
||||
```
|
||||
|
||||
Logger has all the log levels you might expect:
|
||||
|
||||
* **debug:** Provides the highest level of detail but is _not_ logged by default
|
||||
* **info:** Provides general information when a skill is running as expected; it is always logged
|
||||
* **warning:** Indicates something is wrong, but it is not fatal
|
||||
* **error:** Fatal problems; they are displayed in red in the CLI
|
||||
* **exception:** Similar to errors except they include stack traces
|
||||
|
||||
|
||||
|
||||
Along with showing in the CLI, logger writes to `skills.log`. The file's location varies depending on how you installed Mycroft. Common locations are `/var/log/mycroft/skills.log`, `~/snap/mycroft/common/logs/skills.log`, and `/var/opt/mycroft/skills.log`.
|
||||
|
||||
There may be times when you want to use the Mycroft logger outside the instantiated class. For example, if you have some global functions defined outside the class, you can import `LOG` specifically:
|
||||
|
||||
|
||||
```
|
||||
from mycroft import MycroftSkill
|
||||
from mycroft.util import LOG
|
||||
|
||||
def my_global_funct():
|
||||
LOG.info("This is being logged outside the class")
|
||||
|
||||
class MyFakeSkill(MycroftSkill):
|
||||
def __init__(self):
|
||||
self.log.info("Skill starting up")
|
||||
|
||||
def create_skill():
|
||||
return MyFakeSkill()
|
||||
```
|
||||
|
||||
#### Use Python's debugging tools
|
||||
|
||||
If you want something that stands out more, you can use the built-in Python `print()` statements to debug. I have found that there are occasions where the Mycroft logger is slow to produce output. Other times, I just want something that jumps out at me visually. In either case, I prefer using `print()` statements when I am debugging outside an IDE.
|
||||
|
||||
Take the following code, for example:
|
||||
|
||||
|
||||
```
|
||||
if category_name is None:
|
||||
self.log.info("---------------> Adding %s to %s" % (item_to_add, list_name))
|
||||
print("-------------> Adding %s to %s" % (item_to_add, list_name))
|
||||
```
|
||||
|
||||
This produces the following output in the `mycroft-cli-client`:
|
||||
|
||||
|
||||
```
|
||||
~~~~ings:104 | Skill settings successfully saved to /opt/mycroft/skills/fallback-wolfram-alpha.mycroftai/settings.json
|
||||
~~~~1 | mycroft.skills.mycroft_skill.mycroft_skill:handle_settings_change:272 | Updating settings for skill AlarmSkill
|
||||
~~~~save_settings:104 | Skill settings successfully saved to /opt/mycroft/skills/mycroft-alarm.mycroftai/settings.json
|
||||
10:50:38.528 | INFO | 51831 | ConfigurationSkill | Remote configuration updated
|
||||
10:50:43.862 | INFO | 51831 | OurGroceriesSkill | ---------------> Adding hot dogs to my shopping
|
||||
\---------------> Adding hot dogs to my shopping
|
||||
~~~~7.654 | INFO | 51831 | mycroft.skills.skill_loader:reload:108 | ATTEMPTING TO RELOAD SKILL: ourgroceries-skill
|
||||
~~~~831 | mycroft.skills.skill_loader:_execute_instance_shutdown:146 | Skill ourgroceries-skill shut down successfully
|
||||
```
|
||||
|
||||
I find that, as the text scrolls, it is much easier to visually identify a print statement that does not have the uniform header of the other messages. This is a personal preference and not meant as any sort of recommendation for programming best practices.
|
||||
|
||||
### Get input from users
|
||||
|
||||
Now that you know how to see output from your skill, it's time to get some environment-specific information from your users. In many cases, your skill will need some user information to function properly. Most of the time, this is a username and password. Often, this information is required for the skill to initialize properly.
|
||||
|
||||
#### Get user input with internet-connected Mycroft
|
||||
|
||||
If your Mycroft device has a connection to the internet, you can use Mycroft's web UI to enter user information. Log into <https://account.mycroft.ai> and navigate to the [skills][10] section. Once you have configured your skill correctly, you will see something like this:
|
||||
|
||||
![Mycroft Web UI][11]
|
||||
|
||||
Here, you can discover which devices have your skill installed. In my case, there are two devices: `Arch Pi4` and `Asus`. There are also input text boxes to get information from the user.
|
||||
|
||||
This interface is created automatically if you have configured Mycroft's Settings file. You have two choices for file types: you can create a `settingsmeta.yaml` or a `settingsmeta.json`. I prefer the YAML syntax, so that is what I used for this project. Here is my `settingsmeta.yaml` for this skill:
|
||||
|
||||
|
||||
```
|
||||
skillMetadata:
|
||||
sections:
|
||||
- name: OurGroceries Account
|
||||
fields:
|
||||
- type: label
|
||||
label: "Provide your OurGroceries username/password and then Connect with the button below."
|
||||
- name: user_name
|
||||
type: text
|
||||
label: username
|
||||
value: ''
|
||||
- name: password
|
||||
type: password
|
||||
label: Ourgroceries password
|
||||
value: ''
|
||||
- name: default_list
|
||||
type: text
|
||||
label: Default Shopping List
|
||||
value: ''
|
||||
```
|
||||
|
||||
The structure of this file is pretty easy to understand. Each file must start with a `skillsMetadata` heading. Next, there is a `sections` heading. Every new section is denoted by `- name:`, which is YAML syntax for an item on a list. Above, there is only a single section called `OurGroceries Account`, but you can have as many sections as you want.
|
||||
|
||||
Fields are used to both convey and store information. A field can be as simple as a label, which can provide an instruction to the user. More interesting for this skill, however, are the `text` and `password` fields. Text fields allow the user to view what they are typing and are displayed in plain text. This is suitable for non-sensitive information. Password fields are not specific to passwords but are intended to hide sensitive information. After the users enter their information and click the `save` button, Mycroft replaces the `settings.json` file created the first time the skill initializes. The new file contains the values the user input in the web UI. The skill will also use this file to look up credentials and other information. If you are having problems using the correct values in your skill, take a look at the `settings.json` file for proper naming of variables and whether or not values are being stored in the JSON file.
|
||||
|
||||
#### Get user input with offline Mycroft
|
||||
|
||||
As you may have surmised, without internet connectivity, it is more difficult to receive information from end users. There are only a few options. First, you could write your skill such that, on the first run, it prompts the user for the information your skill requires. You could then write this out to `settings.json` if you wish to use the built-in settings parser, or you could write this to a file of your choice and your skill could handle the parsing. Be aware that if you write to `settings.json`, there is a chance that this file could be overwritten if Mycroft re-initializes your skill.
|
||||
|
||||
Another method is having static values in a `settings.json` or another file that is stored with the project. This has some obvious security implications, but if your repository is secure, this is a viable option.
|
||||
|
||||
The third and final option is to enable the user to edit the file directly. This could be done through Network File System (NFS) or [Samba][12] file sharing protocols, or you could simply grant the appropriate permissions to a secure shell (SSH) user who could use any Unix editor to make changes.
|
||||
|
||||
Since this project requires access to the internet, I will not explore these options. If you have questions, you can always engage the community on [Mattermost][13].
|
||||
|
||||
### Access settings from your skill
|
||||
|
||||
Provided that the other parts in the chain are working (i.e., the users updated their settings via the web UI, and Mycroft updated `settings.json` based on those settings), using user-provided settings is easy to understand.
|
||||
|
||||
As I mentioned in the [third article][5] (where I discussed the `__init__` and `initialize` methods), it is impossible to retrieve values from `settings.json` with the `__init__(self)` method. Therefore, you must use another method to handle the settings. In my case, I created an appropriately named `_create_initial_grocery_connection` method:
|
||||
|
||||
|
||||
```
|
||||
def _create_initial_grocery_connection(self):
|
||||
"""
|
||||
This gets the username/password from the config file and gets the session cookie
|
||||
for any interactions
|
||||
:return: None
|
||||
"""
|
||||
self.username = self.settings.get('user_name')
|
||||
self.password = self.settings.get('password')
|
||||
self.ourgroceries_object = OurGroceries(self.username, self.password)
|
||||
asyncio.run(self.ourgroceries_object.login())
|
||||
```
|
||||
|
||||
As you can see, you can extract information from `settings.json` by using `self.settings.get()`. The only thing to note is that the value you pass in _must_ match the name in `settingsmeta.yaml`. In this case, because I am not using the username or password outside this method, I could have opted to not make these variables part of the class scope (i.e., I could have called them `password` instead of `self.password`). This is because I am setting the `ourgroceries_object` to the class scope, and it contains all the information required for the rest of the skill to function.
|
||||
|
||||
### Wrapping up
|
||||
|
||||
Voice assistants are expanding into a multi-million (if not -billion) dollar business and some analysts think a majority of homes in the next few years will have one (or more). With Apple, Google, Facebook, and others frequently in the news for privacy violations, not to mention the constant stream of data breaches reported, it is important to have an open source, privacy-focused alternative to the big players. Mycroft puts your privacy first, and its small but dedicated team of contributors is making inroads into the most common scenarios for voice assistants.
|
||||
|
||||
This series dove into the nitty-gritty of skill development, talking about the importance of thinking things through before you start and having a good outline. Knowing where you are going in the big picture helps you organize your code. Breaking the tasks down into individual pieces is also a key part of your strategy. Sometimes, it's a good idea to write bits or significant chunks outside the Mycroft skill environment to ensure that your code will work as expected. This is not necessary but can be a great starting point for people who are new to skill development.
|
||||
|
||||
The series also explored intent parsers and how to understand when to use each one. The [Padatious][14] and [Adapt][15] parsers each have strengths and weaknesses.
|
||||
|
||||
* Padatious intents rely on phrases and entities within those phrases to understand what the user is attempting to accomplish, and they are often the default used for Mycroft skills.
|
||||
* On the other hand, Adapt uses regular expressions to accomplish similar goals. When you need Mycroft to be context-aware, Adapt is the only way to go. It is also extremely good at parsing complex utterances. However, you need to take great care when using regular expressions, or you will end up with unexpected results.
|
||||
|
||||
|
||||
|
||||
I also covered the basics of dealing with a project. It's an important step in complex skill development to ensure that a skill has all the proper dependencies to work. Ensuring maximum portability is paramount for a skill, and dependency resolution is a key part of that, as your skill may not work properly with unsatisfied dependencies.
|
||||
|
||||
Finally, I explained how to get skill-specific settings from users, whether the device is internet-connected or not. Which method you choose really depends on your use case.
|
||||
|
||||
While it was not my aim to provide an encyclopedia of Mycroft skill development, by working through this series, you should have a very solid foundation for developing most skills you want to create. I hope the concrete examples in this series will show you how to handle the majority of tasks you may want to accomplish during skill development. I didn't go line-by-line through the whole skill but the code is hosted on [GitLab][16] if you'd like to explore it further. Comments and questions are always welcome. I am very much still learning and growing as a fledgling Mycroft developer, so hit me up on [Twitter][17] or the [Mycroft Mattermost][18] instance, and let's learn together!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/7/mycroft-voice-skill
|
||||
|
||||
作者:[Steve Ovens][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/stratusss
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
|
||||
[2]: https://mycroft.ai/
|
||||
[3]: https://opensource.com/article/20/6/open-source-voice-assistant
|
||||
[4]: https://opensource.com/article/20/6/mycroft
|
||||
[5]: https://opensource.com/article/20/6/mycroft-voice-assistant-skill
|
||||
[6]: https://www.ourgroceries.com/overview
|
||||
[7]: https://opensource.com/article/20/6/mycroft-intent-parsers
|
||||
[8]: https://pypi.org/
|
||||
[9]: https://github.com/forslund/white-house-adventure/blob/6eba5df187bc8a7735b05e93a28a6390b8c6f40c/requirements.sh
|
||||
[10]: https://home.mycroft.ai/skills
|
||||
[11]: https://opensource.com/sites/default/files/mycroft_skills_webui.png (Mycroft Web UI)
|
||||
[12]: https://www.samba.org/
|
||||
[13]: https://chat.mycroft.ai/community/channels/skills
|
||||
[14]: https://mycroft-ai.gitbook.io/docs/skill-development/user-interaction/intents/padatious-intents
|
||||
[15]: https://mycroft-ai.gitbook.io/docs/skill-development/user-interaction/intents/adapt-intents
|
||||
[16]: https://gitlab.com/stratus-ss/mycroft-ourgroceries-skill
|
||||
[17]: https://twitter.com/linuxovens
|
||||
[18]: https://chat.mycroft.ai/community/channels/town-square
|
@ -0,0 +1,198 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Real-time noise suppression for video conferencing)
|
||||
[#]: via: (https://fedoramagazine.org/real-time-noise-suppression-for-video-conferencing/)
|
||||
[#]: author: (lkiesow https://fedoramagazine.org/author/lkiesow/)
|
||||
|
||||
Real-time noise suppression for video conferencing
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
With people doing video conferencing all day, good audio has recently become much more important. The best option is obviously a proper audio studio. Unfortunately, this is not something you will always have and you might need to make do with a much simpler setup.
|
||||
|
||||
In such situations, a noise reduction filter that keeps your voice but filters out ambient noises (street noise, keyboard, …) can be very helpful. In this article, we will take a look at how to integrate such a filter into PulseAudio so that it can easily be used in all applications with no additional requirements on their part.
|
||||
|
||||
Example of switching on noise reduction
|
||||
|
||||
### The Idea
|
||||
|
||||
We set up [PulseAudio][2] for live noise-reduction using [an LADSPA filter][3].
|
||||
|
||||
This creates a new PulseAudio source which can be used as a virtual microphone. Other applications will not even realize that they are not dealing with physical devices and you can select it as if you had an additional microphone connected.
|
||||
|
||||
### Terminology
|
||||
|
||||
Before we start, it is good to know the following two PulseAudio terms to better understand what we are doing:
|
||||
|
||||
* _source_ – represents a source from which audio can be obtained. Like a microphone
|
||||
* _sink_ – represents a consumer of audio like a speaker
|
||||
|
||||
|
||||
|
||||
Each PulseAudio sink also has a source called monitor which can be used to get the audio put into that sink. For example, you could have audio put out by your headphones while using the monitor of your headphone device to record the output.
|
||||
|
||||
### Installation
|
||||
|
||||
While PulseAudio is usually pre-installed, we need to get the LADSPA filter for noise reduction. You can [build and install the filter manually][3], but it is much easier to install the filter via Fedora Copr:
|
||||
|
||||
```
|
||||
sudo dnf copr enable -y lkiesow/noise-suppression-for-voice
|
||||
sudo dnf install -y ladspa-realtime-noise-suppression-plugin
|
||||
```
|
||||
|
||||
Note that the Copr projects are not maintained and quality-controlled by Fedora directly.
|
||||
|
||||
### Enable Noise Reduction Filter
|
||||
|
||||
First, you need to identify the name of the device you want to apply the noise reduction to. In this example, we’ll use the RODE NT-USB microphone as input.
|
||||
|
||||
```
|
||||
$ pactl list sources short
|
||||
0 alsa_input.usb-RODE_Microphones_RODE_NT-USB-00.iec958-stereo …
|
||||
1 alsa_output.usb-0c76_USB_Headphone_Set-00.analog-stereo.monitor …
|
||||
```
|
||||
|
||||
Next, we create a new PulseAudio sink, the filter and a loopback between microphone and filter. That way, the output from the microphone is used as input for the noise reduction filter. The output from this filter will then be available via the null sink monitor.
|
||||
|
||||
To visualize this, here is the path the audio will travel from the microphone to, for example, a browser:
|
||||
|
||||
```
|
||||
mic → loopback → ladspa filter → null sink [monitor] → browser
|
||||
```
|
||||
|
||||
While this sounds complicated, it is set up with just a few simple commands:
|
||||
|
||||
```
|
||||
pacmd load-module module-null-sink \
|
||||
sink_name=mic_denoised_out
|
||||
pacmd load-module module-ladspa-sink \
|
||||
sink_name=mic_raw_in \
|
||||
sink_master=mic_denoised_out \
|
||||
label=noise_suppressor_stereo \
|
||||
plugin=librnnoise_ladspa \
|
||||
control=50
|
||||
pacmd load-module module-loopback \
|
||||
source=alsa_input.usb-RODE_Microphones_RODE_NT-USB-00.iec958-stereo \
|
||||
sink=mic_raw_in \
|
||||
channels=2
|
||||
```
|
||||
|
||||
That’s it. You should now be able to select the new device.
|
||||
|
||||
![New recording devices in pavucontrol][4]
|
||||
|
||||
### Chromium
|
||||
|
||||
Unfortunately, browsers based on Chromium will hide monitor devices by default. This means, that we cannot select the newly created noise-reduction device in the browser. One workaround is to select another device first, then use pavucontrol to assign the noise-reduction device afterward.
|
||||
|
||||
But if you do this on a regular basis, you can work around the issue by using the _remap-source_ module to convert the null sink monitor to a regular PulseAudio source. The module is actually meant for remapping audio channels – e.g. swapping left and right channel on stereo audio – but we can just ignore these additional capabilities and create a new source similar to the monitor:
|
||||
|
||||
```
|
||||
pacmd load-module module-remap-source \
|
||||
source_name=denoised \
|
||||
master=mic_denoised_out.monitor \
|
||||
channels=2
|
||||
```
|
||||
|
||||
The remapped device delivers audio identical to the original one so that assigning this with PulseAudio will yield no difference. But this device does now show up in Chromium:
|
||||
|
||||
![Remapped monitor device in Chrome][5]
|
||||
|
||||
### Improvements
|
||||
|
||||
While the guide above should help you with all the basics and will get you a working setup, there are a few things you can improve.
|
||||
|
||||
But while the commands above should generally work, you might need to experiment with the following suggestions.
|
||||
|
||||
#### Latency
|
||||
|
||||
By default, the loopback module will introduce a slight audio latency. You can hear this by running an echo test:
|
||||
|
||||
```
|
||||
gst-launch-1.0 pulsesrc ! pulsesink
|
||||
```
|
||||
|
||||
You might be able to reduce this latency by using the _latency_msec_ option when loading the _loopback_ module:
|
||||
|
||||
```
|
||||
pacmd load-module module-loopback \
|
||||
latency_msec=1 \
|
||||
source=alsa_input.usb-RODE_Microphones_RODE_NT- USB-00.iec958-stereo \
|
||||
sink=mic_raw_in \
|
||||
channels=2
|
||||
```
|
||||
|
||||
#### Voice Threshold
|
||||
|
||||
The noise reduction library provides controls for a voice threshold. The filter will return silence if the probability for sound being voice is lower than this threshold. In other words, the higher you set this value, the more aggressive the filter becomes.
|
||||
|
||||
You can pass different thresholds to the filter by supplying them as control argument when the _ladspa-sink_ module is being loaded.
|
||||
|
||||
```
|
||||
pacmd load-module module-ladspa-sink \
|
||||
sink_name=mic_raw_in \
|
||||
sink_master=mic_denoised_out \
|
||||
label=noise_suppressor_stereo \
|
||||
plugin=librnnoise_ladspa \
|
||||
control=95
|
||||
```
|
||||
|
||||
#### Mono vs Stereo
|
||||
|
||||
The example above will work with stereo audio. When working with a simple microphone, you may want to use a mono signal instead.
|
||||
|
||||
For switching to mono, use the following values instead when loading the different modules:
|
||||
|
||||
* _label=noise_suppressor_mono_ – when loading the _ladspa-sink_ module
|
||||
* _channels=1_ – when loading the _loopback_ and remap-source modules
|
||||
|
||||
|
||||
|
||||
#### Persistence
|
||||
|
||||
Using the _pacmd_ command for the setup, settings are not persistent and will disappear if PulseAudio is restarted. You can add these commands to your PulseAudio configuration file if you want them to be persistent. For that, edit _~/.config/pulse/default.pa_ and add your commands like this:
|
||||
|
||||
```
|
||||
.include /etc/pulse/default.pa
|
||||
|
||||
load-module module-null-sink sink_name=mic_denoised_out
|
||||
load-module module-ladspa-sink …
|
||||
…
|
||||
```
|
||||
|
||||
### Limitations
|
||||
|
||||
If you listen to the example above, you will notice that the filter reliably reduces background noise. But unfortunately, depending on the situation, it can also cause a loss in voice quality.
|
||||
|
||||
The following example shows the results with some street noise. Activating the filter reliably removes the noise, but in this example, the voice quality noticeably drops as well:
|
||||
|
||||
Noise reduction of constant street noise
|
||||
|
||||
As a conclusion, we can say that this can help if you find yourself in less than ideal audio scenarios. It is also very effective if you are not the main speaker in a video conference and you do not want to constantly mute yourself.
|
||||
|
||||
Still, good audio equipment and a quiet environment will always be better.
|
||||
|
||||
Have fun.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/real-time-noise-suppression-for-video-conferencing/
|
||||
|
||||
作者:[lkiesow][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/lkiesow/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/noise-reduction-816x345.png
|
||||
[2]: https://freedesktop.org/wiki/Software/PulseAudio/
|
||||
[3]: https://github.com/werman/noise-suppression-for-voice
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2020/07/pavucontrol-white-1024x379.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2020/07/chrome-1024x243.png
|
Loading…
Reference in New Issue
Block a user