{ "cells": [ { "cell_type": "markdown", "id": "d709b880", "metadata": {}, "source": [ "# Input" ] }, { "cell_type": "markdown", "id": "5f40e11b", "metadata": {}, "source": [ "Here you can download the input files (right click / save as...):\n", "* 2024-06-07\n", "* 2024-06-06\n", "* 2024-03-16\n", "* 2023-04-20\n", "* 2023-06-15\n", "* 2023-03-14" ] }, { "cell_type": "markdown", "id": "6ab69020", "metadata": {}, "source": [ "In this project, we work with audio data.\n", "To facilitate reading it into your program, we provide the inputs in a simple format:\n", "\n", "```{admonition} Format\n", "The first line contains $n$, the number of samples ($0 \\leq n < 2^{32}$).\n", "\n", "Afterwards, $n$ lines follow, each with one sample $x$ as an integer ($-2^{15} \\leq x < 2^{15}$).\n", "```\n", "\n", "The sampling rate $f_s$ is fixed at 16640 Hz.\n", "\n", "## Example\n", "```\n", "10\n", "623\n", "-310\n", "-273\n", "3404\n", "4745\n", "655\n", "-454\n", "3463\n", "3375\n", "-5350\n", "```\n", "\n", "```{note}\n", "Although the samples are given as integer numbers, for the rest of the project it makes sense to convert them into a floating point format at this point already.\n", "```" ] }, { "cell_type": "markdown", "id": "cfcac6c9", "metadata": {}, "source": [ "# Visualization\n", "\n", "It can be helpful during this project to visualize the result after every step.\n", "Wen can do this for example like this:\n", "- The signal contains 2 lines with 2080 pixels each per second. With $f_S = 16640\\text{Hz}$, we have 4 samples per pixel.\n", "- We take every 4th sample. For complex numbers, we calculate the magnitude $(a + ib \\mapsto \\sqrt{a^2+b^2} =\\mathrel{\\vcenter{:}} v)$.\n", "- We find $v_{min}$ and $v_{max}$, the smallest and largest values we obtained.\n", " Then we scale each $v$ to $255 \\cdot (v - v_{min}) / (v_{max} - v_{min})$.\n", " The result is a value between 0 and 255.\n", "- We can save these values as pixels in an image file.\n", " To do this, we can use the [](pgm-format) for example.\n", " \n", "```{figure} img/reference/raw_full_scaled.webp\n", "---\n", "name: fig:raw_full.en\n", "---\n", "Visualization, directly after reading the input.\n", "The image can be discerned already, but it is quite dark.\n", "```\n", "\n", "```{figure} img/reference/raw_detail.webp\n", "---\n", "name: fig:raw_detail.en\n", "---\n", "Detail view.\n", "We can clearly see vertical lines, stemming from the modulation onto the 2.4 kHz carrier.\n", "```" ] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.13" } }, "nbformat": 4, "nbformat_minor": 5 }