<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Matias Di Bernardo</title><link>https://dibernardo.netlify.app/</link><description>Recent content on Matias Di Bernardo</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>Matías Di Bernardo</copyright><lastBuildDate>Thu, 26 Jun 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://dibernardo.netlify.app/index.xml" rel="self" type="application/rss+xml"/><item><title>Acoustic modal response optimization for small rooms with genetic algorithms</title><link>https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/</link><pubDate>Thu, 26 Jun 2025 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/port3.PNG" alt="Featured image of post Acoustic modal response optimization for small rooms with genetic algorithms" />&lt;p>This work was developed in the context of the course &lt;em>Instruments and Acoustic Measurements&lt;/em> at UNTREF Argentina.&lt;/p>
&lt;h3 id="introduction">&lt;strong>Introduction&lt;/strong>
&lt;/h3>&lt;p>Control rooms and critical listening environments often suffer from uneven low-frequency acoustic responses. These irregularities, caused by a clustered distribution of vibrational modes, produce “colorations” that hamper accurate sound evaluation. Traditionally, criteria such as those by Bonello, Bolt and Louden have been used to optimize the geometry of rectangular rooms and improve modal distribution. However, these methodologies do not consider the influence of complex boundaries nor the positions of source and listener.&lt;/p>
&lt;p>This work presents an open-source tool developed in &lt;strong>Python/FEniCS&lt;/strong> that addresses these limitations. The software uses geometric optimization by brute force over finite element models (FEM) to find room dimensions and contours that provide a more uniform modal distribution.&lt;/p>
&lt;h3 id="theoretical-framework-and-classical-criteria">&lt;strong>Theoretical Framework and Classical Criteria&lt;/strong>
&lt;/h3>&lt;p>Low-frequency behavior in an enclosure is dominated by standing waves, or normal modes, which are characterized by pressure nodes and antinodes. Axial, tangential and oblique modes — whose frequencies depend on the room dimensions — can produce coloration problems when they cluster.&lt;/p>
&lt;p>Classical design criteria, such as those of &lt;strong>Bolt&lt;/strong>, &lt;strong>Bonello&lt;/strong> and &lt;strong>Louden&lt;/strong>, focus on avoiding modal clustering and propose optimal geometric ratios for rectangular rooms. However, these approaches have a major limitation: they do not consider crucial factors such as the position of the sound source and the receiver, and they are restricted to simple geometries.&lt;/p>
&lt;h3 id="methodology-and-software-development">&lt;strong>Methodology and Software Development&lt;/strong>
&lt;/h3>&lt;p>The developed tool combines a two-stage optimization process.&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Initial Search:&lt;/strong> First, the software performs a rapid search on rectangular parallelepipeds using the classical modal superposition (MS) method to identify the most promising initial geometric proportions.&lt;/li>
&lt;li>&lt;strong>Refinement and Optimization:&lt;/strong> Then, it refines the search by generating random planar contours with enforced symmetry and applies the &lt;strong>Frequency-Domain Finite Element Method (FD-FEM)&lt;/strong> to evaluate the acoustic merit of complex geometries. This method is more accurate than modal superposition for non-rectangular geometries.&lt;/li>
&lt;/ol>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/geom.PNG"
width="663"
height="353"
srcset="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/geom_hu10103050829635732771.PNG 480w, https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/geom_hu14036568945277152459.PNG 1024w"
loading="lazy"
alt="Geometry generator showing a valid geometry (left) and an INVALID one (right)"
class="gallery-image"
data-flex-grow="187"
data-flex-basis="450px"
>&lt;/p>
&lt;p>To quantify acoustic performance, a combined figure of merit is used: the &lt;strong>Mean Sound Field Deviation (MSFD)&lt;/strong>. This metric integrates two key parameters:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Magnitude Deviation (MD):&lt;/strong> Measures how flat the frequency response is at a specific position.&lt;/li>
&lt;li>&lt;strong>Spatial Deviation (SD):&lt;/strong> Measures the variation of magnitude across the listening area.&lt;/li>
&lt;/ul>
&lt;p>The tool includes a graphical user interface (GUI) in &lt;strong>PyQt5&lt;/strong> that allows the user to define dimensions, margins, and source/receiver positions, and to visualize results and optimized geometries.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/gui.PNG"
width="927"
height="911"
srcset="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/gui_hu10660350233230319476.PNG 480w, https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/gui_hu7665759294953434962.PNG 1024w"
loading="lazy"
alt="Screenshot of the program GUI"
class="gallery-image"
data-flex-grow="101"
data-flex-basis="244px"
>&lt;/p>
&lt;h3 id="results-and-conclusions">&lt;strong>Results and Conclusions&lt;/strong>
&lt;/h3>&lt;p>Case studies on three reference control-room volumes showed &lt;strong>MSFD improvements of up to 5 dB&lt;/strong> compared to the baseline design. The results demonstrate that:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Impact of Margins:&lt;/strong> As the available design space for optimization increases, better results are obtained, improving the overall response by up to 3 dB. This improvement is observed mainly in the Magnitude Deviation (MD).&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/margenes.PNG"
width="769"
height="521"
srcset="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/margenes_hu7235455855802676823.PNG 480w, https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/margenes_hu1596749676858920027.PNG 1024w"
loading="lazy"
alt="Optimization result varying the margins"
class="gallery-image"
data-flex-grow="147"
data-flex-basis="354px"
>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Complex Geometries:&lt;/strong> Increasing the number of walls in a complex geometry produces solutions superior to simple rectangular parallelepipeds, with a mean difference of 1.3 dB in the merit factor. The optimization process does not yield a single solution but a variety of geometries that present a minimum MSFD.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/complex.PNG"
width="1056"
height="484"
srcset="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/complex_hu17276317947581166062.PNG 480w, https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/complex_hu260113823065011408.PNG 1024w"
loading="lazy"
alt="Optimization result varying the number of walls to generate"
class="gallery-image"
data-flex-grow="218"
data-flex-basis="523px"
>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Comparison with Traditional Criteria:&lt;/strong> A complex optimized geometry outperformed rooms dimensioned according to classic criteria by Bolt, Louden and Cox. Although these criteria are effective and computationally free, the software’s ability to model complex geometries and consider the locations of sources and receivers provides a superior condition.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/compare.PNG"
width="882"
height="437"
srcset="https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/compare_hu6871012066806431324.PNG 480w, https://dibernardo.netlify.app/p/acoustic-modal-response-optimization-for-small-rooms-with-genetic-algorithms/compare_hu17032096468667991809.PNG 1024w"
loading="lazy"
alt="Comparison between classical literature results and our optimizers solution"
class="gallery-image"
data-flex-grow="201"
data-flex-basis="484px"
>&lt;/p>
&lt;p>The study concludes that the software is an effective tool for modal acoustic optimization. Future improvements are suggested, such as implementing more advanced optimization algorithms — for example, genetic algorithms — to reduce computation time and increase process efficiency.&lt;/p>
&lt;p>A detailed analysis of the development of this algorithm is available in the following &lt;a class="link" href="https://drive.google.com/file/d/1bFloyBC-lmMt_NCkeMwyjXit8-o1ZzsZ/view?usp=sharing" target="_blank" rel="noopener"
>paper&lt;/a>.&lt;/p></description></item><item><title>Acoustic measurement at Usina del Arte</title><link>https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/</link><pubDate>Fri, 09 May 2025 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/portadix.jpg" alt="Featured image of post Acoustic measurement at Usina del Arte" />&lt;h3 id="introduction">&lt;strong>Introduction&lt;/strong>
&lt;/h3>&lt;p>This measurement was part of the course &lt;em>Instruments and Acoustic Measurements&lt;/em> of the Sound Engineering program at UNTREF. The &lt;strong>acoustic parameters&lt;/strong> obtained from the impulse response are essential to evaluate the behavior of an enclosure. This report presents a comprehensive characterization of the main auditorium of the &lt;strong>Usina del Arte&lt;/strong>, a cultural center in Buenos Aires. The building, originally a 20th-century power plant with a distinctive Florentine-industrial style, was transformed with an acoustic design that sought a natural and balanced quality without the need for amplification. A decoupled structure (&lt;strong>box-in-box&lt;/strong>) was implemented for isolation and interior treatment with materials such as guatambú wood, diffusive surfaces, and a suspended acoustic reflector. The objective was a reverberation time of approximately &lt;strong>2 seconds&lt;/strong> and an even distribution of early lateral reflections for an enveloping sensation.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/vista_ext.PNG"
width="1134"
height="630"
srcset="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/vista_ext_hu376550853728715864.PNG 480w, https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/vista_ext_hu11205598148463235636.PNG 1024w"
loading="lazy"
alt="Exterior view of the Usina del Arte complex"
class="gallery-image"
data-flex-grow="180"
data-flex-basis="432px"
>&lt;/p>
&lt;h3 id="measurement">&lt;strong>Measurement&lt;/strong>
&lt;/h3>&lt;p>The characterization was carried out on June 9, 2025, during which a total of &lt;strong>162 impulse responses&lt;/strong> (monaural and binaural) were recorded. Data were captured from 27 microphone positions and 3 source positions. An on-site survey of the auditorium was also performed to analyze its constructional characteristics and a perceptual analysis was conducted.&lt;/p>
&lt;p>Prior to the measurements, a room model was created in &lt;strong>EASE 4.3&lt;/strong>, which estimated a volume of &lt;strong>15,700 m³&lt;/strong> and a Schroeder frequency of &lt;strong>22.1 Hz&lt;/strong>. Background noise was measured at eight positions to evaluate the isolation, confirming a signal-to-noise ratio greater than 40 dB. The microphone arrangement was based on the room’s symmetry to obtain a detailed mapping.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/mapeo_puntos.PNG"
width="946"
height="876"
srcset="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/mapeo_puntos_hu16757661932159290668.PNG 480w, https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/mapeo_puntos_hu16618579752656839347.PNG 1024w"
loading="lazy"
alt="Source and microphone positions (separated according to microphone type)"
class="gallery-image"
data-flex-grow="107"
data-flex-basis="259px"
>&lt;/p>
&lt;p>More images from the measurement process:&lt;/p>
&lt;div id="carousel0" class="carousel" duration="70000">
&lt;ul>
&lt;li id="c0_slide1" style="min-width: calc(100%/1); padding-bottom: 900px;">&lt;img src="https://dibernardo.netlify.app/images/usina/med1.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide2" style="min-width: calc(100%/1); padding-bottom: 900px;">&lt;img src="https://dibernardo.netlify.app/images/usina/med2.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide3" style="min-width: calc(100%/1); padding-bottom: 900px;">&lt;img src="https://dibernardo.netlify.app/images/usina/med3.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide4" style="min-width: calc(100%/1); padding-bottom: 900px;">&lt;img src="https://dibernardo.netlify.app/images/usina/med4.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>&lt;a href="#c0_slide1">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide2">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide3">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide4">&lt;/a>&lt;/li>
&lt;/ol>
&lt;div class="prev">&amp;lsaquo;&lt;/div>
&lt;div class="next">&amp;rsaquo;&lt;/div>
&lt;/div>
&lt;h3 id="processing">&lt;strong>Processing&lt;/strong>
&lt;/h3>&lt;p>Recordings were processed to obtain the impulse responses and various parameters were calculated following the &lt;strong>ISO 3382-1&lt;/strong> standard:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Reverberation time:&lt;/strong> $T_{20}$, $T_{30}$ and EDT.&lt;/li>
&lt;li>&lt;strong>Clarity:&lt;/strong> $C_{50}$ and $C_{80}$.&lt;/li>
&lt;li>&lt;strong>Strength (G):&lt;/strong> Difference in sound pressure level between the hall and an anechoic reference condition.&lt;/li>
&lt;li>&lt;strong>Lateral Fraction (LF):&lt;/strong> Proportion of sound energy perceived from the laterals.&lt;/li>
&lt;li>&lt;strong>Direct/reverberant ratio (D/R).&lt;/strong>&lt;/li>
&lt;li>&lt;strong>Intelligibility:&lt;/strong> The &lt;strong>Speech Transmission Index (STI)&lt;/strong> and the Articulation Loss of Consonants (%Alcons) were calculated.&lt;/li>
&lt;li>&lt;strong>Stage support:&lt;/strong> $ST_{Early}$ and $ST_{Late}$, to assess acoustic conditions for musicians.&lt;/li>
&lt;/ul>
&lt;p>Various commercial software tools were used, such as the Aurora Acoustical Parameters plugin and the EASERA software, and additional parameters were computed with specific Python scripts.&lt;/p>
&lt;h3 id="results">&lt;strong>Results&lt;/strong>
&lt;/h3>&lt;p>The results show that the auditorium behaves adequately for a concert hall, but with areas for improvement:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Reverberation time:&lt;/strong> The global average was &lt;strong>1.92 s&lt;/strong>. However, notable variations were observed at low frequencies, where the floating stage acts as a resonator.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/rtres.PNG"
width="786"
height="509"
srcset="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/rtres_hu93740916745270815.PNG 480w, https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/rtres_hu4110432717716336813.PNG 1024w"
loading="lazy"
alt="T30 and EDT results by frequency."
class="gallery-image"
data-flex-grow="154"
data-flex-basis="370px"
>&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Clarity and Intelligibility:&lt;/strong> Clarity values for speech are below recommended thresholds, and intelligibility issues were identified in certain zones.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Sound Strength (G):&lt;/strong> The sound strength level shows a low variation considering the auditorium’s dimensions.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/Gfactor.PNG"
width="776"
height="597"
srcset="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/Gfactor_hu12495539726591375420.PNG 480w, https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/Gfactor_hu210762990484597037.PNG 1024w"
loading="lazy"
alt="Mapping of the G value in space."
class="gallery-image"
data-flex-grow="129"
data-flex-basis="311px"
>&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Lateral Fraction (LF):&lt;/strong> Values exceed recommendations, suggesting that most of the sound energy comes from the laterals. This may be related to the large number of diffusers.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Background Noise:&lt;/strong> The room presents a noise level higher than recommended for a symphonic venue (NC-35 vs. NC-20), likely due to the ventilation system.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/ruido.PNG"
width="1032"
height="476"
srcset="https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/ruido_hu16139815568609075014.PNG 480w, https://dibernardo.netlify.app/p/acoustic-measurement-at-usina-del-arte/ruido_hu4680391019551906221.PNG 1024w"
loading="lazy"
alt="Background noise measurement by frequency."
class="gallery-image"
data-flex-grow="216"
data-flex-basis="520px"
>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Sound Diffusion:&lt;/strong> Repetition of a single sequence of diffusers reduces their effectiveness, producing a lobed behavior instead of stochastic diffusion.&lt;/li>
&lt;/ul>
&lt;p>Key improvements are proposed, such as reducing background noise, optimizing sound diffusion with non-periodic sequences, and balancing the spectral response by correcting low-frequency absorption.&lt;/p>
&lt;h3 id="conclusions">&lt;strong>Conclusions&lt;/strong>
&lt;/h3>&lt;p>We were able to effectively characterize the auditorium and apply most of the theoretical topics covered in class to a practical experience. The full report of this work with all results and measurement details can be found in the following &lt;a class="link" href="https://drive.google.com/file/d/1nSmWFrk30IFAhzBs9R42ZR61uK_ARc8z/view?usp=sharing" target="_blank" rel="noopener"
>report&lt;/a>.&lt;/p></description></item><item><title>Generative AI, Flow Matching and TTS</title><link>https://dibernardo.netlify.app/p/generative-ai-flow-matching-and-tts/</link><pubDate>Mon, 24 Mar 2025 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/generative-ai-flow-matching-and-tts/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/generative-ai-flow-matching-and-tts/front2.PNG" alt="Featured image of post Generative AI, Flow Matching and TTS" />&lt;p>At &lt;em>Intercambios Transorgánicos&lt;/em>, we continuously work with state-of-the-art &lt;em>Deep Learning&lt;/em> models. To achieve this, we stay up to date with the latest developments in the field. In this presentation, the objective was to explain the fundamentals of the &lt;em>F5-TTS&lt;/em> model, a cutting-edge speech synthesis system. During the session, the concept of generative artificial intelligence and flow-based models was introduced, as &lt;em>F5-TTS&lt;/em> is based on this technique. The purpose is to share this knowledge with the team and with anyone interested in getting started with &lt;em>Text-to-Speech&lt;/em> (TTS) models.&lt;/p>
&lt;h2 id="introduction---generative-ai-and-tts">Introduction - Generative AI and TTS
&lt;/h2>&lt;p>The class was structured as follows:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Introduction to TTS models&lt;/strong>: Description of the different models used, their main characteristics, and the reasons behind changing approaches.&lt;/li>
&lt;li>&lt;strong>Evolution of TTS models&lt;/strong>: A graph-based survey illustrating the progression of various TTS technologies.&lt;/li>
&lt;li>&lt;strong>Paradigm shift in language models&lt;/strong>: Explanation of how using large datasets has enabled better generalization in language models.&lt;/li>
&lt;li>&lt;strong>Example of generalization&lt;/strong>: Illustrative cases, such as generating an image of an astronaut riding a horse, audio examples, and synthesis of specific accents (e.g., an angry Cordoban speaker).&lt;/li>
&lt;li>&lt;strong>Change in dataset structuring&lt;/strong>:
&lt;ul>
&lt;li>&lt;strong>Traditional approach&lt;/strong>: Use of a single high-quality speaker with a large amount of data (model trained for each speaker).&lt;/li>
&lt;li>&lt;strong>Current and future approach&lt;/strong>: Use of diverse datasets with labels that enable training models capable of understanding speech concepts and generalizing across multiple tasks (&lt;em>VoiceBox&lt;/em> examples).&lt;/li>
&lt;li>&lt;strong>Computational cost&lt;/strong>: Discussion of the increasing model size and training difficulty, similar to large-scale language models (&lt;em>LLMs&lt;/em>).&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;strong>Explanation of Generative AI&lt;/strong>:
&lt;ul>
&lt;li>Introduction to generative models and the concept of underlying distribution.&lt;/li>
&lt;li>Explanation of &lt;em>Transformers&lt;/em> and their function in classification with context. Clarification that while &lt;em>Transformers&lt;/em> are &lt;em>Non-Autoregressive&lt;/em> (NAR) during training, they operate &lt;em>Autoregressively&lt;/em> (AR) in inference.&lt;/li>
&lt;li>Difference between classification models and generative models based on dimensionality reduction and latent variables.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;h2 id="tts-models-voicebox-e2-and-f5">TTS Models: VoiceBox, E2, and F5
&lt;/h2>&lt;p>This section details the key advancements in TTS models leading to the development of &lt;em>F5-TTS&lt;/em>.&lt;/p>
&lt;h3 id="1-voicebox-tts---in-context-learning">1. VoiceBox TTS - &lt;em>In Context Learning&lt;/em>
&lt;/h3>&lt;p>The initial architecture of &lt;em>VoiceBox&lt;/em> is introduced, focusing on generalization through &lt;em>In Context Learning&lt;/em>. This approach allows the model to infer information based on prior examples. To achieve this, it is given an audio sample with a missing segment, forcing it to complete it coherently.&lt;/p>
&lt;blockquote>
&lt;p>&lt;em>&amp;ldquo;We show that Voicebox’s text-guided speech infilling approach is much more scalable in terms of data while subsuming many common speech generative tasks.&amp;rdquo;&lt;/em>&lt;/p>
&lt;/blockquote>
&lt;p>This method, introduced by Meta in &lt;em>VoiceBox&lt;/em>, represents a paradigm shift by demonstrating that TTS models can benefit from techniques previously used in language and image models.&lt;/p>
&lt;p>However, the model still relies on classical TTS techniques such as phoneme duration prediction and &lt;em>Forced Alignment&lt;/em> to map phonemes to Mel spectrograms, as their lengths do not match those of text tokens.&lt;/p>
&lt;h3 id="2-e2-tts---filler-tokens">2. E2 TTS - &lt;em>Filler Tokens&lt;/em>
&lt;/h3>&lt;p>&lt;em>E2 TTS&lt;/em> simplifies many of the architectural decisions of &lt;em>VoiceBox&lt;/em>, particularly in handling the differing lengths of Mel spectrograms and text. Instead of using forced alignment, it introduces &lt;em>Filler Tokens&lt;/em>, which allow text and audio dimensions to be equalized more efficiently. This approach makes it easier for the model to learn temporal associations between the two elements.&lt;/p>
&lt;p>Another significant change is that the model directly processes text instead of phonemes. While this might seem disadvantageous (since homographic words can have different pronunciations), context provides enough information to infer the correct pronunciation, similar to how humans process natural language.&lt;/p>
&lt;h3 id="3-f5-tts---open-source">3. F5 TTS - &lt;em>Open Source&lt;/em>
&lt;/h3>&lt;p>Although &lt;em>E2 TTS&lt;/em> is a major step forward, its training is slow due to the need to infer associations that were previously guided. &lt;em>F5 TTS&lt;/em> optimizes the previous model with the following improvements:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Use of ConvNeXt&lt;/strong>: Enhances text processing.&lt;/li>
&lt;li>&lt;strong>Architectural change&lt;/strong>: Replaces the &lt;em>U-Net&lt;/em> network with &lt;em>DiT&lt;/em> (&lt;em>Diffusion Transformer&lt;/em>).&lt;/li>
&lt;li>&lt;strong>Sway Sampling&lt;/strong>: Optimizes the inference process.&lt;/li>
&lt;/ul>
&lt;p>Additionally, &lt;em>F5-TTS&lt;/em> is open-source, facilitating adoption and improvement by the community.&lt;/p>
&lt;h2 id="flow-matching---theoretical-foundations">Flow Matching - Theoretical Foundations
&lt;/h2>&lt;p>To understand how &lt;em>F5-TTS&lt;/em> works, it is essential to review the models it is based on, known as &lt;em>Flow Matching Models&lt;/em>. These models have evolved from previous techniques in probabilistic distribution modeling.&lt;/p>
&lt;h3 id="1-normalizing-flow">1. Normalizing Flow
&lt;/h3>&lt;p>&lt;em>Normalizing Flows&lt;/em> are a family of probabilistic models that transform a simple distribution into a more complex one through a series of invertible and differentiable functions. They are used to model high-dimensional data distributions and generate realistic samples with precise control over probability.&lt;/p>
&lt;h3 id="2-residual-flow">2. Residual Flow
&lt;/h3>&lt;p>&lt;em>Residual Flows&lt;/em> extend &lt;em>Normalizing Flows&lt;/em> by allowing more flexible transformations without strictly adhering to the invertibility condition. This is achieved through residual networks that approximate transformation functions without structural constraints.&lt;/p>
&lt;h3 id="3-continuous-normalizing-flows-cnf">3. Continuous Normalizing Flows (CNF)
&lt;/h3>&lt;p>&lt;em>Continuous Normalizing Flows&lt;/em> reformulate &lt;em>Normalizing Flows&lt;/em> using ordinary differential equations (ODEs). Instead of applying discrete transformations in successive steps, these models learn a continuous dynamic in the latent space, allowing for greater expressiveness and computational efficiency.&lt;/p>
&lt;h3 id="4-flow-matching">4. Flow Matching
&lt;/h3>&lt;p>&lt;em>Flow Matching&lt;/em> is a technique that optimizes the transformation of a reference distribution into a target distribution by minimizing a specific cost function. It differs from previous approaches by not requiring explicit density function calculations, making it particularly useful for large-scale generative models such as &lt;em>F5-TTS&lt;/em>.&lt;/p>
&lt;h2 id="online-presentation">Online Presentation
&lt;/h2>&lt;p>All of this sections are explained in detail on the online class avaliable here (in Spanish):&lt;/p>
&lt;div class="video-wrapper">
&lt;iframe loading="lazy"
src="https://www.youtube.com/embed/YIpvFC41NUw"
allowfullscreen
title="YouTube Video"
>
&lt;/iframe>
&lt;/div></description></item><item><title>THD+N Meter</title><link>https://dibernardo.netlify.app/p/thd-n-meter/</link><pubDate>Tue, 26 Nov 2024 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/thd-n-meter/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/thd-n-meter/port.jpeg" alt="Featured image of post THD+N Meter" />&lt;h1 id="thdn-meter">THD+N Meter
&lt;/h1>&lt;p>A THD+N meter measures the harmonic distortion of a device. In audio, this is crucial for assessing the quality of equipment. This project was developed as part of the subject &amp;ldquo;Instrumentos y Mediciones Electrónicas&amp;rdquo; at UNTREF. In this course, students design and develop various electronic instruments, and projects are carried forward by successive student groups. This particular project was already underway, and our focus was on developing a phase shifter to align two signals.&lt;/p>
&lt;h2 id="teory-of-thd-measurement">Teory of THD measurement
&lt;/h2>&lt;p>To measure the distortion of a system, a sinusoidal signal with minimal distortion is input to the device under test. The goal is to evaluate how much distortion the device adds to the signal. This is quantified by measuring the power of the original signal and the power of the signal after passing through the device, excluding the fundamental harmonic.&lt;/p>
&lt;p>A differential amplifier is used to subtract the device&amp;rsquo;s output signal from the reference signal, leaving only the higher-order harmonics.&lt;/p>
&lt;p>The THD+N is then calculated as a percentage using the following equation:&lt;/p>
$$
THD+N = \frac{V_{filt}}{V_{tot}} \cdot 100
$$&lt;p>Where:
$V_{filt}$ is the RMS value of the filtered signal (excluding the fundamental harmonic).
$V_{tot}$ is the RMS value of the original signal.&lt;/p>
&lt;h2 id="phase-shifter">Phase Shifter
&lt;/h2>&lt;p>To achieve effective cancellation in the differential section, precise phase and gain adjustments of the two signals are required. The gain adjustment had been successfully implemented by the previous group working on the project. However, achieving the necessary 360-degree phase rotation across the entire audible frequency range (20 Hz to 20 kHz) presented a challenge.&lt;/p>
&lt;p>To address this, we designed two all-pass filters in series and calculated the component values to achieve the desired phase rotation over the target frequency range.&lt;/p>
&lt;p>The design was modular to facilitate seamless integration with the previous stages.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/thd-n-meter/esquem_thd.PNG"
width="991"
height="597"
srcset="https://dibernardo.netlify.app/p/thd-n-meter/esquem_thd_hu7854488014118793125.PNG 480w, https://dibernardo.netlify.app/p/thd-n-meter/esquem_thd_hu5535924513728456883.PNG 1024w"
loading="lazy"
alt="Esquematic of the phase shifter desing for the meter"
class="gallery-image"
data-flex-grow="165"
data-flex-basis="398px"
>&lt;/p>
&lt;p>We tested the circuit on a protoboard before designing the PCB using &lt;em>Altium Designer&lt;/em>.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/thd-n-meter/pcb_thd.PNG"
width="757"
height="496"
srcset="https://dibernardo.netlify.app/p/thd-n-meter/pcb_thd_hu3351495035239025609.PNG 480w, https://dibernardo.netlify.app/p/thd-n-meter/pcb_thd_hu4551021193416416361.PNG 1024w"
loading="lazy"
alt="PCB design of the circuit"
class="gallery-image"
data-flex-grow="152"
data-flex-basis="366px"
>&lt;/p>
&lt;h2 id="the-device">The device
&lt;/h2>&lt;p>The device features several controls for adjusting phase and gain. Both the phase and gain adjustments include fine-tuning potentiometers to ensure maximum precision.&lt;/p>
&lt;div id="carousel0" class="carousel" duration="70000">
&lt;ul>
&lt;li id="c0_slide1" style="min-width: calc(100%/1); padding-bottom: 600px;">&lt;img src="https://dibernardo.netlify.app/images/thd/thd1.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide2" style="min-width: calc(100%/1); padding-bottom: 600px;">&lt;img src="https://dibernardo.netlify.app/images/thd/thd2.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide3" style="min-width: calc(100%/1); padding-bottom: 600px;">&lt;img src="https://dibernardo.netlify.app/images/thd/thd3.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>&lt;a href="#c0_slide1">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide2">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide3">&lt;/a>&lt;/li>
&lt;/ol>
&lt;div class="prev">&amp;lsaquo;&lt;/div>
&lt;div class="next">&amp;rsaquo;&lt;/div>
&lt;/div>
&lt;p>It is equipped with BNC inputs and outputs, allowing users to visualize the output on an oscilloscope and achieve maximum attenuation.&lt;/p>
&lt;h2 id="results">Results
&lt;/h2>&lt;p>This device was compared against a commercial THD meter (GW INSTEK GAD-201G), and the results were highly similar. The primary limitation was the base noise level of the measurement environment, which significantly restricted the lowest THD value we could measure.&lt;/p>
&lt;p>The specifications of the device are summarized in the following table (in Spanish):&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/thd-n-meter/specs_thd.PNG"
width="1192"
height="887"
srcset="https://dibernardo.netlify.app/p/thd-n-meter/specs_thd_hu7856985861425421171.PNG 480w, https://dibernardo.netlify.app/p/thd-n-meter/specs_thd_hu9340525222663809333.PNG 1024w"
loading="lazy"
alt="Technical specifications for the device"
class="gallery-image"
data-flex-grow="134"
data-flex-basis="322px"
>&lt;/p>
&lt;p>A detailed analysis of the device is available in this &lt;a class="link" href="https://drive.google.com/file/d/1b36O_s27LkEJAZ6-y5TcdTT5wKB1xdGk/view?usp=sharing" target="_blank" rel="noopener"
>final report&lt;/a> (written in spanish).&lt;/p></description></item><item><title>The effect of denosing on TTS</title><link>https://dibernardo.netlify.app/p/the-effect-of-denosing-on-tts/</link><pubDate>Fri, 22 Nov 2024 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/the-effect-of-denosing-on-tts/</guid><description>&lt;p>This study was conducted in the context of the class &lt;em>Laboratorio de Acústica&lt;/em> at UNTREF. I chose this topic because it aligns with research I have been pursuing as part of the group &lt;em>Intercambios Transorgánicos&lt;/em>. The class assignment involved conducting a subjective study using a survey to explore the relationship between objective and subjective variables.&lt;/p>
&lt;p>In my research group, I have been investigating how denoising algorithms affect Text-to-Speech (TTS) systems trained on low-quality recordings. The focus is on Rioplatense Spanish, a regional accent with limited high-quality data. Within this context, it was natural to combine both tasks and perform a subjective test on the impact of denoising algorithms on TTS systems.&lt;/p>
&lt;h2 id="overview">Overview
&lt;/h2>&lt;p>The key points of this investigation are:&lt;/p>
&lt;ul>
&lt;li>Evaluation of three denoising algorithms: Wave U-Net, HiFi-GAN, and DeepFilterNet.&lt;/li>
&lt;li>Use of both subjective (CMOS) and objective metrics (PESQ, STOI, MCD).&lt;/li>
&lt;li>Insights into resource-efficient TTS model development for underrepresented accents.&lt;/li>
&lt;/ul>
&lt;h2 id="methodology">Methodology
&lt;/h2>&lt;ul>
&lt;li>&lt;strong>Algorithms&lt;/strong>: Wave U-Net, HiFi-GAN, and DeepFilterNet evaluated with the FastPitch TTS model.&lt;/li>
&lt;li>&lt;strong>Dataset&lt;/strong>: Subset of the ArchiVoz collection (15 minutes of noisy audio).&lt;/li>
&lt;li>&lt;strong>Testing&lt;/strong>: CMOS subjective test and objective metrics (PESQ, STOI, MCD).&lt;/li>
&lt;li>&lt;strong>Participants&lt;/strong>: 24 valid responses, including both experts and non-experts.&lt;/li>
&lt;/ul>
&lt;h2 id="key-findings">Key Findings
&lt;/h2>&lt;ol>
&lt;li>
&lt;p>&lt;strong>DeepFilterNet Performance&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>Achieved the highest CMOS score, reflecting the best subjective quality.&lt;/li>
&lt;li>Demonstrated significant improvements in TTS output despite mixed correlations with objective metrics.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Objective Metrics Analysis&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>PESQ and MCD showed limited correlation with subjective preferences.&lt;/li>
&lt;li>STOI scores were consistent across algorithms, indicating preserved intelligibility.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Algorithm Comparisons&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>DeepFilterNet&lt;/strong>: Superior subjective evaluations, moderate MCD.&lt;/li>
&lt;li>&lt;strong>Demucs&lt;/strong>: Comparable to DeepFilterNet in PESQ but lower subjective scores.&lt;/li>
&lt;li>&lt;strong>Wave U-Net&lt;/strong>: Poor subjective and objective performance.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Subject Expertise&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>No significant differences were observed between expert and non-expert evaluations in subjective testing.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;h2 id="implications">Implications
&lt;/h2>&lt;ul>
&lt;li>&lt;strong>Efficiency&lt;/strong>: Advanced denoising methods like DeepFilterNet can enhance TTS systems without requiring high-quality recordings.&lt;/li>
&lt;li>&lt;strong>Limitations&lt;/strong>: Objective metrics like PESQ and MCD are insufficient standalone indicators of subjective TTS quality.&lt;/li>
&lt;li>&lt;strong>Future Work&lt;/strong>:
&lt;ul>
&lt;li>Expand datasets and noise levels for more robust analysis.&lt;/li>
&lt;li>Explore TTS systems trained jointly with denoising algorithms.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>This work concludes that preprocessing with DeepFilterNet significantly improves TTS performance, with a 1.1 CMOS score increase. These findings underscore the importance of algorithm selection in optimizing low-resource TTS systems. Additionally, I gained valuable insights into subjective evaluations and the statistical analysis required to draw meaningful conclusions from data.&lt;/p>
&lt;p>All the information for this study can be found in the &lt;a class="link" href="https://drive.google.com/file/d/1F4aJGIU9FX2LT8OFik-Yjg4uSz6T09jw/view?usp=sharing" target="_blank" rel="noopener"
>academic report&lt;/a>.&lt;/p></description></item><item><title>Building and design of a personal loudspeaker</title><link>https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/</link><pubDate>Wed, 20 Nov 2024 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/front_bass.PNG" alt="Featured image of post Building and design of a personal loudspeaker" />&lt;h1 id="bassado-a-semi-portable-low-cost-home-speaker">&amp;ldquo;BassAdo&amp;rdquo;: A Semi-Portable Low-Cost Home Speaker
&lt;/h1>&lt;p>This project is part of the Electroacoustics II course at UNTREF within the Sound Engineering program. The task was to design a speaker system from scratch by applying the theory and concepts explained in class.
The project was developed over the entire semester, with various stages to complete and present in reports. The speaker is intended for use in large spaces, potentially outdoors, to play music in a social gathering setting. It was named BassAdo to blend the Argentine tradition of &amp;ldquo;asado&amp;rdquo; (a typical barbecue gathering) with the word &amp;ldquo;bass,&amp;rdquo; emphasizing the speaker’s low-frequency performance.&lt;/p>
&lt;h2 id="design">Design
&lt;/h2>&lt;p>The goal was to design an accessible home audio system that allowed exploration of topics discussed in the course. The design aimed to emphasize bass response, characteristic of commercial systems, prioritizing low-frequency bandwidth extension over minimal group delay and system time control.&lt;/p>
&lt;p>Regarding the transducers, the team had access to Yharo-brand units, which are classified as non-professional, consumer-grade, and suitable for automotive or home systems. The impedance response of the units was evaluated, and an 8” woofer was selected for low frequencies, along with two 4” units for mid/high frequencies.&lt;/p>
&lt;p>Measuring the Thiele-Small parameters of the speakers revealed a high &lt;em>Vas&lt;/em> (Equivalent Suspension Acoustic Volume), necessitating a large cabinet volume for proper control. To address this, and given the availability of two 8” woofers, the team opted for an isobaric speaker configuration, acoustically coupling the woofers to improve control and reduce cabinet size. Additionally, the cabinet was designed as vented to enhance low-frequency response.&lt;/p>
&lt;p>The Thiele-Small parameters were obtained using the software &lt;a class="link" href="https://www.roomeqwizard.com/" target="_blank" rel="noopener"
>REW&lt;/a>. With these parameters, simulations were performed in &lt;a class="link" href="https://www.tolvan.com/index.php?page=/basta/basta.php" target="_blank" rel="noopener"
>Basta!&lt;/a> to optimize the design for the desired response. A key focus was tuning the port’s resonance frequency to achieve strong low-frequency performance. The transducer had an &lt;em>fs&lt;/em> of 45 Hz, and the port was tuned to 40 Hz by adjusting the tube length and cabinet air volume.&lt;/p>
&lt;p>Based on these results, a 3D model of the cabinet was created using &lt;a class="link" href="https://www.solidworks.com/" target="_blank" rel="noopener"
>SolidWorks&lt;/a>, and the design was used to cut the materials for construction.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/dise%C3%B1o_gab.PNG"
width="422"
height="306"
srcset="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/dise%C3%B1o_gab_hu4105664598446689879.PNG 480w, https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/dise%C3%B1o_gab_hu11734023399320749680.PNG 1024w"
loading="lazy"
alt="3D modeing of the loudspeaker box"
class="gallery-image"
data-flex-grow="137"
data-flex-basis="330px"
>&lt;/p>
&lt;p>Details of this process are documented in the following &lt;a class="link" href="https://drive.google.com/file/d/1uej1m6gwg99JoPEw5Jbu3cTq74ViIG58/view?usp=sharing" target="_blank" rel="noopener"
>design report&lt;/a>.&lt;/p>
&lt;h2 id="construction">Construction
&lt;/h2>&lt;p>The wood was cut according to the 3D model, and the cabinet was assembled.&lt;/p>
&lt;div id="carousel0" class="carousel" duration="700000">
&lt;ul>
&lt;li id="c0_slide1" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b1.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide2" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b2.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide3" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b3.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide4" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b4.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide5" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b5.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide6" style="min-width: calc(100%/1); padding-bottom: 700px;">&lt;img src="https://dibernardo.netlify.app/images/bassado/b6.jpeg" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>&lt;a href="#c0_slide1">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide2">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide3">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide4">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide5">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide6">&lt;/a>&lt;/li>
&lt;/ol>
&lt;div class="prev">&amp;lsaquo;&lt;/div>
&lt;div class="next">&amp;rsaquo;&lt;/div>
&lt;/div>
&lt;p>As shown in the images, rock wool was added as an acoustic absorber. Measurements revealed this was excessive (the port resonance was overly damped), so some rock wool was removed to achieve the desired result.&lt;/p>
&lt;h2 id="measurement-and-calibration">Measurement and Calibration
&lt;/h2>&lt;p>Frequency response and directivity measurements were conducted in the university’s laboratory using the following equipment:&lt;/p>
&lt;ul>
&lt;li>Powersoft M50Q amplifier&lt;/li>
&lt;li>Earthworks M50 microphone&lt;/li>
&lt;li>RME Fireface UCX audio interface&lt;/li>
&lt;li>OUTLINE ET250-3D turntable&lt;/li>
&lt;/ul>
&lt;p>Using this setup and the &lt;a class="link" href="https://artalabs.hr/" target="_blank" rel="noopener"
>Arta&lt;/a> software, the acoustic response of individual transducers was characterized (useful for crossover filter simulation). Vertical and horizontal directivity responses were also evaluated to determine the best orientation for use. Frequency response graphs for both transducers were generated.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/patron_polar.PNG"
width="943"
height="584"
srcset="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/patron_polar_hu10205775189482527862.PNG 480w, https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/patron_polar_hu2898494236095029192.PNG 1024w"
loading="lazy"
alt="Polar response for the mid/high driver"
class="gallery-image"
data-flex-grow="161"
data-flex-basis="387px"
>&lt;/p>
&lt;p>All measurements and in-depth analysis are included in the following &lt;a class="link" href="https://drive.google.com/file/d/1dPwJAqadPM3Ja80anA1P1Ei3EP9M8w-q/view?usp=sharing" target="_blank" rel="noopener"
>measurement report&lt;/a>.&lt;/p>
&lt;h2 id="crossover-filter-design">Crossover Filter Design
&lt;/h2>&lt;p>Finally, the crossover filter stage was designed. Using the previous measurements, data were uploaded to &lt;a class="link" href="https://kimmosaunisto.net/" target="_blank" rel="noopener"
>VituixCad&lt;/a> to calculate the simulations. The goal of the crossover filter was to achieve a pleasant frequency response for music playback and to enhance low frequencies. Vertical polar response uniformity was also a priority.&lt;/p>
&lt;p>Since the power stage required an active supply, an active crossover filter with a Sallen-Key topology was implemented. The number of filters was defined based on space and cost, and adjustments were made in the software to achieve the desired response. For example, the low-frequency driver used the following configuration:&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/filtro_cruce.PNG"
width="1221"
height="648"
srcset="https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/filtro_cruce_hu13251352229816192527.PNG 480w, https://dibernardo.netlify.app/p/building-and-design-of-a-personal-loudspeaker/filtro_cruce_hu16925353032023854787.PNG 1024w"
loading="lazy"
alt="Crossover filter for the low frequency driver"
class="gallery-image"
data-flex-grow="188"
data-flex-basis="452px"
>&lt;/p>
&lt;p>Where:&lt;/p>
&lt;ul>
&lt;li>F1: High-pass fs=30 Hz | Q=0.67&lt;/li>
&lt;li>F2: Low-pass fs=480 Hz | Q=0.5&lt;/li>
&lt;li>F3: Notch filter at 220 Hz&lt;/li>
&lt;li>F4: Notch filter at 400 Hz&lt;/li>
&lt;/ul>
&lt;p>Before building the filter, the proposed configuration was tested with a digital filter to practically evaluate the system’s response.
Details of this section are provided in the following &lt;a class="link" href="https://drive.google.com/file/d/121wkPnp_QsODk99a2Jm44jfb-Xbl6ZKn/view?usp=sharing" target="_blank" rel="noopener"
>crossover filter report&lt;/a>.&lt;/p>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>This project allowed us to apply theoretical concepts in practice and gain a deeper understanding of the development and challenges involved in designing an electroacoustic system.&lt;/p></description></item><item><title>Automatic Workout Routine Generator</title><link>https://dibernardo.netlify.app/p/automatic-workout-routine-generator/</link><pubDate>Wed, 17 Apr 2024 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/automatic-workout-routine-generator/</guid><description>&lt;h1 id="automatic-workout-routine-generator">Automatic Workout Routine Generator
&lt;/h1>&lt;p>This project was the final project asignment for the Algoritmos y Programación II on UNTREF. The idea of the application is to function as a smart workout planification, where the user input certain criterias and the program establish the best workout routine to maximice the users preference. The program was written in the Go programming language.&lt;/p>
&lt;h2 id="data-management">Data Management
&lt;/h2>&lt;p>This course does not focues on databases, so we choose to use a CSV to simulate a database. This file contains all the information of the different routines and the differente attributes. This serve as a presistency file wheras all the logic is handle by the program.&lt;/p>
&lt;p>Different exercises are categorized by tematics. There are two entities on the program that are represented as structs in Go, this are the Exercise and the Routines.&lt;/p>
&lt;h3 id="exercise">Exercise
&lt;/h3>&lt;p>All the exercises have the following attributes:&lt;/p>
&lt;ul>
&lt;li>Name: Name of the exercise.&lt;/li>
&lt;li>Description: Detailed description of the exercise.&lt;/li>
&lt;li>Duration: Estimated duration of the exercise.&lt;/li>
&lt;li>Calories: Number of calories burned during the exercise.&lt;/li>
&lt;li>Type: Type of exercise (e.g., cardio, strength, flexibility).&lt;/li>
&lt;li>Muscle Group: Muscle group targeted by the exercise.&lt;/li>
&lt;li>Points: Points assigned to the exercise for each of its types.&lt;/li>
&lt;li>Difficulty: Difficulty level of the exercise.&lt;/li>
&lt;/ul>
&lt;h3 id="routines">Routines
&lt;/h3>&lt;p>All the routines are a collection of exercises. This are paresed as a linked list of exercise. Aside from this, the routins have the following attributes:&lt;/p>
&lt;ul>
&lt;li>Name: Name of the routine.&lt;/li>
&lt;li>Exercises: String that stores the IDs of the exercises in the routine, separated by commas.&lt;/li>
&lt;li>AvailableExercises: Linked list of the exercises available for creating the routine.&lt;/li>
&lt;/ul>
&lt;h2 id="algorithm">Algorithm
&lt;/h2>&lt;p>The idea is to maximice different parameters, for example, maximum calories burnt in the least ammount of time, or the minimum duration for this muscle group or type of exercise. To find the best solutions based on the existing data we propose a dynamic programming algorithm that searches for all the posiblities from the data and find the maximum or minimum according to the specifications of the user. The DP apprach uses memory to avoid recalculation combinantions that already were computed, with this optimization the algorithm is fast enough that can generate the routines in miliseconds (with the test dataset under evaluation).&lt;/p>
&lt;h2 id="user-interface">User Interface
&lt;/h2>&lt;p>At the moment, the programm is designed to be used form the terminal as a CLI application. The user can crear an exersice and a rutine, list the avaliable optionas, and generate a custom routine base on the specifications that he choose.&lt;/p>
&lt;p>This is the first iteration of the project and it is fully functional but we plan to create a custom GUI to be user friendly, but for this proposse it will be better to use a different framework and use this GO application as the backend for a web or app service.&lt;/p>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>With this project I solidify my knowledege on programming topics like data structurs and algorithms because we used the theory seen in class and applied it to a real case scenario. Also it help me to get used to the Go langeage and it became a leangauge that I really enjoy coding on it. The code for this project is avaliable on this &lt;a class="link" href="https://github.com/MatiasDiBernardo/Workout-routine-generator" target="_blank" rel="noopener"
>repository&lt;/a>.&lt;/p></description></item><item><title>Understanding FastPitch and the Transformer Architecture</title><link>https://dibernardo.netlify.app/p/understanding-fastpitch-and-the-transformer-architecture/</link><pubDate>Wed, 23 Aug 2023 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/understanding-fastpitch-and-the-transformer-architecture/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/understanding-fastpitch-and-the-transformer-architecture/front.png" alt="Featured image of post Understanding FastPitch and the Transformer Architecture" />&lt;p>Understanding a modern deep learning model is challenging due to the extensive prior knowledge required and the rapid pace of advancements in the field. In the research project &lt;em>Intercambios Transorgánicos&lt;/em>, we are working with TTS, specifically the FastPitch model from Nvidia. I have studied this model to fine-tune it for Spanish and shared my research process in a class to help my colleagues in the research group understand it better.&lt;/p>
&lt;h2 id="understanding-seq2seq-models">Understanding Seq2Seq Models
&lt;/h2>&lt;p>In &lt;em>Intercambios Transorgánicos&lt;/em>, we previously used Tacotron2 as our TTS model. While Tacotron2 performs well, it has several issues, primarily during training and inference, due to its auto-regressive nature. In contrast, FastPitch is a non-auto-regressive (NAR) model. To grasp these distinctions, I delved into seq2seq models, exploring their evolution over time and creating a quick overview of the sequence analysis models that have been pivotal:&lt;/p>
&lt;ul>
&lt;li>RNN&lt;/li>
&lt;li>LSTM&lt;/li>
&lt;li>Transformers&lt;/li>
&lt;/ul>
&lt;p>Tacotron2 is based on an LSTM (AR) model, whereas FastPitch utilizes Transformers (NAR). Understanding this technological progression provides crucial background knowledge, particularly about transformers, including positional encoding, a key factor in their non-auto-regressive nature, and the attention mechanism.&lt;/p>
&lt;h2 id="the-transformer-architecture">The Transformer Architecture
&lt;/h2>&lt;p>I began by studying the transformer architecture, as it is fundamental to the FastPitch model. I reviewed online resources and the seminal &lt;em>Attention is All You Need&lt;/em> paper. Below are some key points I noted during my study:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Self-Attention Mechanism&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Purpose&lt;/strong>: Dynamically focuses on different parts of the input sequence.&lt;/li>
&lt;li>&lt;strong>Mechanism&lt;/strong>:
&lt;ul>
&lt;li>Query (Q), Key (K), Value (V): Derived from input embeddings.&lt;/li>
&lt;li>Attention scores are computed as the dot product of Q and K, scaled by the square root of the dimension.&lt;/li>
&lt;li>Scores are normalized using softmax to create attention weights.&lt;/li>
&lt;li>A weighted sum of V is computed based on these weights to produce the output.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Multi-Head Attention&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Purpose&lt;/strong>: Captures diverse relationships between tokens by applying multiple self-attention mechanisms in parallel.&lt;/li>
&lt;li>&lt;strong>Mechanism&lt;/strong>: Outputs from multiple attention heads are concatenated and linearly transformed.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Positional Encoding&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Purpose&lt;/strong>: Provides information about token order in the sequence, compensating for the Transformer&amp;rsquo;s lack of built-in sequence order (unlike RNNs).&lt;/li>
&lt;li>&lt;strong>Mechanism&lt;/strong>: A fixed or learnable vector is added to the input embeddings.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Encoder-Decoder Structure&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Encoder&lt;/strong>: Processes the input sequence into context-rich representations.
&lt;ul>
&lt;li>Components:
&lt;ul>
&lt;li>Multi-head self-attention&lt;/li>
&lt;li>Feed-forward neural network (FFN)&lt;/li>
&lt;li>Layer normalization and residual connections&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;strong>Decoder&lt;/strong>: Generates the output sequence by attending to both encoder outputs and previously generated tokens.
&lt;ul>
&lt;li>Components:
&lt;ul>
&lt;li>Masked multi-head self-attention (prevents attending to future tokens)&lt;/li>
&lt;li>Multi-head attention over encoder outputs&lt;/li>
&lt;li>FFN, layer normalization, and residual connections&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Feed-Forward Network (FFN)&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Purpose&lt;/strong>: Introduces non-linearity and processes each token independently.&lt;/li>
&lt;li>&lt;strong>Mechanism&lt;/strong>: Two linear layers with a ReLU activation in between.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Layer Normalization and Residual Connections&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Purpose&lt;/strong>: Stabilizes training and improves gradient flow by normalizing inputs to each layer and adding skip connections.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;h2 id="fastpitch">FastPitch
&lt;/h2>&lt;p>After covering the theory, I examined each section of the FastPitch architecture in detail. I provided a brief explanation of word embeddings and positional encoding, as these are complex topics, and I wanted to keep the class concise.
FastPitch converts text into mel spectrograms, which are then transformed into audio by another model (in our case, HiFi-GAN). The training sequence involves the following steps:&lt;/p>
&lt;ol>
&lt;li>Text to Word Embedding&lt;/li>
&lt;li>Word Embedding concatenated with mel spectrogram&lt;/li>
&lt;li>Positional encoding and FFT (Feed-Forward Transformer block)&lt;/li>
&lt;li>Pitch Prediction&lt;/li>
&lt;li>Phoneme Duration Prediction&lt;/li>
&lt;li>Another FFT block&lt;/li>
&lt;li>Fully connected layer&lt;/li>
&lt;li>Output mel spectrogram&lt;/li>
&lt;/ol>
&lt;p>For each block, I presented the corresponding equations and provided qualitative explanations for their roles in the model. For instance, phoneme duration prediction is crucial for aligning a phoneme&amp;rsquo;s duration with the expected duration in the spectrogram.&lt;/p>
&lt;h2 id="online-class">Online Class
&lt;/h2>&lt;p>Finally, I summarized the most important points and conducted an online class to share these concepts with my colleagues. You can watch it here (in Spanish):&lt;/p>
&lt;div class="video-wrapper">
&lt;iframe loading="lazy"
src="https://www.youtube.com/embed/v4bt8bGIM00"
allowfullscreen
title="YouTube Video"
>
&lt;/iframe>
&lt;/div></description></item><item><title>Z-Plane Visualizer</title><link>https://dibernardo.netlify.app/p/z-plane-visualizer/</link><pubDate>Sat, 12 Aug 2023 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/z-plane-visualizer/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/z-plane-visualizer/frontz.PNG" alt="Featured image of post Z-Plane Visualizer" />&lt;p>On the &lt;em>Procesamiento Digital de Señales&lt;/em> (Digital Signal Processing) course at UNTREF, we explore the Z-Plane for filtering design with discrete variables. During the class, the professor introduced a tool built in MATLAB that visualizes the magnitude and phase plots in relation to the positions of zeros and poles on the Z-Plane. Inspired by this, I decided to recreate this tool in Python.&lt;/p>
&lt;p>Leveraging my experience with the PyGame library, I was able to build a real-time application that allows for the movement of poles and zeros, enabling users to see how the transfer function changes in real time.&lt;/p>
&lt;h2 id="how-it-works">How It Works
&lt;/h2>&lt;p>First, I map the pixel positions on the Z-Plane to coordinates according to the unit circle representation. Then, I construct the transfer function, where each zero $z_{n}$ is a term in the numerator, and each pole $z_{i}$ is a term in the denominator. With the transfer function $H(z)$, I can plot both the magnitude and phase plots, which are also mappings from the normalized response into a space within the app.&lt;/p>
$$
H(z) = \frac{\sum_{n=0}^{N} (z - z_{n})}{\sum_{i=0}^{N} (z - z_{i})}
$$&lt;p>Each frame recalculates the transfer function. The program performs efficiently because I store the zeros and poles in arrays, enabling faster computations with the help of numpy, which is already highly optimized. This allows real-time visualizations of the changes and provides a more intuitive understanding of the behavior of the Z-Plane. The following code snippet shows how the transfer function is computed using complex exponentials:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">e&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">w&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">root&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">exp&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="n">j&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="n">w&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="o">-&lt;/span> &lt;span class="n">root&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">transfer_function&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">zeros&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">poles&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">w&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">linspace&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">pi&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">pi&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">RES&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">for&lt;/span> &lt;span class="n">zero&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">zeros&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">num&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">e&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">w&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">zero&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">for&lt;/span> &lt;span class="n">pole&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">poles&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">den&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">e&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">w&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">pole&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">H_z&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">num&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">den&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">mag&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">abs&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">H_z&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">ang&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">np&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">angle&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">H_z&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="n">mag&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">ang&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>This project is designed as educational material, providing students with a practical tool to better understand the interactions between poles and zeros in the Z-Plane. It is not intended as a professional filter design tool.&lt;/p>
&lt;h2 id="functionality">Functionality
&lt;/h2>&lt;p>The application has the following functionality:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Display and move poles/zeros&lt;/strong>: The user can select and choose the position of zero or pole in the Z plane. With the symmetry option active, all the poles and zeros selected or moved are attached to their symmetric par with respect to the imaginary axes.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Order&lt;/strong>: The order of the poles/zeros can be modified with the mouse wheel up to increse or down to decrease. It supports up to order 4. The color of the zero/pole change with the order.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Information&lt;/strong>: Holding the cursor over a pole or zero displays information about the position, symmetry and order.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Zoom&lt;/strong>: With the plus and minus symbols, the user can zoom in and out of the Z plane.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Delete&lt;/strong>: The trash bin symbol clears all the poles and zeros from the plane, and the user can also delete specific poles or zeros by pressing right click on them.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Magnitude Graph&lt;/strong>: The magnitude spectrum displayed in the app is normalized. This decision helps to keep the focus on the shape of the magnitude and it makes sure that the graph is visually meaningful for the user. The downside is that the difference in peak values is not captured.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Phase Graph&lt;/strong>: The phase is displayed unwrapped between $-\pi$ and $\pi$.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="demo">Demo
&lt;/h2>&lt;p>Here is a quick demo of the app in action:&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/1045497647" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;p>The source code for this project can be found on this &lt;a class="link" href="https://github.com/MatiasDiBernardo/Z-Plane_Visualizer" target="_blank" rel="noopener"
>repo&lt;/a>.&lt;/p></description></item><item><title>AI learns to play 2048 game</title><link>https://dibernardo.netlify.app/p/ai-learns-to-play-2048-game/</link><pubDate>Fri, 17 Feb 2023 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/ai-learns-to-play-2048-game/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/ai-learns-to-play-2048-game/game_img.jpg" alt="Featured image of post AI learns to play 2048 game" />&lt;p>I used this project as an introduction to Reinforcement Learning. Having mostly worked with supervised and unsupervised learning, I wanted to start with a small, simple project to quickly grasp the main ideas and create something fun. I followed this &lt;a class="link" href="https://youtu.be/L8ypSXwyBds" target="_blank" rel="noopener"
>YouTube video&lt;/a> as a reference, which explains how to use Reinforcement Learning (RL) to train a model capable of playing the snake game. To make it more challenging, I applied the same network to the 2048 game.&lt;/p>
&lt;h2 id="code">Code
&lt;/h2>&lt;p>The code has three main components:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>The Game&lt;/strong>: Implements the game logic and the graphical user interface (GUI).&lt;/li>
&lt;li>&lt;strong>Agent&lt;/strong>: Controls the gameplay.&lt;/li>
&lt;li>&lt;strong>AI Model&lt;/strong>: A neural network that learns how to play and guides the agent.&lt;/li>
&lt;/ul>
&lt;h3 id="game-state">Game State
&lt;/h3>&lt;p>I modeled the game state as a 4x4 matrix representing the board. The actions in the game are represented by a vector, with the following possibilities:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Left&lt;/strong>: [1, 0, 0, 0]&lt;/li>
&lt;li>&lt;strong>Right&lt;/strong>: [0, 1, 0, 0]&lt;/li>
&lt;li>&lt;strong>Up&lt;/strong>: [0, 0, 1, 0]&lt;/li>
&lt;li>&lt;strong>Down&lt;/strong>: [0, 0, 0, 1]&lt;/li>
&lt;/ul>
&lt;h3 id="reward">Reward
&lt;/h3>&lt;p>The RL model works with rewards to quantify when the agent performs well or poorly. Initially, I defined the following rewards:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>+10 points&lt;/strong>: When the agent doubles the points. This is crucial because, in 2048, points increase exponentially.&lt;/li>
&lt;li>&lt;strong>-10 points&lt;/strong>: When the game is lost. This serves as a straightforward negative reward.&lt;/li>
&lt;/ul>
&lt;p>Initially, the model showed slow improvement. To address this, I added an additional reward:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>+2 points&lt;/strong>: When points are increased. This reward incentivizes actions that maximize board clearance and progress.&lt;/li>
&lt;/ul>
&lt;h2 id="how-the-model-works">How the Model Works
&lt;/h2>&lt;p>The model is a simple linear neural network. It takes the game state as input and predicts the best next action to maximize the reward.&lt;/p>
&lt;p>Rewards are managed using a technique called Q-Learning. A &lt;em>Q Value&lt;/em> represents the quality of a decision based on the loss function. The loss function is derived from the &lt;em>Bellman Equation&lt;/em>:&lt;/p>
$$
NewQ(s, a) = Q(s, a) + \alpha [R(s, a) + \lambda \, \text{max}Q'(s', a') - Q(s, a)]
$$&lt;p>Where:&lt;/p>
&lt;ul>
&lt;li>$Q(s, a)$: The &lt;em>Q Value&lt;/em> for a specific state and action.&lt;/li>
&lt;li>$\alpha$: Learning rate.&lt;/li>
&lt;li>$R(s, a)$: Reward for a specific state and action.&lt;/li>
&lt;li>$\lambda$: Discount rate.&lt;/li>
&lt;li>$\text{max}Q&amp;rsquo;(s&amp;rsquo;, a&amp;rsquo;)$: Maximum expected future reward.&lt;/li>
&lt;/ul>
&lt;h2 id="experiments-and-results">Experiments and Results
&lt;/h2>&lt;h3 id="random-test-as-a-baseline">Random Test as a Baseline
&lt;/h3>&lt;p>To establish a baseline, I tested the average score achievable by taking random actions. After 1,000 iterations, the average score was &lt;strong>170&lt;/strong>, far below the 2048 points needed to win the game.&lt;/p>
&lt;h3 id="initial-results">Initial Results
&lt;/h3>&lt;p>My initial attempts were discouraging. The model performed worse than random movements. Here are some early results:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Game 1,000&lt;/strong> | Score: 208 | Record: 416 | Mean Score: 200 | Reward: 640&lt;/li>
&lt;li>&lt;strong>Game 1,000&lt;/strong> | Score: 116 | Record: 346 | Mean Score: 161 | Reward: 310&lt;/li>
&lt;li>&lt;strong>Game 1,000&lt;/strong> | Score: 112 | Record: 348 | Mean Score: 146 | Reward: 320&lt;/li>
&lt;/ol>
&lt;p>In these attempts, the agent developed a suboptimal strategy of filling the board before increasing points.&lt;/p>
&lt;h3 id="improvements">Improvements
&lt;/h3>&lt;p>After experimenting with the reward parameters, I focused on the exploration phase. Initially, the &lt;em>exploration games&lt;/em> parameter, which randomly picks moves, was set to 25 games. Increasing this parameter allowed the agent to explore more strategies, leading to better results:&lt;/p>
&lt;ol start="4">
&lt;li>&lt;strong>Game 1,000&lt;/strong> | Score: 478 | Record: 478 | Mean Score: 230&lt;/li>
&lt;li>&lt;strong>Game 1,000&lt;/strong> | Score: 514 | Record: 964 | Mean Score: 382&lt;/li>
&lt;/ol>
&lt;p>As the model improved, I extended the training to more games:&lt;/p>
&lt;ol start="6">
&lt;li>&lt;strong>Game 3,796&lt;/strong> | Score: 770 | Record: 1,366 | Mean Score: 469&lt;/li>
&lt;li>&lt;strong>Game 4,852&lt;/strong> | Score: 631 | Record: 1,462 | Mean Score: 483&lt;/li>
&lt;/ol>
&lt;p>Finally, with 200 exploration games and 5,000 training games, the results were as follows:&lt;/p>
&lt;ol start="8">
&lt;li>&lt;strong>Game 5,000&lt;/strong> | Score: 840 | Record: 1,678 | Mean Score: 512&lt;/li>
&lt;/ol>
&lt;p>Although the model didn&amp;rsquo;t beat the game, I was satisfied with the progress. I believe that with longer training (the final run lasted 4 hours) and additional network layers, it would be possible to win the game using this architecture.&lt;/p>
&lt;h2 id="demo">Demo
&lt;/h2>&lt;p>Here is a demo of the application, showcasing the agent&amp;rsquo;s learning process:&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/1045495533" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;p>I implemented keybindings to control the game&amp;rsquo;s speed, providing three options:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Fast&lt;/strong>: For rapid training.&lt;/li>
&lt;li>&lt;strong>Slow&lt;/strong>: To observe and analyze the agent&amp;rsquo;s progress and mistakes.&lt;/li>
&lt;li>&lt;strong>Medium&lt;/strong>: Rarely used.&lt;/li>
&lt;/ul>
&lt;p>The complete code for this project is available in this &lt;a class="link" href="https://github.com/MatiasDiBernardo/RF_2048-game" target="_blank" rel="noopener"
>repository&lt;/a>.&lt;/p></description></item><item><title>Time Scale Modification Algorithms</title><link>https://dibernardo.netlify.app/p/time-scale-modification-algorithms/</link><pubDate>Sat, 11 Feb 2023 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/time-scale-modification-algorithms/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/time-scale-modification-algorithms/tsm.PNG" alt="Featured image of post Time Scale Modification Algorithms" />&lt;p>Time scale modifications algorithms are used to speed up or slow down the reproduction velocity of an audio. When you change the sample rate of an audio, the velocity changes but it also changes the pitch (when the audio is speed up it sounds highier pitch). There are different algorithms that change the velocity of the audio but mantain the pitch.&lt;/p>
&lt;p>The main reference for this study is the following article, where all the different algorithms are describe in detail.&lt;/p>
&lt;blockquote>
&lt;p>A Review of Time-Scale Modification of Music Signals.&lt;br>
— &lt;cite>Jonathan Driedger and Meinard Müller&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup>&lt;/cite>&lt;/p>
&lt;/blockquote>
&lt;h2 id="algorithm-comparison">Algorithm comparison
&lt;/h2>&lt;p>There are two main algorithms, the &lt;em>Overlap-and-add&lt;/em> (OLA) and the &lt;em>Phase Vocoder&lt;/em> (PV). Both achieve good results under different signals and conditions. For this, a final implementation using &lt;em>Harmonic Percussion Separation&lt;/em> (HPS) combines both algorithms and achiving the best results.&lt;/p>
&lt;h3 id="ola">OLA
&lt;/h3>&lt;p>This method works on time domain and overlap sections of the audio (windows) and rearange it to achive a certain desire change on speed. This method works well for percussive signals, but it introduces artifacts when used with harmonic or tonal signals.&lt;/p>
&lt;h3 id="pv">PV
&lt;/h3>&lt;p>This method works on frequency domain, and it combines chunks of audio in the frequency domain to achieve the desire change in time. This uses the phase vocoder principle to propagate the phase between the windows, this grantice the continuity of when applied to harmonic signals. On the contrary, it does not work for percussive signals becouse the phase propagation process eliminate the transients in the signals.&lt;/p>
&lt;p>I created visualizations using &lt;em>Manim&lt;/em> to enhance my class presentation. The first video demonstrates how the PV algorithm aligns windows to ensure smooth transitions in the generated signal over time. To achieve this, a Gaussian window is applied, which maintains continuity and smoothness, even at the start and end of the sequence.&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/1045495557" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;p>The second video showcases the effects of applying the PV algorithm to a signal containing transients.&lt;/p>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://player.vimeo.com/video/1045495634" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="vimeo video" webkitallowfullscreen mozallowfullscreen allowfullscreen>&lt;/iframe>
&lt;/div>
&lt;p>As predicted by theory, the transients vanish because the PV algorithm disrupts the vertical phase alignment. While these examples utilize idealized signals, they effectively demonstrate the key strengths and limitations of the algorithm.&lt;/p>
&lt;h3 id="hps">HPS
&lt;/h3>&lt;p>To use both methods with their ideal signals, the HPS algorithms is used. This algorithm separete the signal into the harmonics and the percussive parts. It works by comparing the continuty of the signal in the STFT representation and using a filter to compare vertical versus horizontal presence on the spectrogram. With a threshold, a binary mask can be define over the spectrogram to separete the percussive parts from the harmoincs sections.&lt;/p>
&lt;h2 id="results">Results
&lt;/h2>&lt;p>We succesfully implement all the algorithms and compare them, verifying the theortical contents presented on the referenca article. In the process, we develope the toolkit to use this algorithms with the python programming language. All the code is avaliable on this &lt;a class="link" href="https://github.com/MatiasDiBernardo/TSM_Toolkit" target="_blank" rel="noopener"
>repo&lt;/a>&lt;/p>
&lt;h2 id="academic-presentation">Academic Presentation
&lt;/h2>&lt;p>The study was preseented with my classmates on the &lt;em>JAAS&lt;/em> (Jornadas de Acustica, Audio y Sonido). The main ideas and conclusions were preseneted on the conference. In the following repoert there is all the details and anlysis done for this proyect (in spanish).&lt;/p>
&lt;blockquote>
&lt;p>ALGORITMOS DE MODIFICACIÓN DE ESCALA TEMPORAL.&lt;br>
— &lt;cite>Matías Di Bernardo; Matías Vereertbruhggen; Sebastían Carro &lt;sup id="fnref:2">&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref">2&lt;/a>&lt;/sup>&lt;/cite>&lt;/p>
&lt;/blockquote>
&lt;div class="footnotes" role="doc-endnotes">
&lt;hr>
&lt;ol>
&lt;li id="fn:1">
&lt;p>A Review of Time-Scale Modification of Music Signal &lt;a class="link" href="https://www.researchgate.net/publication/295082364_A_Review_of_Time-Scale_Modification_of_Music_Signals" target="_blank" rel="noopener"
>paper&lt;/a>.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:2">
&lt;p>JAAS 2023 - Algoritmos de Modificación de Escala Temporal &lt;a class="link" href="https://drive.google.com/file/d/12kPB3qBjczyx7X2XV3ZpBDo1GDO2u4qR/view?usp=sharing" target="_blank" rel="noopener"
>paper&lt;/a>.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;/ol>
&lt;/div></description></item><item><title>Comparative analysis of time-frequency transformations</title><link>https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/</link><pubDate>Fri, 11 Nov 2022 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/fourier.jpg" alt="Featured image of post Comparative analysis of time-frequency transformations" />&lt;p>This research is conducted as part of the subject &lt;em>Metodología de la Investigación&lt;/em> at UNTREF. The article aims to compare the differences between three types of time-frequency transformations:&lt;/p>
&lt;ol>
&lt;li>Fourier Transform (FT)&lt;/li>
&lt;li>Wavelet Transform (WT)&lt;/li>
&lt;li>Huang-Hilbert Transform (HHT)&lt;/li>
&lt;/ol>
&lt;p>The objective of this work is to understand the differences between these types of transformations and deepen my knowledge of signal processing.&lt;/p>
&lt;h2 id="objective">Objective
&lt;/h2>&lt;p>The general objective of the research is to determine which spectral analysis tool achieves the highest accuracy in pitch detection tasks.&lt;/p>
&lt;p>To achieve this objective, the following specific objectives are proposed:&lt;/p>
&lt;ul>
&lt;li>Identify the parameters needed to represent the signal in the spectral domain for each case.&lt;/li>
&lt;li>Select an algorithm that identifies the pitch of the signal based on its spectral representation.&lt;/li>
&lt;li>Generate the data (audio signals) to be used for the comparison.&lt;/li>
&lt;li>Evaluate the generated data with the different analysis methods and apply statistical processes to validate the results.&lt;/li>
&lt;li>Establish a measure of accuracy for the pitch detection task.&lt;/li>
&lt;li>Compare the results of the different analyses and determine which method achieves the highest accuracy in pitch detection.&lt;/li>
&lt;/ul>
&lt;p>The pitch detection task was chosen because it is one of the main applications of these types of transformations.&lt;/p>
&lt;h2 id="algorithms">Algorithms
&lt;/h2>&lt;p>The theoretical analysis of all the transformations is performed in the continuous domain, but to conduct the experiments and comparisons, the discrete domain is used, enabling all calculations to be performed digitally.&lt;/p>
&lt;h3 id="fft">FFT
&lt;/h3>&lt;p>The FFT is an algorithm that optimizes the DFT (Discrete Fourier Transform). With this algorithm, the spectral representation of the signal is obtained according to Fourier analysis, which decomposes a complex signal into a sum of sines or cosines. The DFT is calculated using the formula:&lt;/p>
$$
X_k = \sum_{n=0}^{N-1} e^{-i\frac{2\pi}{N}kn} x_n
$$&lt;p>Where \( N \) is the number of signal samples, and \( k \) are natural numbers from \( 0 \) to \( N – 1 \).&lt;/p>
&lt;h3 id="wt">WT
&lt;/h3>&lt;p>The Wavelet Transform (WT) uses an oscillatory function (wavelet) and applies a convolution between the signal and the chosen wavelet function to determine whether that wave shape is present in the signal. The wavelet is stretched and scaled in frequency and amplitude, allowing a single wavelet function to recreate the entire spectrum of interest.&lt;/p>
&lt;p>In this research, the CDWT (Cyclic Discrete Wavelet Transform) will be used, the most common implementation when discretizing the WT. Conceptually, this transform extends Fourier analysis by projecting the signal onto a basis of wavelet functions instead of sines and cosines. It is calculated as follows:&lt;/p>
$$
Wf[n, a^j] = \sum_{m=0}^{N-1} f[m] \psi_j[m-n]
$$&lt;p>Where \( N \) is the number of signal samples, \( \psi \) is the wavelet function, and \( j \) represents the deformation of the wavelet according to the selected wavelet bank.&lt;/p>
&lt;h3 id="hht">HHT
&lt;/h3>&lt;p>Lastly, the Huang-Hilbert Transform (HHT) will be used for spectral representation. It employs a method called Empirical Mode Decomposition (EMD) to decompose the signal into subsignals that contain the relevant information of the original function.&lt;/p>
&lt;p>Like the previous analysis methods, the key part of the analysis is the decomposition of the signal into simpler signals. However, instead of sine or wavelet functions, EMD finds intrinsic mode functions (IMFs) that form the basis of our decomposition and are unique to each signal.&lt;/p>
&lt;p>The relationship between the IMFs and the frequency of the original signal is established with the equation:&lt;/p>
$$
z(t) = f(t) + i H\{ f(t) \}
$$&lt;p>Where \( f(t) \) is an IMF of the original signal, and \( H \) is the Hilbert Transform. This allows the IMF to be represented as a complex signal by projecting it onto the imaginary axis using the Hilbert Transform.&lt;/p>
&lt;p>Thus, the IMF is represented as a complex signal, and the amplitude and phase of each moment can be extracted to construct the spectral representation. Since a signal generally has multiple IMFs, this process is repeated for all of them, and the results are summed to obtain the complete spectrum.&lt;/p>
&lt;h2 id="procedure">Procedure
&lt;/h2>&lt;p>This research analyzes the relationship between types of spectral representation and accuracy in pitch detection.&lt;/p>
&lt;p>First, the parameters for the different transformations will be selected. Among the most critical parameters to determine is the number of samples for temporal windowing, as it determines the trade-off between temporal and frequency resolution.&lt;/p>
&lt;p>To ensure a fair comparison among the methods, data representing various cases of interest will be generated, including four types of signals:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Monophonic&lt;/strong>: Signals with a single note corresponding to \( F_0 \).&lt;/li>
&lt;li>&lt;strong>Polyphonic&lt;/strong>: Signals with multiple notes where harmony determines \( F_0 \).&lt;/li>
&lt;li>&lt;strong>Slow Transitions&lt;/strong>: Signals with gradual changes in \( F_0 \).&lt;/li>
&lt;li>&lt;strong>Fast Transitions&lt;/strong>: Signals with abrupt changes in \( F_0 \).&lt;/li>
&lt;/ul>
&lt;p>The real value \( V(t) \) will be compared to the result \( P(t) \) from each transform, integrating the difference over time to calculate the accuracy.&lt;/p>
&lt;h2 id="results">Results
&lt;/h2>&lt;p>At this stage, the task was to complete the research plan detailing the procedure and analysis methods. Dummy data was generated and statistically validated to simulate expected results.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/res.PNG"
width="834"
height="550"
srcset="https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/res_hu8387233291062647437.PNG 480w, https://dibernardo.netlify.app/p/comparative-analysis-of-time-frequency-transformations/res_hu2809804783985204141.PNG 1024w"
loading="lazy"
alt="Graph showing the precision of each transform according to the type of signal analyzed"
class="gallery-image"
data-flex-grow="151"
data-flex-basis="363px"
>&lt;/p>
&lt;p>The graph compares the precision achieved by the three transformations for different signal types. Based on the properties of the transforms, the Wavelet Transform (WT) is expected to outperform the Fourier Transform (FT), and the Huang-Hilbert Transform (HHT) is expected to achieve the highest precision overall.&lt;/p>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>In pitch detection tasks using spectral analysis, the Huang-Hilbert Transform (HHT) generally provides higher precision than the Fast Fourier Transform (FFT) and the Cyclic Discrete Wavelet Transform (CDWT).&lt;/p>
&lt;p>The significance of this precision gain depends on the type of signal being analyzed, with fast-transition signals benefiting the least from the transformation change, while polyphonic signals show the most significant improvement when using the HHT.&lt;/p>
&lt;p>This project allowed me to deepen my understanding of signal processing and grasp the foundations of why tools like the WT and HHT are used based on the characteristics of the signal being analyzed.&lt;/p>
&lt;p>All details of this work are available in the following &lt;a class="link" href="https://drive.google.com/file/d/1G5kasP3BzZPVuxrXArHM72pUVlkN9b2Q/view?usp=sharing" target="_blank" rel="noopener"
>report&lt;/a>.&lt;/p></description></item><item><title>Evaluation of different models for Speaker Diarization task</title><link>https://dibernardo.netlify.app/p/evaluation-of-different-models-for-speaker-diarization-task/</link><pubDate>Fri, 04 Nov 2022 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/evaluation-of-different-models-for-speaker-diarization-task/</guid><description>&lt;p>This project started as the final assignment for a seminar class at UNTREF called &lt;em>Seminario en Aplicaciones de Redes Neuronales en la recuperación de información musical&lt;/em>. The objective was to use a Siamese Neural Network (SNN) in a different context than the one explored in class (music similarity detection).&lt;/p>
&lt;p>For the final project of this course, we developed an SNN model from scratch using the &lt;em>Keras&lt;/em> framework and the &lt;em>SincNet&lt;/em> architecture to reduce audio dimensionality, achieving good results. Later, to expand this project, I tried another approach by using &lt;em>Wav2Vec&lt;/em> for dimensionality reduction and re-implementing the entire project in the &lt;em>PyTorch&lt;/em> framework. This attempt, however, yielded suboptimal results, indicating that the dimensionality reduction using Wav2Vec lost critical information required for the speaker diarization task.&lt;/p>
&lt;h2 id="speaker-diarization-task">Speaker Diarization Task
&lt;/h2>&lt;p>The goal of a speaker diarization model is to identify different speakers in an audio stream containing multiple speakers. For example, in a podcast with two people (A and B), the model must determine the time steps where speaker A is talking and the time steps where speaker B is speaking (and implicitly identify the periods of silence). These models are incredibly useful for audio editing and analyzing long audio sequences with multiple speakers.&lt;/p>
&lt;h2 id="why-siamese-neural-networks">Why Siamese Neural Networks?
&lt;/h2>&lt;p>In class, we explored the Siamese architecture to compare similarities between pieces of music, developing a tool capable of identifying covers of famous songs.&lt;/p>
&lt;p>A Siamese Neural Network consists of two or more identical subnetworks sharing the same weights and parameters. It is designed to compare input pairs and measure their similarity, typically using a distance metric like Euclidean distance. Each subnetwork processes one input, and the outputs are combined to compute a similarity score.&lt;/p>
&lt;p>With this similarity comparison in mind, we wanted to apply these networks to the speaker diarization task. The idea was to generate speaker embeddings from audio using a pre-trained model and compare the outputs of different audio segments. Based on the similarity score, we aimed to identify the segments where different speakers are talking.&lt;/p>
&lt;h2 id="experiments">Experiments
&lt;/h2>&lt;p>I tested two different methods for audio feature extraction to serve as speaker embeddings.&lt;/p>
&lt;h3 id="keras-implementation-with-sincnet">Keras Implementation with SincNet
&lt;/h3>&lt;p>In this approach, we used the SincNet architecture to extract speaker-specific features from audio. SincNet applies learnable sinc functions as its filters, which are particularly well-suited for audio processing as they mimic traditional bandpass filters. These features were then fed into the Siamese Neural Network, which compared pairs of audio segments to calculate their similarity scores. The model was trained on labeled audio datasets, and we observed strong performance in clustering audio segments by speaker, achieving clear boundaries between different speakers.&lt;/p>
&lt;p>A report with the results can be found in the following &lt;a class="link" href="https://github.com/MatiasDiBernardo/Speaker-Diarization-with-SNN/blob/master/TP%20Final%20Seminario%20Redes%20-%20Di%20Bernardo%20Ferreyra.ipynb" target="_blank" rel="noopener"
>Jupyter notebook&lt;/a> (in Spanish).&lt;/p>
&lt;h3 id="pytorch-implementation-with-wav2vec">PyTorch Implementation with Wav2Vec
&lt;/h3>&lt;p>For this method, I utilized Wav2Vec, a powerful pre-trained model for extracting deep audio embeddings. Unlike SincNet, Wav2Vec embeddings are derived from self-supervised learning, capturing high-level representations of audio. These embeddings were used in the Siamese Neural Network for similarity comparisons. However, the results were suboptimal for the diarization task. It appears that Wav2Vec, while excellent for speech recognition tasks, lost some speaker-specific details necessary for distinguishing between speakers in our setup.&lt;/p>
&lt;h2 id="results">Results
&lt;/h2>&lt;p>The experiments demonstrated that the choice of feature extraction method is crucial for speaker diarization. The Keras implementation with SincNet outperformed the PyTorch implementation with Wav2Vec, showing higher accuracy in identifying speaker transitions. This suggests that task-specific feature extraction, like SincNet, is more effective than general-purpose embeddings like Wav2Vec for speaker diarization.&lt;/p>
&lt;p>The code for this project is available in this &lt;a class="link" href="https://github.com/MatiasDiBernardo/Speaker-Diarization-with-SNN" target="_blank" rel="noopener"
>repository&lt;/a>.&lt;/p>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>This project was one of my first experiences with deep learning models, where I applied my knowledge to a problem without following a specific paper or using a pre-trained model. I explored different solutions and concluded on the importance of feature extraction and model selection.&lt;/p>
&lt;p>It also helped me become familiar with the syntax of the most popular deep learning frameworks and solidified my understanding in the process.&lt;/p></description></item><item><title>Theather Acoustic Design</title><link>https://dibernardo.netlify.app/p/theather-acoustic-design/</link><pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/p/theather-acoustic-design/</guid><description>&lt;img src="https://dibernardo.netlify.app/p/theather-acoustic-design/front.PNG" alt="Featured image of post Theather Acoustic Design" />&lt;p>This project is the final assignment for the class &lt;em>Acoustics and Psychoacoustics II&lt;/em>, where we were tasked with redesigning an existing auditorium. The goal was to apply the theory covered in class to create an acoustically optimized auditorium. For our project, we chose to redesign the Royal Albert Hall in London. This was particularly challenging due to the auditorium&amp;rsquo;s vast dimensions, which make it difficult to ensure that sound reaches all spectators equally.&lt;/p>
&lt;h2 id="redesign-main-ideas">Redesign Main Ideas
&lt;/h2>&lt;p>The redesign aimed to preserve the original concept of the auditorium, including its large volume and extensive seating capacity, while introducing critical changes to improve its acoustics. Although the primary focus was on acoustic enhancement, the redesign also considered other essential factors, such as sightlines and appropriate seat distribution.&lt;/p>
&lt;p>Despite the intent to maintain the auditorium&amp;rsquo;s original dimensions, its volume proved too large to achieve an optimal reverberation time. To address this, the redesign introduced an intermediate ceiling to reduce the spherical ceiling&amp;rsquo;s volume, and the main seating area was reduced. These changes helped create a better reverberation time in the room, as illustrated in the cross-section below.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/theather-acoustic-design/cross_section.PNG"
width="1324"
height="506"
srcset="https://dibernardo.netlify.app/p/theather-acoustic-design/cross_section_hu8201639409724213049.PNG 480w, https://dibernardo.netlify.app/p/theather-acoustic-design/cross_section_hu5610852418196906417.PNG 1024w"
loading="lazy"
alt="Cross section of the auditorium redesign"
class="gallery-image"
data-flex-grow="261"
data-flex-basis="627px"
>&lt;/p>
&lt;h2 id="building-details-and-regulations">Building Details and Regulations
&lt;/h2>&lt;p>To ensure a feasible and functional redesign, the following key aspects were carefully considered:&lt;/p>
&lt;ul>
&lt;li>Seat distribution&lt;/li>
&lt;li>Corridor spacing&lt;/li>
&lt;li>Sightline optimization&lt;/li>
&lt;li>Stage comfort&lt;/li>
&lt;/ul>
&lt;h2 id="acoustic-treatment">Acoustic Treatment
&lt;/h2>&lt;p>Acoustic treatment was the most critical part of this study and focused on two main aspects: reflections and reverberation time.&lt;/p>
&lt;h3 id="reflections">Reflections
&lt;/h3>&lt;p>Analyzing reflections is essential for the audience&amp;rsquo;s acoustic experience. The original Royal Albert Hall features a spherical ceiling that centralizes reflections, creating undesirable acoustic effects. To mitigate this, the redesign incorporated an intermediate ceiling with a specific geometry designed to distribute reflections evenly across the audience.&lt;/p>
&lt;p>The staggered ceiling design ensures adequate reflections for all seating rows. In the main balcony, two reflections were specifically addressed to compensate for the lower sound pressure level (SPL) caused by the large distance from the stage, as shown in the image below.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/theather-acoustic-design/balcony_cel_ref.PNG"
width="1136"
height="462"
srcset="https://dibernardo.netlify.app/p/theather-acoustic-design/balcony_cel_ref_hu8173242411301837287.PNG 480w, https://dibernardo.netlify.app/p/theather-acoustic-design/balcony_cel_ref_hu890172879033338586.PNG 1024w"
loading="lazy"
alt="Balcony ceiling reflections"
class="gallery-image"
data-flex-grow="245"
data-flex-basis="590px"
>&lt;/p>
&lt;p>Lateral reflections were also optimized through adjustments to the stage geometry and the walls of the lateral balconies.&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/theather-acoustic-design/lateral_ref.PNG"
width="642"
height="521"
srcset="https://dibernardo.netlify.app/p/theather-acoustic-design/lateral_ref_hu2629534869006446785.PNG 480w, https://dibernardo.netlify.app/p/theather-acoustic-design/lateral_ref_hu11386676131120321573.PNG 1024w"
loading="lazy"
alt="Lateral reflections on the main audience"
class="gallery-image"
data-flex-grow="123"
data-flex-basis="295px"
>&lt;/p>
&lt;p>Additionally, the redesign sought to minimize the Initial Time Delay Gap (ITDG) across different audience locations.&lt;/p>
&lt;h3 id="materials-and-reverberation-time">Materials and Reverberation Time
&lt;/h3>&lt;p>The redesign adhered to recommendations from &lt;em>Acoustic Absorbers and Diffusers&lt;/em> to achieve a balance between absorption, diffusion, and specular reflections. Reflective materials were used for the ceiling and parts of the lateral balconies to ensure effective specular reflections. To lower the reverberation time (RT), materials with higher absorption coefficients were applied to other surfaces.&lt;/p>
&lt;p>Using the selected materials and the Sabine equation, we calculated the auditorium&amp;rsquo;s estimated RT. The resulting reverberation time for different frequencies is shown below:&lt;/p>
&lt;p>&lt;img src="https://dibernardo.netlify.app/p/theather-acoustic-design/rt.PNG"
width="848"
height="644"
srcset="https://dibernardo.netlify.app/p/theather-acoustic-design/rt_hu5951076229482181811.PNG 480w, https://dibernardo.netlify.app/p/theather-acoustic-design/rt_hu15811556200730072255.PNG 1024w"
loading="lazy"
alt="Reverberation time per frequency"
class="gallery-image"
data-flex-grow="131"
data-flex-basis="316px"
>&lt;/p>
&lt;p>The calculated mid-frequency RT is 2.51 seconds. While this is slightly above the recommended maximum of 2.4 seconds for optimal acoustics, it is acceptable given the auditorium&amp;rsquo;s large volume.&lt;/p>
&lt;h2 id="3d-modelling">3D Modelling
&lt;/h2>&lt;p>We rendered the redesigned auditorium using &lt;em>SketchUp&lt;/em> software. Below are some of the visualizations:&lt;/p>
&lt;div id="carousel0" class="carousel" duration="70000">
&lt;ul>
&lt;li id="c0_slide1" style="min-width: calc(100%/1); padding-bottom: 450px;">&lt;img src="https://dibernardo.netlify.app/images/royal/r1.PNG" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide2" style="min-width: calc(100%/1); padding-bottom: 450px;">&lt;img src="https://dibernardo.netlify.app/images/royal/r2.PNG" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide3" style="min-width: calc(100%/1); padding-bottom: 450px;">&lt;img src="https://dibernardo.netlify.app/images/royal/r3.PNG" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;li id="c0_slide4" style="min-width: calc(100%/1); padding-bottom: 450px;">&lt;img src="https://dibernardo.netlify.app/images/royal/r4.PNG" alt="" />&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>&lt;a href="#c0_slide1">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide2">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide3">&lt;/a>&lt;/li>
&lt;li>&lt;a href="#c0_slide4">&lt;/a>&lt;/li>
&lt;/ol>
&lt;div class="prev">&amp;lsaquo;&lt;/div>
&lt;div class="next">&amp;rsaquo;&lt;/div>
&lt;/div>
&lt;h2 id="conclusions">Conclusions
&lt;/h2>&lt;p>Redesigning the Royal Albert Hall to improve its acoustics while retaining its original essence presented significant challenges. The project required innovative solutions to address acoustic issues without compromising the hall&amp;rsquo;s iconic design. Although some changes were necessary, the final result demonstrates a thoughtful redesign that enhances acoustics while preserving the auditorium&amp;rsquo;s historical character. This project also deepened our understanding of acoustics and auditorium design principles.&lt;/p>
&lt;p>A detailed description of this project can be found in the following &lt;a class="link" href="https://drive.google.com/file/d/1CkX-t_gx2s_YlKbrjB-5IK_dmZIkpJrd/view?usp=sharing" target="_blank" rel="noopener"
>article&lt;/a>.&lt;/p></description></item><item><title>About me</title><link>https://dibernardo.netlify.app/about-me/</link><pubDate>Fri, 18 Feb 2022 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/about-me/</guid><description>&lt;h2 id="bio">Bio
&lt;/h2>&lt;p>I am completing a double major in Sound Engineering and Computer Engineering at the National University of Tres de Febrero (UNTREF). I am currently in my final year of the Sound Engineering program and concurrently finishing my studies in Computer Engineering. As CTO of the research group Intercambios Transorgánicos, I lead the development of voice-synthesis technologies tailored to the Argentine (Rioplatense) accent, coordinating everything from data collection and acoustic measurement to model development and deployment.&lt;/p>
&lt;p>My work sits at the intersection of digital signal processing and deep learning applied to speech: I design and implement pipelines that combine classical DSP techniques with modern neural approaches to improve robustness and naturalness in TTS systems. I enjoy bridging the methodological rigor of acoustics with practical software engineering, and I focus on reproducible, data-driven solutions that are sensitive to regional phonetic and prosodic characteristics. I am especially interested in scalable methods for dataset creation, automated cleaning, and model fine-tuning that reduce annotation effort while preserving linguistic and acoustic diversity.&lt;/p>
&lt;h2 id="why-i-started-this-blog">Why I started this blog?
&lt;/h2>&lt;p>Many of the projects I’ve started in the past have either fizzled out or ended abruptly. A blog, however, is an excellent way to stay organized and get the most out of my work.&lt;/p>
&lt;p>Additionally, documenting my projects here allows me to keep track of my progress and serves as a useful reference for future endeavours. For now, the blog will primarily focus on tech and science topics, but I’m open to expanding into other areas in the future.&lt;/p>
&lt;h2 id="best-reference-books">Best reference books?
&lt;/h2>&lt;p>As a bonus, here are some of the books that have been most helpful to me across different topics:&lt;/p>
&lt;ul>
&lt;li>Acoustics: Sound Fields, Transducers and Vibration (2nd Edition) by Leo Beranek&lt;/li>
&lt;li>Fundamental of Music Processing by Meinard Müller&lt;/li>
&lt;li>Deep Learning by Ian Goodfellow&lt;/li>
&lt;li>Fundations of Signal Processing by Martin Vetterli&lt;/li>
&lt;/ul>
&lt;p>These are some of my favorites, and I highly recommend them!&lt;/p></description></item><item><title>Archives</title><link>https://dibernardo.netlify.app/archives/</link><pubDate>Tue, 28 May 2019 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/archives/</guid><description/></item><item><title>Search</title><link>https://dibernardo.netlify.app/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dibernardo.netlify.app/search/</guid><description/></item></channel></rss>