<?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[BQ Engineering - Medium]]></title>
        <description><![CDATA[Engineers at BQ sharing their knowledge on multiple topics - Medium]]></description>
        <link>https://medium.com/bq-engineering?source=rss----eebf05664821---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>BQ Engineering - Medium</title>
            <link>https://medium.com/bq-engineering?source=rss----eebf05664821---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 13 Nov 2026 05:07:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/bq-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mini: Embrace Reactivity. Flux & Android]]></title>
            <link>https://medium.com/bq-engineering/mini-embrace-reactivity-flux-android-a623d1782b29?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/a623d1782b29</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flux]]></category>
            <dc:creator><![CDATA[Francisco García Sierra]]></dc:creator>
            <pubDate>Thu, 08 Nov 2018 16:01:41 GMT</pubDate>
            <atom:updated>2018-11-08T16:01:41.325Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SaK4nDVF54Uh1ALPOpIWeA.jpeg" /></figure><p>Flux is an architecture pattern created by Facebook and used to build client-side web application. It complements Reacts view components by utilizing an unidirectional data flow. Flux eschews MVC in favor of a unidirectional data flow.</p><p>Across this article we will explain how Flux works, together with how to implement it in our Android applications using an external framework developed for the Android platform using Kotlin thus allowing us to minimize the boilerplate that this architecture could produce in other languages without using popular JS framerworks.</p><h3>Data Flow : Dispatchers, Stores and Views</h3><p>The unidirectional data flow is the core idea of the Flux pattern. In order to ensure this flow we will use a series of structures. The Dispatcher, Stores and Views are <strong>independent nodes with different inputs and outputs</strong>. Actions are just <strong>bare objects</strong> that carries an optional payload of data. <br>Let’s see through an example how they work and interact with each other.</p><p>When an user interacts with a view, it propagates an Action (use case) that will be handled by a <strong>certain number of stores</strong> that hold the actual business logic of the application. The state of each of these Stores conforms the state of the application and will be mutated by the <strong>dispatch of Actions</strong> by means of the Dispatcher. Finally, our views will change reactivity <strong>based on </strong>the changes of these States.</p><p>Let’s see it in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pgxTL69KXTYjupzGO015Ew.png" /><figcaption>Flux flow diagram</figcaption></figure><h4>Dispatcher</h4><p>The dispatcher is the central hub that manages all data flow in a Flux application. It’s just a mechanism that distributes the actions to the stores. Each Store provides a callback for one or more Actions. When a new action go though the Dispatcher, all the stores receives this action and trigger their callbacks if needed.</p><h4>Stores</h4><p>Stores contains the <strong>application state</strong> and the <strong>logic</strong>. Their function is to <strong>hold and manage</strong> the state related to a particular domain within the application. Stores register itself to certain <strong>Actions and triggers,</strong> a state change together with other side effects when these Actions are dispatched. An action should result in an update to the state of one or multiple stores.</p><h4>Views</h4><p>Views on Flux <strong>listen reactively</strong> the changes emitted by the stores. On the Flux pattern, the changes in the views should be a <strong>side effect</strong> caused by a certain change in the stores.</p><h4>Actions</h4><p>The actions are <strong>simple objects</strong> dispatched though the Dispatcher to the Stores, containing new data provided to cause a state change. For example, the action LoginAction(email : String, password : String)contains the payload of data needed to make a call to an API REST with a login request.</p><h3>The Clean pattern</h3><p><a href="https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html">Clean architecture</a> is a pattern for a modular system, which strictly follows a design principle called <a href="https://en.wikipedia.org/wiki/Separation_of_concerns">separation of concerns</a>. This style of architecture focuses on <strong>splitting software into different layers</strong>, looking forward of simplify the development and make easier the maintenance of the application itself. When layers are well-separated, individual pieces can be reused, as well as developed and updated independently.</p><p>The architecture is usually composed of four fundamental layers. These layers will be identified as:</p><ul><li><strong>Enterprise Logic :</strong> Data models and entities.</li><li><strong>Application Logic :</strong> Business logic and use cases.</li><li><strong>Presentation Logic:</strong> Presentation design patterns.</li><li><strong>Infrastructure Logic:</strong> External dependencies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8vrMy4dsb78D2Q9HnkKxJA.png" /><figcaption>The Clean Architecture Pyramid, © 2018 PXPGraphics</figcaption></figure><p>Also, each layer should respect these rules:</p><ol><li><strong>Should be testable.</strong></li><li><strong>Should be independent of a user interface.</strong></li><li><strong>Should be independent of a database.</strong></li><li><strong>Should be independent of interfaces to third-party dependencies.</strong></li><li><strong>Should be respectful of boundaries.</strong></li></ol><h3>Clean Problems</h3><ul><li>Enforce the separation even if you don’t need to <strong>share modules with multiple projects</strong> can be overhead: as you need layer-specific objects and mapping in between</li><li>Navigation should be a <strong>domain-layer responsibility</strong>, but it is a common problem that people<em> abuse</em> Activities and make navigation state implicitly part of the task stack.</li><li>Hiding certain things under interfaces can be hard, often people still leak details, or their abstraction does not properly handle how their library of choice actually works.</li><li>Lots of <strong>boilerplate</strong></li></ul><p>So how is Flux different from Clean?</p><ul><li><strong>The Flow</strong> of the app is essential to Flux and there are very strict rules that are enforced by the Dispatcher. In Clean the flow isn’t enforced and most Clean patterns implement it differently</li><li><strong>Unidirectional flow: </strong>Every change goes through the dispatcher. A store can’t change other stores directly. Same applies for views and other actions. Changes must go through the dispatcher via actions. In Clean it’s very common to have bidirectional flow</li><li><strong>Stores</strong> don’t need to model anything and can store any application related state. In Clean models try to model something, usually single objects</li></ul><h3>Mini. A Minimal Android Flux Architecture</h3><p>Mini is a minimal Flux architecture written in Kotlin that also adds a set of useful features to build UIs fast.</p><p>The objective of this framework is to develop a reactive application with good performance (using code-gen over reflection). Feature development using Mini is fast compared to traditional architectures (like CLEAN or MVP), low boilerplate and state based models make feature integration and bugfixing easy as well as removing several kind of issues like concurrency or view consistency across screens.</p><h4>Sample case</h4><p>Let’s pose a typical case for a backend related application. We want to do a login request to our backend. If this request success, the user will be redirected to the home screen, if it fails, an error will be shown.<br>For this we will just need to build:</p><ul><li>An Action as an use case for our login request and the result callback.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97ea663b0a8bf777c5afb8283a59c741/href">https://medium.com/media/97ea663b0a8bf777c5afb8283a59c741/href</a></iframe><ul><li>A Store and that contains the application state regarding the session.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4616273248a164dfdc2d12ea3f587468/href">https://medium.com/media/4616273248a164dfdc2d12ea3f587468/href</a></iframe><ul><li>A View subscription to SessionStore state changes. This can be made listening all the changes for mapping data or custom logic or a single one for navigation purposes.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dae65b5b1108141e64e3a30292b5571e/href">https://medium.com/media/dae65b5b1108141e64e3a30292b5571e/href</a></iframe><p>With this code, the flow will happen in the next way:</p><ul><li>After click on the button login() is called and LoginAction is dispatched.</li><li>The Reducer functions that receives LoginAction are executed.</li><li>The state will change the value of loginTask to RUNNING in the state and the Controller makes the async operation over the backend. When the async operation will end LoginCompleteAction will be dispatched.</li><li>The state will change the value of loginTask to SUCCESS or FAILURE depending of the data retrieved.</li><li>The view will navigate to home or show an error depending of the state.</li></ul><h4>Testing</h4><p>Mini includes an extra library called mini-android-testing with a few methods and Expresso TestRules to simplify your UI tests over this architecture.</p><ul><li>TestDispatcherRule : This rule will intercept any action that arrives to the Dispatcher, avoiding any call to the Store and their controllers. If we include this rule we will need to change the states manually in our tests.</li><li>CleanStateRule : It just reset the state of your stores before and after each test.</li></ul><p>Test that actions are correctly dispatched:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2649191bbdd735cff61c24cd30395095/href">https://medium.com/media/2649191bbdd735cff61c24cd30395095/href</a></iframe><p>Test that a view correctly changes based on an specify state:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cbc1512182fc989dbbb8f3cdd8a939e/href">https://medium.com/media/4cbc1512182fc989dbbb8f3cdd8a939e/href</a></iframe><h3>Mini on Github</h3><p>You can grab Mini by adding dependency to your <strong><em>build.gradle</em></strong> file:</p><pre>implementation &#39;com.github.pabloogc:Mini:1.0.7&#39;<br>kapt &#39;com.github.pabloogc.Mini:mini-processor:1.0.7&#39;<br>androidTestImplementation &#39;com.github.pabloogc.Mini:mini-android-testing:1.0.7&#39; //Optional</pre><p>These are just a few examples of how to use the library, feel free to use it, open issues, creating pull requests and contribute to the project.</p><p>Join us on Github! Happy coding!</p><p><a href="https://github.com/pabloogc/Mini">pabloogc/Mini</a></p><h4>Links and resources</h4><ul><li><a href="https://facebook.github.io/flux/docs/overview.html">Flux architecture overview</a></li><li><a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter">Model — View — Presenter</a></li><li><a href="http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html">The Clean architecture by Uncle Bob</a></li><li><a href="https://medium.com/hacking-and-gonzo/flux-vs-mvc-design-patterns-57b28c0f71b7">Flux vs MVC pattern</a></li><li><a href="https://proandroiddev.com/mvc-mvp-mvvm-clean-viper-redux-mvi-prnsaaspfruicc-building-abstractions-for-the-sake-of-building-18459ab89386">Building abstractions for the sake of building abstractions.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a623d1782b29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/mini-embrace-reactivity-flux-android-a623d1782b29">Mini: Embrace Reactivity. Flux &amp; Android</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to analyze Bluetooth ANC Headphones acoustic performance]]></title>
            <link>https://medium.com/bq-engineering/how-to-analyze-bluetooth-anc-headphones-acoustic-performance-817965851d91?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/817965851d91</guid>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[sound]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[headphones]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Ángel Sola Otero]]></dc:creator>
            <pubDate>Thu, 18 Oct 2018 07:35:59 GMT</pubDate>
            <atom:updated>2018-10-17T16:03:44.549Z</atom:updated>
            <content:encoded><![CDATA[<p>Nowadays, Bluetooth headphones are growing up on demand. This article is focused on how we measure and analyze their acoustic performance into BQ audio laboratory.</p><p>First, we classify the type of each headphone according to their shape and how they couple to the ear as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Hg-W1VV_46vN-9vuGkkBjA.png" /><figcaption>(a) circumaural, (b) supra-aural, © intra-concha, (d) insert or in-ear</figcaption></figure><p>Although BT headphones have electronic components we are going to approach the analysis from a user point of view analyzing their acoustic performance.</p><h3><strong>Test equipment &amp; setup</strong></h3><p>There are some international standards, such as IEC60268–7, which provides a set of recommendations on how to perform these tests. The required environment must be completely quiet and without sound reflections. Measurements must be done with very precise equipment.</p><p>In order to achieve that conditions, we perform all our measurement within our anechoic chamber (which prevents the acoustic sounds from reflections and isolate acoustically the test environment).</p><p>The audio analyzer used in the measurements is APx555.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uIw0Pmav9K6nhJdQ.png" /></figure><p>In order to simulate the nonlinearities of the human ear at DRP (Drum Reference Point), a special HATS (Head and Torso Simulator) from Head Acoustics is used. The HATS is a fixture tool over which all measurements can be done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YiZNMjb0jJSgkjapZXB-Sw.png" /><figcaption>Headphones placed on HATS</figcaption></figure><p>Acoustic measurements of the headphones over the HATS are very sensitive to how the headphones are fixed to the HATS. In order to avoid measurements error, we repeat and average the measurements up 5 times removing and repositioning each time. This also allows us to have repeatability and realistic in our measures.</p><p>Now we will focus on a basic subset of measurements which can provide a good overview of a given DUT (Device Under Test). In our case, we will analyze a circumaural ANC (Active Noise Canceller) Headphone.</p><h3><strong>Measurements</strong></h3><p><strong>Frequency Response</strong></p><p>This is one of the most relevant measurements. It is generally thought to be the most representative characteristic of perceived quality. This measurement is done by playing a sweep tone (sinusoidal waves) from 20Hz to 20KHz at 94dB of Sound Pressure Level (dB SPL).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OymJeNhqKhfAYnPdIRG6FA.png" /><figcaption>Frequency Response graph</figcaption></figure><p>In this measurement, we can see how the headphone behaves reproducing different frequencies and their corresponding level in each channel (left &amp; right).</p><p><strong>Total Harmonic Distortion (THD)</strong></p><p>This quality factor is related to the signal clarity. It is able to measure the amount of distortion present at every part of the audible spectrum.</p><p>The THD is given as a percentage which represents the amount of acoustic signal energy caused by the distortion related to the original signal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHOKx83Z6tytpMMgSfXT-w.png" /><figcaption>THD Ratio graph</figcaption></figure><p><strong>Sound Pressure Level (SPL)</strong></p><p>This is the method to determine what sound pressure levels the headphones will generate when the input signal is maximum (0dBFS) filtered pink noise test signal (pink noise is a lab test signal which is very similar to the music and voice test signals).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8m3BIJcR44posjiyw4jL-A.png" /><figcaption>Result of SPL when the simulated program signal is played</figcaption></figure><p><strong>Crosstalk</strong></p><p>It is the unwanted leakage of a signal from one channel to the other channel. This may be due to a signal coupling in the internal electronic circuit and influence the stereo separation. The test signals used for this test are 1kHz and 10kHz sine waves. We play the signal into one channel and measure how much of that signal appears in the other channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4h5aat4KvjPLpfJxRdWGw.png" /><figcaption>Result of crosstalk in right channel when the signal is played in left channel</figcaption></figure><p><strong>Signal-to-Noise Ratio (SNR)</strong></p><p>SNR is the difference between the maximum loudness (1KHz tone) and the idle noise level (sound present at the headphone in the absence of input signal). SNR is always measured as a ratio in dBs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YuWxbIGiZOGwEjoBgiavQ.png" /><figcaption>Example of SNR measurement.</figcaption></figure><p><strong>Active Noise Cancellation (ANC)</strong></p><p>ANC is a measure of how capable a headphone is of removing the ambient noise from entering the ear channel. We create a 90dBSPL pink noise atmosphere and measure how much of that noise is perceived by the HATS´ ears. The noise signal should be played for several seconds to allow the noise canceling algorithms to become stable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7qYses2Phlbs91XqiXROQ.jpeg" /><figcaption>Setup for ANC measurement</figcaption></figure><p>The procedure can be split into three measurements.</p><ol><li>Pink noise atmosphere is measured by the HATS with no headphones on it. This way we assure we are playing 90dBSPL pink noise at the hearing point.</li><li>We repeat test 1, just after placing the headphones over the HATS. That can give us the passive isolation of the DUT.</li><li>Finally, the measure is done again with the ANC turned on. Comparing these result to result in step 2, we can find how much noise our ANC algorithm is canceling.</li></ol><p>The spectral analysis is typically smoothed in 1/3 octave band, which generates data that is more representative of how a human ear would hear</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EGLrMbO2LR2fLBBMnmqDFQ.png" /><figcaption>Green — Measurement 1 //////// Red — Measurement 2 //////// Blue — Measurement 3</figcaption></figure><p>In this example, we observe the ANC works below 800Hz. Above this frequency, passive isolation becomes more relevant.</p><p>We can also check not only the spectrum but the perceived loudness on each test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NS8-DgXnoscm-gPWbAGPLg.png" /><figcaption>RMS level vs time</figcaption></figure><p>As I said before, there are much more key performance indicators that can be added to this basic analysis such us idle noise, impulse response, phase shift, compression, R&amp;B, …</p><p>I hope you have found interesting this article and find it useful for next time you try a new pair of headphones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=817965851d91" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/how-to-analyze-bluetooth-anc-headphones-acoustic-performance-817965851d91">How to analyze Bluetooth ANC Headphones acoustic performance</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signal Amplification on Smartphone´s Audio — Part II]]></title>
            <link>https://medium.com/bq-engineering/signal-amplification-on-smartphone-s-audio-part-ii-1041ab96aeef?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/1041ab96aeef</guid>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[amplification]]></category>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[Luis Gomez]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 13:54:25 GMT</pubDate>
            <atom:updated>2018-09-26T13:54:24.435Z</atom:updated>
            <content:encoded><![CDATA[<p>Some time ago, we released a post on which we were giving a basic introduction about the role of the signal amplification on the smartphone´s sound and some basic concepts. It is recommendable to have read that part before going ahead, you can find the first part on this <a href="https://medium.com/bq-engineering/signal-amplification-on-smartphone-s-audio-part-i-d65f7f4f913e">link</a></p><p>Today´s post is about the three most common Amplifying Structures used in smartphone´s industry. These ICs are based on a power amplifier (PA) adding some other components which provide to the system a certain degree of intelligence in order to optimize the amplification process.</p><p>The PA used as the amplifying unit is classified according to its properties which vary a lot depending on its electrical design. In our case, in most of the Amplifying Structures, the PA unit used is class-D as a consequence of the good balance this class has in terms of efficiency and performance.</p><p><strong>Naked PA</strong></p><p>These chips just contain the PA. Usually, the gain of the PA can be adjusted by HW through some external resistors and low&amp;high cutoff frequencies through basic RC passive filters at the chip signal input.</p><p>Gain setting adjusts the output power level. This adjustment must take into account the worst use case so that the speaker is never overloaded (a) or the output on the PA is never saturated (b).</p><p>a)You need to consider the output level for the greatest possible input signal to make sure it won´t exceed the speaker max. rated power (if that happens you may get high distortion or even damage your speaker).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*2YY-8aO-luLxZPoMLqJK7Q.png" /><figcaption>Output-Input level curve for Naked PA</figcaption></figure><p>b)You need to consider the lowest possible battery level on the PA supply power, to make sure the output signal will never reach it (if that happens the output signal will be saturated).</p><p>*Typical designs using the “Naked PA” use an external DC-DC regulator to keep the power supply constant at 5V and avoid b).</p><p>This solution totally lacks of awareness about system status or input signal and that makes it low efficient in terms of how capable it is of keeping the system boosted to maximum whichever the use case/system status is.</p><p>This type of amplifying structure is used in cost-effective devices. They are simple, cheap and easy to integrate into any hardware solution.</p><p><strong>AGC/DRC</strong> (Automated Gain Control/Dynamic Range Control)</p><p>This Amplifying Structure´s name is quite clarifying. Automated Gain Control sounds like a system which is somehow capable to automatically adjust its gain and this is one of the lacks that Naked PA has.</p><p>We explained before that fixing the gain requested to consider the worse use case (greater input signal) in order not to overload the speaker/saturate the output signal. What would happen if we were capable of using a variable gain which could be adjusted depending on the input signal level? That is exactly what the Automated Gain Control does.</p><p>The main advantage of that is that you can use higher gains for low input level signals. This way, we can get greater output signal for all those cases on which the input level is lower than the worse case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQdSjBYxV2bDpkZQqgn32A.png" /><figcaption>Output-Input level curve for AGC</figcaption></figure><p>Why do we call this system Dynamic Range Control? DRC, as well known simply as compressor, is an audio processing block which compresses the input dynamic range into a smaller output dynamic range.</p><p>Dynamic Range is the amount of different possible levels which can be observed. As you can see in the picture below, the main side-effect for using the compressor is that you will loose some dynamic range as a trade-off for the loudness increasement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*FtydWxrfPavBX0-apyKYZA.png" /></figure><p>In order to give a better understanding about the difference between the Naked PA and the AGC, we can make an example. Using a piece of song which shows a great dynamic (the difference between lowest and highest level), we have simulated the effect of a 5dB Naked PA and an AGC which reaches same maximum output level (assuming both of them would be loading the same speaker).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1XoXE-GBO8Njm4S5ozCWg.png" /><figcaption>Original Signal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PeNDQG-2QbLRwu7Snr3-Q.png" /><figcaption>5 dB Amplification by a Naked PA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1AB_uT7T92FNeFH6NN7MHg.png" /><figcaption>Amplification by a DRC</figcaption></figure><p>You can clearly observe in that example, that the part of the song with the highest level is amplified quite the same, but the initial part, with low level, is boosted much more on the AGC, as a consequence of its adaptive gain which can be much higher for that part of the song.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fembed%2Fepisodes%2FOriginal-e29rvs&amp;url=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fepisodes%2FOriginal-e29rvs&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded400%2F1074747%2F1074747-1537955777643-cec2c310e7af6.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f62b1f923c7b719f8c7bab98b6f71e4/href">https://medium.com/media/9f62b1f923c7b719f8c7bab98b6f71e4/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fembed%2Fepisodes%2FNaked-PA-e29s00&amp;url=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fepisodes%2FNaked-PA-e29s00&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_episode400%2F1074747%2F1074747-1537955749006-1d3a345bcf963.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/be86da7553c4b603ccce6908d9ba6a67/href">https://medium.com/media/be86da7553c4b603ccce6908d9ba6a67/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fembed%2Fepisodes%2FAGC-e29s0i&amp;url=https%3A%2F%2Fanchor.fm%2Fluis-gomez23%2Fepisodes%2FAGC-e29s0i&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_episode400%2F1074747%2F1074747-1537955819472-5664ce4577e6a.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/23a188e3520df1ae115995bdd6443720/href">https://medium.com/media/23a188e3520df1ae115995bdd6443720/href</a></iframe><p>Additionally, the AGC/DRC includes in most of the cases the DC-DC converter which sets the power supply to max voltage according to the maximum output level expected to avoid signal saturation.</p><p>These amplifiers are used nowadays in entry-level smartphones as they are still quite inexpensive and can enhance the loudness. The main advantages of this platform compared to Naked PA are basically thanks to the system awareness of the input level signal before applying a certain amplification gain.</p><p><strong>Smart PA</strong></p><p>There is a big loudness improvement on AGC related to Naked PAs but the Amplifying Structures “changed the rules” for reaching an outstanding improvement never seen before.</p><p>Up to the moment, we are always trying to maximize the amount of power delivered to the speaker for not overloading the speaker, understanding that the limit of the speaker is always the rated power specified by the speaker supplier. Is it the real limit? can we go beyond that limit?</p><p>If we just think on these questions, we can clearly understand, that if we could be able to find a new speaker limit which would allow delivering more power to it, the overall performance (PA+Speaker) could be improved.</p><ul><li>How do suppliers determine the rated power for a speaker?</li></ul><p>The rated power is defined by analyzing the reliability of the component while playing a wideband signal (20Hz to 20kHz) at a given power for a long time (96 hours). If the speaker performance remains the same after several tests, we can assure that the speaker can handle that rated power.</p><p>This wideband signal is usually pink noise. This signal has a particular frequency density and peak to RMS relation (also known as crest factor) which mimics the average audio content which can be played through the speaker.</p><p>What if I am not playing all the time audio content similar to that pink noise? What if we can analyze in real time the type of audio content being played and adapt my system to maximize the signal delivered to the speaker?</p><ul><li>Which are truly the key parameters which set the speaker´s limit?</li></ul><p>We need to understand what exactly is relevant to the speaker´s reliability and analyze those parameters in real-time based on the content being played.</p><p>Well, signal power looks like relevant, but it is not the key parameter to look into to check if the speaker may be or not reaching its limit. Speaker overload point can be tracked by two very low-level physical magnitudes: Temperature and Distance.</p><p>The speaker limit is truly fixed by the maximum temperature its coil can handle, and the maximum excursion (elongation) of its membrane. If we are able to observe and control the coil´s temperature and the membrane´s excursion, we can deliver as much power as we want.</p><p>The rule has been changed, speaker limit is not the power anymore but its excursion and temperature.</p><p>This new approach will request from the Amplification System the capability of tracking the status of the speaker. SmartPAs will be aware not only of the audio input signal but also of the speaker status.</p><ul><li>Do these systems require a greater power supply for avoiding saturation?</li></ul><p>They do! As we are claiming, these systems are capable of delivering much more power to the speaker without reaching its limit (excursion/temperature ) so you may think that we should also increase the power supply voltage to avoid saturation, and that is correct.</p><p>While typical AGCs use a 5V power supply, it is normal that you can use a 10V power supply to avoid saturation under certain power peaks demand. Keep in mind making double the voltage, makes four times bigger the power demand!</p><p>This Amplifying Structures also use its smartness in terms of power handling! Any power supply has a constant current drain known as the quiescent current which is proportional to its output voltage. That means, the greater the voltage the power supply provides, the greater the standby consumption will be. Smart PAs, are aware of the input signal level so they can predict their output level. That level will not always reach the maximum output voltage so, why do we need to keep always the power supply set to max voltage? We don´t have to! Smart PAs use Smart Power Supplies, which dynamically adjust the power supply voltage to the minimum necessary level to avoid saturation.</p><p>We are not even close to fully explain how SmartPAs work, but we have just given some insights into the trigger which enabled such a big improvement on the Amplifying Structures.</p><p>*******************************************************************</p><p>I hope you all have enjoyed this article and keep reading. We will release soon the third and last part of this post on which we will go deep into Smart PA operation and explain in detail how these amazing amplifiers work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1041ab96aeef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/signal-amplification-on-smartphone-s-audio-part-ii-1041ab96aeef">Signal Amplification on Smartphone´s Audio — Part II</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Micronaut, ‘Spring’ fresh air…]]></title>
            <link>https://medium.com/bq-engineering/micronaut-spring-fresh-air-745571396421?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/745571396421</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Pablo Jose Gonzalez Granados]]></dc:creator>
            <pubDate>Tue, 25 Sep 2018 10:25:55 GMT</pubDate>
            <atom:updated>2018-09-27T14:43:06.889Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey, there we are!. Today we are going to talk about ‘Micronaut’ a JVM modular microframework. Micronaut is developed by Grails core team and they claim a minimal JAR size (around 8 Mb) and support Java, Groovy and Kotlin language. The syntax and annotation paradigm is very similar to Spring. Both, Spring and Micronaut, use reflexion in order to process java annotations, something that I don’t really like because break completely the object-oriented paradigm and encapsulation. The main different of Micronaut is that they use reflexion at compile time, instead of runtime, this will give you a better start time.</p><p>On the other hand, they also implement their own dependency injection, based on annotations and an application context that handler all beans initialization and tracking (pretty much as Spring).</p><p>So well, let&#39;s move on to a real example in order to see, about what we are talking about. We are going to setup <a href="https://github.com/micronaut-projects/micronaut-examples/tree/master/petstore">this petstore</a> example application and have a look how much memory they use at start time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UoY7tuzWJbP2FM4lrGIv9A.png" /><figcaption>Micronaut docker container memory usage</figcaption></figure><pre>java -&gt; petstore_pets_1 -&gt; 162.5Mb</pre><pre>java -&gt; petstore_mail_1 -&gt; 58.52Mb</pre><pre>java -&gt; petstore_offers_1 -&gt; 149.6Mb</pre><p>Mmm … It’s too far from this 8Mb that ‘OCI’, the Grails core team, claims. Why?. Maybe because they were talking about JAR size, however, this JAR will never work without a JVM. I am sure that if you use Java 11 and modules you will be able to reduce this JAR + JVM size. <a href="https://github.com/pjgg/javaMicroservicePOC">We already did the effort</a>, and we got a microservice of 40 Mb using <a href="https://vertx.io/">Vertx</a> framework.</p><h3><strong>Hello World Micronaut Vs Hello World Spring</strong></h3><p>In order to make a fair comparison between both framework, we are going to set up the “same” HelloWorld application.</p><ul><li><a href="https://github.com/micronaut-projects/micronaut-examples/tree/master/hello-world-java">Micronaut helloWorld app</a></li><li><a href="https://spring.io/guides/gs/rest-service/">Spring helloWorld app</a></li></ul><h4><strong>Micronaut Memory/Thread usage</strong></h4><p>We are going to run a performance test with 100 concurrent users that make one request per second, in order to see how each framework behaves in terms of memory consumption and threads.</p><p>1.<strong>Micronaut Memory</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOJaH9lpMOfJkUBpL_CTLg.png" /><figcaption>Micronaut helloWorld docker container size</figcaption></figure><pre>around … 76.3Mb</pre><p><strong>2.Micronaut Threads</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utTtaUCSi8z8lJev7pcEvQ.png" /><figcaption>Micronaut threads usage</figcaption></figure><p><strong>Threads details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njVmXrhrqcF0Fn9irV2BpQ.png" /><figcaption>Micronaut threads details</figcaption></figure><p>The behavior is as expected. Micronaut is an asynchronous none blocking threads framework (reactor), so we expected this behavior, a fixed thread pool (even one thread would be enough) that handler all request. This is quite handy when you have to design and develop a middleware that acts as a proxy of several pieces each one with their own latency.</p><h4><strong>Spring Memory/Thread usage</strong></h4><ol><li><strong>Memory needed</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rU78r9tHvV63Q7xrzJS4xw.png" /><figcaption>Spring HelloWorld docker container size</figcaption></figure><pre>around … 233.7Mb</pre><p>2.<strong>Spring Threads</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKWflSUns0clF5YgjF8jlA.png" /><figcaption>Spring threads</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvAwPanUsCd5TWiJ3RSN0g.png" /><figcaption>Spring threads details</figcaption></figure><p>… 1 min later the test was stopped…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4o9otQ3MKMgLOYVKH9uasA.png" /><figcaption>Spring threads behavior</figcaption></figure><p><strong>Threads details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvmkHFgjuJNuPJVR4G535w.png" /><figcaption>Spring threads details</figcaption></figure><p>Look at the size of the scroll…</p><p>The behavior is also as expected. Spring has a huge legacy and has a lot of libraries that break the main golden rule of all ‘asynchronous none blocking’ frameworks:</p><blockquote>Don’t Block the Event Loop</blockquote><p>This is very important to keep in mind because if you use Micronaut you should pay attention to all of these third party libraries that you use in order to don’t finish up as Spring. Anyway, it’s quite interesting for this test, because this is a hello world application (there are no third-party libraries), and Spring behaves like an old synchronous and blocking framework.</p><h3><strong>Conclusion</strong></h3><p>Micronaut it’s a fresh air in the Spring world, they keep the annotation paradigm live at the same time that they remove all legacy ‘mess’. The result was a slim approach that handler in a smooth way all concurrency issues. I miss an eventbus as other JVM frameworks have, as Lagom, Akka, Vertx… that decouple the microservice (the business logic) with ‘how to deliver’ this logic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=745571396421" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/micronaut-spring-fresh-air-745571396421">Micronaut, ‘Spring’ fresh air…</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AUDIO SIGNAL PROCESSING APPROACHES ON SOUND RECORDINGS]]></title>
            <link>https://medium.com/bq-engineering/audio-signal-processing-approaches-on-sound-recordings-a536640dd662?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/a536640dd662</guid>
            <category><![CDATA[audio]]></category>
            <dc:creator><![CDATA[Diego Poderoso Novo]]></dc:creator>
            <pubDate>Wed, 22 Aug 2018 06:59:38 GMT</pubDate>
            <atom:updated>2018-09-26T10:40:48.905Z</atom:updated>
            <content:encoded><![CDATA[<p>At BQ we try to improve every time we launch a new product to the market. Camera, battery or performance are very important nowadays, but also audio. And I am not referring only to playback which is so flashy, but also to recording skills.</p><p>We use this recording feature every time we send a voice memo using Whatsapp, audio is recorded in mono, or when we record a video, which is captured in stereo.</p><p>In this article I am going to focus on stereo recording and its signal processing techniques but same key points could be applied also for mono recording.</p><h3><strong>Recording Scenarios</strong></h3><p>We can distinguish between two different recording scenarios depending on Sound Pressure Level (SPL):</p><ul><li>High SPL scenario: recordings during concerts or in nightclubs. These recordings are characterised by high audio level which could cause so much distortion.</li><li>Low SPL scenario: recordings in silence rooms such as libraries. These are characterised by low audio level which have to be amplified causing high noise floor.</li></ul><p>These two scenarios will determine our recording signal processing strategy.</p><h3>Common Recording Tuning</h3><p>Our complete recording processing chain is composed by different modules, each module has a specific role. They are set in a specific order as the following image shows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*pybxrkT7B0pi7MxnnKTawg.png" /><figcaption>Recording tuning chain</figcaption></figure><ul><li>Analog Gain: it could be set to different values (0, 6 ,12, 18 or 24 dB). We have set it to 0dB and applied all the necessary amplification in the digital part which gives you more accuracy.</li><li>Analog to Digital Converter (ADC): one dedicated converter for each mic.</li><li>High Pass Filter (HPF) IIR: used to attenuate low frequency components such as wind. Its cutoff frequency is set to 50Hz.</li><li>Digital Gain: it could be set from -72.5 to 18dB in 0.5dB steps. We have set it to 11dB in order to avoid saturation before the compressor.</li><li>Infinite Impulse Response (IIR) Filter: used to make flat mics frequency response. This is necessary due to some mics have a peak level in high frequencies, so it is used to attenuate it.</li><li>Dynamic Range Control (DRC): used to characterise type of recording we want to achieve.</li></ul><p>For now on, we are going to focus exclusively in DRC which will determine the behaviour in the different scenarios. I am going to explain how this module works, and different types of processing we can do depending on the scenario.</p><h3>Dynamic Range Control</h3><p>This module applies different gains depending on input signal level. It is formed by four parts as you can see in the next image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*bHJvRKc94thpFIjtnJMC0w.png" /><figcaption>DRC sample</figcaption></figure><ul><li>Makeup Gain: it is the total gain applied for middle level signals.</li><li>Compressor: it acts when the signal is too high and needs to be less amplified or even attenuated.</li><li>Noise gate: it acts when the signal is too low, in most cases it is noise, and needs to be less amplified.</li><li>Limiter: it acts only when compressor can’t catch some specific audio sample. It is much more aggressive.</li></ul><p>Once we have explained how a DRC works, we are going to described how to adjust it for three scenarios and the difference between them.</p><h3>BQ Style</h3><p>We are going to start describing main DRC parameters used in our final DRC. We want to achieve following behaviour:</p><ul><li>Makeup gain set to 18dB this will cause enough makeup gain to amplify low and middle levels.</li><li>Soft compression from -34dBFS will avoid saturation in high SPL scenarios. For a 0dBFS level an attenuation of 5dBFS is applied.</li><li>Soft noise gate from -53dBFS will avoid noise amplification in silent scenarios.</li><li>Limiter is set to -4dBFS, and after it amplifies 3dB.</li></ul><h3>Loudness Optimized</h3><p>The main purpose of this processing is to obtain more level so it is perfect for low SPL scenarios. Comparing with processing used changes to apply are:</p><ul><li>Makeup gain set to 24dB, which is the maximum level.</li><li>Harder compression from -34dBFS. For a 0dBFS level same attenuation of 5dBFS is applied.</li><li>Noise gate starts from -63dBFS. This will amplify very low sounds.</li><li>Same limiter.</li></ul><p>These changes will cause more noise presence and more low signal amplification. Also, more saturation in high SPL scenarios will be present due to its harder compressor.</p><h3>Idle Noise &amp; Distortion Optimised</h3><p>The main purpose of this approach is to avoid idle noise and saturation so it is very convenient for high SPL scenarios. Comparing with tuning used changes to apply are:</p><ul><li>Makeup gain set to 8dB.</li><li>Soft compression from -19dBFS. For a 0dBFS level same attenuation of 5dBFS is applied.</li><li>Soft noise gate from -72dBFS with more drop. This will amplify very low sounds and attenuate silent scenarios.</li><li>Same limiter.</li></ul><p>Sacrificing so much level will cause less noise presence and more natural transitions between noise gate and amplification zone. Also, less saturation will be present.</p><p>A comparison between these three DRCs can be seen in the next images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*D_F6oPAaZ36QDf03aJR7NA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*80lE2lCwRQ14ac4O13UnCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*YfxBnXXsTzliPArXDPO__A.png" /><figcaption>DRC Comparison: left one is BQ Style, center is Loudness Optimized and right is Idle Noise &amp; Distortion Optimised</figcaption></figure><h3>Recording Audio Tests</h3><p>In our laboratory we do several tests to analyse and validate the recording performance. These tests are always done in a stable environment within an anechoic chamber. In this article we are going to show three of them and each result of the different approaches so you can get your own conclusions.</p><p>The first one is a woman talking at a very low volume, low SPL scenario. We recommend to use headphones for these listening tests setting volume to a high level.</p><blockquote>Note: all the recordings were done with the smartphones in portrait mode. This is the reason why the right channel has more level than left one.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FWoman-voice-low-volume-BQ-Style-e20v6g&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FWoman-voice-low-volume-BQ-Style-e20v6g&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/3eb27be09f3f2244da6840f418e2d980/href">https://medium.com/media/3eb27be09f3f2244da6840f418e2d980/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FWoman-voice-low-volume-Loudness-Optimised-e20v73&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FWoman-voice-low-volume-Loudness-Optimised-e20v73&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/912184c2cdb48d18a0f5c47fc1fece73/href">https://medium.com/media/912184c2cdb48d18a0f5c47fc1fece73/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FWoman-voice-low-volume-Idle-Noise--Distortion-Optimised-e20v78&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FWoman-voice-low-volume-Idle-Noise--Distortion-Optimised-e20v78&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/afb2028051f6197a798f3a86c27e0264/href">https://medium.com/media/afb2028051f6197a798f3a86c27e0264/href</a></iframe><p>The second and third tests are done with the same song. During the second one, it was played at a middle volume. So we recommend to decrease a little the volume of your headphones.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-middle-volume-BQ-Style-e20v7d&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-middle-volume-BQ-Style-e20v7d&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9065e4f211e57e5dec8b43f57a6164a/href">https://medium.com/media/f9065e4f211e57e5dec8b43f57a6164a/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-middle-volume-Loudness-Optimised-e20v7i&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-middle-volume-Loudness-Optimised-e20v7i&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/85b35279fb02005c6dd93682dc627ec0/href">https://medium.com/media/85b35279fb02005c6dd93682dc627ec0/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-middle-volume-Idle-Noise--Distortion-Optimised-e20v7k&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-middle-volume-Idle-Noise--Distortion-Optimised-e20v7k&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3f2e3872bd652cb82f9cf0ea299a771/href">https://medium.com/media/e3f2e3872bd652cb82f9cf0ea299a771/href</a></iframe><p>In the third one the volume is set to a level similar to a concert scenario, so we recommend to decrease even more the volume of your headphones.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-high-volume-BQ-Style-e20v7r&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-high-volume-BQ-Style-e20v7r&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/861c17eb8d9cc05056bd62b263649d94/href">https://medium.com/media/861c17eb8d9cc05056bd62b263649d94/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-high-volume-Loudness-Optimised-e20vbn&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-high-volume-Loudness-Optimised-e20vbn&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/09a5a9e0b50b336c76460a1371dd896c/href">https://medium.com/media/09a5a9e0b50b336c76460a1371dd896c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fembed%2Fepisodes%2FSong-high-volume-Idle-Noise--Distortion-Optimised-e20v82&amp;url=https%3A%2F%2Fanchor.fm%2Fbq-audio-tests%2Fepisodes%2FSong-high-volume-Idle-Noise--Distortion-Optimised-e20v82&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fanchor-generated-image-bank%2Fproduction%2Fpodcast_uploaded_nologo400%2F848841%2F848841-1534238897564-e93f3b76e8487.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=anchor" width="400" height="102" frameborder="0" scrolling="no"><a href="https://medium.com/media/10b5673b96066ed97e7e940ba3babc6c/href">https://medium.com/media/10b5673b96066ed97e7e940ba3babc6c/href</a></iframe><p>Which is your favourite processing policy? What would you change? We are willing to know your opinion!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a536640dd662" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/audio-signal-processing-approaches-on-sound-recordings-a536640dd662">AUDIO SIGNAL PROCESSING APPROACHES ON SOUND RECORDINGS</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the command pattern to undo our mistakes]]></title>
            <link>https://medium.com/bq-engineering/using-the-command-pattern-to-undo-our-mistakes-68dbaf55609?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/68dbaf55609</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[qt]]></category>
            <category><![CDATA[vtk]]></category>
            <category><![CDATA[command-pattern]]></category>
            <category><![CDATA[qml]]></category>
            <dc:creator><![CDATA[Nicanor Romero Venier]]></dc:creator>
            <pubDate>Mon, 13 Aug 2018 08:30:09 GMT</pubDate>
            <atom:updated>2018-08-13T11:31:38.567Z</atom:updated>
            <content:encoded><![CDATA[<p>In the <a href="https://medium.com/bq-engineering/integrating-qtquickcontrols-2-with-vtk-df54bbb99de3">previous article</a> we described how Qt was integrated with VTK to create a 3D rendering application. In one of the sections we showed how commands were passed from the main thread to the rendering thread. In this new article we will expand said section, describing how to apply the command pattern to this particular case.</p><p>The command pattern is a behavioural design pattern that consists of encapsulating actions within generic objects that will be executed later. This allows us to create different actions from any part of our code and send them to a queue. This queue will then be consumed by an invoker, which has no idea where this command is coming from or what it does. This gives us the advantage of treating all the different actions in the same way, since they will all have the same interface.</p><p>In our case, the client creating the commands will be the QVtkFboItem, the invoker will be the QVtkFboRenderer and the receiver will be the ProcessingEngine in most cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*aHwMfhKhpfOw3yvRqk82ww.png" /><figcaption>Interactions in the command pattern</figcaption></figure><p>Another advantage of using this pattern is the ease of integrating a QUndoStack. This will allow the user to undo/redo all the actions that are applied to the 3D canvas, such as importing a 3D model or translating it. To achieve this, all our command objects will inherit from QUndoCommand.</p><pre>class CommandModel : public QUndoCommand</pre><p>The QUndoCommand provides two virtual methods called <strong>undo() </strong>and <strong>redo()</strong>. Using the first one we will implement the particular action we want executed in the canvas. In the redo method, we will implement the action to revert it.</p><pre>void CommandModelAdd::<em>redo</em>()<br>{<br>    m_vtkFboRenderer-&gt;addModelActor(m_model);<br>}</pre><pre>void CommandModelAdd::<em>undo</em>()<br>{<br>    m_vtkFboRenderer-&gt;deleteModelActor(m_model);<br>}</pre><p>Compared with the code presented in the previous article, here we will add a QUndoStack where the commands will we pushed after being executed. In fact, the QUndoStack runs the redo method automatically when pushing to the stack. Then, when the user undoes an action the command will run the undo method and be popped out of the stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*wy32B-akxrHHdqwUPvHIYQ.gif" /><figcaption>The Queue and the Stack</figcaption></figure><p>In the case of the Translate command we had to implement a small adaptation. Since the translation is done using the mouse, the objects being translated goes through several transformations that give feedback to the user while dragging the model. However, we do not want all these intermediate commands to be added to the stack, just the command after the user releases the mouse button. In order to achieve this we just added a parameter to the translate command objects that differentiate which ones need to be added to the stack and which ones do not.</p><pre>if (command-&gt;<em>addToStack</em>())<br>{<br>    m_undoStack-&gt;push(command);<br>}<br>else<br>{<br>    command-&gt;<em>execute</em>();<br>}</pre><p>Also, since the undo/redo actions need to be executed in the renderer thread, these are also implemented as commands. This way they are executed during the render step, just like all the other commands. Fortunately there is another reason why we want this behaviour. Imagine you are working on a really slow computer executing really demanding actions, a situation where the user can generate commands more quickly than the computer can process them. In this case, if an undo action is submitted we want it to be queued as well so that it reverts the last action from the queue and not the last action executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zIJnSgMIexrWaSiagSRQXw.png" /><figcaption>Undo/Redo buttons implemented in QML</figcaption></figure><p>Another use case where this approach is helpful is when opening a project. A project could consist of several STL files with different instances, different position, rotation angle or scale factor. In this case, all these commands would be created and queued at once to be executed but stacked as a single command. This way, despite having multiple commands, the action of opening a project could be undone with just one click. To achieve this, QUndoStack provides developers with macros.</p><p>To further extend the capabilities of this example application we could add commands to rotate, scale or duplicate models. For now, only the Add, Delete and Translate commands have been implemented. You can find the source code in the following repository:</p><p><a href="https://github.com/nicanor-romero/CommandPattern">nicanor-romero/CommandPattern</a></p><p>The code was compiled using Qt 5.9.3 and VTK 8.1.1, tested both in Windows 10 and Ubuntu 16.04. Bear in mind that in order for this code to work you will need to add the <em>vtkRenderingExternal </em>module when compiling VTK. For more detailed building instructions check the <a href="https://github.com/nicanor-romero/CommandPattern/blob/master/README.md"><em>README</em></a> file found in the repository.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68dbaf55609" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/using-the-command-pattern-to-undo-our-mistakes-68dbaf55609">Using the command pattern to undo our mistakes</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Computing “Yes”, Cloud Computing “No”, Which Cloud?]]></title>
            <link>https://medium.com/bq-engineering/cloud-computing-yes-cloud-computing-no-which-cloud-d0588d935eaa?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/d0588d935eaa</guid>
            <category><![CDATA[public-cloud]]></category>
            <category><![CDATA[private-cloud]]></category>
            <category><![CDATA[hybrid-cloud]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Pablo Jose Gonzalez Granados]]></dc:creator>
            <pubDate>Tue, 07 Aug 2018 20:39:12 GMT</pubDate>
            <atom:updated>2018-08-09T07:52:16.932Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, I am not a blogger, writer or a typist, I am just a software engineer so sorry for my “french” and my style unorthodox. Remember that all that I am going to write here is based on 20% of academic theories and 80% our experience.</p><blockquote>Ignore the “Real World”, learn from your mistakes. Allow that the function makes the organs, I am completely sure that the 80% of the mammal thought the dolphins were crazy, but there they are, alive and kicking.</blockquote><p>On the other hand, remember that <strong>all the technology is volatile</strong>, it is conjunctural almost ephemeral. That today it’s “right” tomorrow could be “wrong”, that’s because we live in an ecosystem that is constantly changing, so something that today is important, tomorrow is not. For example, if quantum computing success all the cryptography that we have developed until now will not make sense anymore. But until that happens, asymmetric keys are “the truth”.</p><p>So, after these random thoughts, that make you think a little, and also allow me to excuse my self in case you bother me or blame me for something that I wrote, let’s move on to the main topic, cloud computing “Yes”, cloud computing “No”, Which Cloud?. I expected to create a dialog with the readers and based on their feedback start a conversation and put more light into the darkness.</p><h3>Cloud computing, formal definition</h3><p>Cloud computing is an information technology (IT) paradigm that enables ubiquitous access to shared pools of configurable system resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a public utility.</p><p>Not bad definition, from Wikipedia. And actually they are right. Cloud computing doesn’t talk about dropping your on-premise data center or delegate your operations to a third party like Amazon or Google. Cloud computing talks about virtualization, talks about share resources between departments, companies and/or people, improving the usage performance and reducing the cost of maintenance and hardware. And all of that only could be done if we guarantee that each workload (virtual machine, container, process) it’s well encapsulated, from security, data integrity, and memory/CPU cycles. And that job could be done by yourself, or delegated to a third party in a public or in a private way.</p><h3>Public / private / hybrid cloud</h3><p>Based on your need or your company policies you will (soon or later) move on to one of this solutions:</p><p><strong>Private Cloud</strong>: A model of cloud computing where IT services are provisioned over private IT infrastructure for the dedicated use of a single organization. A private cloud is usually managed via internal resources. The terms private cloud and virtual private cloud (VPC) are often used interchangeably. So, in other words, if you decided to go through this solution is because you have (or are going to have) your own data center. In order to virtualize your stuff, you will need some virtualization providers as VMware, OpenStack (an open source solution, with open APIs and some free implementations), Softlayer or AzurePack. Also, you will need some technical support in order to install configure and maintain all of this solutions. One of the best partners/consultants in private/hybrid clouds is Rackspace.</p><p><em>OpenStack contributors chart</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hvy4Oj1RHLeMV_vV" /></figure><p><strong>Public Cloud</strong>: computing services offered by third-party providers over the public Internet, making them available to anyone who wants to use or purchase them. They may be free or sold on-demand, allowing customers to pay only per usage for the CPU cycles, storage, or bandwidth they consume. So, in other words, we are not talking about security (this is one of the most commons errors). Indeed I think that most of professionals in the sector will agree that public cloud is more secure than a private cloud in the 99% of the cases. Maybe the key point in order to choose between public or private clouds is your capex budget. If it’s not big enough to invest in hardware, buildings, security, “diesel generator sets”, temperature control… and so on, and you only have a budget to run your current business (opex) from an operational point of view, then the public cloud should be your choice. You will be lucky because there are plenty of choices out of there that will give you an awesome cloud service. The most popular are AWS (amazon web services), Gcloud (Google Cloud Computing) and Azure (Microsft Azure). There are others like Digital Ocean, Heroku or Scaleway. Depends on your needs, some of them will fit better with your organization than others. But this analysis will take me another post.</p><p><strong>Hybrid Cloud</strong>: A hybrid cloud is a computing environment that combines a public cloud and a private cloud by allowing data and applications to be shared between them. When computing and processing demand fluctuates, hybrid cloud computing gives businesses the ability to seamlessly scale their on-premises infrastructure up to the public cloud to handle any overflow — without giving third-party datacenters access to the entirety of their data. Organizations gain the flexibility and computing power of the public cloud for basic and non-sensitive computing tasks while keeping business-critical applications and data on-premises, safely behind a company firewall. So in other words, if you have your own data center, but you don’t have capex in your budget in order to make it bigger, one great solution could be cover this extra demand with public cloud. Companies will pay only for resources they temporarily use instead of having to purchase, program or buy hardware that have to maintain for a long-term.</p><p>As you can see there is plenty of choice according to your needs. But they are not all the same. Some providers are more focused on infrastructure, others are more abstract and are more focused on application services, while others remain in the middle. Indeed, there are three layers of services (Iaas, Paas, Saas) in the industry that you should know, in order to understand what each provider is selling you.</p><h3>Iaas Vs Paas Vs Saas</h3><p><strong>Iaas (Infrastructure as a service)</strong>: refers to online services that provide high-level APIs used to dereference various low-level details of underlying network infrastructure like physical computing resources, location, data partitioning, scaling, security, backup, etc. So in other words, Infrastructure as a service will give you a high level of control with a low level of abstraction. Your solutions should be based on this kind of services when the core of your business is to make the most of the hardware at different levels (Network, storage, compute …). There are plenty of choices here, as AWS (EC2, EBS, ELB, VPCs …), GCloud (VMinstances, Disk, LB, VPCs … ), Joyent, SoftLayer, Azure… etc.</p><p><strong>Paas (Platform as a service)</strong>: The capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created or acquired applications created using programming languages, libraries, services, and tools supported by the provider. The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, or storage, but has control over the deployed applications and possibly configuration settings for the application-hosting environment. In other words: it provides balance between control and abstraction. When the core of your business is at the application level but you need to customize them, test them, in the end, build competitive applications at low cost (when what you need is a framework) then, this is your best choice. Examples of good Paas are Kubernetes, Firebase, Kuasars (private Paas developed by PyroStudios), Tongari (private Paas developed by BQ that allow you secure, monitor and order (service mesh), Kubernetes microservices ), Parse.com (deprecated by Facebook in an epic fail movement), etc.</p><p><strong>Saas (Software as a service)</strong>: The capability provided to the consumer is to use the provider’s applications running on a cloud infrastructure. The applications are accessible from various client devices through either a thin client interface, such as a web browser (e.g., web-based email), or a program interface. The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings. So in other words, minimum control, maximum abstraction. When the core of your business is at the application level and does not require special customization then this is your choice. As an example of good Saas could be Google Docs, Medium.com, Aws S3, Google BigQuery … etc</p><h3>Conclusions</h3><p>In this article, we dive into the most basic but core concepts of the cloud. The eternal debate, between cloud Yes or Cloud No, it has already concluded, and now the question should be Which Cloud. Unfortunately, there is not a clear answer to this question: that will depend on your need, but we saw that if you don’t have capex, then you must go for the public cloud. Finally, we saw that all Internet services could be classified into three classes, and again depends on your needs maybe one cloud provider could fit better with your requirements than others. In any case, remember what we said at the begging of the article: “Ignore the Real World, learn from your mistakes”, or…in other words “the movement is shown walking” so move on! Understand your problems and find your way.</p><p><em>Sources</em></p><p><a href="https://en.wikipedia.org/wiki/Cloud_computing"><em>https://en.wikipedia.org/wiki/Cloud_computing</em></a></p><p><a href="https://www.techopedia.com/definition/13677/private-cloud"><em>https://www.techopedia.com/definition/13677/private-cloud</em></a></p><p><a href="https://www.rackspace.com/"><em>https://www.rackspace.com/</em></a></p><p><a href="http://stackalytics.com/"><em>http://stackalytics.com/</em></a></p><p><a href="https://azure.microsoft.com/en-us/overview/what-is-a-public-cloud/"><em>https://azure.microsoft.com/en-us/overview/what-is-a-public-cloud/</em></a></p><p><a href="https://azure.microsoft.com/en-us/overview/what-is-hybrid-cloud-computing/"><em>https://azure.microsoft.com/en-us/overview/what-is-hybrid-cloud-computing/</em></a></p><p><em>https://en.wikipedia.org/wiki/Cloud_computing#Infrastructure_as_a_service_(IaaS)</em></p><p><em>https://en.wikipedia.org/wiki/Cloud_computing#Platform_as_a_service_(PaaS)</em></p><p><a href="https://basecamp.com/books/rework">https://basecamp.com/books/rework</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0588d935eaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/cloud-computing-yes-cloud-computing-no-which-cloud-d0588d935eaa">Cloud Computing “Yes”, Cloud Computing “No”, Which Cloud?</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adapting your apps to Android Oreo]]></title>
            <link>https://medium.com/bq-engineering/adapting-your-apps-to-android-oreo-56055fbfbeef?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/56055fbfbeef</guid>
            <category><![CDATA[android-o]]></category>
            <category><![CDATA[android-oreo]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Adrián García]]></dc:creator>
            <pubDate>Fri, 27 Jul 2018 07:21:33 GMT</pubDate>
            <atom:updated>2018-07-27T07:21:32.677Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQGW3u9EwZMKV62Qu_kAAg.jpeg" /></figure><p>As you may already know, <a href="https://blog.bq.com/es/todas-las-novedades-android-8-0-oreo/">we plan to update some of our latest devices to Android Oreo</a>. As a result of this upgrade, we’ve had to update our apps to target this new Android version in order to take advantage of the new features provided by the OS, as well as adjust some of our applications’ behaviour to comply with the new specifications defined by Google.</p><p>In this article we want to focus on the major changes included in Android Oreo and on our experience in implementing these in our apps in order to make them compatible.</p><h3>Adaptive icons</h3><p>One of the biggest UI changes in Android Oreo is the inclusion of adaptive launcher icons. In summary, adaptive icons allow developers and designers to create application icons that can be morphed using masks defined by the device’s launcher app, like our BQ Launcher. This allows launcher apps to normalise icon shapes and provide a more visually appealing experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*AOxrSd1ZsZjAp2pPJziddg.gif" /><figcaption>Adaptive icons composition, source: <a href="https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html">https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html</a></figcaption></figure><p>To do this, we have to split our application icon into two separate layers:</p><ul><li>A background layer: a solid colour, a gradient…</li><li>A foreground layer: typically contains the application’s main icon, which can be a raster image or a VectorDrawable.</li></ul><p>Using these two layers, launchers apply a mask over them to display the final icon with a defined shape (circles, squares or more complex shapes, like squircles or teardrops). This also allows compatible launcher apps to animate both layers with different effects such as parallax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MDfOg3SLPbAXdm-o" /><figcaption>Example of adaptive icon using our <a href="https://play.google.com/store/apps/details?id=com.bq.camerabq">Camera</a> app icon</figcaption></figure><p>We didn’t experience much trouble implementing the new icon format in our apps, especially since we already use VectorDrawables and drawables with layers in our applications to reduce their size (and to save our designers some headaches along the way :) ). It should be relatively simple to reuse your existing launcher icons and adapt them to this new scheme.</p><h3>Notification channels</h3><p>Starting in Android Oreo, notification channels have been added to allow fine-grained control over how and when certain notifications should be displayed to the user. This also lets users manage which notifications they want to receive as well as how they want them to be displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*8zmQq7Q3_BcmMDB5-0zDCw.png" /><figcaption>Google has already implemented notification channels for their apps, one example is Google Chrome</figcaption></figure><p>The process of creating and using a notification channel is quite simple:</p><ul><li>Create a <em>NotificationChannel</em> with a unique ID and initial display settings: description, importance, sound, vibration, lights, privacy settings…</li><li>Provide this <em>NotificationChannel</em> to the <em>NotificationManager</em> via <em>NotificationManager.createNotificationChannel()</em>.</li><li>Build your Notification the usual way (for example, we use <em>NotificationCompat</em> to support older Android versions).</li><li>Publish your <em>Notification</em> using the <em>NotificationManager</em> and your notification channel ID.</li></ul><p>Keep in mind that it’s mandatory to implement at least one notification channel if your app targets Android Oreo. This is really important because when we first tested targeting Android Oreo, our notifications weren’t displayed at all!</p><h3>Alert windows and overlays changes</h3><p>In order to fortify the OS security measures, some functionality and behaviour changes have been made to avoid Android APIs being used with malicious intentions. One of these changes involves the use of alert windows and draw overlays.</p><p>The “alert windows” feature is a way to display views over other applications. Two of the most famous uses of this feature are the chat heads used in the <a href="https://play.google.com/store/apps/details?id=com.facebook.orca">Facebook Messenger</a> app, which let users quickly see incoming messages and start conversations with their friends, and the “Tap to translate” feature in <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.translate">Google Translate</a>, that lets users translate texts with a few taps without having to open the app.<br>This feature is not to be confused with the new <a href="https://developer.android.com/about/versions/oreo/android-8.0.html#opip">Picture-In-Picture mode</a> also added to Android Oreo, which focuses on video playback over other apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*d_4C6VEDU_Modzjy9mYl2Q.png" /><figcaption>Google Translate shows an overlay icon over other apps (such as Chrome) when using “Tap to translate”</figcaption></figure><p>One of the advantages of using this feature up to Android Oreo was that we could draw over any interface element, including the notification bar, to enhance user experience. This was used by apps such as <a href="https://play.google.com/store/apps/details?id=com.urbandroid.lux">Twilight</a> or <a href="https://play.google.com/store/apps/details?id=com.james.status">Status</a> to add new functionality on top of the current system capabilities. However, apps that now use these kinds of overlays and target Android Oreo must use a specific Window type (<em>TYPE_APPLICATION_OVERLAY</em>) that breaks drawing over system UI elements or the keyboard, for example. Furthermore, existing apps that use alert windows in Android Oreo (even without explicitly targeting it) won’t be able to draw over system UI elements either.</p><p>Keep this in mind if you want to target Android Oreo in your applications that have this kind of functionality because these changes may affect their behaviour, or even cause them to malfunction.</p><h3>File Uris and permission changes</h3><p>A new restriction was added starting from Android Nougat prevented developers from exposing <em>file://</em> Uris in given contexts, giving a <em>FileUriExposedException</em> reminding us that we can’t use <em>file://</em> Uris and that we should use <em>content://</em> Uris with the correct permissions for other apps to use them.</p><p>In Android Oreo these restrictions seem to be more severe, causing us some trouble with sharing files that are stored in an app’s private storage (for example, when users send internal app logs via email for us to analyse).</p><p>To resolve this issue, we had to implement a <em>FileProvider</em> to expose our private files using a <em>content://</em> Uri, and then generate our Uris with <em>FileProvider.getUriForFile()</em> to get Uris that external applications can read by adjusting the permissions granted to them.</p><h3>Final thoughts</h3><p>Adapting current applications to newer Android versions can be somewhat daunting, especially when major changes are introduced, however, in doing so, full advantage can be taken of the new features included in these versions, and users will be sure to get the best experience possible when using our devices. Many other changes have been introduced in Android Oreo that haven’t been covered in this post (beware <a href="https://developer.android.com/about/versions/oreo/background.html">background execution limits</a>, among others), however, these key points will give you a good idea on where to start should you decide to prepare your apps to target Android Oreo.</p><h3>References</h3><ul><li>Android 8.0 Behaviour changes: <a href="https://developer.android.com/about/versions/oreo/android-8.0-changes.html">https://developer.android.com/about/versions/oreo/android-8.0-changes.html</a></li><li>Adaptive icons design guidelines: <a href="https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html">https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html</a></li><li>How to manage notification channels: <a href="https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels">https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels</a></li><li>Android 8.0 Behaviour changes in alert windows: <a href="https://developer.android.com/about/versions/oreo/android-8.0-changes.html#all-aw">https://developer.android.com/about/versions/oreo/android-8.0-changes.html#all-aw</a></li><li>Android 7.0 Behaviour changes in Uri permissions: <a href="https://developer.android.com/about/versions/nougat/android-7.0-changes.html#perm">https://developer.android.com/about/versions/nougat/android-7.0-changes.html#perm</a></li></ul><p><em>Portions of this page are reproduced from work created and </em><a href="http://code.google.com/policies.html"><em>shared by the Android Open Source Project</em></a><em> and used according to terms described in the </em><a href="http://creativecommons.org/licenses/by/2.5/"><em>Creative Commons 2.5 Attribution License</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56055fbfbeef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/adapting-your-apps-to-android-oreo-56055fbfbeef">Adapting your apps to Android Oreo</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backhaul]]></title>
            <link>https://medium.com/bq-engineering/backhaul-4c933de56d6?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/4c933de56d6</guid>
            <category><![CDATA[wireless-router]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[wi-fi-network]]></category>
            <category><![CDATA[wireless-mesh-network]]></category>
            <dc:creator><![CDATA[Mario Bodega Prieto]]></dc:creator>
            <pubDate>Tue, 24 Jul 2018 09:48:11 GMT</pubDate>
            <atom:updated>2018-07-24T10:02:43.068Z</atom:updated>
            <content:encoded><![CDATA[<p>Purely speaking, the meaning of Backhaul word in telecommunications environment is concerned with transporting traffic between distributed sites (typically access points) and more centralized points of presence, in other words, can be defined as the part of a telecommunications networks responsible of establish and manage the connections between a main system with other smaller subnetworks or subsystems.</p><p>Applying this concept into a WIFI Mesh ecosystem, Backhaul is the communication way between the Main node and the remaining nodes attached in a mesh network. How good or bad is a WiFi Mesh is totally dependent with the Backhaul efficiency and the Backhaul technology choosed for communicating one node with each, so this concept shouldn’t be overlooked when choosing a mesh system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*TsYUqlb5IglN9_aw8CAbhA.png" /><figcaption>Typical mesh network structure</figcaption></figure><h4>Backhaul options?</h4><p>Once we know the concept meaning, it is time to talk about the different backhaul systems. Depending on the backhaul transmission mode used we can classify the backhaul systems as follows:</p><ul><li><strong>Wired:</strong> Backhaul connection is based on a cable between each node. The wire uses Gb Ethernet ports in the far ends and it&#39;s able to manage up to 1Gbps Bandwidth. This connection transit independent of the WIFI clients resources so clearly provides a good way to communicate the Mesh nodes between each other as the WiFi interfaces are 100% reserved for users/clients.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*kXv8oFMqavEmSTbLCiJTvw.png" /><figcaption>Ethernet Backhaul</figcaption></figure><ul><li><strong>Wireless</strong>: Backhaul connection is based on a Wi-Fi link between each node. The backhaul can travel in Wi-Fi 2,4Ghz or Wi-Fi 5Ghz radio bands. We can find two potential configurations for Wireless Backhaul:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*VdlUFIRUlc2D7Flte7Fp3A.png" /><figcaption>Wi-Fi Backhaul</figcaption></figure><ul><li><strong>1) Wi-Fi Shared</strong>: The backhaul connections share the front-end resources with the clients attached to the mesh network. It allows saving space in the WiFi devices (they do not have a specific radio resources for Backhauling) but the whole WIFI performance is shared between real clients and the nodes, so that, lower final users performance would be expected. This solution was adopted by Google Wi-Fi and this kind of devices are commonly called as “Dual-Band”.</li><li><strong>2) Dedicated Wi-Fi </strong>: The backhaul connection takes place in a specific radio link interface, used exclusively to communicate any node with any other. It requires more hardware resources (i.e. Power amplifiers, Front-ends, radio filters, Wi-Fi antennas) but provides a clear and efficient communication solution, where the clients (real users) are attached in a different network (entirely used for clients) than the Wi-Fi nodes communication link, so better global performance is expected for users and also for Backhaul. Finally, it is important to highlight than in this case, the dedicated backhaul uses Wi-Fi 5Ghz radio band due to the high link speed capacity that this band is able provide. This is the solution used in Asus Lyra, Linksys Velop, Netgear Orbi and it is commonly called “Tri-Band” since there is two radio bands dedicated for Users and other additional band, the third, dedicated for Backhauling.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnCRLkNoFlQWWlMJ_WS7YQ.jpeg" /><figcaption>Wi-Fi Backhaul dedicated radio band</figcaption></figure><p>Now it is time to discuss about the capacity for each solution. Normally speaking, the Wi-Fi solutions come with a capacity code indicator such as AC2200 or AC3000. This code mention the highest protocol supported (in this case Wi-Fi 802.11ac) and the radio links capacity (adding 2,4Ghz and 5Ghz radio bands). To an easy understanding, let&#39;s go with a sample:</p><p><strong>AC3000</strong></p><ul><li>Best protocol supported is 802.11ac.</li><li>Wi-Fi 2,4 capacity: 200 Mbps per antenna x 2 Antennas: 400 Mbps</li><li>Wi-Fi 5 capacity: 433 Mbps per antenna x 6 Antennas: 2598 Mbps</li><li>Total: 400+2598 = 2998 ~3000 Mbps</li></ul><p>So we can now evaluate the numbers and general Wi-Fi device capacity but we also already know than depending on the Backhaul technology used, not 100% of the capacity is used for clients. In general terms, we can find in the market two Wi-Fi mesh solutions as I mentioned:</p><ul><li>Dual Band: Generally comes with a 2x2 Wi-Fi 2,4Ghz + 2x2 Wi-Fi 5Ghz in each node, so the total capacity is AC1200. As we saw above, dual band does not have a dedicated backhaul so that the 1200Mbps of Bandwidth manageable by the system is shared between Clients and Network nodes.</li><li>Tri Band: We can find AC2200 or AC3000 versions depending on the antennas configuration. For AC2200, we have 2x2 Wi-Fi 2,4Ghz + 2x2 Wi-Fi 5Ghz subsystem dedicated for clients (1200Mhz) and 2x2 Wi-Fi 5Ghz dedicated exclusively for backhaul. In AC3000, the most common configuration is 2x2 Wi-Fi 2,4Ghz + 2x2 Wi-Fi 5Ghz subsystem dedicated for clients (1200Mhz) and 4x4 Wi-Fi 5Ghz dedicated exclusively for backhaul.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*hBvE1OrG3OmBPSPn2KOQsg.png" /><figcaption>Typical Tri Band set up, AC2200 (On top) and AC3000 (at the bottom)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c933de56d6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/backhaul-4c933de56d6">Backhaul</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signal Amplification on Smartphone´s Audio — Part I]]></title>
            <link>https://medium.com/bq-engineering/signal-amplification-on-smartphone-s-audio-part-i-d65f7f4f913e?source=rss----eebf05664821---4</link>
            <guid isPermaLink="false">https://medium.com/p/d65f7f4f913e</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[amplifier]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[audio]]></category>
            <dc:creator><![CDATA[Luis Gomez]]></dc:creator>
            <pubDate>Tue, 17 Jul 2018 12:45:57 GMT</pubDate>
            <atom:updated>2018-07-17T12:45:57.388Z</atom:updated>
            <content:encoded><![CDATA[<p>Maximizing the speaker acoustic capabilities on smartphones has been for years one of the main development concerns. Recently, it has been fond out that the amplification is the key for a huge improvement.</p><p>Firstly, we will do an overview of the basic principles of the amplifiers before going into detail in the state of the art on audio amplifiers in smartphones industry.</p><p><strong>What is an amplifier?</strong></p><p>Amplifier´s target is increasing the signal level to adequate it to the next system in the signal path with the lowest signal perturbation. In the picture below we can see a very simple block diagram of an amplifier. Amplifiers replicate the input signal at a greater level. Most of amplifiers need a power supply as “raw material” source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/0*-H85ZJa5iG5yyN2l" /></figure><p><strong>Types of amplifiers</strong></p><p>There are many different types of amplifiers based on different parameters such as its input (signal nature, level, bandwidth, frequency,…), output, efficiency, quality and system limitations (size, cost, thermal performance , interferences shielding…). We can cover some of the most interesting amplifiers attending to the input signal nature:</p><ul><li>Acoustic amplifiers are very interesting since they can work without a power source. Acoustic signal reverberations within a cavity can amplify the original (input) signal. This is the physical phenomenon behind the speaker baffles.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/152/0*sIXZ6G7g37nL9Qux" /></figure><ul><li>Electric amplifiers work with electric signals, and require an external power supply as source to output the increased signal. These are the most common amplifiers, and can be used for many different applications such as radio and audio (which will be our case of study).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*66Sw8hrI3DNBr3Kf" /></figure><p><strong>Which parameters describe an amplifier?</strong></p><ul><li>Input signal: Physical nature, level, spectrum</li></ul><p>The physical nature of the signal describes which kind of input we have in the amplifier, it can be an optic, acoustic or electric signal among others.</p><p>Two of the most relevant parameters of an input signal are the amplitude and frequency. We can observe both either in the time domain or in the frequency domain. Time let us understand how the signal changes in time while frequency shows signal´s spectral content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*bZyWwA2e4UmxdeWs" /></figure><ul><li>Power Supply: level, noise, stability.</li></ul><p>Raw material quality is essential in amplifying the input signal; <em>we can’t construct a building if we lack a big amount of stable and pure concrete.</em></p><p>Boost level, is the maximum level the power supply can deliver. This level will obviously limit the maximum output level.</p><p>Power supply must be kept clean, with no interferences or instabilities, as every defect this signal has will be present in the output signal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*pN8aDR7JlnNtcJB5" /></figure><ul><li>Output: level, gain, load.</li></ul><p>The output level will be defined by the gain set to the amplifier (as long as our boost voltage is high enough). The gain defines how many times bigger the output signal will be. Depending on which is the next system in the signal path (called load), our amplifier can be capable or not of supplying the output signal to it.</p><ul><li>Efficiency</li></ul><p>Defines how efficient the amplifier is in terms of power. Which amount of the total used power is delivered in the output? Depending on the application, this parameter can be extremely relevant, or not.</p><p><strong>Amplifier Quality</strong></p><p>We already got the output signal! It is time to check how well it was amplified. These parameters describe the amplifier quality.</p><ul><li>Frequency Response (FR): Defines how constant the gain is across the different frequencies which compound the input signal, and which is the amplifier working bandwidth.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*tdr2H2Q3vq-DybD4" /></figure><ul><li>Total Harmonic Distortion (THD): Distortion refers to “added” content in frequencies not present in the input. Harmonic signal is a type of distortion which appears on the harmonics of the original signal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*9B3kPtpm757Op429" /></figure><ul><li>Transient response: Besides spectral analysis, there are several time-dependent quality indicators, which define how the amplifier behaves in rapid signal changes. Slew Rate is the most common way of describing how fast the signal level can increase/decrease in the output.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*KeTKXKr5TKMNDW5b" /></figure><p>Now that we have already explained amplifiers a bit, we can face a deeper analysis about which peculiarities audio amplifiers have, their types, which is the state of the art on smartphone´s industry and nowadays leading technology.</p><p>Hope you can all read the second part of the article soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d65f7f4f913e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bq-engineering/signal-amplification-on-smartphone-s-audio-part-i-d65f7f4f913e">Signal Amplification on Smartphone´s Audio — Part I</a> was originally published in <a href="https://medium.com/bq-engineering">BQ Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>