Monday, September 18, 2017

OpenCodecDev Discord channel

I just created a new Discord channel called OpenCodecDev, for the purpose of discussing open-source media codecs. It's public so anyone can join. We also have a voice channel.

Here's what it will look like in the Discord desktop app. I'm under Admin, and Foxx is a newcomer.

Notable features of Discord include:

  • Posting images, whether photos or pasting from PrintScreen.
  • Blog URL's become a block with an excerpt from the post
  • YouTube URL's are expanded into a player in the chat history
  • Unlimited backlog which is stored on the server. You don't miss out on messages that happened while you were logged out, unlike IRC, and no past message is ever lost.
  • The backlog is searchable.
This will be more convenient than the Google group, and it has a better GUI than IRC.

Monday, August 14, 2017

Root-Raised Cosine

Yesterday I finally figured out the root-raised cosine. I've been trying to understand it for about a year. It's very necessary for transmitting PSK signals because merely mixing a square wave with a carrier wave makes a wave with sharp transitions that cause lots of spurious signals. The clean, narrow PSK signals you may have seen are all using the root-raised cosine.

Here is the resource that I found yesterday to explain it properly: Pulse Shaping with raised cosine filters.

I found it confusing at first for two reasons. The first is that I didn't know if Wikipedia's formula was for time or frequency domain, and the second is that I had no idea that the RRC is centered on each PSK symbol, meaning that a time of 0 is the center.

Here is the time-domain formula from the University of Stuttgart's Webdemo (linked above):
[REF] Stephan ten Brink, "Pulse Shaping," webdemo, Institute of Telecommunications, University of Stuttgart, Germany, Aug. 2017. [Online] Available:

Why to use it

If I told you to multiply a square wave with a cosine and sine wave to make a QPSK signal, you'd get a result similar to the top stereo track shown below.

Those are some sharp transitions. This is what I got when I first tried to make my own QPSK signals. It seems well and good, right? We have our digital wave mixed with I (cosine) and Q (sine) to make an IQ signal playable in an SDR program. Well, yes, but there's a slight problem...

[Vertical is frequency, horizontal is time]
This isn't what QPSK is supposed to look like. See all the spurious signals splattering everywhere? Satellites like Inmarsat have neat and narrow QPSK, so why does mine look so bad?

It turns out that we've simply placed a square wave (which is full of harmonics) into the RF spectrum by mixing with a carrier.

Now, notice the bottom stereo track. It is the same QPSK signal, but smoothed out using a root-raised cosine filter.

Notice how narrow it becomes:

The signal is also good enough that Signals Analyzer can lock onto the 80 kBit bitrate:

I initially made the mistake of entering 40000 in the BR (bitrate) field because it's 40 kHz QPSK, and with QPSK the bitrate is twice the symbol rate.

(Below) SA can also lock onto the bitrate of the unfiltered QPSK, which means that although it's undesirable for transmitting, it is nonetheless a valid signal (although I did have to zoom out the bottom-left constellation window a bit).

How to use it

The formula generates "taps", which means an array of values to be used on the signal you want to process. In our case, we multiply the taps by our signal.

Here are the variables:

t: time, in fractions of a second, since the center of the symbol.
T: length of half a symbol, in seconds (1 / (2*symbol rate)). (Why not 1/symbol rate? Pitfall explained below)
alpha: roll-off factor, ranges from 0 to 1 (1=wide, 0=brick wall filter)

To maintain the parameters of the signals shown earlier, let's assume we want a QPSK signal with a symbol rate of 40 kHz (80 kbit/sec) and we'll have it in an IQ file sampled at 1 MHz.

Our variables would be:
t: x/sample rate (in our case, x/1000000). x is the FOR loop variable.
T: 0.0000125
alpha: 0.1 (very high roll-off)

40 kHz is a convenient value since we want an odd number of taps. Since 1,000,000/40,000 = 25, it will take 25 samples to make one symbol and so we need 25 taps.

The center value will be 12 (base 0) or 13 if you prefer base 1. We want to start at 0 so we can do our time values properly, so we want a FOR loop to go backwards from 12 to 0.

for (x = 12; x >= 1; x--) {
    taps[12 - x] = [The formula depicted above, substituting (x/1,000,000) for t]

taps[12] = 1

for (x = 1; x <= 12; x++) {
    taps[12 + x] = [The formula depicted above, substituting (x/1,000,000) for t]

This code will give you 25 taps. Think of it as a matrix with just one column; you would use matrix multiplication to multiply each point by a corresponding point in time on an unfiltered QPSK signal. Just make sure to align this so that the taps begin at the beginning of the QPSK symbol, otherwise it won't filter properly. Here's a crude ASCII drawing of what I mean:

|     Taps       |        |   QPSK   |
|   Matrix       |   *   |       IQ       |
|                   |        |   samples |

Note that both matrices are only ONE symbol long; the taps repeat at the start of each symbol.


The pitfall I was referring to is that 0 is the center. This is what my first RRC taps looked like when I calculated starting from 0:

I mistakenly thought that was the whole filter but it's only the right half. Again, here is the right half of another RRC filter:

And finally, here is the output of this mistake. I applied the right half of an RRC filter to the QPSK starting at the beginning of each symbol, which kept the ends from matching properly. When it's done right, the ends meet perfectly. I eventually found out it needed to be mirrored and applied with 0 being the center of the symbol.

This is why we use 1/(2 * bitrate). If you use 1/bitrate, then the right half will span the entire symbol time when you only want it to span half. With 1/(2 * bitrate), each half will cover half the symbol.

I hope this helped if you had no idea how to program the RRC. Use the comment section below if you have any questions or if I left something out.

Tuesday, August 8, 2017

UTSC v1 Packet Specification

After showing the spec to Foxx, wordsun, and Corrosive, only Corrosive had a suggestion and it was to allow embedding a list of ID's in the packets to facilitate pay-per-view. In other words, broadcasters could include a list of ID's of various decoder boxes so only specific paying viewers can see a channel. This is in contrast to my current method of handling encryption like Wi-Fi, using a single password for the channel. I told him his one-key-per-viewer idea most likely wasn't feasible since the packets need to be small.

Here is a link to the document: utsc_finished_release_r1.txt


The UTSC name and specification are Copyright 2017 Designing on a Juicy Cup. The specification may be freely implemented by anyone for any purpose as long as this copyright notice is displayed in the license. The UTSC name may be used in products implementing this standard as long as attribution is made to Designing on a Juicy Cup.

Monday, August 7, 2017

UTSC v1 Standard Finalized

Since 2016, I've been working on a way to transmit digital TV in the 900 MHz Part 15 band. The main focus is on reliability, because ATSC fails miserably in that department. The second focus is on unlicensed operation, because broadcasting is a near-monopoly.

The format officially consists of a 1 Mbit data stream containing VP9 video at about 900 kbits and Opus audio at 48 kbits. Opus is extremely resilient and can withstand high loss, similar to analog TV's sound. It also sounds amazing at that bitrate. Other services, such as audio or data, could be conveyed as well.

My proposed standard is called UTSC. The acronym means nothing, officially. It is designed to be expansible like WAV, meaning that new features can be added without breaking compatibility with the first receivers. My current research suggests that I can fit 32 channels in the band in any given area.

The standard can accommodate any video codec, resolution, and frame rate in theory, but VP9 960x540 @ 30.000 fps is suggested.

I finalized the standard today and I'm documenting it here as proof that I devised this first. If someone else claims to have been first, you can verify with the Wayback Machine that no site before this date carried this info.

The encoder and air interface are proprietary and will not be released yet. However, I'm planning to release the packet format for public review. I'm submitting it privately to Foxx, Corrosive, and wordsun for a pre-review.

Saturday, June 24, 2017

Velvet Ant vs Ziploc Bag

About a week ago I saw a weird bug walking away from a wood pile. It looked dangerous so I caught it in a ziploc bag. It turned out to be a velvet ant. Its jaws were so powerful that it stretched and nearly punctured the bag when I held it taut. Knowing nothing about velvet ants, I didn't realize that the jaws were the least of my worries. I did not know I had to watch out for a stinger, but thankfully I wasn't stung.

As you'd expect by the bright coloring, an article described the pain of their sting as "life-changing, pray-for-death pain". Here is a YouTube video of someone being stung by one:

Needless to say, I was glad to have caught it in a bag. Eventually the bag was placed under a basket on a table and forgotten.

Then today as I entered the living room I saw a bug running across the table. I thought it was a roach and hit it hard and flung it down so I could get a clear path to kill it. But after getting it onto the floor, I realized with horror that this was not a roach, but the velvet ant! Quickly snatching up an envelope, I put it on top of the retreating wasp (that's what they really are) and delivered one quick blow which instantly killed it. It was running to the edge of the table and if I had entered the living room just 5 seconds sooner or later I would've missed it.

Apparently velvet ants can escape from ziploc bags. Here is a picture of the hole it made:

Monday, June 12, 2017

Faulty Marvel Walkie-Talkies

Recently I had the chance to test some children's walkie-talkies. These are generic blue walkie-talkies that can accept plastic front plates with Marvel characters. The label did not specify the frequency but a quick Google search for the FCC ID, 08KAK-2, revealed that they operate in the 49 MHz band. However, that's not where they actually operate...

I played a song on YouTube while holding down the talk button and this is what I got:

(The vertical bars are my LED monitor)

Apparently, this is an incredibly unstable oscillator that actually operates in the 6 meter ham band.

Because of the waterfall, it was trivial to figure out that this was FM. While the width appears to be around 24 kHz here, it can go up to 75 kHz when you blow the mic.

I'm really surprised that the other walkie-talkie can pick up the signal, considering how the transmitter jumps around not only each time you push talk, but even as you're transmitting.

As a ham (Extra class, by the way), I know I would HATE seeing something like this in the 6 meter band. But since the toys work despite their instability, I would expect any narrow FM in this range to "bleed" into the toy's passband, so kids should hear any hams they're interfering with.

Thursday, March 30, 2017

Huge ice maker output

This post is about computer cooling, primarily for GPU's and hard drives. Before I begin, I wanted to suggest that you enter to win an EVGA GTX 1080 Ti. The contest closes 12 days from now. Full disclosure: I do benefit if you enter.

My computer setup happens to be in a room that the previous owners neglected to insulate, so we don't usually run AC there. That presented quite a problem last summer when my computer's aging fan, even with the dust blown out, couldn't keep up and the computer would keep shutting down for its own protection. Losing work randomly made me eventually devise a system of a well-insulated box containing the computer, a fan, and frozen water bottles. It worked pretty well and the box was about as cold as AC, but it still didn't put out nearly as much consistent cold air as was necessary. Using this over the summer, I observed several problems:
  • The bottles didn't have much surface area
  • It quickly goes from frozen bottle to water bottle with ice core. The water was insulating the ice core, and ice "steals" a lot more energy than cold water possibly could (because of the heat of fusion).
  • None of my freezers could freeze bottles as fast as the computer could melt them. I eventually figured out that if I could freeze enough bottles initially, I could swap them in and out and have enough consistently. I worked out the math to find out how many bottles I would need.
I also noticed that our old freezer, a Kenmore Frostless from 1990, froze bottles slightly faster than the brand-new Frigidaire we got in 2014. Considering the old freezer draws less electricity, I suspect the R-12 is responsible. Naturally, I shifted the bulk of my ice production to the Kenmore.

This past winter (2016-2017), I decided to build a better system before it became necessary, so I would have time to perfect it. Since the ice does most of the work and the water (even though it's near-freezing) is virtually useless, I would need my new system to discard the water. Since freezers' automatic ice makers are much faster than freezing bottles, they would be the source of ice. This also solves the surface area problem since a pile of ice cubes will have a lot more area than a cluster of bottles.

I put together a crude system consisting of a plastic container with a hole in the bottom. I fill it with ice and mount a desk fan on top. The fan takes up about half of the top's area and forces air through all the cubes and out the top again. This system worked well. It produced consistent and very cold air, almost like a small AC unit. There are now only two problems:
  • The freezer's ice maker must be able to keep up
  • A bucket must be kept underneath and emptied periodically
This is a lot better than where I was last summer. Lately it's been cold to mild in South Carolina so I haven't had to put it into "production" use yet. However, the old freezer's ice maker was still too slow. A quick Google search for making ice faster revealed something called "Quick Ice", which is a feature on fancy fridges that uses a fan to blow across the ice maker. At one website they write, "For models with the Quick Ice feature, ice production can be increased by nearly 48% to about 6.2 lbs per day." This did not sound impressive, but I knew it couldn't get worse so I decided to try the idea and see how much I could make. Using my strongest CPU fan and the steel wire used for the Inmarsat antenna, I made a mountable fan setup for the old Kenmore freezer. Of course, I first checked to see exactly where the plastic ceiling rail was, so I wouldn't end up making the wrong mount. Then I mounted it and wired it to a 12-volt external hard drive power supply. I emptied the ice maker's bucket and then ran the ice maker and fan for 24 hours before checking it. When I returned, I was very surprised to have 14.3 LB of ice! That happens to be exactly 3 full ice cream buckets (below).

Here's the freezer's ice bucket before being emptied:

And here are my freezer settings:

At 144 BTU/LB for ice, this comes out to 2059.2 BTU of cooling per day, or 85.8 BTU/hour. Nowhere near an AC unit, but still quite useful for small enclosures. Plus, since I'm not there to get the ice during the night, I can get more BTU's per hour using it only during the hottest parts of the day. If that's 8 hours a day, I would get 257.4 BTU/hour.

This is probably not financially feasible in the long term, but it's still a neat project. I was thinking that if I ever set up my GPU for a remote compute service and was still using ice, my website could have a footer that says, "Our GPU setup is proudly cooled with CFC-12, an energy-efficient refrigerant."