<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Team Papercup on Medium]]></title>
        <description><![CDATA[Stories by Team Papercup on Medium]]></description>
        <link>https://medium.com/@papercupai?source=rss-ef413c72a96a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*mkKELJAq3VK-Irc_JZacLg.png</url>
            <title>Stories by Team Papercup on Medium</title>
            <link>https://medium.com/@papercupai?source=rss-ef413c72a96a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 09:17:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@papercupai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Subscriber Count Doesn’t Matter in 2020]]></title>
            <link>https://medium.com/papercup-ai/why-subscriber-count-doesnt-matter-in-2020-cdea9a5c242?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdea9a5c242</guid>
            <category><![CDATA[growth-hacking]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[video-marketing-strategy]]></category>
            <category><![CDATA[vanity-metrics]]></category>
            <category><![CDATA[youtube]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Wed, 05 Aug 2020 12:11:01 GMT</pubDate>
            <atom:updated>2020-08-05T12:11:01.275Z</atom:updated>
            <content:encoded><![CDATA[<p>The human brain loves numbers. We tend to quantify certain aspects of our lives to be able to make ‘objective’ judgements on where we stand in our household, our community, our society and the world at large. Things like popularity, success, ability, and self-worth are just some of the concepts that the human race has attempted to put a number on for centuries.</p><p>Nowadays, the latest measure can be broadly defined as ‘a certain number of people who give a crap about what you do every day,’ or simply put — followers. But as much as having an ‘impressive’ number of subscribers or followers strokes our egos and makes us feel good, it is not always an informative indicator of any of the above mentioned ‘achievements’.</p><p>Today, we’ll walk you through reasons why you can take a big breath, exhale and not stress too much over subscriber numbers on your YouTube channel and which metrics you might want to pay closer attention to instead, to not only successfully grow your channel but also earn more revenue.</p><h3>What are your goals?</h3><p>First, as a creator, you need to clearly define for what purpose you want to look at someone else’s, or your own subscriber count. What are you measuring? (tick all that apply)</p><ul><li>Your ability to monetise content online</li><li>Your revenue potential</li><li>How many collaborations you participate in every year</li><li>How frequently you get approached by brands</li><li>Your own self-worth and popularity (please don’t pick this one)</li><li>Other</li></ul><p>If you are not planning to make YouTube your life’s career and are not approaching it from a business stand-point, maybe the purpose of your subscriber number can really just end at satisfying an ego itch and you can continue trying to grow it at all costs. But if you spend hours upon hours honing your content production craft and are maybe even relying on YouTube financially, you have to look at your subscriber count strategically and, in some situations, not worry too much about it.</p><p>Think about all the ways you can earn money on YouTube. There is ad revenue, sponsorships, brand deals, merchandise sales, Patreon, super chat, channel sponsorships, events, etc. The only revenue stream from this list that the number of subscribers actually matters for is the ad revenue, but even then the benchmark for unlocking monetisation through ads on YouTube is pretty low-1,000 subs.</p><p>So technically, you should only really obsess over your subscriber count in that initial starting phase where you have got to unlock monetisation features to take your channel to a new level. After that though, there are way more important metrics that you should focus on to help you grow your YouTube channel. The fact that you also need 4,000 hours of watch time to be able to put ads on your YouTube videos, further drives the point across, doesn’t it?</p><h3>What metrics to look at instead?</h3><p>Now as for which metrics actually matter if you have grand plans for your YouTube channel, the best place to find them is the Analytics section of your Studio page and here we’ll cover just a couple to get you started (but if you want a more in-depth dive into this, just give us a shout!):</p><ol><li><strong>Average view duration</strong> or how much of the video the viewers are watching. The reason it’s important is if people watch the majority of a video, the algorithm learns that this must be good content and that videos begin to be suggested across the platform, thus gaining more views.</li><li><strong>Click-through rate (CTR)</strong> or how many people who have been presented the video have clicked on it. This metric indicates how enticing the thumbnail and the title of the video are, which can give you clues about what your audience prefers to watch and click on.</li><li><strong>Cost per millie (CPM)</strong> or how much revenue you will generate from 1,000 views. Recently YouTube has introduced a newer version of this- the RPM, which you can read more about <a href="https://support.google.com/youtube/thread/57999713?hl=en">here</a>.</li><li><strong>Suggested traffic sources</strong> or where what percentage of your audience finds your videos from them being suggested to them by the algorithm. This is an incredibly telling metric of how well your content is doing with the algorithm because the more your videos get suggested, the better the algorithm thinks they are.</li></ol><h3>Post Scriptum</h3><p>Don’t get me wrong, do ‘subscribers’ as a metric not matter at all? Not entirely. You still get rewarded by YouTube for passing certain subscriber milestones (10k subs, 100k subs, 1 million subs, etc.) with a trendy looking button, which got a nice little facelift in the recent years. All you ‘old’ button holders, raise your hands!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmbF0-E9CqdLNHJWdJ2OoQ.png" /></figure><p>After passing the 10k subs threshold you also gain access to a <a href="https://www.youtube.com/space/">YouTube Space</a> near you (if there is one in your country). Currently, there are 7 YouTube Spaces around the world in Berlin, London, Los Angeles, New York, Paris, Rio de Janeiro and Tokyo. With that said, if you have over 100k subscribers you are able to unlock more perks at the said YouTube Spaces, so keep working hard for these sweet perks folks!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_D9J6rBO1ZHR2N-8HJjOBQ.jpeg" /></figure><p><strong>Written by Margarita Letitchevski — Head of Creator Community at Papercup</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdea9a5c242" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/why-subscriber-count-doesnt-matter-in-2020-cdea9a5c242">Why Subscriber Count Doesn’t Matter in 2020</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Lessons Learned in a Tech Startup]]></title>
            <link>https://medium.com/papercup-ai/7-lessons-learned-in-a-tech-startup-2e313a856ada?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e313a856ada</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup-life]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[tech-startups]]></category>
            <category><![CDATA[startup-lessons]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Mon, 13 Jul 2020 10:21:01 GMT</pubDate>
            <atom:updated>2020-07-13T10:21:01.274Z</atom:updated>
            <content:encoded><![CDATA[<p>Every Friday, team Papercup receive an email from a member of the team called ‘PaperThoughts’. The email can be about anything from struggles with lockdown, interesting things someone has read that week, something they love about the company or their favourite childhood book. We don’t pretend to have groundbreaking or totally novel ideas, but we’re proud to have a super interesting and reflective bunch on our team and we wanted to share some of their best life lessons, quips and all-round lovely thoughts. Enjoy!</p><h3>Fundraising prep</h3><p>Fundraising — the crucial hurdle for every startup. For us, fundraising is about telling a good story. I’m not talking about superficial storytelling — investors can cut through an ungrounded pitch — but one that shows off your pitch!. A good story has three basic components:</p><ul><li><strong>It sparks interest: </strong>You can break someone’s logic by explaining things that aren’t intuitive. If you can pitch how your product is different and novel, you’ll spark interest with investors.</li><li><strong>You’re after a HUGE market: </strong>Investors typically depend on 1–2 investments to generate the lion’s share of the returns for a single fund. They need to have conviction that any investment they make has the potential to be a billion-dollar exit. If the market’s limited, then surely the company’s potential is too.</li><li><strong>We’re the team to tackle this :</strong>More than just raw talent, you need to demonstrate why your team is so well positioned to take on these enormous ambitions. The best indicator is showcasing what you’ve achieved with limits — no funding, low resources, short space of time, small team. Good luck!</li></ul><h3>Being Egoless</h3><p>We’ve spent a lot of time interviewing over the years and have always struggled with what exactly we’re looking for. What takes us so long to find someone that fits the bill? What else is there outside insatiable curiosity, authentic passion, and ability?</p><p>We look for someone egoless. We’re tackling a number of complex interdependent problems that don’t have obvious answers. The only way we can hope to move the needle on these problems is through healthy constructive dialogue. You need to be able to express your opinion and be challenged. You need to be able to counter someone’s point without fearing pushback.</p><p>The second someone enters that dialogue needing to prove <strong><em>their</em></strong> point, the conversation becomes counterproductive. The needle doesn’t move. We’re building a team without personal agendas and ego clouding us from solving these challenges. Hopefully, then, we can easily make the next best step.</p><h3>What’s Essential</h3><p>This takeaway is from a mouse called Frederick. Frederick is the main character in a children’s book and it explains, in child’s terms, what it means to be human (or rather, a mouse!). The story follows that all the mice are hoarding supplies to prepare for winter, yet Frederick isn’t helping! Frederick, when asked, says “I am collecting sunshine” or “I am busy memorising the colours of the rainbow”. When the winter is longer than expected, Frederick tells the mice about the sunshine, the rainbows and all the memories he collected until they all become warm and fuzzy while dreaming of spring.</p><p>This story is a reminder of the value of everydayness, especially during lockdown. All the food and toilet paper in the world can’t get us through this pandemic — our will power can. Whatever helps you or someone else go through this time (or life, in general) is essential, no matter how mindless or irresponsible it may seem from another’s perspective.</p><h3>Believing an answer exists</h3><p>When tackling something that’s never been done before, there are usually three kinds of people:</p><ul><li>The people who don’t know enough and make wild claims and predictions</li><li>The people who know enough to know that certain things are impossible</li><li>The people who know enough to make an educated assumption that there definitely will be a way to solve the problem</li></ul><p>Build a team that falls in the third camp. These are people who also have expertise in the field, but they realise that perhaps you can make an “educated assumption” eventually that there will be a “good enough” solution which solves the problem 90% of the times. It takes a lot of bravery to believe that these solutions exist and working towards them, especially knowing all the difficulties involved.</p><p>This belief alone provides ample motivation to go and do everything to make it happen.</p><h3>Sustaining Creativity</h3><p>Creativity, Inc. is a great book by the founder of Pixar. For Pixar, creativity is an environment, rather than a group of creative people. A key part to the way Pixar works is the concept of a BrainTrust — a group of people in a room who have the ability to discuss and get to the emotional core of the storyline without themselves getting emotional.</p><p>In movie-making, financial and reputational stakes are high, and deadlines are effectively carved in stone. So the temptation to avoid the daunting creative journey and simply repeat / incrementally build on something previously proven to work (i.e. sequels) is pretty much irresistible. To counter this, Pixar is committed to a ratio of originals to sequels when deciding which movies to make. It’s the balance between exploration and exploitation — exploitation provides resources to fuel exploration, and exploration sustains and discovers new areas for exploitation.</p><p>We’re thinking about a similar rule our team: having a quarterly OKR or KPI that scares us a bit so we’ve always got our eye on those lofty ambitions. This is not an easy thing to do. Sometimes we avoid confrontation by not speaking up, other times we lose self-awareness and get defensive. But the important thing is that here at Papercup, we feel safe enough to keep trying.</p><h3>How holidays help</h3><p>Take. Holidays. Not only is it essential to take breaks for your health, but it can make you so much better at your job! Stepping out of your everyday life and environment triggers different thought processes. When you travel the same route, sit at the same desk and do similar tasks, you don’t give your brain the creative kicks it needs to generate ideas.</p><p>Even just driving out of London can force your mind to hit the refresh button. When you actively process your surroundings more presently, you might feel like those things that have been on your mind are suddenly more manageable.</p><h3>Resilience</h3><p>Another PaperThought sparked from lockdown — it’s clearly got us all introspective!</p><p>Obstacles feel unsurmountable until you manage to surmount them. Think of the last time you pulled a plaster (or a band-aid for those from the other side of the pond). The worse part is <strong>always</strong> the anticipation, never the pulling itself. We always underestimate how adaptable we are. We think we’ll never be able to do without that frequent trip to the gym, and it definitely sucks in the first few days. But we adapt and we find this new exercise routine that suits us just as well.</p><p>There are three things that have really shaped the way I approach things now:</p><ul><li>Take what you are definitely ultra certain is the max you can handle life throws at you, add 50% on top, and you’re about there!</li><li>Be curious. Explore, iterate, understand, let yourself be fascinated with your new situation.</li><li>We all have different hardship so we all learn different things. We could all be the young American girl on a plane who, out of boredom, learns knitting from the lady next to her and ten years on, teaches it to her (very thankful) colleagues — seriously Alexandra, thank you!!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xGHzxA6_VJ_BoXEA.jpg" /></figure><p><strong>Written by Marlene, Tian, Astrid, Jesse and Jiameng from the Papercup team.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e313a856ada" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/7-lessons-learned-in-a-tech-startup-2e313a856ada">7 Lessons Learned in a Tech Startup</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Subscale WaveRNN]]></title>
            <link>https://medium.com/papercup-ai/subscale-wavernn-f91fc9c7a106?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f91fc9c7a106</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Mon, 06 Jul 2020 11:46:01 GMT</pubDate>
            <atom:updated>2020-07-06T11:46:01.042Z</atom:updated>
            <content:encoded><![CDATA[<p>You have read <a href="https://arxiv.org/abs/1802.08435">Efficient Neural Audio Synthesis</a> aka the WaveRNN paper and would like to know more about how the subscale system works and how it can be implemented?</p><p>This blog post might appease your eagerness.</p><p>You’d also like a working PyTorch implementation to play around with?</p><p>Our accompanying repo <a href="https://github.com/papercup-open-source/subscale-wavernn">subscale-wavernn</a> might be right up your alley.</p><p>We found this idea very interesting and a fun engineering problem to solve, with a lot of room for imagination left for those willing to re-implement the system. So we gave it a go and are now ready to share our interpretation and code.</p><p>We will go through:</p><ul><li>Motivation behind subscale</li><li>The high-level idea</li><li>How subscale inference works</li><li>Where it fits in the WaveRNN architecture</li><li>Details about our implementation</li></ul><p>Please do reach out for any comments / questions / requests — enjoy!</p><h3>Autoregressiveness works wonders but… inference is slow</h3><p>Autoregressiveness is a really sensible assumption when modelling audio — it very much reflects the physical nature of how speech is produced. Have a look <a href="https://machinelearningmastery.com/autoregression-models-time-series-forecasting-python/">here</a> for a hands-on overview of basic autoregressive models. <a href="https://en.wikipedia.org/wiki/Place_of_articulation">This article</a> explains how human speech is a pressure wave (like any other sound) which originates in our lungs and vocal folds and is modulated by the topology of our vocal tract up to our lips movements. Let’s take the lips as an example of speech organ: intuitively, the shape of our lips at time t is always dependent on the shape at time t-dt. You can only modify the lips shape by x in a timespan dt; so knowing the shape at t-dt is incredibly useful information that you can regress against. Similarly for all other speech organs, which are responsible to create human speech. This is an oversimplified explanation, but it provides a barebone intuition as to why speech is often modelled using the autoregressive assumption.</p><p>Needless to say, this assumption translates into state-of-the-art results in TTS output quality: see the <a href="https://arxiv.org/pdf/1712.05884.pdf">tacotron 2</a> and <a href="https://arxiv.org/abs/1609.03499">wavenet</a> papers for examples of how the autoregressive assumption is key to modelling speech.</p><p>However, autoregressive models are fundamentally slow when it comes to inference time, especially when dealing with high clock rates like in waveforms. For high-quality speech, we want 24khz and often we’d want more than just 1 second, so as you can imagine a hell of a long output sequence!</p><p>We can only generate sample by sample because each prediction is conditioned on the previous one and each step needs to wait until the previous one is completed. This seems incompatible with what GPUs and other hardware are good at: parallelization.</p><p>The itch is: we’ve got all this extra memory in the GPU free to exploit… we can’t just chunk up the input across the time dimension and batch the chunks together: we’d end up with glitches when stitching the output chunks back together. What can we do to exploit the batch dimension without decreasing output quality?</p><h3>Can we trade some past for some future?</h3><p>The idea behind subscale is to trade off past context for some samples in exchange of future context for other samples. For a target batch size <strong><em>B</em></strong>, this is achieved by having your RNN sampling at a <strong>1/<em>B</em>ᵗʰ</strong> of the waveform sample rate clockrate, with a time offset between each RNN. Each RNN of the batch sees a different amount of context based on what has already been generated. This way, at a given point midway through generating your waveform, you’ll be able to generate <strong><em>B</em></strong> samples at the time.</p><h3>Ok, we get the high-level idea… but how is it done in practice?</h3><p>Getting this to happen in practice does require some clever engineering. Disclaimer: there are probably other ways to interpret what is described in the subscale part of the paper other than the few that we present here.</p><p>Let’s first introduce some concepts so that we can abstract them away in the later explanations:</p><h4>1. Permutation</h4><p>We organize the target waveform in <strong><em>B</em></strong> subtensors by grouping every <strong><em>B</em>ᵗʰ</strong> element together. This is a permutation because we’re only manipulating the order of the samples. In the image, each color codes the membership of the sample to one of the <strong><em>B</em></strong> subtensors (in all our examples we have <strong><em>B</em>=3</strong>). In subscale inference, we can generate the <strong><em>B</em></strong> subtensors in parallel (with an offset), and within each subtensor we’ll generate by following the permuted order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/0*vyA1BXVWDEJ0sRnq.png" /></figure><h4>2. Future horizon</h4><p>The future horizon <strong><em>F</em></strong> represents the number of <strong><em>B</em></strong>-sized groups of future samples that are in principle eligible to be seen by the network as context when generating a sample. <strong><em>FB</em>−1</strong> is the offset between samples that can be generated in parallel, in the same batch. In our examples <strong><em>F</em>=1</strong>, and in the picture below the target sample is sample number 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*ds3J3YjFInblrJA3.png" /></figure><h3>How is the batch constructed?</h3><p>This is best appreciated visually, so you are welcome to jump to the gif below and read this after. I’d also recommend unpacking the gif and go through each frame in your own time. A more wordy explanation in this paragraph.</p><p>Given the hyperparameters <strong><em>B</em></strong> and <strong><em>F</em></strong> and a target waverform at clockrate sr<em>sr</em>, we permute the target waveform into <strong><em>B</em></strong> subtensors which run at clockrate <strong><em>sr</em>/<em>B</em></strong> per second, each containing samples from the original waveform at <strong><em>B</em></strong> distance between each other.</p><p>When generating a sample <strong><em>T</em></strong>, belonging to the <strong><em>N</em>ᵗʰ</strong> subtensor, the network has access to all the previous samples belonging to <strong><em>N</em>ᵗʰ</strong> subtensor:</p><pre>N, N + B, N + 2B, N + 3B, N + 4B...<br>etc. up to T - B</pre><p>as well as all samples from <strong><em>0</em></strong> to <strong><em>T</em></strong> +<strong><em>FB</em></strong> belonging to the <strong><em>0</em>ᵗʰ</strong> to <strong><em>(N−1)ᵗʰ </em></strong>subtensors:</p><pre>0, 1, 2... N,    B, B + 1, B + 2... B + N,    2B, 2B + 1, 2B + 3.<br>etc. up to T + FB.</pre><p>Let’s go through it step by step for <strong><em>B</em>=3</strong> and<strong> <em>F</em>=1</strong>:</p><ul><li>First, we generate sample <strong>0</strong> which belongs to the <strong>0ᵗʰ</strong> subtensor. At this stage, the batch size is <strong>1</strong> as we’re only filling up one subtensor.</li><li>Now we can generate the next sample in the <strong>0ᵗʰ</strong> subtensor, i.e. sample <strong>0ᵗʰ</strong>. Batch size is still <strong>1</strong>.</li><li>Sample <strong>0</strong> and <strong>3</strong> are available, so we can generate sample <strong>1</strong>, which is the <strong>0ᵗʰ</strong> element of the <strong>1ˢᵗ</strong> subtensor, as well as sample <strong>6</strong> to continue filling up the <strong>0ᵗʰ</strong> subtensor. Batch size is now <strong>2</strong>, as we’re filling up both the <strong>0ᵗʰ</strong> and <strong>1ˢᵗ</strong> subtensors.</li><li>The samples available are now <strong>0</strong>,<strong> 1</strong>,<strong> 3 </strong>and<strong> 6</strong>. It’s still too early to start generating the next and last subtensor, as we’re missing sample <strong>4</strong> which is required to generate sample <strong>2</strong>. However, we can generate <strong>4 </strong>and <strong>9</strong> together (batch size of <strong>2</strong>).</li><li>Now we’ve got everything to exploit the full batch size of <strong>3 </strong>as we can generate <strong>2</strong>, <strong>7 </strong>and <strong>12 </strong>together. Sample <strong>2 </strong>requires <strong>0</strong>, <strong>1</strong>, <strong>3</strong> and <strong>4</strong>, sample <strong>7</strong> requires <strong>0</strong>, <strong>1</strong>, <strong>3</strong>, <strong>4</strong>, <strong>6</strong> and <strong>9 </strong>and sample <strong>12 </strong>only needs <strong>0</strong>, <strong>3</strong>, and <strong>9</strong>.</li><li>And similarly for the remaining steps. The same principle still holds at the end. This time, with the <strong>0ᵗʰ</strong> subtensor finishing first, the <strong>1ˢᵗ</strong> second, and so forth. This means that some of the future context become unavailable for the higher-order subtensors, as they are out of range. E.g. if the waveform is only <strong>18</strong> samples long (so the that the last one is sample <strong>17</strong>), when generating sample <strong>16</strong> we’re not goinig to have sample <strong>18</strong> and when generating sample <strong>17</strong> we won’t have <strong>18</strong> and <strong>19</strong>.</li></ul><p>You might have noticed that there’s quite a difference between the <strong>0ᵗʰ</strong> subtensor and the other ones. The <strong>0ᵗʰ</strong> subtensor is generated completely independently from the other <strong><em>B</em>−1</strong> subtensors, and it behaves more like the classic autoregressive manner where each sample is conditioned on the previously generated ones, with no extra clues from future samples. The other subtensors instead seem to have an easier task, since if you already know what sample is next and what sample was before, if you interpolate the two you probably already get a good guess. In our experiments, this is reflected in the loss: the loss can be broken down into <strong><em>B</em></strong> losses, one specific to each tensors. And the loss relative to the <strong>0ᵗʰ</strong> subtensor is always higher than the successive ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/0*hqm5ivabgwWrBMIk.gif" /></figure><p><strong>Gif 1.</strong> In dark green are the <em>available dependencies</em>, i.e. samples used to condition the network when generating a target sample (in dark red). The light green samples are <em>recoverable dependencies</em> relative to the dark red sample. These are samples that could in principle be accessed when generating the dark red sample because they have already been generated at previous steps. However, these are deliberately discarded by design choice. Light red samples are target samples that can be generated in the same batch in which the dark red sample is generated. Please note that samples corresponding to <em>recoverable</em> dependencies relatively to the dark red sample can be <em>available</em> dependencies for the light red target samples.</p><h3>How is the context information fed to the network?</h3><p>The paper is not explicit about this so we can’t guarantee this is exactly what the authors meant, but rather what seems most plausible to us given the information available.</p><p>A basic autoregressive RNN cell takes an input features frame <strong><em>I</em></strong><em>t</em>​ (in our case the upsampled MFBs, mel filter bank feautres) as well as the output from the previous step <strong><em>I</em></strong><em>t</em>​-₁​ and generates <strong><em>O</em></strong><em>t</em>​. Training happens in teacher forcing mode, i.e. by feeding the ground truth <strong><em>O</em></strong><em>t</em>-₁​​ as the RNN inputs.</p><p>In subscale WaveRNN, we don’t just condition on <strong><em>O</em></strong><em>t-</em>₁​, but rather on a wider window of outputs (ground truths during training and generated during inference), whose range depends on the subscale parameters (batch factor, future horizon and context width). Let’s call this window of outputs the <em>context</em>.</p><p>The context is fed through a conditioning network whose output replaces the traditional O_{t-1}<em>Ot</em>−1​ in the RNN cell input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tMpQzlV_a6u9bJLp.png" /></figure><p><strong>Img 1.</strong> The conditioning network condenses the information contained in the context, which is extracted from the waveform, and is equivalent to the previous output sample in the standard, non-subscale settings.</p><h3>How is the context constructed?</h3><p>To get the context, we need to select the right window of samples from the waveform. At training time, we use the ground truth waveform and all samples are available, so we only need to mask the window of samples in a way that simulates which samples would be actually available at inference time.</p><p>The main intuition when trying to implement this was that at any step <strong><em>t</em></strong>, the RNN has no notion of how far into the MFB sequence it is reading, and therefore, the way the context is constructed needs to obey the same invariance. By design, the right-hand side boundary of the context window is in the future relative to the target sample. So the <strong>(<em>FB</em>+1)ᵗʰ</strong> entry from the right will always be empty as it represents the target sample.</p><p>The left-hand side boundary of the context needs to be fixed but it’s arbitrary. It basically reflects how far into the past you’re looking back to.</p><p>The context is masked based on the subtensor’s membership of the target sample. This can be seen when permuting the window similarly to how the target waveform is permuted when running the subscale inference. For example when the target sample belongs to the <strong>0ᵗʰ </strong>subtensor, all entries in the context corresponding to samples belonging to the <strong>1ˢᵗ</strong> to the <strong><em>B</em>ᵗʰ</strong> subtensor will be blank, as well as the samples belonging to the <strong>0ᵗʰ</strong> subtensor that is in the future relative to the target sample. For the other subtensor, the masking follows from the same principle as in the first section of the blog post, and is best illustrated in <strong>Gif 2</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*VHc2cwrDNHnXaMcz.gif" /></figure><p><strong>Gif 2.</strong> The context is a masked window of the waveform which is fed to the conditioning network. The masking at training time needs to simulate the available dependencies at inference time.</p><p>Another way of visually constructing this is overlaying a context-shaped tensor (left rectangle in Gif 2) over the permuted waveform (right rectangle in Gif 2). Use the target sample position — which is always the same in the context — to set the matched location. Then you can visually slide the context shape over the waveform to find out which samples are available dependencies and which positions they should be located into the context.</p><p>The reason why the target sample needs to always be in a fixed position in the context is because of the above-metioned invariance: the network needs to learn the relationship between the target sample and the available dependencies in the context in a way that is generalizable across the whole sequence. In other words, the relative distance in the context between <strong><em>t</em></strong> and <strong><em>t</em>±<em>t</em></strong>₀​ must be the same for all <strong><em>t</em></strong>.</p><p>It’s easiest to picture the masking in the 2d permuted representation. However, what the conditioning network sees is actually a 1d vector which follows the same ordering as the original waveform. This can be appreciated in Gif 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*ikoZBzfAVpiFefMJ.gif" /></figure><p><strong>Gif 3.</strong> The context (bottom sequence) as seen by the upsampling network.</p><p>It will be up to the conditioning network to condense the context information in a way that the RNN can make the best use of it. Ideally, when the context is rich and many future samples are available, the RNN should maximally exploit that, to the extent that the MFBs almost become insignificant. Whilst when the context is poor, the RNN should rely heavily on the MFBs and the most recent available output samples.</p><p>The job of the RNN cell is vastly different for each of the subtensors, to the point that one wonders whether in the original implementation they actually had a different set of rnn weights for each subtensor, effectively leveraging <strong><em>B</em></strong> RNNs. In principle, these could be stacked together into a single layer run or simply run in parallel. However, this would mean increasing the total number of (RNN) weights by <strong><em>B</em></strong> times. At that point, if you have 1 RNN per subtensor then why not 1 conditioning network per subtensor as well?</p><p>This leads us to guess that it is the same RNN and conditioning network that learns all these different tasks, just by virtue of learning the different “modes” of the conditioning network’s output (which reflect the <strong><em>B</em></strong> modes of the context). And it’s actually the training routine that can be engineered to encourage the model to learn the desired behaviour.</p><h3>How is it trained?</h3><p>This is more of an open question for us, as we haven’t experimented much with it. For now we will limit ourselves to write some considerations to spark the discussion. We also encourage everyone to use our implementation to experiment with different trainining routines and subscale hyperparameters.</p><p>At training time, we can compute the loss for all the different subtensors and confirm that generating samples from the <strong>0ᵗʰ</strong> subtensor is indeed the hardest (and loss is highest).</p><p>A spontaneous worry arises: at inference time, each subtensor relies on outputs from the previous subtensors, so if the <strong>0ᵗʰ</strong> subtensor is hard to generate, the error will compund when generating samples in the following subtensors. Because at training time we use samples from the ground truth waveforms, the typical discrepancy between inference and training time performance could be amplified.</p><p>One way to engineer the training routine could be to weight the partial losses differently. Or possibly learn the weighting dynamically using <a href="http://bayesiandeeplearning.org/2018/papers/33.pdf">Lagrange multipliers</a>.</p><p>Since at training time, the masking is done artificially, we could set up a “curriculum”, where we first show the network the easy cases (more context) and gradually increase the percentage of lower context samples. Or vice versa!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nzp0c7z1s9aegsqp.jpg" /></figure><p><strong>Written by Lorenzo Foglianti — Machine Learning Engineer.</strong></p><p>Originally posted on <a href="https://papercup.dev/">Papercup Dev blog</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f91fc9c7a106" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/subscale-wavernn-f91fc9c7a106">Subscale WaveRNN</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Answer to the YouTube CPM Mystery]]></title>
            <link>https://medium.com/papercup-ai/an-answer-to-the-youtube-cpm-mystery-aa4495ba870b?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa4495ba870b</guid>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[advertisement]]></category>
            <category><![CDATA[cpm]]></category>
            <category><![CDATA[content-marketing]]></category>
            <category><![CDATA[youtube]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Thu, 25 Jun 2020 12:00:07 GMT</pubDate>
            <atom:updated>2020-06-25T12:00:07.348Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve watched YouTube videos for as long as I can remember (yes, <a href="https://www.youtube.com/channel/UCqQo7ewe87aYAe7ub5UqXMw">House of Highlights</a>, you’re still my go-to), but I never understood the often talked about the world of CPMs. As soon as I started working with creators as part of Papercup, I quickly realised how murky and misunderstood CPMs are. In this post, I hope to lay out what exactly the problem is around CPMs and how we can solve it.</p><h3>What are CPMs?</h3><p>I don’t want to reinvent the wheel here defining the key terms, though it’s worth mentioning some of the basics.</p><p>CPM = cost per mile. A fancy advertising term that gives you a sense of how much advertisers are willing to spend on ads served on your content.</p><p>More technically, CPMs tell you how much advertisers paid per 1,000 impressions (not views) — impressions are when an ad is shown on your video. Confusingly, Google highlights a slightly <em>different metric</em> on the analytics tab of YouTube studio: playback based CPMs. This reflects the amount an advertiser paid for every 1,000 playbacks that included an ad.</p><p>For the purposes of this post, I won’t dig further into the other CPM variations and definitions, though take a look at Google’s breakdown <a href="https://support.google.com/youtube/answer/9314357?hl=en">here</a> and a comprehensive explanation from Looxcie <a href="https://www.looxcie.com/youtube-cpm/">here</a>.</p><p>Suffice to say, there’s an endless list of CPM variants, all of which give a different spin on how effectively your content is making money.</p><h3>Why are CPMs important?</h3><p>CPMs are important for two fundamental reasons:</p><ol><li>They tell you how efficiently your content has been monetized. In other words, did your video on how to make lasagne (disclaimer: I’m not the biggest lasagne fan) need 10,000 views or 5,000 views to generate $10? It’s a meaningful question to ask because of reason #2:</li><li>CPMs inform your content strategy — what type of content to make and which regions to target</li></ol><p>If you knew that a certain style of video or that catering your content to an audience from a different country was likely to result in a higher CPM rate, it would be in your interest to tweak your content strategy accordingly. I’m not claiming that monetization should be your sole objective nor that you should only optimize for this. Though if you depend on YouTube for a non-trivial portion of your income, understanding CPMs can be game-changing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*QNmL6cPvLp4FntOg" /></figure><h3>So what’s the big unanswered question?</h3><p>It’s fairly well established that CPMs are important.</p><p>There is one other point of consensus: it’s difficult to know if your videos generate ‘good’ or ‘bad’ CPMs unless you sit on the extremes of the spectrum (roughly a few cents per 1,000 impressions on the low end, and $20+ on the high end).</p><blockquote>Put simply, the world of CPMs is opaque and constantly misunderstood.</blockquote><p>Why, you ask?</p><p>Because there is no central database you can compare your numbers against. Yes, there are articles and videos that divulge statistics for a handful of channels, though they usually reflect a really narrow data set and are static. CPMs change all the time depending on advertisers’ willingness to spend cash on digital ads. If Trump sends a Tweet about a trade deal; if the New York Times has an exposé on ads placed against inappropriate content; if I get featured on <a href="https://www.youtube.com/channel/UCqQo7ewe87aYAe7ub5UqXMw">House of Highlights</a>, CPMs change wildly (okay fine I was kidding about the last variable).</p><p>Not only do CPMs oscillate based on economic events, but they can also drastically differ based on country, content type, device usage, and many other factors. CPMs are so fluid and changing so constantly that creators are left with nothing credible to compare their data against.</p><h3>How can we solve the CPM conundrum?</h3><p>A constantly updated repository of CPM data with a sufficient number of channels as inputs. With just a few thousand channels across each major content category and country, we can amass a database that will help creators with their content and monetization strategy. We can create a simple dashboard for creators that shows updated CPM rates for country and content types based on submissions from thousands of channels.</p><p>Yes, that’s a monumental task. There’s development required to build a product capable of amalgamating the relevant stats, maintenance of a system that processes and stores the data, outreach to creators to anonymously share their data- all amongst 100 other reasons why this is a tough challenge. But we think it’s something that can be a big help the entire creator community on YouTube.</p><p>So who can do this? I see two options:</p><ol><li>YouTube. They obviously have the data and can publish platform-wide metrics which help creators. I know there are likely 1,000 reasons why they would be disinclined to do this, though given how much creators invest in the platform, I think it’s a gesture that would go a long way.</li><li>Us. I don’t just mean me and the Papercup team, I mean any creator, media company or individual who uploads to YouTube. If you share this post with creator communities, we can at least figure out if creators need this as badly as we think they do.</li></ol><p><strong>Written by Jesse Shemen — CEO at Papercup</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa4495ba870b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/an-answer-to-the-youtube-cpm-mystery-aa4495ba870b">An Answer to the YouTube CPM Mystery</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial on declipping WAV files]]></title>
            <link>https://medium.com/papercup-ai/tutorial-on-declipping-wav-files-58fa87a27d44?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/58fa87a27d44</guid>
            <category><![CDATA[tts]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Wed, 24 Jun 2020 09:16:01 GMT</pubDate>
            <atom:updated>2020-06-24T09:16:01.062Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I introduce the problem of clipped audio when sound is recorded through a microphone. The post does not assume a signal processing background, but does assume Python programming knowledge. Though the tutorial will go through major parts of the declipping process, the full script can be found at <a href="https://github.com/papercup-open-source/tutorials/tree/master/declipping">our Github repository</a>.</p><h3>What is clipping?</h3><p>Signals in longitudinal waves traverse through space through the oscillation of particles. As particles move back and forth, they push against each other. Thus, even though a single particle only moves a short distance, the signal in the wave is smoothly propagated through space. Dr. Daniel Russell gives an <a href="https://www.acs.psu.edu/drussell/Demos/waves/wavemotion.html">excellent demonstration</a> of this phenomenon with a 1D longitudinal wave, in which a signal is propagated in one direction, from left to right:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*RlHZcdcn0hMY8io0lnRycw.gif" /></figure><p>Though sound waves are 3-dimensional, the principal of signal propagation is the same. Air particles push against each other, oscillating back and forth to propagate the sound signal through space. The amplitude of a longitudinal wave corresponds to the displacement of individual particles: how far they oscillate before returning to their position of equilibrium. In sound, we perceive amplitude as volume. The louder a sound signal is, the further the air particles are moving back and forth to propagate the signal before returning to their original state.</p><p>The task of a microphone is convert this physical acoustic signal into electrical energy that can then be interpreted by computers, or passed on to speakers, etc. Microphones do this by using what is called a diaphragm: a thin flexible material that vibrates back and forth when bombarded by oscillating air particles in a sound wave. Unlike the oscillation of air particles, the oscillation of the diaphragm can be constrained in two ways: both by the physical space containing the diaphragm, and the power supply to it. In this way, microphones have a minimum and maximum amplitude that they can handle. If the original sound signal is at a volume (amplitude) too great for the diaphragm, the signal becomes “clipped”; some of the original acoustic signal is too loud to be converted into electrical energy. You can hear what this sounds like in the sample below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F430427086%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F430427086&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F911014407_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/8bd39656934b4ef961b8d2ecfb263b38/href">https://medium.com/media/8bd39656934b4ef961b8d2ecfb263b38/href</a></iframe><p>Here, the clipping is particularly prevalent in the word “fascinating”, which sounds quite <em>buzzy</em> compared to other words in the utterance.</p><h3>Why is this a problem for TTS?</h3><p>Neural text-to-speech (TTS) relies on having hours of recorded speech data divided into short utterances, such as the sample above. Through providing a neural model with hundreds or thousands of these training samples, paired with their corresponding text, it learns to create a mapping between the written text and the speech. Given enough data and training time, the model will eventually be able to synthesise new utterances that weren’t present in the training data.</p><p>Because the neural model is trained on many of these samples, if only one or two contain clipping, the model will probably learn to ignore it as an anomaly; it won’t produce clipped speech. However, if the clipping is prevalent in the training data, the model will learn to replicate it as part of the target sound. This is particularly problematic when training with public domain data, where it is impossible to send the bad utterances back to studio to be rerecorded. To address this issue, we developed a system to identify clipped segments in audio files, and “declip” them.</p><h3>What is declipping?</h3><p>Declipping is the process by which we use interpolation to estimate the signal at its clipped segments, using information in the original signal that we know to be non-clipped. In this tutorial, we will walk through a three-step process to declip the clipped audio file above. First, we will see how to identify the clipped segments in the waveform. Then, we will see how to fix each of these segments, in an effort to restore what we hypothesise to be the original signal. Finally, we will see how to save our edited waveform as a new audio file.</p><h3>Identifying clipped segments</h3><p>Visually, identifying clipped segments is pretty straightforward. Below is a 6ms segment of the waveform from the clipped audio above. This segment occurs inside of the “a” vowel within the word “fascinating”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*icdywUrcTMMmxaWrS01izg.png" /></figure><p>Here we can see that the waveform plateaus at minimum and maximum values. Note that the y-axis in this image is unitless; we will come back to this when it is time to save the new declipped audio file. So the plateaus are visually obvious, but how can we identify them programmatically? To do so, we first need to convert the audio file into a numpy array. Assume here that the audio file is a .wav as opposed to an .mp3 or other audio file format.</p><pre>from scipy.io.wavfile import read<br>import numpy as np<br><br>sample_rate, file_info = read(wav_path)<br>np_array = np.array(file_info, dtype=float)</pre><p>Then we need to store the max and min of this numpy array. We will use this information to determine if a particular waveform sample is inside of a clipped segment or not.</p><pre>nmax = max(np_array)<br>nmin = min(np_array)</pre><p>Ultimately, we want to return a list of all of the clipped segments, so we instantiate an empty clipped_segments list that will be filled as we loop through every sample in the numpy array. Additionally, as we loop through, we want to keep track of whether or not we are currently inside of a clipped segment, as well as the start and end indices of the current clipped segment. So we predefine these variables as well.</p><pre>clipped_segments = []<br>inside_clip = False<br>clip_start = 0<br>clip_end = 0</pre><p>Now we are ready to loop through our numpy array.</p><pre>for i, sample in enumerate(np_array):</pre><p>If a certain sample is equal to or extremely close to the max or min of the array, then we identify this as a clipped sample. If we haven’t determined that we are already inside of a clipped segment, then we declare that we are indeed in a clipped segment, and this clipped sample is the first clipped sample of that segment.</p><pre>    #sample equal to or extremely close to max or min<br>    if (sample &lt;= nmin + 1) or (sample &gt;= nmax - 1):<br>        if not inside_clip:<br>            # declare we are inside clipped segment<br>            inside_clip = True<br>            # this is the first clipped sample<br>            clip_start = i</pre><p>But if the sample is not equal to or extremely close to the max or min, then we know we are now not inside of a clipped segment. So if we were in a clipped segment before, we can now identify the previous sample as the end of that segment. Now we know the start and end of our clipped segment, which we can store as a tuple, and then add to our list of clipped segments.</p><pre>    elif inside_clip:<br>        inside_clip = False # no longer inside clipped segment<br>        clip_end = i-1  # previous sample is end of segment<br>        # save segment as tuple<br>        clipped_segment = (clip_start, clip_end))<br>        # store tuple in list of clipped segments<br>        clipped_segments.append(clipped_segment)</pre><h3>Fixing the segments</h3><p>Recall from above that the objective is to use the non-clipped information outwith¹ the segment to estimate what the signal would have looked like were the microphone’s diaphragm not pushed to its limits. We can do this with interpolation using the scipy library again. We’re also going to import matplotlib.pyplot so that we can see the results of our declipping in action. Now that we have identified where the clipping occurs, we want to loop through each of these segments and declip them one by one. Since we will also be saving our new predicted values to a new array, let’s make a copy of the original array now.</p><pre>from scipy.interpolate import interp1d<br>import matplotlib.pyplot as plt</pre><pre>new_array = np_array.copy()  # make copy of original np_array<br>for segment in clipped_segments:</pre><p>First we should get a few of the samples surrounding the segment that we know are not clipped. Let’s say 5 samples before and after.</p><pre>    start = segment[0]<br>    end = segment[1]</pre><pre>    x_true = list(range(start - 5, start)) + \<br>                  list(range(end + 1, end + 6))<br>    y_true = [np_array[i] for i in x_true]</pre><p>Now we can use interpolation to define a function to predict the missing values. Note that we want to use cubic interpolation, as opposed to linear, to accommodate for the curvy shape of the waveform. Then we can get a list of all the sample indices (x_axis) we want to pass through this function. And finally we can generate our new sample values (y_axis).</p><pre>    # function to predict missing values    <br>    interpolation_function = interp1d(x_true, y_true, kind=&#39;cubic&#39;)<br>    # indices to pass through function <br>    x_axis = list(range(start - 5, end + 6))<br>    # new sample values<br>    y_axis_new = [float(int(i)) for i in      <br>                  interpolation_function(x_axis)]</pre><p>Let’s see what this function did, by plotting the original sample values against the new values we’ve just calculated.</p><pre>    y_axis_old = [np_array[i] for i in x_axis]  # original values</pre><pre>    plt.plot(x_axis, y_axis_old,&#39;bo-&#39;)<br>    plt.plot(x_axis, y_axis_new,&#39;r--&#39;)<br>    plt.show()</pre><p>Below are the first two clipped segments, with the original values shown in blue and our predicted new values in red, from the clipped audio sample above. Note that the x-axis here is just the np_array indices. If we wanted to see the time in seconds instead, we could divide each x-axis value by the sample rate, which for this wav file is 48khz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AYoGBbM-ovtVgFPszfEFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*boiTbVg7r4cA02Xaxj74bA.png" /></figure><p>Now we can finally update the numpy array with the new values.</p><pre>    for i, x in enumerate(x_axis):<br>        if start &lt;= x &lt;= end:<br>            new_array[x] = y_axis_new[i]</pre><p>Recall the 6ms segment from above showing the plateaus. If we plot this segment in the new array, we can see that the plateaus have now been interpolated with our predicted values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-9wm2bMZXc_QQAUV22aqQ.png" /></figure><h3>Saving the new array as a wav file</h3><p>Note that the scale of the y-axis in the 6ms segment has grown because we have predicted new values above the original min and max. The original scale was dependant on the limits of numpy arrays. So if we simply tried to save this array as-is, we would actually produce overflow. Let’s try it now.</p><pre>from scipy.io.wavfile import read, write</pre><pre>write(&quot;bad_file.wav&quot;, sample_rate, new_array)</pre><p>Notice that the file sounds even worse than before due to overflow. *<strong>Warning: I would not recommend listening to this sample through headphones.*</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F430427187%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F430427187&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F911014470_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/694b23fae7620e4b2ca71b62103087c8/href">https://medium.com/media/694b23fae7620e4b2ca71b62103087c8/href</a></iframe><p>To avoid this overflow, we need to rescale the y-axis so that it is between -32768.0 and 32768, as constrained by the numpy array. We can do this by first finding the maximum or minimum value of the new array, dividing the new array by that value, and then multiplying the new array by 32768.0. Finally, we declare the new array as 16-bit.</p><pre>new_max = max(abs(new_array))  # find new maximum<br>new_array = np.divide(new_array, new_max)  # divide by maximum<br># multiply by old maximum<br>new_array = np.multiply(new_array, 32768.0)  <br>new_array = new_array.astype(&#39;int16&#39;)  # 16-bit</pre><p>If we look at the 6ms segment now, we’ll see that it is again between -32768.0 and 32768, as it was before it was declipped.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cex6sS5WO92BUFmW.png" /></figure><p>We are finally ready to save the file!</p><pre>write(&quot;new_wav.wav&quot;, sample_rate, new_array)</pre><p>Notice that the new file sounds quieter than the original. This is because we rescaled the y-axis to accommodate for our predicted values. We increased the maximum and minimum amplitude, and so all the original values now have a lower volume.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F430427248%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F430427248&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F911014736_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/27e53ad77bcc3ba4176cddf01e30f9ab/href">https://medium.com/media/27e53ad77bcc3ba4176cddf01e30f9ab/href</a></iframe><p>Notice also that the file still sounds buzzy in some of the places where it was clipped before, such as in the word “fascinating”. This is because we can never truly recover the original signal, as it was lost at recording time when the microphone’s diaphragm maxed out. However, the buzziness is hopefully less stark than it was before, and now more easily ignorable by our neural TTS system.</p><p>[1] This Scottish preposition is the opposite of “within”. In non-Scottish dialects of English, it roughly means “outside of”. I picked up this word when I was doing my Master’s in Edinburgh, and I think it’s very useful and severely underused!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RwGdl6OQHoas_V4w.jpg" /></figure><p><strong>Written by Alexandra Torresquintero — Data Engineer at Papercup.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58fa87a27d44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/tutorial-on-declipping-wav-files-58fa87a27d44">Tutorial on declipping WAV files</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dubbing vs. Subtitles: The Ultimate Showdown]]></title>
            <link>https://medium.com/papercup-ai/dubbing-vs-subtitles-the-ultimate-showdown-be46404e4746?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/be46404e4746</guid>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[language]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[translation]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 09:59:46 GMT</pubDate>
            <atom:updated>2020-06-17T09:59:46.061Z</atom:updated>
            <content:encoded><![CDATA[<p>Dubbing or subtitles? The age-old question in translated content. In the media industry, “localisation” refers to the conversion of media content from one language to another, either through dubbing or subtitles. Dubbing entails replacing the original audio with a new audio recording in the target language. Subtitles are the on-screen text which is a translation of the original dialogue. But which is better? There’s only one way to find out…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*DWkDORXfJgjjcIix.png" /><figcaption><em>For those not familiar with Harry Hill’s TV burp, we can move swiftly on…</em></figcaption></figure><p>Dubbing dates back to the 1930s and was used by countries as part of their cultural and political mission to defend their nation and its language in the face of foreign influence. This was particularly true among fascist governments at the time. The highly developed, and still active, dubbing industries in Italy, Spain and Germany are therefore remnants of their political contexts in the 1930s, when sound film emerged. If you want to learn more about why the likes of Germany is so good at dubbing you might enjoy <a href="https://player.fm/series/the-world-in-words-74528/dubbing-with-benefits">this podcast</a> from The World in Worlds, playfully titled “Dubbing with benefits”.</p><p>Skip forward a few decades, when the motivation wasn’t political, and dubbing was typically an activity that occurred at the tail-end of production, when all the money had been spent. This meant quality was a secondary consideration, and it is this part of dubbing’s history that gives rise to the negative connotations surrounding the industry. That, and the badly dubbed kung-fu movies from the 1970s.</p><p>Skip forward to present day, and dubbing is a critical contributor to the commercial success of international TV and film releases, as well as the norm for certain content types, such as children’s programming, visual documentaries and instructional videos.</p><p>So despite what highbrow, film critic friends might tell you, someone’s preference for dubbing or subtitles is largely an accident of history. Subtitling is more prevalent in English speaking and Nordic countries, while dubbing is more common in France, Italy, Germany and Spain.</p><p>However, Netflix has challenged the deeply rooted idea that English speakers reject dubbed content and shown that defaulting to dubbed dialogue <a href="https://www.indiewire.com/2018/03/netflix-dubbed-tv-shows-default-subtitles-1201937425/">increases viewership</a>. This is based on tests run that analysed show completion rates for dubbed vs. subtitled content. ‘Money Heist’ and ‘Dark’ are popular non-English programmes on Netflix, and the percentage of US viewers that preferred the dubbed versions is <a href="https://www.slashgear.com/netflix-is-making-its-dubbed-foreign-content-sound-less-awkward-19584653/">72% and 85% respectively</a>.</p><p>This growing preference for dubbing may be explained by any one of the following shortcomings of subtitles for today’s audiences:</p><ul><li>Viewers are increasingly multi-tasking or using another device whilst watching, which makes reading subtitles impractical</li><li>Smaller screen spaces on mobile can also make reading subtitles impractical</li><li>Slower comprehension speed of reading means that the original meaning can be lost as long audio clips are converted to short, easy to read subtitles</li><li>Subtitles can distract from the viewing experience</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BOGgbS6YiwxWKn5k.jpg" /></figure><p>The upside of subtitles is that they are quicker and cheaper to produce, and for some better preserve the spirit and audio experience of the original.</p><p>So with dubbing providing a better viewer experience, but at a cost and time to deliver that cannot compete with subtitles, a fundamentally different approach to dubbing is needed. That is why at Papercup we are developing state-of-the-art translation technology that can translate voice into any language while maintaining the original voice’s characteristics and intonation.</p><p>For examples of our work, see the <a href="https://www.youtube.com/channel/UCzG5BnqHO8oNlrPDW9CYJog">Sky News in Spanish</a> YouTube channel.</p><p>If you’re a content producer and interested in growing your content into more languages, contact us <a href="/service/mailto:margarita@papercup.com">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be46404e4746" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/dubbing-vs-subtitles-the-ultimate-showdown-be46404e4746">Dubbing vs. Subtitles: The Ultimate Showdown</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ways to Find Answers]]></title>
            <link>https://medium.com/papercup-ai/ways-to-find-answers-312bc52ecebf?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/312bc52ecebf</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[stackoverflow]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 09:06:01 GMT</pubDate>
            <atom:updated>2020-06-15T09:06:01.286Z</atom:updated>
            <content:encoded><![CDATA[<p>You start working on a task, you find a library that does everything you need. You start using the library, and then you get an error. You look at the documentation of the library, but it is mum about the issue you are experiencing. Somebody asked the same question on StackOverflow, but no resolution has been posted, yet. If this sounds familiar, that is because it has happened to you at some point (assuming you are a programmer). At this point, you can give up, quit your job, move to the countryside or use some of the strategies we cover in this article.</p><h3>Understanding Documentation</h3><p>Before giving up hope on documentation let’s look into ways we can study it. Similar to technical books, I like skimming through the whole material quickly. My goal is not to study it, but to get an understanding of the coverage of documentation. Once I know what it covers and to what depth, I can decide which parts are worth for me to invest into. Let’s take a recent example.</p><p>One of the tasks on hand I had was to develop a priority queue system for our internal system to replace SQS as a form of communication between services. My first goal was to seek possible solutions that will let us set up a priority queue which is able to handle tasks with arbitrary priority. Candidate tools to help me achieve this were RabbitMQ, ZeroMQ, and Redis. My first goal in skimming through their respective documentations was to seek for any feature that can be used to solve my problem. The documentation will not necessarily use the term you might have in your head, therefore we need to get a general idea of APIs available to us. After quickly going through API documentation, I came to the conclusion that Redis has the necessary APIs to achieve my desired result. At that point, I still did not know exactly how to use the APIs, but I knew which ones existed. (Sidenote: The API I ended up using relies on a data model called sorted set, and we can adapt it to our use case.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*U9kE3wZUL-em-k0B.jpg" /></figure><p>Once I settled on the technology, I made a deep dive into the documentation of Redis. Thankfully, it is detailed, with good examples. Did I read all of it? No, I left out parts that are not relevant to my task, such as deployment-related aspects of Redis.</p><p>One step I omitted in my description of the steps taken so far; Before diving into the documentation, I used a search engine to help me narrow down the list of technologies that can be suitable for my task.</p><p>For developers, a more interesting place to search is GitHub, it offers advanced search which can be used to find example use cases of functions, internals of the module we are using or some comments left by the developers. I use this feature often to identify how others have set up their projects, and structured them. Let’s take a look at some of the cases.</p><h3>Observing others</h3><p>When we were setting up our front-end application, I wanted to know how to set-up the project properly. One of the benefits and drawbacks of the JS development world is that there are hundreds of ways to achieve the same functionality. Once we decided to use Next.js, a framework for developing React applications. We needed to configure it to work with different sets of plug-ins for our front-end application. To see how others have done it, I went to GitHub and search for the following:</p><pre>filename:next.config.js</pre><p>The search result shows me all the repositories that have a Next.js configuration. The term “filename” is a keyword for Github’s advanced search functionality. We specify the name of the files we want to search in by appending it to the keyword separated by a colon. In this case, I am not even searching within the file, just searching for the existence of it since all Next.js projects require a next.config.js file.</p><p>Our application also uses postcss, so we want to see an example of a configuration with postcss.</p><pre>filename:next.config.js postcss</pre><p>Once we update our search term, we get back all next js projects with custom postcss configuration. <em>Neat</em>. You can find a handy page with all the github advanced search features <a href="https://github.com/search/advanced">here</a>.</p><h3>Searching in the darkness</h3><p>In the previous example, I was looking for examples of projects to learn from them. We can also use the search functionality to find how people use specific functionality of a module you are using. When I was working on a Django project, I had a particularly specific use case for a MultiChoiceField on the seriliaser. I wanted to provide MultiChoiceField choice values from a result of a database query. To see if it is possible to do so, I looked up the official documentation which did not provide a clear answer. Then I went to GitHub and searched for extension:py MultipleChoiceField.</p><p>The results showed me different ways people have used the field, and one of the examples I stumbled upon was the same pattern as I was thinking to use. I could have also found out if it is possible by trying it out, but I was lazy and didn’t have the project set-up locally.</p><p>The next challenge was coming up with a more advanced use case for the field. We want to have a custom error as part of the serializer error, and the Django Rest Framework (DRF) documentation does have a small section on the feature, but we wanted an error which displayed input and list of choices available to the user. I had an intuition it was possible, since the default error shows the original user input as part of the error message.</p><p>This brings me to the next stage of dealing with a lack of documentation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yqusBBSr84CreQQuF6lfcg.jpeg" /></figure><h3>All roads lead to the source code.</h3><p>For a long time, I was irrationally afraid of reading the source of projects. Could be due to my previous experience of diving into <a href="https://en.wikipedia.org/wiki/Spaghetti_code#Lasagna_code">lasagne code</a> of the Java/Scala world. It can feel daunting sometimes to do, and some projects do not lend themselves for an easy read, but it is worth a shot. I find python and typescript projects source code quite readable. By reading the source code of DRF, we figured out that the serializer use .format on the string with a placeholder of the original user input specified as {input} in the string. By looking at the documentation, we arrive at a nice and concise way to improve our error messages in our serializer.</p><p>If none of the strategies above yield a result, you can always ask your colleagues, friends or people on the internet.</p><p>I often say that ability to search is one of the best skills I have. My default assumption for any task is always that someone else has already done it. To prove it, I use a mix of terms to use to search on StackOverflow, GitHub or a forum for the project. Only if I don’t find evidence of it, I start considering moving to the countryside.</p><p>P.S. Given we are all working remotely right now, moving to the countryside will not help me.</p><p><strong>Written by Doniyor Ulmasov — Software Engineer at Papercup</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=312bc52ecebf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/ways-to-find-answers-312bc52ecebf">Ways to Find Answers</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moving our machine learning models to GKE]]></title>
            <link>https://medium.com/papercup-ai/moving-our-machine-learning-models-to-gke-bfebf6bb78ec?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfebf6bb78ec</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[paper-cups]]></category>
            <category><![CDATA[model]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Wed, 27 May 2020 09:04:13 GMT</pubDate>
            <atom:updated>2020-05-27T09:04:13.642Z</atom:updated>
            <content:encoded><![CDATA[<p>GKE is the new Victoria’s Secret. That’s where all the best models go.</p><p>Ugh, why do I have to cringe at my own jokes… Moving on. Let me tell you about this kinda unique setup we have at the moment, where all of our prod services are in AWS except our two models requiring GPUs. These two live on our Google Kubernetes cluster. It’s been a pretty fun adventure setting it up and we’ve learnt a bunch of things along the way that I want to share with you.</p><h3>Yeah but why?</h3><p>Several reasons, but one is the good ol’ money thing. Thanks to the program we’re on, Google Cloud for Startup, we got free Google credits to use. Although all of our infrastructure is on AWS, we chose to move our GPU-intensive models over to Google as they are by far the most expensive of our cloud bills. We picked Kubernetes because of the impressive flexibility and modularity it offers, and with the sights of one day moving other things over. Its network policies, scalability and deployment system make it pretty attractive for a growing codebase like ours.</p><p>I love that Kubernetes is declarative by nature. The ability to have all of your cluster’s config as code in one place and being able to apply it really satisfies the OCD person in me. And I’m not even OCD.</p><h3>So, what have we got?</h3><p>One cluster with two-node pools:</p><ul><li>one with GPUs for our models, it autoscales from 2 to 4 nodes,</li><li>one node pool for supporting pods that are automatically added by Google,</li></ul><p>And that’s about it for now.</p><p>Since our two programs pick messages up from SQS queues, their Kubernetes pods don’t need public IPs and therefore no load balancer needed.</p><h3>A couple of choices along the way</h3><p>Since our services need to query from AWS queues, they need credentials to access them. We’re storing them as cluster-wide secrets that we generate locally, apply once and then delete. We originally decided to encode them using a KMS key and decode them in our build process before applying them; but building with CircleCI meant the decoded creds might get stored, which we definitely did not want.</p><p>Oops, I said it, now it’s no longer a surprise: we are using <a href="https://circleci.com/">CircleCI</a> for our CI/CD. Damn, always spoiling the juicy details, me.</p><p>That part’s been ok, though we faced a couple of challenges I’ll be mentioning below.</p><h3>Queue-based scaling</h3><p>Funnily enough, with this whole queuing system, our GPU models don’t really bite off more than they can chew and our biggest overload issue is actually latency when the queue backlogs get too big. This means that autoscaling on GPU usage makes no sense for us (and is not straightforward with GKE), let alone on CPU usage. Instead, we’ve chosen to scale on queue backlog, meaning we increase the number of instances every time more than 100 messages are waiting.</p><p>Now, that’s been tricky on two ends — AWS because we chose to trigger a lambda when the number of messages got too big and that was not straightforward; and on the program’s end because programmatically scaling a cluster from another cloud provider requires a lot of trial and error. Each of these issues will get their own little tutorial because it’s just not super fun figuring it out by yourself.</p><p>In short, we now have two AWS lambdas that will scale up or down our GKE model instances based on SQS queue length.</p><h3>The challenges</h3><p>A few things that could be useful to a distant reader dealing with similar issues.</p><h3>GPU taints and tolerations (docs <a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/">here</a>)</h3><p>GKE automatically taints all its GPU node pools with nvidia.com/gpu=present so that, technically, only pods with the corresponding tolerations would be scheduled on them. I don’t quite know why but it did not work for us, such that if you upscaled your deployment - say, from 2 to 3 replicas - your node pool would go up to 3 nodes, but when you downscaled your replicas, your node pool would stay at 3 because other GKE-native pods would have been scheduled on the third node.</p><p>As a result, we had to add our own taint to this pool to make sure that it works. We called it mlonly=true.</p><p>Another interesting bug was that, for a while, a node pool had a duplicate of this taint. The taints looked like this: nvidia.com/gpu=present mlonly=true mlonly=true. This caused our deployments to never get scheduled on them. Granted, we were idiots for having this duplicate and this may not be fully a bug.</p><h3>Image pulling from containers</h3><p>That was a little bit frustrating. In short, we wanted that every time we “deploy” a new version of our code, well, it actually deployed. But since our deployment folder essentially calls for the my-image:latest image, it doesn’t know to actively pull a new image whenever you re-apply your config. And using templates for our k8s config isn’t an option yet.</p><p>We thought we’d fixed this by first adding imagePullPolicy: Always on our deployment config. Turns out this wasn’t enough. So we ended up using an ugly hack which consists of force patching a random parameter into our config to force a new pull. This hack can be found <a href="https://github.com/kubernetes/kubernetes/issues/33664">here</a>.</p><p>Interestingly enough, in Kubernetes 1.15, there’s a nice command that’ll do that for you, kubectl rollout restart, but GKE doesn’t yet support this version.</p><h3>CircleCI</h3><p>A couple of challenges cropped up with CircleCI.</p><p>We started using CircleCI’s <a href="https://circleci.com/docs/2.0/orb-intro/">orbs</a>, which are kinda cool because they make your config look much cleaner. However, they do sometimes get a little rigid, which made us revert to the old Circle ways on a couple of occasions.</p><p>One unfortunate annoyance that we have come across on multiple projects is related to image naming. We use the CIRCLE_BRANCH variable to generate our image name, but we also tend to use forward slash / a lot in our branch names. Forward slash not being supported in GCP’s container registry, it causes our image pulls to fail. To work around this, we’ve been using a quick Regex (brrr…) hack to remove all forward slashes from the image name. Not a challenge per se, but every time I use a regex, it feels as sinful as leaving the water running when I brush my teeth.</p><h3>To conclude</h3><p>We have learnt a couple of things along the way on which I will make quick dirty tutorials. There is a lot to be said about technology concentration with one provider, even though this leads to ugly monopolies.</p><p><strong>Written by Astrid de Gasté. This article was originally posted </strong><a href="https://papercup.dev/posts/moving-our-ml-models-to-gke/"><strong>here</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xtqGYW0cyeSAzhBnQFDsA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfebf6bb78ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/moving-our-machine-learning-models-to-gke-bfebf6bb78ec">Moving our machine learning models to GKE</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Duck-typing in style with TypeScript and Tachyons]]></title>
            <link>https://medium.com/papercup-ai/duck-typing-in-style-with-typescript-and-tachyons-62ce2e087c4d?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/62ce2e087c4d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[paper-cups]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Fri, 15 May 2020 08:27:11 GMT</pubDate>
            <atom:updated>2020-05-15T08:27:11.919Z</atom:updated>
            <content:encoded><![CDATA[<p>It can be challenging to set up a new project. You need to decide not only on the technologies to use but also on what patterns will be utilised in the project. Sometimes, certain patterns work well with sets of technology and might even, dare I say, create a synergy. We discovered that, for us, using Tachyons in combination with TypeScript and React was an excellent solution. Below we cover how we did it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JNPsiEt5GIIWQMjxtNWDA.jpeg" /></figure><h3>Tachyons?</h3><p><a href="https://tachyons.io/">Tachyons</a> is a simple CSS strategy, where each class rule is responsible for only one part of the style. For example, if we want our element to have a bold text we add a b class to it.</p><pre>&lt;p&gt;Hello, &lt;span <em>class</em>=&quot;b&quot;&gt;I am bold&lt;/span&gt;&lt;/p&gt;</pre><p>The Tachyons library already specifies the most common rules, which lets you start your project with a minimum amount of CSS. Having a class responsible for only a subset of CSS rules was/is considered by some a bad pattern. It causes repetition if the same set of styles need to be applied to different elements. If we were discussing the use of Tachyons in days before React (or similar frameworks), I too would look at Tachyons suspiciously.</p><h3>How does React address the issue?</h3><p>React allows us to create elements of our page as encapsulated components. Therefore, we can start hiding away some of the details of the styling from the user of the component.</p><p>Let’s look at an example:</p><pre>const Page = ({ isDark, children }) =&gt; {<br>    	return (<br>    		&lt;div <em>className</em>={isDark ? &quot;bg-dark-blue washed-blue&quot; : &quot;bg-washed-blue dark-blue&quot;}&gt;<br>    			{children}<br>    		&lt;/div&gt;<br>    	)<br>    }<br>    ...<br>    Example uses:</pre><pre>    &lt;Page <em>isDark</em>={true}&gt; Hello! it is dark in here!&lt;/Page&gt;<br>    &lt;Page&gt; Hello! it is dark in here! Oh wait, it is not.&lt;/Page&gt;</pre><p>Obviously, you can achieve the same result with BEM style CSS, Bootstrap or alternative styling options. The main benefit comes from the fact that we did not have to write any new CSS. All the classes used in the example are from the default Tachyons CSS file. It is true that some of the styling libraries like Bootstrap provide us with a set of classes to take advantage of, but they most often focus on the whole component while Tachyons provides us only the building blocks, thus giving us more granular control.</p><h3>Customizing your Tachyons</h3><p>It is all and good to have all these classes predefined by someone else, but in your use case, you might not agree with the colours, paddings and margins defined by the creators of Tachyons. That is simple to address. The source code of Tachyons is written with SASS; and that means we can swap out the variables of spacing, fonts, and colours to our own hues and get our own custom CSS bundle.</p><p>At Papercup, we use PostCSS to combine our custom classes, overridden variables and Tachyons base library into a single stylesheet. The whole process is part of our build script to ensure that, if there was a change made to the base styles, the developer does not have to remember to recompile the CSS manually. We created another abstraction layer over the class names of the colours. Instead of using the name of the colour, we defined the class name by its definition in our style guide:</p><pre>.bg-primary {<br>  background-color: var(--near-black);<br>}<br>.bg-brand {<br>  background-color: var(--orange);<br>}<br>.bg-inverted {<br>  background-color: var(--near-white);<br>}</pre><p>The pattern mirrors our style guide, therefore changes there quickly propagate through our websites. This allows us to update the colours of the site from a single place.</p><p><em>Sometimes you have to get creative when styling 3rd party libraries</em></p><h3>Adding some syntax sugar on top</h3><p>The className prop can start getting confusing as we increase the number of classes we use to define it, especially if they do not follow any grouping. To improve the readability of the code, we use a library called classNames, which allows us to take arrays, objects, strings and convert them into a class name. By using the library, we can split out classes, group them based on what aspect they are styling, and even enable or disable some classes based on the props of the component.</p><pre>className={classNames(<br>        &quot;flex db&quot;,  // Layout<br>        &quot;w-100 pl4 h4&quot;, // Sizing<br>        &quot;lh-f5 fw5 f5 pff&quot;, // Font<br>        !selected &amp;&amp; &quot;b--solid bw1 br2&quot;,  // Add some border if the element is selected<br>    )}</pre><h3>The final piece, TypeScript</h3><p>Now we have our React components with our Tachyons classes that match our design. The final piece, that takes the experience to the next level is TypeScript. To take advantage of it we need to create an abstraction layer on top of a div element. Below is a simplified version of our Container component</p><pre>import classNames from &quot;classNames&quot;;</pre><pre>    type Width = &quot;w1&quot; | &quot;w2&quot; | &quot;w3&quot; | &quot;m-w1&quot; | &quot;m-w2&quot; | &quot;m-w3&quot;</pre><pre>    interface ContainerProps = {<br>     dimension?: { width: Width | Width[] }<br>    }</pre><pre>    const Container: React.FunctionalComponent&lt;ContainerProps&gt; = ({ dimension }) =&gt; {</pre><pre>    	return (<br>    		&lt;div <em>className</em>={classNames(dimension &amp;&amp; Object.values(dimension))}&gt;<br>    			{children}<br>    		&lt;/div&gt;<br>    	)<br>    }</pre><p>What is happening here?</p><p>First, we define a string literal with a set of values the width can have, in this case we are using our class names. We do this on purpose, to reduce any unnecessary abstraction layers, such as mapping from one value to a class name. The string literal is used as part of the declaration of the interface of the component. Notice the property can be a single value or an array of values. We can specify an array of values if we want to use properties like max-width in combination with width or if we have device resolution-based properties.</p><p>Now when you use the Container, as soon as you type the dimensions props and width, you will start seeing appropriate values for the width of the component.</p><h3>Real examples</h3><pre>export interface InterfaceContainer extends ClassNameOverrideInterface {<br>  asElement?: React.ElementType;<br>  border?: BorderProperties;<br>  dimensions?: DimensionProperties;<br>  flex?: FlexProperties;<br>  layout?: LayoutProperties;<br>  background?: ColoursBackground;<br>}</pre><pre>export const Container: WithAsElementPropWithRef&lt;InterfaceContainer&gt; = React.forwardRef(<br>  (<br>    {<br>      asElement,<br>      border,<br>      dimensions,<br>      flex,<br>      layout,<br>      background,<br>      children,<br>      classNameOverride,<br>      ...rest<br>    }: any,<br>    ref: any,<br>  ) =&gt; {<br>    const Component = asElement || &#39;div&#39;;</pre><pre>    return (<br>      &lt;Component<br>        <em>ref</em>={ref}<br>        <em>className</em>={classNames(<br>          border &amp;&amp; Object.values(border),<br>          dimensions &amp;&amp; Object.values(dimensions),<br>          flex &amp;&amp; Object.values(flex),<br>          layout &amp;&amp; Object.values(layout),<br>          background,<br>          classNameOverride,<br>        )}<br>        {...rest}<br>      &gt;<br>        {children}<br>      &lt;/Component&gt;<br>    );<br>  },<br>) as WithAsElementPropWithRef&lt;InterfaceContainer&gt;;</pre><pre>export const FlexColumn: WithAsElementProp&lt;InterfaceContainer&gt; = ({<br>  children,<br>  flex,<br>  layout,<br>  ...props<br>}: any) =&gt; {<br>  return (<br>    &lt;Container<br>      <em>layout</em>={Object.assign({ d: &#39;flex&#39; }, layout)}<br>      <em>flex</em>={Object.assign({ fd: &#39;flex-column&#39; }, flex)}<br>      {...props}<br>    &gt;<br>      {children}<br>    &lt;/Container&gt;<br>  );<br>};</pre><pre>export const FlexRow: WithAsElementProp&lt;InterfaceContainer&gt; = ({<br>  children,<br>  flex,<br>  layout,<br>  ...props<br>}: any) =&gt; {<br>  return (<br>    &lt;Container<br>      <em>layout</em>={Object.assign({ d: &#39;flex&#39; }, layout)}<br>      <em>flex</em>={Object.assign({ fd: &#39;flex-row&#39; }, flex)}<br>      {...props}<br>    &gt;<br>      {children}<br>    &lt;/Container&gt;<br>  );<br>};</pre><p>Once we defined all our properties, we can duck type way.</p><pre>&lt;FlexRow<br>  <em>id</em>=&quot;layout&quot;<br>  <em>background</em>={&#39;bg-primary&#39;}<br>  <em>dimensions</em>={{ h: &#39;vh-100&#39;, w: &#39;vw-100&#39; }}<br>  <em>flex</em>={{<br>    fai: &#39;items-center&#39;,<br>    fjc: &#39;justify-center&#39;,<br>  }}<br>&gt;<br>  {children}<br>&lt;/FlexRow&gt;</pre><h3>Is it worth it?</h3><p>The initial set up of the base components and the style definitions was not the most fun experience. However, as the project grew, we started appreciating the solution more.</p><p>Written by Doniyor Ulmasov — Software Engineer at Papercup</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62ce2e087c4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/duck-typing-in-style-with-typescript-and-tachyons-62ce2e087c4d">Duck-typing in style with TypeScript and Tachyons</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Bother Translating Your Videos Into Other Languages?]]></title>
            <link>https://medium.com/papercup-ai/why-bother-translating-your-videos-into-other-languages-c356b468d298?source=rss-ef413c72a96a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c356b468d298</guid>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[videos]]></category>
            <category><![CDATA[translation]]></category>
            <category><![CDATA[monetization]]></category>
            <category><![CDATA[content-creation]]></category>
            <dc:creator><![CDATA[Team Papercup]]></dc:creator>
            <pubDate>Wed, 13 May 2020 13:08:50 GMT</pubDate>
            <atom:updated>2020-05-13T13:08:50.832Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, if you post a video in English, there are 6 billion non-English speakers that will most likely not want to watch it. Yet, a <a href="https://www.pewresearch.org/internet/2019/07/25/popular-youtube-channels-produced-a-vast-amount-of-content-much-of-it-in-languages-other-than-english/">whopping 60%</a> of all YouTube viewers do not speak English as a native language. So the international audience is there, but why is it that content translation is still a topic of discussion and not a hygiene factor on YouTube?</p><p>We know what you’re thinking- there is plenty of subtitled content out there and most content creators caption their videos in multiple languages. That is a great first step in trying to reach more international viewers, but actually, <a href="https://www.japantimes.co.jp/news/2010/08/31/national/viewers-of-western-movies-tiring-of-subtitles-prefer-dubbed-voice-versions/#.XfkBhWT7SUk">research shows</a> that people largely prefer to watch content in their native language. This way they can multitask while watching without having to constantly read off of the screen or watch content on smaller devices.</p><blockquote>Many bilingual creators admit that they want to make videos in languages other than English but they just don’t have the time and energy to go through with it.</blockquote><p>So why do most content creators not dub their videos? The answer is quite simple and usually comes down to cost, time and consistency. The time and effort it takes to create multiple versions of the same video in different languages are sky high while finding external resources can be expensive and not always reliable. Many bilingual creators we spoke with admit that they want to make videos in languages other than English but they just don’t have the time and energy to go through with it.</p><p>On the other hand, we have major global content producers like Discovery dubbing over <a href="https://slator.com/features/media-localization-buyers-on-outsourcing-automation-and-last-minute-schedule-changes/">100,000 hours</a> of content per year in EMEA region alone and employing over 55 different third-party providers based in those territories. If we look at <a href="https://www.hollywoodreporter.com/news/netflix-s-global-reach-sparks-dubbing-revolution-public-demands-it-1229761">Netflix</a>, it currently dubs into 30+ languages, uses 125 facilities worldwide and has grown its investment in dubbing 25–35% per year for the past few years. Consumption of translated content on Netflix is growing even faster, at an average 120% annually.</p><p>We know what you’re thinking.. again :) These are premium content produced and they are of a completely different calibre than your average online content creator. We get it! But it still shows a strong indication of high demand for translated, specifically dubbed, content. So assuming these media giants know a thing or two, shouldn’t we, semi-professional content creators, take note and try to dub our content to reach a wider international audience. Not convinced yet? Here are 3 reasons that might just change your mind:</p><h3>A Simple Equation</h3><p>The first reason is dead simple and can best be described like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*E8pYo4rU24xS5Ezm6_ngzg.jpeg" /><figcaption><em>Playing around with Paint after about a decade surprisingly remained as exciting</em></figcaption></figure><p>Simply put, it’s a foolproof formula where the more content you translate, the more international views you will garner, which in turn will earn you more ad revenue on YouTube. Having said that, we all know how precarious and unpredictable YouTube’s ad revenue can be, and the best way to hedge for that, if you’re not a massive production powerhouse, is by localising your existing content.</p><p>Also, don’t be misled by the seeming ubiquity of English. There are 1.1 billion speakers of Mandarin Chinese, 341 million Hindi speakers, and 527 million Spanish speakers worldwide, in addition to billions of other non-English speakers (<a href="https://www.ethnologue.com/guides/most-spoken-languages%20%20%E2%86%A9">source</a>). Translating content into any of those languages will open the floodgates of audiences you never thought would be interested in your videos.</p><h3>Efficiency is King</h3><p>The second reason takes root in the beauty of repurposing content. Let’s say, for argument’s sake, every new video you release on your English-speaking channel gains 1 million views within a week. If you wanted to get 1 million more views that same week, you would need to produce an entirely new video and we all know how much work that requires. Instead, if you simply translate your original video into another language and release it, you’ve got yourself a potential 1 million extra views in the same week, using the same piece of content.</p><p>It isn’t easy to grow a brand new channel from scratch, especially if you’re targeting an audience whose preferences you know nothing about. Thankfully, at Papercup we have a team of channel management experts specialising in different non-English speaking markets, so I’ll just leave our <a href="/service/mailto:margarita@papercup.com">contact here</a>, for no particular reason, and move on to reason #3.</p><blockquote>As a trailblazer, you’ll reap the most benefits by being amongst the first few who reach international viewers within your content category.</blockquote><h3>Being a Trendsetter</h3><p>As the saying goes, the early bird gets the worm, and you can be that bird if you choose to start dubbing your content. Looking at how many resources are becoming readily available to transcribe, translate, subtitle and dub digital content, it may appear like this trend has been around for a while (which it has, but not so much in the semi-professional content creation space that you and I are a part of), and there is no way to become an early adopter, which is not true. The fact that dubbing and subtitling services are now readily available means that <strong><em>now</em></strong> is the prime time to jump onto this bandwagon and pave the way for other content creators to take note.</p><p>Let’s say you start translating your content. Creators who watch your videos will become curious and excited by your success with non-English speaking audience and attempt the same, kickstarting an entire trend of localising digital content. And as a trailblazer, you’ll reap the most benefits by being amongst the first few who reach international viewers within your content category. So think fast, and don’t miss the opportunity to reach the Spanish or German or Japanese audiences who can’t wait to watch your awesome videos!</p><p>In the end, anyone who has ever invested a considerable amount of time into a YouTube channel knows that there are no guarantees that yet another of your crazy video ideas will become successful until you try it. Let’s be honest, nobody expected telenovelas to be popular in the middle east or K-dramas to be a hit in Latin America. Same goes for trying to reach new international audiences, and current localisation tools make it almost a risk-free endeavour, so why not give it a try?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r00qoyEFzQoLwbV5Rtl6DA.jpeg" /></figure><p>This is a repost of original content found on the <a href="http://blog.papercup.com/"><strong>Papercup blog</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c356b468d298" width="1" height="1" alt=""><hr><p><a href="https://medium.com/papercup-ai/why-bother-translating-your-videos-into-other-languages-c356b468d298">Why Bother Translating Your Videos Into Other Languages?</a> was originally published in <a href="https://medium.com/papercup-ai">Papercup AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>