modelisationanalysespectrale/rossignol/parametrique/.ipynb_checkpoints/note_flute-checkpoint.ipynb

183 lines
3.8 KiB
Text
Raw Normal View History

2019-10-01 13:43:39 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Flute\n",
"\n",
"## Objectif de ce fichier\n",
"\n",
"pipopipopipo\n",
"\n",
"## Code\n",
"\n",
"On importe le son de la flûte.\n",
"\n",
"On affiche et on joue le son pour s'assurer qu'il est bien **Ne fonctionne pas ?**"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Info: Precompiling ImageView [86fae568-95e7-573e-a6b2-d8a6b900c9ef]\n",
"└ @ Base loading.jl:1242\n"
]
}
],
"source": [
"using WAV\n",
"using Plots\n",
"using WORLD\n",
"using ImageView"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"y_flute, fs_flute = wavread(\"fluteircam.wav\");\n",
"y_flute = vec(y_flute);\n",
"fs_flute = floor(Int, fs_flute);\n",
"t_flute = (0 : 1 : size(y_flute)[1]-1)/fs_flute;"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"#wavplay(y_flute, fs_flute);\n",
"#plot(t_flute, y_flute, title=\"Flute\",label=[\"Signal brut\"])"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"opt = HarvestOption(300.0, 800.0, 0.02)#floor and ceil freq, period\n",
"f0, timeaxis = harvest(y_flute, fs_flute, opt);"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"#plot(timeaxis, f0)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"opt = DioOption(f0floor=300.0, f0ceil=800.0, channels_in_octave=2.0,\n",
" period=0.2, speed=1)\n",
"f0, timeaxis = dio(y_flute, fs_flute, opt);"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"#plot(timeaxis, f0)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"spectrogram = cheaptrick(y_flute, fs_flute, timeaxis, f0);"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1025, 68426)\n"
]
}
],
"source": [
"println(size(spectrogram/max(spectrogram)))"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Dict{String,Any} with 4 entries:\n",
" \"gui\" => Dict{String,Any}(\"window\"=>GtkWindowLeaf(name=\"\", parent, wi…\n",
" \"roi\" => Dict{String,Any}(\"redraw\"=>74: \"map(clim-mapped image, input…\n",
" \"annotations\" => 40: \"input-14\" = Dict{UInt64,Any}() Dict{UInt64,Any} \n",
" \"clim\" => 39: \"CLim\" = CLim{Float64}(5.04797e-17, 1.15948) CLim{Float6…"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"imshow(spectrogram)"
]
},
{
"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"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 1,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}