{ "metadata": { "name": "", "signature": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 15, Musical sound & acoustic of buildings" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1, page 518" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import log10\n", "# decibles\n", "#given data :\n", "i1=4 #assume\n", "i2=4*i1 #\n", "dl=10*log10(i2/i1) #db\n", "print \"Decibles by which intensity level will decrease = %0.2f db \" %dl" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Decibles by which intensity level will decrease = 6.02 db \n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2, page 519" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import sympy\n", "# ratio of amlitudes\n", "#given data :\n", "l1=10 #db\n", "l2=40 #db\n", "dl=l2-l1 #db\n", "x=(10**(dl/10)) #\n", "x1=sympy.sqrt(x) #\n", "print \"Ratio of amplitudes =\", x1" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Ratio of amplitudes = 10*sqrt(10)\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3, page 521" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# frequency\n", "#given data :\n", "x=264 #key note\n", "g=x*(3.0/2) #\n", "print \"Frequency of note G = %0.f \" %g\n", "cd1=x*2 #\n", "print \"Frequency of note C = %0.f \"%cd1" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Frequency of note G = 396 \n", "Frequency of note C = 528 \n" ] } ], "prompt_number": 3 } ], "metadata": {} } ] }