1 Star 0 Fork 1

周治国/ThinkDSP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 10.78 KB
一键复制 编辑 原始数据 按行查看 历史
周治国 提交于 2021-11-21 04:00 . index
<h1 id="thinkdsp">ThinkDSP</h1>
<p>LaTeX source and Python code for <em>Think DSP: Digital Signal Processing in Python</em>, by Allen B. Downey.</p>
<p>The premise of this book (and the other books in the <em>Think X</em> series) is that if you know how to program, you can use that skill to learn other things. I am writing this book because I think the conventional approach to digital signal processing is backward: most books (and the classes that use them) present the material bottom-up, starting with mathematical abstractions like phasors.</p>
<p>With a programming-based approach, I can go top-down, which means I can present the most important ideas right away. By the end of the first chapter, you can break down a sound into its harmonics, modify the harmonics, and generate new sounds.</p>
<p>Here’s a notebook that previews what you will see in Chapter 1:</p>
<ul>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap01preview.ipynb">chap01preview.ipynb</a></li>
</ul>
<p>And if you want to see where were headed, here’s a preview of Chapter 10:</p>
<ul>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap10preview.ipynb">chap10preview.ipynb</a></li>
</ul>
<h2 id="running-the-code">Running the code</h2>
<p>Most of the code for this book is in Jupyter notebooks. If you are not familiar with Jupyter, you can run a tutorial by <a href="https://jupyter.org/try">clicking here</a>. Then select “Try Classic Notebook”. It will open a notebook with instructions for getting started.</p>
<p>To run the ThinkDSP code, you have several options:</p>
<p>Option 1: Run the notebooks on Google Colab.</p>
<p>Option 2: Run the notebooks on Binder.</p>
<p>Option 3: Use Conda to install the libraries you need and run the notebooks on your computer.</p>
<p>Option 4: Use poetry to install the libraries you need and run the notebooks on your computer.</p>
<p>The following sections explain these options in detail.</p>
<p>Note: I have heard from a few people who tried to run the code in Spyder. Apparently there were problems, so I don’t recommend it.</p>
<h3 id="option-1-run-on-colab">Option 1: Run on Colab</h3>
<p>I have recently updated most of the notebooks in this repository so they run on Colab.</p>
<p>You can open any of them by clicking on the links below. If you want to modify and save any of them, you can use Colab to save a copy in a Google Drive or your own GitHub repo, or on your computer.</p>
<ul>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap01.ipynb">chap01.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap01soln.ipynb">chap01soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap02.ipynb">chap02.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap02soln.ipynb">chap02soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap03.ipynb">chap03.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap03soln.ipynb">chap03soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap04.ipynb">chap04.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap04soln.ipynb">chap04soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap05.ipynb">chap05.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap05soln.ipynb">chap05soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap06.ipynb">chap06.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap06soln.ipynb">chap06soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap07.ipynb">chap07.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap07soln.ipynb">chap07soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap08.ipynb">chap08.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap08soln.ipynb">chap08soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap09.ipynb">chap09.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap09soln.ipynb">chap09soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap10.ipynb">chap10.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap10soln.ipynb">chap10soln.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap11.ipynb">chap11.ipynb</a></li>
<li><a href="https://colab.research.google.com/github/AllenDowney/ThinkDSP/blob/master/code/chap11soln.ipynb">chap11soln.ipynb</a></li>
</ul>
<h3 id="option-2-run-on-binder">Option 2: Run on Binder</h3>
<p>To run the code for this book on Binder, press this button:</p>
<p><a href="http://mybinder.org/repo/AllenDowney/ThinkDSP"><img src="http://mybinder.org/badge.svg" alt="Binder" /></a></p>
<p>It takes a minute or so to start up, but then you should see the Jupyter home page with a list of files. Click on <code>code</code> to open the folder with the notebooks, then click on one of the notebooks (with the .ipynb extension).</p>
<h3 id="option-3-install-pythonjupyter">Option 3: Install Python+Jupyter</h3>
<p>First, download the files from this repository. If you are a Git user, you can run</p>
<pre><code>git clone --depth 1 https://github.com/AllenDowney/ThinkDSP.git</code></pre>
<p>Otherwise you can <a href="https://github.com/AllenDowney/ThinkDSP/archive/master.zip">download this Zip file</a> and unzip it. Either way, you should end up with a directory called <code>ThinkDSP</code>.</p>
<p>Now, if you don’t already have Jupyter, I highly recommend installing Anaconda, which is a Python distribution that contains everything you need to run the ThinkDSP code. It is easy to install on Windows, Mac, and Linux, and because it does a user-level install, it will not interfere with other Python installations.</p>
<p><a href="https://www.anaconda.com/distribution/">Information about installing Anaconda is here</a>.</p>
<p>If you have the choice of Python 2 or 3, choose Python 3.</p>
<p>There are two ways to get the packages you need for ThinkDSP. You can install them by hand or create a Conda environment.</p>
<p>To install them by hand run</p>
<pre><code>conda install jupyter numpy scipy pandas matplotlib seaborn</code></pre>
<p>Or, to create a conda environment, run</p>
<pre><code>cd ThinkDSP
conda env create -f environment.yml
conda activate ThinkDSP</code></pre>
<h3 id="option-4-use-poetry-to-manage-the-project-on-your-computer-or-notebook-locally.">Option 4: Use poetry to manage the project on your computer or notebook locally.</h3>
<p>First, download the files from this repository. If you are a Git user, you can run</p>
<pre><code>git clone --depth 1 https://github.com/AllenDowney/ThinkDSP.git</code></pre>
<p>Then, assuming you have <a href="https://python-poetry.org">poetry</a> installed on your machine, run</p>
<pre><code>cd ThinkDSP
poetry install</code></pre>
<p>to install the libraries you need in a virtual environment. To activate the environment, run</p>
<pre><code>poetry shell</code></pre>
<p>Then you can run Jupyter.</p>
<h2 id="run-jupyter">Run Jupyter</h2>
<p>To start Jupyter, run:</p>
<pre><code>jupyter notebook</code></pre>
<p>Jupyter should launch your default browser or open a tab in an existing browser window. If not, the Jupyter server should print a URL you can use. For example, when I launch Jupyter, I get</p>
<pre><code>~/ThinkComplexity2$ jupyter notebook
[I 10:03:20.115 NotebookApp] Serving notebooks from local directory: /home/downey/ThinkDSP
[I 10:03:20.115 NotebookApp] 0 active kernels
[I 10:03:20.115 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 10:03:20.115 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).</code></pre>
<p>In this case, the URL is <a href="http://localhost:8888">http://localhost:8888</a>. When you start your server, you might get a different URL. Whatever it is, if you paste it into a browser, you should see a home page with a list of directories.</p>
<p>Click on <code>code</code> to open the folder with the notebooks, then click on one of the notebooks (with the .ipynb extension).</p>
<p>Select the cell with the import statements and press “Shift-Enter” to run the code in the cell. If it works and you get no error messages, <strong>you are all set</strong>.</p>
<p>If you get error messages about missing packages, you can install the packages you need using your package manager, or install Anaconda.</p>
<p>If you run into problems with these instructions, let me know and I will make corrections. Good luck!</p>
<h2 id="freesound">Freesound</h2>
<p>Special thanks to Freesound (http://freesound.org), which is the source of many of the sound samples I use in this book, and to the Freesound users who uploaded those sounds. I include some of their wave files in the GitHub repository for this book, using the original file names, so it should be easy to find their sources.</p>
<p>Unfortunately, most Freesound users don’t make their real names available, so I can only thank them using their user names. Samples used in this book were contributed by Freesound users: iluppai, wcfl10, thirsk, docquesting, kleeb, landup, zippi1, themusicalnomad, bcjordan, rockwehrmann, marchascon7, jcveliz. Thank you all!</p>
<p>Here are links to the sources:</p>
<p>http://www.freesound.org/people/iluppai/sounds/100475/</p>
<p>http://www.freesound.org/people/wcfl10/sounds/105977/</p>
<p>http://www.freesound.org/people/Thirsk/sounds/120994/</p>
<p>http://www.freesound.org/people/ciccarelli/sounds/132736/</p>
<p>http://www.freesound.org/people/Kleeb/sounds/180960/</p>
<p>http://www.freesound.org/people/zippi1/sounds/18871/</p>
<p>http://www.freesound.org/people/themusicalnomad/sounds/253887/</p>
<p>http://www.freesound.org/people/bcjordan/sounds/28042/</p>
<p>http://www.freesound.org/people/rockwehrmann/sounds/72475/</p>
<p>http://www.freesound.org/people/marcgascon7/sounds/87778/</p>
<p>http://www.freesound.org/people/jcveliz/sounds/92002/</p>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/spaitlab_0/ThinkDSP.git
git@gitee.com:spaitlab_0/ThinkDSP.git
spaitlab_0
ThinkDSP
ThinkDSP
master

搜索帮助