<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hammad Khalid</title>
    <description>The latest articles on DEV Community by Hammad Khalid (@hammadk).</description>
    <link>https://dev.to/hammadk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3534303%2F3187c947-2e62-44a8-843d-365c94e80be0.png</url>
      <title>DEV Community: Hammad Khalid</title>
      <link>https://dev.to/hammadk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hammadk"/>
    <language>en</language>
    <item>
      <title>Wait—Your Voice Is Just 0s and 1s?!</title>
      <dc:creator>Hammad Khalid</dc:creator>
      <pubDate>Mon, 03 Nov 2025 12:50:00 +0000</pubDate>
      <link>https://dev.to/hammadk/wait-your-voice-is-just-0s-and-1s-2d64</link>
      <guid>https://dev.to/hammadk/wait-your-voice-is-just-0s-and-1s-2d64</guid>
      <description>&lt;p&gt;Wait—Your Voice Is Just &lt;strong&gt;0s and 1s&lt;/strong&gt;?!&lt;/p&gt;

&lt;p&gt;You say &lt;strong&gt;"Hello!"&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Your phone saves it.&lt;br&gt;&lt;br&gt;
But &lt;strong&gt;inside&lt;/strong&gt;?&lt;br&gt;&lt;br&gt;
It’s not sound.&lt;br&gt;&lt;br&gt;
It’s &lt;strong&gt;code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let’s see how — in 4 crazy-simple steps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Sound = A Wild Wiggle&lt;br&gt;
Your voice pushes air.&lt;br&gt;&lt;br&gt;
That air &lt;strong&gt;wiggles&lt;/strong&gt; — up, down, up, down.&lt;br&gt;&lt;br&gt;
Smooth. Endless. &lt;strong&gt;Analog.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Freeze It! (Sampling)
We &lt;strong&gt;can’t save the whole wiggle&lt;/strong&gt;.
So we take &lt;strong&gt;super-fast photos&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Snap!&lt;/em&gt; Every 0.0001 seconds.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Snap!&lt;/em&gt; Again.&lt;br&gt;&lt;br&gt;
&lt;em&gt;Snap!&lt;/em&gt; 44,100 times in one second.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now we have &lt;strong&gt;dots&lt;/strong&gt; — a connect-the-dots wave.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Round It Off (Quantization)
We can’t save &lt;em&gt;every&lt;/em&gt; dot perfectly.
So we &lt;strong&gt;snap each dot to the nearest floor&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;High? → Floor 7&lt;br&gt;&lt;br&gt;
Medium? → Floor 5&lt;br&gt;&lt;br&gt;
Low? → Floor 2&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now it’s &lt;strong&gt;blocky&lt;/strong&gt;. Like 8-bit Mario.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Translate to Binary (Encoding)
Each floor gets a &lt;strong&gt;secret code&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Floor 7 → &lt;code&gt;111&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Floor 5 → &lt;code&gt;101&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Floor 2 → &lt;code&gt;010&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Boom.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Your voice is now a &lt;strong&gt;string of 0s and 1s&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s It!&lt;br&gt;
&lt;strong&gt;Wiggle → Snapshots → Blocks → 0s &amp;amp; 1s&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next time you send a voice note…&lt;br&gt;&lt;br&gt;
You’re sending &lt;strong&gt;rounded air wiggles in binary&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mind blown?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Drop a brain-explosion emoji below!&lt;/p&gt;

</description>
      <category>audio</category>
      <category>beginners</category>
      <category>dsp</category>
      <category>fun</category>
    </item>
    <item>
      <title>From Analog to Digital: Signal Simulation</title>
      <dc:creator>Hammad Khalid</dc:creator>
      <pubDate>Sat, 27 Sep 2025 21:16:24 +0000</pubDate>
      <link>https://dev.to/hammadk/from-analog-to-digital-signal-simulation-357n</link>
      <guid>https://dev.to/hammadk/from-analog-to-digital-signal-simulation-357n</guid>
      <description>&lt;p&gt;In this post, I explore the process of converting an analog signal to a digital one using MATLAB simulation. The analog signal is a simple 100 Hz sine wave.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Analog Signal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We start with a continuous sine wave: x = sin(2πft). This represents real-world continuous signals like audio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Sampling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sampling discretizes the time axis. According to the Nyquist theorem, the sampling frequency (Fs) must be at least twice the signal frequency (200 Hz here) to avoid aliasing.&lt;/p&gt;

&lt;p&gt;Below Nyquist (150 Hz): Aliasing distorts the signal, making it look like a lower frequency wave.&lt;br&gt;
At Nyquist (200 Hz): Captures the signal minimally, but phase issues might arise.&lt;br&gt;
Above Nyquist (1000 Hz): Accurate representation with no distortion. Plots show the sampled points; lower Fs leads to fewer points and potential misinformation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Quantization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Quantization rounds amplitudes to discrete levels. We tested 8, 16, and 64 levels (3, 4, 6 bits). Lower levels (8) create a "staircase" effect, increasing error. Higher levels (64) make the signal closer to the original, reducing quantization noise. Overlaid plots highlight how more levels improve fidelity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Encoding and Bitstream&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Quantized values are converted to binary. Higher bits mean longer codes but better quality. The bitstream is the final digital representation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This simulation shows trade-offs: Higher Fs and bits improve quality but increase data size. Key takeaway: Digital signals approximate analogs; parameters like Fs and bits control accuracy vs. efficiency.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>science</category>
    </item>
  </channel>
</rss>
