commit julia du sale

This commit is contained in:
hschindler 2019-10-02 14:36:08 +02:00
parent 750efa2a80
commit ba48cde99b
16 changed files with 202690 additions and 426 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,247 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyse non paramétrique du signal de la flute\n",
"\n",
"Nous allons commencer par afficher le signals\n",
"\n",
"/TODO mettre des labels X/Y avec unités et des titres à toutes les figure"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"using WAV\n",
"\n",
"s, fs = wavread(\"../myson.wav\");\n",
"s = vec(s);\n",
"t = (0 : 1 : size(s)[1]-1)/fs;\n",
"fs = floor(Int, fs);\n",
"\n",
"t_s = 10 #s\n",
"trame_period = 0.005 #s\n",
"\n",
"floor_freq = 10 #Hz\n",
"ceil_freq = 60 #Hz\n",
"\n",
"number_trame = 50 # trames on each side of t_s\n",
"overlap = 0.0001;#s\n",
"\n",
"N_fft = 2^18- 1; #number points fft"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using Plots\n",
"plot(t, s, title=\"Son bizarre\",label=[\"Signal\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Regardons des trames. La taille de trame reste classique : de l'ordre de 20ms.\n",
"\n",
"/TODO attention Gabor\n",
"\n",
"/TODO FFT avec gros nombre"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#using LinearAlgebra\n",
"\n",
"#plot(t_trame, s_trame)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using FFTW\n",
"\n",
"i_s = floor(Int, t_s*fs+1)\n",
"i_e = floor(Int, i_s+trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"# Fourier Transform of it \n",
"s_pad = zeros(N_fft)\n",
"s_pad[1:size(s_trame,1), 1:size(s_trame,2)]=s_trame\n",
"F = fft(s_pad) |> fftshift\n",
"freqs = fftfreq(N_fft, fs) |> fftshift\n",
"\n",
"# plots \n",
"time_domain = plot(t_trame, s_trame, title = \"Signal\")\n",
"freq_domain = plot(freqs, abs.(F), title = \"Spectrum\", xlim=(-1000, +1000)) \n",
"plot(time_domain, freq_domain, layout = 2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"i_s = floor(Int, t_s*fs-number_trame*trame_period*fs+1)\n",
"i_e = floor(Int, i_s+2*number_trame*trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"# Fourier Transform of it \n",
"s_pad = zeros(N_fft)\n",
"s_pad[1:size(s_trame,1), 1:size(s_trame,2)]=s_trame\n",
"F = fft(s_pad) |> fftshift\n",
"freqs = fftfreq(N_fft, fs) |> fftshift\n",
"\n",
"# plots \n",
"time_domain = plot(t_trame, s_trame, title = \"Signal\")\n",
"freq_domain = plot(freqs, abs.(F), title = \"Spectrum\", xlim=(-1000, +1000)) \n",
"plot(time_domain, freq_domain, layout = 2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On cherche maintenant la fréquence du fondamental. Comme il s'agit d'un instrument à vent, on choisit notre interval de fréquence."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using WORLD\n",
"\n",
"f0, timeaxis = harvest(s, fs, HarvestOption(floor_freq, ceil_freq, trame_period));#floor and ceil freq, period\n",
"plot(timeaxis, f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On observe des vibratos, par exemple un gros vibrato vers 5s, un \"fa\". La fréquence du son ne correspond pas exactement à la fréquence du fondamental. On a une modulation de fréquence.\n",
"\n",
"/TODO étudier cette modulation de fréquence\n",
"\n",
"Regardons un zoom sur un vibrato. \n",
"\n",
"/TODO fft du petit bout de signal"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"i_s = floor(Int, t_s*fs-number_trame*trame_period*fs+1)\n",
"i_e = floor(Int, i_s+2*number_trame*trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"f0, timeaxis = harvest(s_trame, fs, HarvestOption(floor_freq, ceil_freq, trame_period));#floor and ceil freq, period\n",
"plot(timeaxis.+t_trame[1], f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On va s'intéresser maintenant au spectrogramme.\n",
"\n",
"\\TODO On choisit une fenêtre XXXX car XXX"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using DSP, PyPlot\n",
"\n",
"println(floor(Int, trame_period*fs), floor(Int, overlap*fs))\n",
"S = spectrogram(s, floor(Int, trame_period*fs), floor(Int, overlap*fs); fs=fs, window=hanning)\n",
"t = time(S)\n",
"f = freq(S)\n",
"imshow(reverse(log10.(power(S)), dims=1), extent=[first(t), last(t), first(f), last(f)], aspect=\"auto\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zoom sur notre vibrato que l'on voit un peu"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"S = spectrogram(s_trame, floor(Int, trame_period*fs), floor(Int, overlap*fs); fs=fs, window=hanning)\n",
"t = time(S)\n",
"f = freq(S)\n",
"imshow(reverse(log10.(power(S)), dims=1), extent=[first(t).+t_trame[1], last(t).+t_trame[1], first(f), last(f)], aspect=\"auto\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.2.0",
"language": "julia",
"name": "julia-1.2"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.2.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,247 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyse non paramétrique du signal de la flute\n",
"\n",
"Nous allons commencer par afficher le signals\n",
"\n",
"/TODO mettre des labels X/Y avec unités et des titres à toutes les figure"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"using WAV\n",
"\n",
"s, fs = wavread(\"../myson.wav\");\n",
"s = vec(s);\n",
"t = (0 : 1 : size(s)[1]-1)/fs;\n",
"fs = floor(Int, fs);\n",
"\n",
"t_s = 10 #s\n",
"trame_period = 0.005 #s\n",
"\n",
"floor_freq = 10 #Hz\n",
"ceil_freq = 60 #Hz\n",
"\n",
"number_trame = 50 # trames on each side of t_s\n",
"overlap = 0.0001;#s\n",
"\n",
"N_fft = 2^18- 1; #number points fft"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using Plots\n",
"plot(t, s, title=\"Son bizarre\",label=[\"Signal\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Regardons des trames. La taille de trame reste classique : de l'ordre de 20ms.\n",
"\n",
"/TODO attention Gabor\n",
"\n",
"/TODO FFT avec gros nombre"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#using LinearAlgebra\n",
"\n",
"#plot(t_trame, s_trame)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using FFTW\n",
"\n",
"i_s = floor(Int, t_s*fs+1)\n",
"i_e = floor(Int, i_s+trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"# Fourier Transform of it \n",
"s_pad = zeros(N_fft)\n",
"s_pad[1:size(s_trame,1), 1:size(s_trame,2)]=s_trame\n",
"F = fft(s_pad) |> fftshift\n",
"freqs = fftfreq(N_fft, fs) |> fftshift\n",
"\n",
"# plots \n",
"time_domain = plot(t_trame, s_trame, title = \"Signal\")\n",
"freq_domain = plot(freqs, abs.(F), title = \"Spectrum\", xlim=(-1000, +1000)) \n",
"plot(time_domain, freq_domain, layout = 2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"i_s = floor(Int, t_s*fs-number_trame*trame_period*fs+1)\n",
"i_e = floor(Int, i_s+2*number_trame*trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"# Fourier Transform of it \n",
"s_pad = zeros(N_fft)\n",
"s_pad[1:size(s_trame,1), 1:size(s_trame,2)]=s_trame\n",
"F = fft(s_pad) |> fftshift\n",
"freqs = fftfreq(N_fft, fs) |> fftshift\n",
"\n",
"# plots \n",
"time_domain = plot(t_trame, s_trame, title = \"Signal\")\n",
"freq_domain = plot(freqs, abs.(F), title = \"Spectrum\", xlim=(-1000, +1000)) \n",
"plot(time_domain, freq_domain, layout = 2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On cherche maintenant la fréquence du fondamental. Comme il s'agit d'un instrument à vent, on choisit notre interval de fréquence."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using WORLD\n",
"\n",
"f0, timeaxis = harvest(s, fs, HarvestOption(floor_freq, ceil_freq, trame_period));#floor and ceil freq, period\n",
"plot(timeaxis, f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On observe des vibratos, par exemple un gros vibrato vers 5s, un \"fa\". La fréquence du son ne correspond pas exactement à la fréquence du fondamental. On a une modulation de fréquence.\n",
"\n",
"/TODO étudier cette modulation de fréquence\n",
"\n",
"Regardons un zoom sur un vibrato. \n",
"\n",
"/TODO fft du petit bout de signal"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"i_s = floor(Int, t_s*fs-number_trame*trame_period*fs+1)\n",
"i_e = floor(Int, i_s+2*number_trame*trame_period*fs)\n",
"t_trame = t[i_s:i_e]\n",
"s_trame = s[i_s:i_e]\n",
"\n",
"f0, timeaxis = harvest(s_trame, fs, HarvestOption(floor_freq, ceil_freq, trame_period));#floor and ceil freq, period\n",
"plot(timeaxis.+t_trame[1], f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On va s'intéresser maintenant au spectrogramme.\n",
"\n",
"\\TODO On choisit une fenêtre XXXX car XXX"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"using DSP, PyPlot\n",
"\n",
"println(floor(Int, trame_period*fs), floor(Int, overlap*fs))\n",
"S = spectrogram(s, floor(Int, trame_period*fs), floor(Int, overlap*fs); fs=fs, window=hanning)\n",
"t = time(S)\n",
"f = freq(S)\n",
"imshow(reverse(log10.(power(S)), dims=1), extent=[first(t), last(t), first(f), last(f)], aspect=\"auto\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Zoom sur notre vibrato que l'on voit un peu"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"S = spectrogram(s_trame, floor(Int, trame_period*fs), floor(Int, overlap*fs); fs=fs, window=hanning)\n",
"t = time(S)\n",
"f = freq(S)\n",
"imshow(reverse(log10.(power(S)), dims=1), extent=[first(t).+t_trame[1], last(t).+t_trame[1], first(f), last(f)], aspect=\"auto\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.2.0",
"language": "julia",
"name": "julia-1.2"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.2.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

Binary file not shown.

View file

@ -0,0 +1,443 @@
% Default to the notebook output style
% Inherit from the specified cell style.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
% Nicer default font (+ math font) than Computer Modern for most use cases
\usepackage{mathpazo}
% Basic figure setup, for now with no caption control since it's done
% automatically by Pandoc (which extracts ![](path) syntax from Markdown).
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
% Set max figure width to be 80% of text width, for now hardcoded.
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}
% Ensure that by default, figures have no caption (until we provide a
% proper Figure object with a Caption API and a way to capture that
% in the conversion process - todo).
\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel}
\usepackage{adjustbox} % Used to constrain images to a maximum size
\usepackage{xcolor} % Allow colors to be defined
\usepackage{enumerate} % Needed for markdown enumerations to work
\usepackage{geometry} % Used to adjust the document margins
\usepackage{amsmath} % Equations
\usepackage{amssymb} % Equations
\usepackage{textcomp} % defines textquotesingle
% Hack from http://tex.stackexchange.com/a/47451/13684:
\AtBeginDocument{%
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
}
\usepackage{upquote} % Upright quotes for verbatim code
\usepackage{eurosym} % defines \euro
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
\usepackage{fancyvrb} % verbatim replacement that allows latex
\usepackage{grffile} % extends the file name processing of package graphics
% to support a larger range
% The hyperref package gives us a pdf with properly built
% internal navigation ('pdf bookmarks' for the table of contents,
% internal cross-reference links, web links for URLs, etc.)
\usepackage{hyperref}
\usepackage{longtable} % longtable support required by pandoc >1.10
\usepackage{booktabs} % table support for pandoc > 1.12.2
\usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
% normalem makes italics be italics, not underlines
% Colors for the hyperref package
\definecolor{urlcolor}{rgb}{0,.145,.698}
\definecolor{linkcolor}{rgb}{.71,0.21,0.01}
\definecolor{citecolor}{rgb}{.12,.54,.11}
% ANSI colors
\definecolor{ansi-black}{HTML}{3E424D}
\definecolor{ansi-black-intense}{HTML}{282C36}
\definecolor{ansi-red}{HTML}{E75C58}
\definecolor{ansi-red-intense}{HTML}{B22B31}
\definecolor{ansi-green}{HTML}{00A250}
\definecolor{ansi-green-intense}{HTML}{007427}
\definecolor{ansi-yellow}{HTML}{DDB62B}
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
\definecolor{ansi-blue}{HTML}{208FFB}
\definecolor{ansi-blue-intense}{HTML}{0065CA}
\definecolor{ansi-magenta}{HTML}{D160C4}
\definecolor{ansi-magenta-intense}{HTML}{A03196}
\definecolor{ansi-cyan}{HTML}{60C6C8}
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
\definecolor{ansi-white}{HTML}{C5C1B4}
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
% commands and environments needed by pandoc snippets
% extracted from the output of `pandoc -s`
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\newenvironment{Shaded}{}{}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
\newcommand{\RegionMarkerTok}[1]{{#1}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
\newcommand{\NormalTok}[1]{{#1}}
% Additional commands for more recent versions of Pandoc
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
\newcommand{\ImportTok}[1]{{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
\newcommand{\BuiltInTok}[1]{{#1}}
\newcommand{\ExtensionTok}[1]{{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
% Define a nice break command that doesn't care if a line doesn't already
% exist.
\def\br{\hspace*{\fill} \\* }
% Math Jax compatability definitions
\def\gt{>}
\def\lt{<}
% Document parameters
\title{Analyse-Non-Param-Flute}
% Pygments definitions
\makeatletter
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
\let\PY@ul=\relax \let\PY@tc=\relax%
\let\PY@bc=\relax \let\PY@ff=\relax}
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
\def\PY@toks#1+{\ifx\relax#1\empty\else%
\PY@tok{#1}\expandafter\PY@toks\fi}
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
\PY@it{\PY@bf{\PY@ff{#1}}}}}}}
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}
\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit}
\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf}
\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\expandafter\def\csname PY@tok@fm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@vm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\expandafter\def\csname PY@tok@sa\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@dl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\def\PYZbs{\char`\\}
\def\PYZus{\char`\_}
\def\PYZob{\char`\{}
\def\PYZcb{\char`\}}
\def\PYZca{\char`\^}
\def\PYZam{\char`\&}
\def\PYZlt{\char`\<}
\def\PYZgt{\char`\>}
\def\PYZsh{\char`\#}
\def\PYZpc{\char`\%}
\def\PYZdl{\char`\$}
\def\PYZhy{\char`\-}
\def\PYZsq{\char`\'}
\def\PYZdq{\char`\"}
\def\PYZti{\char`\~}
% for compatibility with earlier versions
\def\PYZat{@}
\def\PYZlb{[}
\def\PYZrb{]}
\makeatother
% Exact colors from NB
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
% Prevent overflowing lines due to hard-to-break entities
\sloppy
% Setup hyperref package
\hypersetup{
breaklinks=true, % so long urls are correctly broken across lines
colorlinks=true,
urlcolor=urlcolor,
linkcolor=linkcolor,
citecolor=citecolor,
}
% Slightly bigger margins than the latex defaults
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\begin{document}
\maketitle
\section{Analyse non paramétrique du signal de la
flute}\label{analyse-non-paramuxe9trique-du-signal-de-la-flute}
Nous allons commencer par afficher le signals
/TODO mettre des labels X/Y avec unités et des titres à toutes les
figure
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}46}]:} \PY{k}{using} \PY{n}{WAV}
\PY{n}{s}\PY{p}{,} \PY{n}{fs} \PY{o}{=} \PY{n}{wavread}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{.}\PY{l+s}{.}\PY{l+s}{/}\PY{l+s}{f}\PY{l+s}{l}\PY{l+s}{u}\PY{l+s}{t}\PY{l+s}{e}\PY{l+s}{i}\PY{l+s}{r}\PY{l+s}{c}\PY{l+s}{a}\PY{l+s}{m}\PY{l+s}{.}\PY{l+s}{w}\PY{l+s}{a}\PY{l+s}{v}\PY{l+s}{\PYZdq{}}\PY{p}{)}\PY{p}{;}
\PY{n}{s} \PY{o}{=} \PY{n}{vec}\PY{p}{(}\PY{n}{s}\PY{p}{)}\PY{p}{;}
\PY{n}{t} \PY{o}{=} \PY{p}{(}\PY{l+m+mi}{0} \PY{o}{:} \PY{l+m+mi}{1} \PY{o}{:} \PY{n}{size}\PY{p}{(}\PY{n}{s}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{]}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{/}\PY{n}{fs}\PY{p}{;}
\PY{n}{fs} \PY{o}{=} \PY{n}{floor}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{fs}\PY{p}{)}\PY{p}{;}
\end{Verbatim}
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}47}]:} \PY{k}{using} \PY{n}{Plots}
\PY{n}{plot}\PY{p}{(}\PY{n}{t}\PY{p}{,} \PY{n}{s}\PY{p}{,} \PY{n}{title}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{S}\PY{l+s}{o}\PY{l+s}{n}\PY{l+s}{ }\PY{l+s}{d}\PY{l+s}{e}\PY{l+s}{ }\PY{l+s}{f}\PY{l+s}{l}\PY{l+s}{u}\PY{l+s}{t}\PY{l+s}{e}\PY{l+s}{\PYZdq{}}\PY{p}{,}\PY{n}{label}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZdq{}}\PY{l+s}{S}\PY{l+s}{i}\PY{l+s}{g}\PY{l+s}{n}\PY{l+s}{a}\PY{l+s}{l}\PY{l+s}{\PYZdq{}}\PY{p}{]}\PY{p}{)}
\end{Verbatim}
\texttt{\color{outcolor}Out[{\color{outcolor}47}]:}
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_2_0.pdf}
\end{center}
{ \hspace*{\fill} \\}
Regardons des trames. La taille de trame reste classique : de l'ordre de
20ms.
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}48}]:} \PY{k}{using} \PY{n}{LinearAlgebra}
\PY{n}{t\PYZus{}s} \PY{o}{=} \PY{l+m+mi}{5} \PY{c}{\PYZsh{}s}
\PY{n}{trame\PYZus{}period} \PY{o}{=} \PY{l+m+mf}{0.01} \PY{c}{\PYZsh{}s}
\PY{n}{i\PYZus{}s} \PY{o}{=} \PY{n}{floor}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{t\PYZus{}s}\PY{o}{*}\PY{n}{fs}\PY{o}{+}\PY{l+m+mi}{1}\PY{p}{)}
\PY{n}{i\PYZus{}e} \PY{o}{=} \PY{n}{floor}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{i\PYZus{}s}\PY{o}{+}\PY{n}{trame\PYZus{}period}\PY{o}{*}\PY{n}{fs}\PY{p}{)}
\PY{n}{t\PYZus{}trame} \PY{o}{=} \PY{n}{t}\PY{p}{[}\PY{n}{i\PYZus{}s}\PY{o}{:}\PY{n}{i\PYZus{}e}\PY{p}{]}
\PY{n}{s\PYZus{}trame} \PY{o}{=} \PY{n}{s}\PY{p}{[}\PY{n}{i\PYZus{}s}\PY{o}{:}\PY{n}{i\PYZus{}e}\PY{p}{]}
\PY{n}{plot}\PY{p}{(}\PY{n}{t\PYZus{}trame}\PY{p}{,} \PY{n}{s\PYZus{}trame}\PY{p}{)}
\end{Verbatim}
\texttt{\color{outcolor}Out[{\color{outcolor}48}]:}
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_4_0.pdf}
\end{center}
{ \hspace*{\fill} \\}
On cherche maintenant la fréquence du fondamental. Comme il s'agit d'un
instrument à vent, on choisit notre interval de fréquence.
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}49}]:} \PY{k}{using} \PY{n}{WORLD}
\PY{n}{floor\PYZus{}freq} \PY{o}{=} \PY{l+m+mi}{300} \PY{c}{\PYZsh{}Hz}
\PY{n}{ceil\PYZus{}freq} \PY{o}{=} \PY{l+m+mi}{800} \PY{c}{\PYZsh{}Hz}
\PY{n}{f0}\PY{p}{,} \PY{n}{timeaxis} \PY{o}{=} \PY{n}{harvest}\PY{p}{(}\PY{n}{s}\PY{p}{,} \PY{n}{fs}\PY{p}{,} \PY{n}{HarvestOption}\PY{p}{(}\PY{n}{floor\PYZus{}freq}\PY{p}{,} \PY{n}{ceil\PYZus{}freq}\PY{p}{,} \PY{n}{trame\PYZus{}period}\PY{p}{)}\PY{p}{)}\PY{p}{;}\PY{c}{\PYZsh{}floor and ceil freq, period}
\PY{n}{plot}\PY{p}{(}\PY{n}{timeaxis}\PY{p}{,} \PY{n}{f0}\PY{p}{)}
\end{Verbatim}
\texttt{\color{outcolor}Out[{\color{outcolor}49}]:}
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_6_0.pdf}
\end{center}
{ \hspace*{\fill} \\}
On observe des vibratos, par exemple un gros vibrato vers 5s, un "fa".
La fréquence du son ne correspond pas exactement à la fréquence du
fondamental. On a une modulation de fréquence.
/TODO étudier cette modulation de fréquence
Regardons un zoom sur un vibrato.
/TODO fft du petit bout de signal
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}50}]:} \PY{n}{number\PYZus{}trame} \PY{o}{=} \PY{l+m+mi}{100} \PY{c}{\PYZsh{} trames on each side of t\PYZus{}s}
\PY{n}{i\PYZus{}s} \PY{o}{=} \PY{n}{floor}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{t\PYZus{}s}\PY{o}{*}\PY{n}{fs}\PY{o}{\PYZhy{}}\PY{n}{number\PYZus{}trame}\PY{o}{*}\PY{n}{trame\PYZus{}period}\PY{o}{*}\PY{n}{fs}\PY{o}{+}\PY{l+m+mi}{1}\PY{p}{)}
\PY{n}{i\PYZus{}e} \PY{o}{=} \PY{n}{floor}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{i\PYZus{}s}\PY{o}{+}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{number\PYZus{}trame}\PY{o}{*}\PY{n}{trame\PYZus{}period}\PY{o}{*}\PY{n}{fs}\PY{p}{)}
\PY{n}{t\PYZus{}trame} \PY{o}{=} \PY{n}{t}\PY{p}{[}\PY{n}{i\PYZus{}s}\PY{o}{:}\PY{n}{i\PYZus{}e}\PY{p}{]}
\PY{n}{s\PYZus{}trame} \PY{o}{=} \PY{n}{s}\PY{p}{[}\PY{n}{i\PYZus{}s}\PY{o}{:}\PY{n}{i\PYZus{}e}\PY{p}{]}
\PY{n}{f0}\PY{p}{,} \PY{n}{timeaxis} \PY{o}{=} \PY{n}{harvest}\PY{p}{(}\PY{n}{s\PYZus{}trame}\PY{p}{,} \PY{n}{fs}\PY{p}{,} \PY{n}{HarvestOption}\PY{p}{(}\PY{n}{floor\PYZus{}freq}\PY{p}{,} \PY{n}{ceil\PYZus{}freq}\PY{p}{,} \PY{n}{trame\PYZus{}period}\PY{p}{)}\PY{p}{)}\PY{p}{;}\PY{c}{\PYZsh{}floor and ceil freq, period}
\PY{n}{plot}\PY{p}{(}\PY{n}{timeaxis}\PY{o}{.+}\PY{n}{t\PYZus{}trame}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{,} \PY{n}{f0}\PY{p}{)}
\end{Verbatim}
\texttt{\color{outcolor}Out[{\color{outcolor}50}]:}
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_8_0.pdf}
\end{center}
{ \hspace*{\fill} \\}
On va s'intéresser maintenant au spectrogramme.
\TODO On choisit une fenêtre XXXX car XXX
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}53}]:} \PY{c}{\PYZsh{}\PYZpc{}matplotlib inline}
\PY{k}{using} \PY{n}{DSP}\PY{p}{,} \PY{n}{PyPlot}
\PY{n}{trame\PYZus{}period} \PY{o}{=} \PY{l+m+mf}{0.01} \PY{c}{\PYZsh{}s}
\PY{n}{overlap} \PY{o}{=} \PY{l+m+mf}{0.001}\PY{c}{\PYZsh{}s}
\PY{n}{S} \PY{o}{=} \PY{n}{spectrogram}\PY{p}{(}\PY{n}{s}\PY{p}{,} \PY{n}{convert}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{trame\PYZus{}period}\PY{o}{*}\PY{n}{fs}\PY{p}{)}\PY{p}{,} \PY{n}{convert}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{overlap}\PY{o}{*}\PY{n}{fs}\PY{p}{)}\PY{p}{;} \PY{n}{fs}\PY{o}{=}\PY{n}{fs}\PY{p}{,} \PY{n}{window}\PY{o}{=}\PY{n}{hanning}\PY{p}{)}
\PY{n}{t} \PY{o}{=} \PY{n}{time}\PY{p}{(}\PY{n}{S}\PY{p}{)}
\PY{n}{f} \PY{o}{=} \PY{n}{freq}\PY{p}{(}\PY{n}{S}\PY{p}{)}
\PY{n}{imshow}\PY{p}{(}\PY{n}{reverse}\PY{p}{(}\PY{n}{log10}\PY{o}{.}\PY{p}{(}\PY{n}{power}\PY{p}{(}\PY{n}{S}\PY{p}{)}\PY{p}{)}\PY{p}{,} \PY{n}{dims}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{,} \PY{n}{extent}\PY{o}{=}\PY{p}{[}\PY{n}{first}\PY{p}{(}\PY{n}{t}\PY{p}{)}\PY{p}{,} \PY{n}{last}\PY{p}{(}\PY{n}{t}\PY{p}{)}\PY{p}{,} \PY{n}{first}\PY{p}{(}\PY{n}{f}\PY{p}{)}\PY{p}{,} \PY{n}{last}\PY{p}{(}\PY{n}{f}\PY{p}{)}\PY{p}{]}\PY{p}{,} \PY{n}{aspect}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{a}\PY{l+s}{u}\PY{l+s}{t}\PY{l+s}{o}\PY{l+s}{\PYZdq{}}\PY{p}{)}
\end{Verbatim}
The analogue of IPython's \texttt{\%matplotlib} in Julia is to use the \href{https://github.com/stevengj/PyPlot.jl}{PyPlot package}, which gives a Julia interface to Matplotlib including inline plots in IJulia notebooks. (The equivalent of \texttt{numpy} is already loaded by default in Julia.)
Given PyPlot, the analogue of \texttt{\%matplotlib inline} is \texttt{using PyPlot}, since PyPlot defaults to inline plots in IJulia.
To enable separate GUI windows in PyPlot, analogous to \texttt{\%matplotlib}, do \texttt{using PyPlot; pygui(true)}. To specify a particular gui backend, analogous to \texttt{\%matplotlib gui}, you can either do \texttt{using PyPlot; pygui(:gui); using PyPlot; pygui(true)} (where \texttt{gui} is \texttt{wx}, \texttt{qt}, \texttt{tk}, or \texttt{gtk}), or you can do \texttt{ENV["MPLBACKEND"]=backend; using PyPlot; pygui(true)} (where \texttt{backend} is the name of a Matplotlib backend, like \texttt{tkagg}).
For more options, see the PyPlot documentation.
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor} }]:} \PY{n}{Zoom} \PY{n}{sur} \PY{n}{notre} \PY{n}{vibrato} \PY{n}{que} \PY{n}{l}\PY{o}{\PYZsq{}}\PY{n}{on} \PY{n}{voit} \PY{n}{un} \PY{n}{peu}
\end{Verbatim}
\begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}52}]:} \PY{n}{S} \PY{o}{=} \PY{n}{spectrogram}\PY{p}{(}\PY{n}{s\PYZus{}trame}\PY{p}{,} \PY{n}{convert}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{trame\PYZus{}period}\PY{o}{*}\PY{n}{fs}\PY{p}{)}\PY{p}{,} \PY{n}{convert}\PY{p}{(}\PY{k+kt}{Int}\PY{p}{,} \PY{n}{overlap}\PY{o}{*}\PY{n}{fs}\PY{p}{)}\PY{p}{;} \PY{n}{fs}\PY{o}{=}\PY{n}{fs}\PY{p}{,} \PY{n}{window}\PY{o}{=}\PY{n}{hanning}\PY{p}{)}
\PY{n}{t} \PY{o}{=} \PY{n}{time}\PY{p}{(}\PY{n}{S}\PY{p}{)}
\PY{n}{f} \PY{o}{=} \PY{n}{freq}\PY{p}{(}\PY{n}{S}\PY{p}{)}
\PY{n}{imshow}\PY{p}{(}\PY{n}{reverse}\PY{p}{(}\PY{n}{log10}\PY{o}{.}\PY{p}{(}\PY{n}{power}\PY{p}{(}\PY{n}{S}\PY{p}{)}\PY{p}{)}\PY{p}{,} \PY{n}{dims}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{,} \PY{n}{extent}\PY{o}{=}\PY{p}{[}\PY{n}{first}\PY{p}{(}\PY{n}{t}\PY{p}{)}\PY{o}{.+}\PY{n}{t\PYZus{}trame}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{,} \PY{n}{last}\PY{p}{(}\PY{n}{t}\PY{p}{)}\PY{o}{.+}\PY{n}{t\PYZus{}trame}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{,} \PY{n}{first}\PY{p}{(}\PY{n}{f}\PY{p}{)}\PY{p}{,} \PY{n}{last}\PY{p}{(}\PY{n}{f}\PY{p}{)}\PY{p}{]}\PY{p}{,} \PY{n}{aspect}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{a}\PY{l+s}{u}\PY{l+s}{t}\PY{l+s}{o}\PY{l+s}{\PYZdq{}}\PY{p}{)}
\end{Verbatim}
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_12_0.png}
\end{center}
{ \hspace*{\fill} \\}
\begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}52}]:} PyObject <matplotlib.image.AxesImage object at 0x7fac9988bb38>
\end{Verbatim}
% Add a bibliography block to the postdoc
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 6.7 MiB

Binary file not shown.

View file

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="400" viewBox="0 0 2400 1600">
<defs>
<clipPath id="clip6700">
<rect x="0" y="0" width="2400" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip6700)" points="
0,1600 2400,1600 2400,0 0,0
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/>
<defs>
<clipPath id="clip6701">
<rect x="480" y="0" width="1681" height="1600"/>
</clipPath>
</defs>
<polygon clip-path="url(#clip6700)" points="
208.77,1487.47 2352.76,1487.47 2352.76,47.2441 208.77,47.2441
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/>
<defs>
<clipPath id="clip6702">
<rect x="208" y="47" width="2145" height="1441"/>
</clipPath>
</defs>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
269.449,1487.47 269.449,47.2441
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
775.095,1487.47 775.095,47.2441
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1280.74,1487.47 1280.74,47.2441
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
1786.39,1487.47 1786.39,47.2441
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
2292.03,1487.47 2292.03,47.2441
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
208.77,1284.36 2352.76,1284.36
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
208.77,987.715 2352.76,987.715
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
208.77,691.068 2352.76,691.068
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
208.77,394.421 2352.76,394.421
"/>
<polyline clip-path="url(#clip6702)" style="stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none" points="
208.77,97.7738 2352.76,97.7738
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,1487.47 2352.76,1487.47
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,1487.47 208.77,47.2441
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
269.449,1487.47 269.449,1465.87
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
775.095,1487.47 775.095,1465.87
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1280.74,1487.47 1280.74,1465.87
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1786.39,1487.47 1786.39,1465.87
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
2292.03,1487.47 2292.03,1465.87
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,1284.36 240.93,1284.36
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,987.715 240.93,987.715
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,691.068 240.93,691.068
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,394.421 240.93,394.421
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
208.77,97.7738 240.93,97.7738
"/>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 269.449, 1541.47)" x="269.449" y="1541.47">5.0000</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 775.095, 1541.47)" x="775.095" y="1541.47">5.0025</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1280.74, 1541.47)" x="1280.74" y="1541.47">5.0050</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 1786.39, 1541.47)" x="1786.39" y="1541.47">5.0075</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;" transform="rotate(0, 2292.03, 1541.47)" x="2292.03" y="1541.47">5.0100</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 184.77, 1301.86)" x="184.77" y="1301.86">-0.05</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 184.77, 1005.21)" x="184.77" y="1005.21">0.00</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 184.77, 708.568)" x="184.77" y="708.568">0.05</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 184.77, 411.921)" x="184.77" y="411.921">0.10</text>
</g>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;" transform="rotate(0, 184.77, 115.274)" x="184.77" y="115.274">0.15</text>
</g>
<polyline clip-path="url(#clip6702)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
269.449,1317.61 275.815,1283.21 282.18,1175.84 288.449,1085.13 294.814,1030.08 301.083,993.328 307.448,1017.23 313.717,1076.26 320.082,1143.43 326.351,1217.3
332.717,1267.46 338.986,1312 345.351,1340.43 351.62,1330.29 357.985,1314.36 364.35,1296.61 370.619,1269.27 376.985,1263.48 383.253,1258.23 389.619,1245.01
395.888,1246.64 402.253,1252.97 408.522,1253.52 414.887,1266.01 421.156,1265.65 427.521,1243.92 433.79,1209.16 440.155,1144.88 446.521,1049.46 452.79,946.613
459.155,834.715 465.424,717.205 471.789,615.989 478.058,534.51 484.423,491.417 490.692,482.183 497.058,477.294 503.326,496.306 509.692,527.449 515.961,570.542
522.326,618.887 528.595,644.236 534.96,645.503 541.325,633.734 547.594,599.875 553.96,540.305 560.229,457.377 566.594,355.981 572.863,248.61 579.228,164.052
585.497,109.733 591.862,90.1781 598.131,112.63 604.496,184.694 610.765,314.698 617.131,477.656 623.496,638.079 629.765,793.433 636.13,932.852 642.399,1039.86
648.764,1108.3 655.033,1132.57 661.398,1123.69 667.667,1077.7 674.033,994.414 680.302,917.824 686.667,872.739 692.936,864.591 699.301,941.725 705.57,1057.42
711.935,1151.94 718.301,1244.46 724.569,1316.89 730.935,1345.14 737.204,1367.77 743.569,1369.76 749.838,1370.85 756.203,1384.43 762.472,1402.17 768.837,1428.61
775.106,1446.71 781.472,1426.07 787.74,1394.93 794.106,1372.11 800.471,1337.53 806.74,1299.15 813.105,1287.56 819.374,1280.13 825.739,1275.25 832.008,1281.4
838.374,1289.37 844.642,1307.66 851.008,1305.48 857.277,1254.42 863.642,1160.27 869.911,1065.39 876.276,1014.33 882.545,1001.11 888.91,1027.73 895.276,1096.9
901.545,1177.83 907.91,1242.29 914.179,1289.37 920.544,1322.14 926.813,1338.98 933.178,1335.72 939.447,1310.55 945.812,1283.76 952.081,1266.37 958.447,1260.94
964.715,1254.42 971.081,1249.9 977.446,1247.54 983.715,1248.63 990.08,1252.25 996.349,1267.28 1002.71,1264.74 1008.98,1234.51 1015.35,1189.24 1021.62,1126.05
1027.98,1040.59 1034.25,929.05 1040.62,813.893 1046.89,703.806 1053.25,602.229 1059.52,529.079 1065.89,490.15 1072.25,478.38 1078.52,483.631 1084.88,501.195
1091.15,532.338 1097.52,574.164 1103.79,610.014 1110.15,636.269 1116.42,647.495 1122.79,620.335 1129.06,572.715 1135.42,515.68 1141.69,428.588 1148.06,321.216
1154.42,226.339 1160.69,147.576 1167.06,96.8775 1173.32,88.0053 1179.69,130.737 1185.96,224.166 1192.32,358.697 1198.59,518.577 1204.96,686.605 1211.23,839.604
1217.59,964.358 1223.86,1063.76 1230.23,1124.24 1236.59,1129.31 1242.86,1114.46 1249.23,1065.39 1255.49,967.436 1261.86,888.129 1268.13,857.348 1274.49,874.187
1280.76,958.02 1287.13,1072.09 1293.4,1169.87 1299.76,1253.34 1306.03,1324.13 1312.4,1361.61 1318.67,1376.64 1325.03,1378.81 1331.4,1379 1337.67,1390.95
1344.03,1410.68 1350.3,1427.7 1356.66,1435.13 1362.93,1414.12 1369.3,1385.51 1375.57,1359.44 1381.93,1329.38 1388.2,1295.71 1394.57,1276.33 1400.84,1276.15
1407.2,1285.2 1413.57,1279.77 1419.84,1287.92 1426.2,1314.72 1432.47,1299.51 1438.84,1235.77 1445.1,1136.91 1451.47,1042.4 1457.74,1004.92 1464.1,1009.08
1470.37,1043.66 1476.74,1122.06 1483.01,1195.76 1489.37,1258.04 1495.64,1309.65 1502.01,1335.18 1508.37,1339.34 1514.64,1326.85 1521.01,1301.86 1527.27,1283.57
1533.64,1268.18 1539.91,1254.97 1546.27,1252.07 1552.54,1252.07 1558.91,1242.83 1565.18,1248.81 1571.54,1257.32 1577.81,1260.22 1584.18,1257.68 1590.54,1227.63
1596.81,1175.66 1603.18,1114.1 1609.44,1022.48 1615.81,912.935 1622.08,797.416 1628.44,683.708 1634.71,588.83 1641.08,527.811 1647.35,485.261 1653.71,476.57
1659.98,490.331 1666.35,508.437 1672.62,540.667 1678.98,584.303 1685.35,612.006 1691.62,630.475 1697.98,636.45 1704.25,606.031 1710.61,557.144 1716.88,488.52
1723.25,401.066 1729.52,298.221 1735.88,201.171 1742.15,133.453 1748.52,100.499 1754.79,97.6018 1761.15,147.213 1767.52,256.033 1773.79,400.342 1780.15,560.222
1786.42,730.06 1792.79,875.093 1799.05,993.69 1805.42,1082.59 1811.69,1135.64 1818.05,1137.09 1824.32,1099.43 1830.69,1034.25 1836.96,947.881 1843.32,862.961
1849.59,841.958 1855.96,891.57 1862.32,970.333 1868.59,1083.68 1874.96,1193.04 1881.22,1268.36 1887.59,1336.99 1893.86,1372.11 1900.22,1376.46 1906.49,1391.13
1912.86,1394.02 1919.13,1393.66 1925.49,1412.13 1931.76,1426.25 1938.13,1429.33 1944.49,1408.69 1950.76,1371.93 1957.13,1344.96 1963.4,1317.07 1969.76,1291.18
1976.03,1280.68 1982.39,1280.13 1988.66,1277.6 1995.03,1281.4 2001.3,1303.13 2007.66,1319.79 2013.93,1292.08 2020.3,1203.72 2026.66,1104.32 2032.93,1035.7
2039.3,998.579 2045.57,1011.62 2051.93,1067.93 2058.2,1139.08 2064.57,1210.24 2070.83,1278.69 2077.2,1314.17 2083.47,1335.18 2089.83,1338.8 2096.1,1320.15
2102.47,1300.41 2108.74,1284.84 2115.1,1263.84 2121.47,1256.23 2127.74,1251.71 2134.1,1244.28 2140.37,1241.21 2146.74,1244.46 2153,1248.99 2159.37,1258.23
2165.64,1250.62 2172,1216.76 2178.27,1169.5 2184.64,1102.15 2190.91,1002.92 2197.27,895.191 2203.64,776.775 2209.91,661.075 2216.27,575.069 2222.54,517.49
2228.91,483.812 2235.17,476.751 2241.54,487.615 2247.81,516.042 2254.17,554.065 2260.44,587.2 2266.81,614.903 2273.08,630.475 2279.44,625.586 2285.71,597.34
2292.08,544.831
"/>
<polygon clip-path="url(#clip6700)" points="
1989.93,251.724 2280.76,251.724 2280.76,130.764 1989.93,130.764
" fill="#ffffff" fill-rule="evenodd" fill-opacity="1"/>
<polyline clip-path="url(#clip6700)" style="stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none" points="
1989.93,251.724 2280.76,251.724 2280.76,130.764 1989.93,130.764 1989.93,251.724
"/>
<polyline clip-path="url(#clip6700)" style="stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none" points="
2013.93,191.244 2157.93,191.244
"/>
<g clip-path="url(#clip6700)">
<text style="fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;" transform="rotate(0, 2181.93, 208.744)" x="2181.93" y="208.744">y1</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 21 MiB

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 3.1 MiB