To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 30 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
@bind audio HTML("""
<z id="player"></z>
<button class="button" id="stopButton">Stop</button>
<script>
const player = document.getElementById('player')
const stop = document.getElementById('stopButton')
const handleSuccess = function(stream) {
const context = new AudioContext()
const source = context.createMediaStreamSource(stream)
const processor = context.createScriptProcessor(1024, 1, 1);


source.connect(processor)
processor.connect(context.destination)
processor.onaudioprocess = function(e) {
const data = e.inputBuffer.getChannelData(0)
player.value = data
player.dispatchEvent(new CustomEvent("input"))
if(!document.body.contains(player)){
processor.onaudioprocess = undefined
}
}
stop.onclick = () => {processor.onaudioprocess = undefined}
}

navigator.mediaDevices.getUserMedia({ audio: true, video: false })
.then(handleSuccess)
</script>
<style>
.button {
background-color: darkred;
border: none;
border-radius: 12px;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: "Alegreya Sans", sans-serif;
margin: 4px 2px;
cursor: pointer;
}
</style>
""")
260 ms
using Plots
👀 Reading hidden code
4.0 s
Error message

Cannot convert Missing to series data for plotting

Stack trace

Here is what happened, the most recent locations are first:

  1. error(s::String)
  2. _prepare_series_data(x::Missing)
  3. _series_data_vector(x::Missing, plotattributes::Dict{Symbol, Any})
  4. macro expansion
  5. apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)
  6. _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
  7. recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
  8. _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
  9. plot(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
  10. plot(audio*10, ylim=(-1,1))
plot(audio*10, ylim=(-1,1))
👀 Reading hidden code
---