Content is global, but advertisement is local

February 3rd, 2010

Content is global. In every corner of the world there’s people wanting to read, listen to and watch content produced in every other corner of the world. The only thing that slows it down is language; cultural differences not so much.

Advertisement is not global. A restaurant wants to advertise only to people that could actually go to it, not to people that lives across the continent. Even global companies run very different advertisements in different countries and regions. In some places, competitive advertisement (where you mention your competition) is illegal, in others it’s the norm, maybe in some it’s allowed, but considered low. Nudity is OK in some places, illegal in others. Advertisement is local.

During the old-media days, that wasn’t a problem because content distribution was local. TV, radio, newspapers, magazines could reach only people in some well defined region. Content was mixed with ads in each region and shipped or broadcasted. No issues there.

But content distribution today is global and it’s called the internet. And this seems to confuse and startle a lot of people. What do we do with ads? Do we show USA-based ads in all the world? That means that most people won’t care about the ad, and even if they do, they won’t be able to buy the products. A huge waste. The solution: let’s break the internet into regions and limit the distribution of our content. Wrong!

We are not mixing ads and content manually at a central location an then shipping it anymore. Today we have these amazing machines called computers that can mix ads and content every single time a viewer or listeners asks for the content; and every single time the result can be different. A New Yorker using a Mac listens to one ad, a New Yorker using a PC listens to another ad, a Berliner listens to another ad, and an Australian to a different ad. That is how we deliver ads at Hear a Blog. Our content is for the world, and our ad market is also the world.

Mixing audio in C# using NAudio

January 7th, 2010

Processing audio is one of our core tasks. When you create a startup there are a thousand things that you could do manually or automate. Which ones do you automate? We decided to automate as little as possible. Yes, you’ve read it correctly; as little as possible.

Automating is great because you solve a problem once and you don’t have to do it ever again. If you know that you’ll have to do it again. In a startup, you don’t know what you’ll be doing tomorrow. They are higly experimetal endevours. We decided to do all the audio processing by hand; and we did it until Audacity, an excellent audio processing tool, became a recurring character in our nightmares.

We decided to automate. We picked the library NAudio because it’s free and apparently capable of doing what we need. We struggle with it at first, but it turned out there was a bug, which was solved quite quickly by the developers. Surely they deserve all the donations they can get, as soon as we are profitable, we’ll make one.

Our process is simple:

  1. The intro starts
  2. 6 seconds after that the main audio starts
  3. 30 seconds after the main audio finishes, the outro finishes.

That ensures the proper synchronization of our amazing intro and outro. And the code is quite simple.

First, we load the intro, the outro and the main audio:

var intro = new WaveFileReader("Intro.wav"));
var outro = new WaveFileReader("Outro.wav"));
 
var audio = new WaveFileReader(OriginalAudioFileName);

Then we create the mixer stream:

var mixer = new WaveMixerStream32();
mixer.AutoStop;

Out of the loaded audios we create new ones with the proper time offsets (note: the intro doesn’t need an offset):

var audioOffsetted = new WaveOffsetStream(
   audio, TimeSpan.FromSeconds(6), TimeSpan.Zero, audio.TotalTime);
var outroOffset = TimeSpan.FromSeconds(6) + audio.TotalTime +
   TimeSpan.FromSeconds(30) - outro.TotalTime;
var outroOffsetted = new WaveOffsetStream(
   outro, outroOffset, TimeSpan.Zero, outro.TotalTime);

All our wavs are stored as 16bit, but the mixer expects 32bit wavs, so we convert them before adding them to the mixer:

var intro32 = new WaveChannel32(intro);
intro32.PadWithZeroes = false;
mixer.AddInputStream(intro32);
var outro32 = new WaveChannel32(outroOffsetted);
outro32.PadWithZeroes = false;
mixer.AddInputStream(outro32);
var audio32 = new WaveChannel32(audioOffsetted);
audio32.PadWithZeroes = false;
mixer.AddInputStream(audio32);

Pad with zeros is set to false because otherwise you end up with pretty big files. When we forgot that we ended up with a 10GB wav, not sure if we stopped it or it crashed.

Once our mixer is set up we save that wav to a temporary location

WaveFileWriter.CreateWaveFile(tempwav, new Wave32To16Stream(mixer));

tempwav is the full file name of the temporary wav. Note that we go back to 16bit wavs. After that comes the ugly part of converting to MP3 which is left as an exercise for the reader.

We hope you find this information useful.

Linking a podcast to Zune

December 22nd, 2009

You may have notice that we now provide links to the usual RSS, iTunes, Google (Reader), Zune and pcast (for pcast:// compatible podcatchers):

Podcast links

All the links were trivial to make, except Zune. iTunes took long to have proper links, because you have to submit them to Apple and, obviously, they have to approve them.

Linking to Zune has many pitfalls. Hopefully you’ll read about them here and spend only a fraction of the time I’ve spent on creating them. The format is initially quite simple:

zune://subscribe/?title=url

My first try was to URL-encode both the title and the url which resulted in two undesirable behaviors:

  1. The title of the podcast on the Zune dialog appeared URL-encoded. That dialog that says “Do you want to subscribe the A%20Smart%20Bear podcast?”
  2. It didn’t work, it claimed the URL was broken.

I’ve tried not urlencoding and instead of saying “A%20Smart%20Bear” it was saying “A+Smart+Bear”, and still not working.

I was doing all my testing and debugging with Firefox. Not sure where to go next, I’ve tried Google Chrome which shows you the command line it is about to run. That command line included hyphens to specify the arguments.

Bingo! We had hyphens in our URL and that was breaking. Zune cannot deal with hyphens in the URL.

Our solution was to replace spaces for underscores in the title to reach what we think was the most readable solution:

  • A%20Smart%20Bear
  • A+Smart+Bear
  • ASmartBear
  • A_Smart_Bear

and to replace the hyphens in underscores in our URLs and everything just worked. Thankfully our use of hyphens is no critical and changing them to underscores didn’t require a single line of code, but it could have been much worst. This is something to have in mind when you are defining your routes.

gdgt, the gadgets site

November 3rd, 2009

gdgt-logo-redIf you are into podcasts, you are also into gadgets. That is, the gadgets to listen to podcasts. There are a lot of alternatives. You have the usual i-devices, like iPod, iPhone. You have all the other phones, and even people using GPS devices (to listen to podcasts on the car).

If you are like us, it’s possible that you have a device nobody else you know also has. What do you do when the device doesn’t work as expected? How do you learn how to make the most out of it? You can really do that by interacting with other people that have the same device. Thankfully now there’s a web site for that which can be tagged as “the Facebook for gadgets”: gdgt. They want to pronounce it “gadget”.

They are Ryan Block and Pete Rojas, creators of a gadget blog Engadget. On gdgt you can list which gadgets you want, have or had and a small community is formed around each gadget. That is the perfect place to discuss your gadgets. You may also go to the community of a gadget you are consider getting to help you decide whether it would be a good investment or not.

Apple vs Palm

July 30th, 2009

We knew this was coming since Palm announced iTunes compatibility. Both Palm and Apple are companies that are loved by many, both bringing innovation to everyone. Palm released the Pre, Apple changed the protocol, only a few hours later, to something incompatible with the Pre. Palm was able to keep up and re-enable syncing a week later. Not bad, Palm.

Now it seems the fight is going to move from the technological to the legal arena. It’s getting nasty very fast. Who is the bully? that’s easy to answer. Who is right? that’s harder. The case for Palm is: software and devices should be interoperable and there should be competition between companies. But to make the Pre interoperable, Palm is using Apple’s iPhone USB id and make the Pre look like an iPhone.

What happens when someone subverts the USB id process for a malicious intent? What if Palm makes the Pre 2 look like an iPhone and sync the removal of every song on your iTunes because Palm wants you to use the PreTunes? We are not sure if that’s technically possible, but there’s a good reason why USB devices have id numbers.

It’s not clear who’s going to win this fight, but surely more and more people are mentioning Apple and anti-trust in the same sentence.

The Palm Pre starts shipping

June 6th, 2009

Palm PreThe third player in the modern smart phone has arrived: the Palm Pre. It has the potential to be a huge failure and be the last nail in Palm’s coffin but it also has the potential to turn into a major player.

By adopting JavaScript, HTML and CSS as its development environment they are inviting the most vibrant development community there is to generate millions of applications by cutting and pasting, the same way trillions of web pages were written.

A very interesting move for Palm is that the Pre can disguise itself as an iPhone when you plug it in your computer so that you can load it with entertainment straight from your iTunes. Apple will certainly not like that. Apple may try to go to court but that would probably put Apple closer to the anti-trust suit it’s evading miraculously. They could also start to change the protocol daily and a huge mouse and cat chase will start. Even with such difficulties, Palm’s move is probably the right thing to do, but will they have the muscle to fight Apple at their own game? on their own field?

Whatever happens, there’s a new player in the personal portable entertainment and they will surely bring new ideas to the field.

The age of wasting time is over

May 21st, 2009

Zürich tramIt is almost unbelievable that not so long ago we would waste our time whenever we were doing mindless activities like house chores, driving, running. In an effort to try to fill that void we would consume whatever the big media wanted to feed us, without question. Now we have a choice, now we have more choice.

The devices we carry in our pockets get smarter and smarter. Today they can contain whole libraries, thousands of hours of music or podcasts, even movies! The only reason we can’t say that we are at edge of carrying the whole production of human kind, be it music, movies, books, etc in our pockets is because the rate of production is accelerating as much as our technology.

We are entering the age of participation and that means we’ll have much more interesting and much more choice of content to fill the mindless voids of our lives. More than that, we won’t be filling the voids to keep us entertained but to learn, grow, improve. We’ll start searching for voids to fill with such a rich experience.

Blogger Character

Subscribe

Search


Recent Comments

  • pablo: As expected, Apple already broke the protocol for iTunes, so Palm Pre...

Categories


Archives