<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by followCrom on Medium]]></title>
        <description><![CDATA[Stories by followCrom on Medium]]></description>
        <link>https://medium.com/@followcrom?source=rss-a0b23a5bef36------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ptQhaYR4HMwATaiQYkA7SQ.png</url>
            <title>Stories by followCrom on Medium</title>
            <link>https://medium.com/@followcrom?source=rss-a0b23a5bef36------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:28:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@followcrom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Since Records Began]]></title>
            <link>https://medium.com/@followcrom/vinyl-grooves-to-digital-waves-fe0b8a683101?source=rss-a0b23a5bef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe0b8a683101</guid>
            <category><![CDATA[20th-century-music]]></category>
            <category><![CDATA[sound-recording]]></category>
            <category><![CDATA[dj]]></category>
            <category><![CDATA[audio-formats]]></category>
            <category><![CDATA[streaming-music]]></category>
            <dc:creator><![CDATA[followCrom]]></dc:creator>
            <pubDate>Mon, 01 Jan 2024 20:08:21 GMT</pubDate>
            <atom:updated>2026-01-17T15:40:59.308Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>💥How Changing Formats Shaped DJing 🎧</h3><figure><img alt="An old school DJ performs for a crowd in a ballroom" src="https://cdn-images-1.medium.com/max/1024/1*GhcvVX_c6rYPaKNaxAC9Hg.png" /></figure><p>A great DJ 🏆is two things:</p><p>🗃️ <strong>a Selektah</strong>: plays the right tunes, and</p><p>🎛️ <strong>an Operator</strong>: mixes smoothly between those tunes.</p><p>(🕒 You’d be surprised how far showing-up will get you too!)</p><p>So a DJ’s music collection is paramount. ⛰️ Some famous DJs have more flexibility in their music selection, but most need to have the tunes a crowd wants to hear.</p><p>Over the course of a 20-year DJ career, my music collection has shifted from crates of vinyl 𖣐, to wallets of CDs, to a hard drive full of mp3s. I owned them all and could use them at my discretion.</p><figure><img alt="Crate digging" src="https://cdn-images-1.medium.com/max/1024/1*AvQ71rqc-DtFBqJVCk4RVQ.png" /><figcaption>Digging in the crates</figcaption></figure><p>But many of us have moved from ownership to subscription. We don’t own the music we listen to any more, and if we stop subscribing, we can no longer access it. 🔓</p><p>This is significant for DJs. What digital streaming platforms (DSPs) connect to a serious DJ set-up? I’ve seen Beatport and Tidal access, but not Amazon Music or Spotify. SoundCloud? Sure, if you only want to play copyright-free tracks.</p><p>What happens to a DJ’s library if a DSP shuts down or removes certain tracks? Established DJs still buy their music - or get serviced with promos - but what about the nu-skool crew? Are they even in the habit of buying music? The charts suggest otherwise. 📉</p><p>Comedian John Robins has a bit in his <em>Howl</em> show about being grateful for the things we often take for granted. To distract himself from life’s daily annoyances, he decides to listen to some music. “What music have you got on your phone John?”, he muses. “<strong>All music!</strong>”</p><p>As a veteran club DJ, I know that when punters approach the DJ booth with a request, they expect the DJ to have <em>all music </em>♪. We’re accustomed to having all recorded music available to us, all of the time, and at the swipe of a finger.</p><figure><img alt="Making a request at the DJ booth" src="https://cdn-images-1.medium.com/max/1024/1*yvqcq28vcaVC4bXnfc8T7A.png" /><figcaption>“No DJ is ever pumped to see a rando approaching.” - Mark Ronson</figcaption></figure><h3>🎙️ <strong>A Brief History of Recorded Sound</strong></h3><p>It wasn’t that long ago that if you wanted to hear music, it had to be performed live. Sheet music was sold, but only became sound when somebody played it.</p><p><strong>19th century</strong><br>Sound was first recorded in 1877, when Thomas Edison captured the words “Mary had a little lamb” on a Phonograph; a tinfoil-covered cylinder with two needles. (One needle was for recording, the other for playback.)</p><p>In 1887, Emile Berliner invented the Gramophone, which recorded onto flat disks rather than cylinders. One of his early recordings was ‘Twinkle, Twinkle Little Star’. It was a pretty limited selection at this point, and these early examples were barely audible, and short, as recording time was limited.</p><p>However, in a clear demonstration of demand, both formats were quickly marketed. 💰 Tinfoil-covered cylinders were replaced by wax cylinders and sold. Flat discs came in two varieties: a 7-inch disc which could hold about three minutes of sound, and 10-inch version which held four minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xlq0ArV01DxgvgBoiBS-0Q.png" /></figure><p>As well as music, early customers bought speeches from notable public figures, comedy sketches 🥸, or readings from literary works. Due to the time limitations however, these were often abbreviated versions of longer pieces.</p><p><strong>20th century</strong><br>Even today, recording time is limited by disc size. 12-inch discs can only hold about 20–25 minutes of audio per side because of the density of the grooves that can be cut into it. The longer the recording, the closer together the grooves are, and the lower the sound quality.</p><p>🖭 Magnetic tape allowed for longer recordings, but wasn’t widely used until the end of World War II, as it was a German invention and kept secret from the Allies until 1945.</p><p><strong>1950s</strong><br>Magnetic tape ruled the 1950s, but this was far from the end for the disc. The change from shellac to polyvinyl plastic in disc manufacture saw an improvement in the durability and quality of records. In 1949, RCA released the first commercial seven-inch single - Eddy Arnold’s <em>Texarkana Baby</em>. The 45rpm 7-inch single wasn’t just a technological innovation; by the late 1950s it became a symbol of a cultural revolution, coinciding with the birth of rock ‘n’ roll 🕺 and (not coincidentally given the size of the disc) the 3-minute pop song. 💃</p><figure><img alt="1950s teenagers" src="https://cdn-images-1.medium.com/max/1024/1*QBKSA-l4jUkGYYW1Ym28Nw.png" /></figure><p><strong>1960s </strong><br>In 1962, Philips introduced the first compact audio cassette ◁ || ▷, which recorded onto 1/8-inch tape. This brought portability and convenience to the tape format, and within a decade, cassettes dominated the consumer market. Later combined with Sony’s Walkman, the ways we could access music changed too.</p><p><strong>1980s</strong><br>The first all-digital music album (Ry Cooder’s <em>Bop Til You Drop</em>) was released in 1979, and the 80s were the era of the compact disc. 📀 Initially marketed as indestructible, people soon realised that wasn’t the case, but did enjoy instantly skipping between tracks and the improved sound quality.</p><p><strong>Present<br></strong>Fast forward to the present day and digital remains the standard, but the methods of distribution have changed dramatically. DSPs have democratized access to an unprecedented variety of music, and an immense library of tracks is now just a click away. 🖱️</p><p>However, for DJs this convenience comes with a trade-off. The shift from owning physical copies to accessing music via subscriptions means DJs have less control over their collections. If a streaming service removes a track, or if a DJ ends their subscription, access to that music is lost. This lack of ownership could be problematic for a serious <em>selectah</em>.</p><figure><img alt="An anxious DJ" src="https://cdn-images-1.medium.com/max/1024/1*6NLOXjAaDDoaHFPnS2x8gQ.png" /></figure><p>My own music collection ranges from the 1920s to about 2018 when, no longer able to ignore the advantages, I committed DJ sacrilege and subscribed to a DSP.</p><p><strong>One more tune!</strong><br>As is evident here, sound recording is constantly evolving. Formats come and go and we don’t want to get stuck in any era, no matter how fondly we romanticize that period 🎀. So, to all you crate diggers, vinyl purists, patch designers, and digital pioneers, remember… it’s all about the music! 🎵</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe0b8a683101" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Books, Bytes, and Daily Insights]]></title>
            <link>https://medium.com/@followcrom/books-bytes-and-daily-insights-c22a4e169b10?source=rss-a0b23a5bef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/c22a4e169b10</guid>
            <category><![CDATA[vocabulary-expansion]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[mailing-lists]]></category>
            <dc:creator><![CDATA[followCrom]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 14:29:13 GMT</pubDate>
            <atom:updated>2025-10-15T03:53:52.016Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>⚡A Python-Powered Word of the Week Email 📩</h3><figure><img alt="A colourful, retro science fiction style image of a mail man on a fast-moving, floating hover board." src="https://cdn-images-1.medium.com/max/968/1*08UKVtpjtFVs5vKMo1RFOA.jpeg" /><figcaption>Word of the Week delivery</figcaption></figure><blockquote>“A reader lives a thousand lives. The person who never reads lives only one.” — George R. R. Martin</blockquote><p>It’s a familiar tale. I read books as a child (The Famous Five, Nancy Drew, etc.) but during my teenage years my reading habit faded. It became a chore, a requirement for school, where the books imposed on us by the curriculum lacked the adventure of my childhood favourites. Add hormones and puberty to the mix, and reading was shelved for a number of years.</p><p>I was 18 before I began to appreciate it again. At university I picked up David Mamet’s <em>On Directing Film</em>, and the pleasures of reading were reignited🌟. I soon found myself looking forward to the moment I could return to the books waiting on my bedside table 📚 and immerse myself in the worlds they created.</p><blockquote>“Reading is like travel, allowing you to exit your own life for a bit, and to come back with a renewed, even inspired, perspective.” — Laurie Helgoe</blockquote><p>I have read consistently since then, and make a habit of highlighting passages of interest. Initially, I cataloged these excerpts in a blog, but I wanted a more interactive platform for these insights, so I developed the <a href="https://play.google.com/store/apps/dev?id=5317464024462469704">Ran</a><a href="https://play.google.com/store/apps/dev?id=5317464024462469704">DOM</a><a href="https://play.google.com/store/apps/dev?id=5317464024462469704"> WisDOM Android app</a>. 📱 The app serves as a portable, searchable database of the knowledge and inspiration I’ve picked up from the books I’ve read.</p><figure><img alt="Screenshot from the ‘Random Wisdom’ Android app" src="https://cdn-images-1.medium.com/max/1024/1*fNMoJ6cVvak-EBKXFLp7pA.png" /><figcaption>RanDOM WisDOM Android app</figcaption></figure><p>Alongside the memorable excerpts, I also began noting words that were unfamiliar to me. This practice turned into a project of its own, culminating in a comprehensive word list, complete with definitions and example sentences.</p><p>But how to make the most of this collection? I wanted a way to regularly engage with these words, without scrolling blindly through a csv file. I know, a <em>Word of the Week</em> email! 🧠 I wrote a Python script to randomly select a word from my list, and share it, complete with its definition and an example sentence, with subscribers via email. Here is the Python to do just that:</p><pre>import pandas as pd<br>import smtplib<br>from email.mime.text import MIMEText<br>import datetime<br>import os<br><br># Read the CSV file into a Pandas DataFrame<br>words_df = pd.read_csv(&quot;./data/complete_words.csv&quot;)<br><br># Function to get a random word and its details<br>def get_word_of_the_day(df):<br>    return df.sample().iloc[0]<br><br># Select the word of the day<br>word_of_the_day = get_word_of_the_day(words_df)<br><br># Function to format word details for a plain text email<br>def format_word_details(word_row):<br>    details = f&quot;Word of the Day: {(word_row[&#39;word&#39;]).upper()} ({word_row[&#39;word_type&#39;]})\n&quot;<br>    details += f&quot;Definition: {word_row[&#39;definition&#39;]}\n&quot;<br>    details += f&quot;Example: {word_row[&#39;examples&#39;]}\n&quot;<br>    return details<br><br># Format the word of the day into email body<br>word_details = format_word_details(word_of_the_day)<br><br># Function to send email with the word of the day<br>def send_email(word_details):<br>    fromaddr = os.getenv(&quot;EMAIL_ACCOUNT&quot;)<br>    toaddr = os.getenv(&quot;EMAIL_LIST&quot;).split(&quot;,&quot;)<br><br>    # Create the MIMEText object<br>    msg = MIMEText(word_details, &quot;plain&quot;)<br><br>    # Set email headers<br>    msg[&quot;From&quot;] = fromaddr<br>    msg[&quot;To&quot;] = &quot;, &quot;.join(toaddr)<br>    msg[&quot;Subject&quot;] = f&quot;Word of the Day for {datetime.datetime.now().strftime(&#39;%Y-%m-%d&#39;)}&quot;<br><br>    # Email from a Gmail account with the necessary permissions<br>    try:<br>        server = smtplib.SMTP(&quot;smtp.gmail.com&quot;, 587)<br>        server.starttls()<br>        server.login(fromaddr, os.getenv(&quot;EMAIL_PASSWORD&quot;))<br>        server.sendmail(fromaddr, toaddr, msg.as_string())<br>        server.quit()<br>        print(&quot;Email sent successfully&quot;)<br>    except smtplib.SMTPException as e:<br>        print(f&quot;Failed to send email: {e}&quot;)<br><br># Send the email with the word of the day<br>send_email(word_details)</pre><p>GitHub is a key part of the workflow. 🚀First, I pushed both the Python script and the CSV file containing the vocabulary list to a remote repository. Next, I used GitHub Actions to schedule a cron job. The job is configured to automatically trigger the above script every weekday at 18:00 UTC. Below is the YAML that triggers the action (please note that any sensitive information is saved as a repository secret):</p><pre>name: Word of the Day<br><br>on:<br>  schedule:<br>    # This schedule triggers the workflow every weekday at 6PM UTC<br>    - cron: &quot;0 18 * * 1-5&quot;<br><br>jobs:<br>  send-email:<br>    runs-on: ubuntu-latest # Specifies the runner environment to be the latest version of Ubuntu<br><br>    steps:<br>      - name: Check out the repository<br>        uses: actions/checkout@v3<br>        # Checks out your repository under $GITHUB_WORKSPACE, so the workflow can access it<br><br>      - name: Set up Python<br>        uses: actions/setup-python@v4<br>        with:<br>          python-version: &quot;3.x&quot;<br><br>      - name: Install dependencies<br>        run: pip install -r requirements.txt<br>        # Installs the dependencies listed in your requirements.txt file<br><br>      - name: Run the email script<br>        run: python word_of_the_day.py<br>        env:<br>          GMAIL_ACCOUNT: ${{ secrets.GMAIL_ACCOUNT }}<br>          GMAIL_PASSWORD: ${{ secrets.GMAIL_PASSWORD }}<br>          EMAIL_LIST: ${{ secrets.EMAIL_LIST }}<br>        # This step runs the Python script to send the Word of the Day email<br>        # It uses secrets to securely pass sensitive information like Gmail account details and email list</pre><p>You made it to the end! Seems like we’re both readers.😉 If you would like to receive a word of the day email, please <a href="https://followcrom.com/wotd/">sign up here</a>. 📨</p><p>💾 <a href="https://github.com/followcrom/word-of-the-day">Visit the GitHub repo</a> for all the resources.</p><p>🤝 <a href="https://followcrom.com/contact/contact.php">Get in touch</a>, I’d love to hear from you.</p><blockquote>“Reading is the sole means by which we slip, involuntarily, often helplessly, into another’s skin; another’s voice; another’s soul … to enter a consciousness not known to us.” — Joyce Carol Oates</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c22a4e169b10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mixtape Heavyweight]]></title>
            <link>https://medium.com/@followcrom/mixtape-heavyweight-259444d11ca9?source=rss-a0b23a5bef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/259444d11ca9</guid>
            <category><![CDATA[web-audio-api]]></category>
            <category><![CDATA[web-audio-player]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[dj]]></category>
            <category><![CDATA[streaming-music]]></category>
            <dc:creator><![CDATA[followCrom]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 18:43:37 GMT</pubDate>
            <atom:updated>2024-10-03T22:28:34.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>MixTape HeavyWeight</h3><p>With a bit of JavaScript magic, it’s possible to make a good-looking, user-friendly audio player that updates track names, cover art, and more, enhancing listener experience. However, most of these players rely on loading a new audio file for each track, which doesn’t work well for DJ mixes which typically consist of one single, long, opaque audio file of multiple songs. I wanted an audio player for DJ mixes which plays just one audio file while updating track information onscreen so the listener knows at a glance what song the DJ is spinning!</p><p>:: <a href="https://mixtape-heavyweight.one/index.html">Try MixTape HeavyWeight</a><br>:: <a href="https://github.com/followcrom/MixTapeHeavyWeight">Visit the GitHub repo</a></p><figure><img alt="Designed as a hi-fi stacking system, the vibe is ‘old-skool’" src="https://cdn-images-1.medium.com/max/1024/1*BQZ5WIfBJqnw1VEaIz4m8w.jpeg" /><figcaption>Designed as a hi-fi stacking system, the style is ‘old-skool’</figcaption></figure><p><strong>Hi-Fi Stack 1: Tape Deck</strong><br>The top stack uses a skeuomorphic design reminiscent of a classic cassette tape. The default audio player controls are hidden and styled ones are imported from Cloudflare. JavaScript updates the central progress bar based on the current time of the audio (audio.currentTime) so know exactly where you are in the mix. You can also click on the progress bar to jump around, unlike a tape IRL!</p><figure><img alt="Hi-Fi Stack 2: Visualizer and EQ" src="https://cdn-images-1.medium.com/max/1024/1*yeEY5WZLYvTSQcg37Nz9YQ.jpeg" /></figure><p><strong>Hi-Fi Stack 2:<br>Visualizer</strong><br>The left panel is a graphical display of the audio’s frequency data. It dynamically generates a bar for each data point in the frequency range, presenting a real-time, color-coded visualization of the music.</p><p><strong>EQ</strong><br>The sliders on the right serve as low-shelf, peaking, and high-shelf filters. They boost or cut frequency ranges in the audio — bass (low frequencies), midrange, and treble (high frequencies). Leveraging the gain function from the Web Audio API makes controling the filters relatively straightforward. The bigger challenge came from the CSS, specifically creating the vertical sliders. Horizontal sliders seem to have much more display compatibility across browsers!</p><figure><img alt="Hi-Fi Stack 3: Interactive playlist" src="https://cdn-images-1.medium.com/max/1024/1*LGXKl-GOfb1EMgnP3kmvIg.jpeg" /></figure><p><strong>Hi-Fi Stack 3: Playlist<br></strong>The green text at the top of the stack’s screen displays the name of the song currently playing. An event listener activates whenever the timeupdate event is fired. Within this event listener, a loop runs through an array containing song data. It checks if audio.currentTime is greater than or equal to the start time of a particular song. If this condition is met, the displayed text (stored in the title.innerText property) is updated with the name of that song.</p><pre>audio.addEventListener(&#39;timeupdate&#39;, () =&gt; {<br>  if (audio.paused || audio.ended) {<br>    title.innerText = initialTitle;<br>  } else {<br>    syncData.forEach((item) =&gt; {<br>      if (audio.currentTime &gt;= item.start) {<br>        title.innerText = item.text;<br>      }<br>    });<br>  }<br>});</pre><figure><img alt="Hi-Fi Stack 3: Interactive playlist with hover" src="https://cdn-images-1.medium.com/max/1024/1*o7WKHzrMt_ZRtcLpXcLbWA.jpeg" /></figure><p>Adding another layer of interactivity, listeners can click on a track name to jump to that specific point in the mix. This is made possible by the clicked.dataset.time attribute, which retrieves the &#39;time&#39; value from the clicked HTML element&#39;s data- attributes. By setting audio.currentTime to this &#39;time&#39; value, playback jumps to that specific point in the audio.</p><figure><img alt="Hi-Fi Stack 4: Submit a review or read previous reviews" src="https://cdn-images-1.medium.com/max/1024/1*pTXiM_F_uB8MPz4xUbgFFQ.jpeg" /></figure><p><strong>Hi-Fi Stack 4: Feedback Stack<br></strong>The bottom stack (just above the vinyl!) allows listeners to rate and review the mixes. To prevent any interruptions to the ongoing mix, fetch API handles form submissions. This allows the form data to be sent to the server without a page reload. Uninterrupted playback is important, especially when listeners are deep in the mix!</p><p>The script below handles the form submission. An event listener triggers on submit, prevents the default form submission action, checks if a rating has been selected, and constructs the form data. It then sends the form data to the server using the Fetch API. The server&#39;s response is used to provide feedback to the user regarding the status of their submission.</p><pre>form.addEventListener(&#39;submit&#39;, (event) =&gt; {<br>  event.preventDefault(); // Prevent the default form submission behavior<br><br>  const formData = new FormData(form); // Get the form data<br><br>  let selected = false;<br>  const rating = document.getElementsByName(&quot;stars&quot;);<br>  for (let i = 0; i &lt; rating.length; i++) {<br>    if (rating[i].checked) {<br>      selected = true; // Check if a rating has been selected<br>      break;<br>    }<br>  }<br><br>  if (!selected) {<br>    reviewFeedback.innerHTML = &quot;Please select a rating.&quot;; // Provide feedback if no rating is selected<br>    return false; // Stop form submission<br>  }<br><br>  fetch(&#39;https://example.com/submit-feedback&#39;, { // Replace with the actual URL to which the form data should be sent<br>    method: &#39;POST&#39;, // Set the HTTP method to POST<br>    body: formData // Set the form data as the request body<br>  })<br>    .then(response =&gt; {<br>      if (response.ok) {<br>        reviewFeedback.innerHTML = &#39;Thanks for your review!&#39;; // Provide feedback to the user<br>      } else {<br>        reviewFeedback.innerHTML = &#39;Form submission failed.&#39;; // Provide feedback to the user<br>      }<br>    })<br>    .catch(error =&gt; {<br>      console.log(&#39;An error occurred while submitting the form:&#39;, error); // Log an error message<br>      reviewFeedback.innerHTML = `An error occurred while submitting the form: ${error.message}`; // Provide feedback to the user<br>    });<br>});</pre><p>:: <a href="https://github.com/followcrom/MixTapeHeavyWeight">Visit the GitHub repo</a> for the complete codebase. Clone all the resources and please contribute to improve the project!</p><p>If you have any questions, suggestions, or feedback, please <a href="https://followcrom.com/contact/contact.php">get in touch</a>. Your input is greatly appreciated. Thanks for reading and happy mixing!</p><p><strong>The Tech behind MixTape HeavyWeight</strong></p><ul><li>JavaScript: Responds to user actions, controls audio playback, and updates track information in real-time.</li><li>Web Audio API: Handles tasks such as audio playback control and EQ adjustments.</li><li>Canvas API: Creates the dynamic audio visualizer.</li><li>Fetch API: Enables seamless submission of user feedback by allowing form data to be sent to the server without a page reload.</li><li>HTML5: The core markup language used for structuring the webpage.</li><li>CSS3: Styles the intuitive and responsive design of the user interface.</li></ul><figure><img alt="Mixtape Heavyweight" src="https://cdn-images-1.medium.com/max/999/1*z66jT7sqi5okAd0pPFVyuA.jpeg" /><figcaption>Mixtape Heavyweight</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=259444d11ca9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Makes a Hit Song?]]></title>
            <link>https://medium.com/@followcrom/predicting-spotifys-popularity-score-256e9da26147?source=rss-a0b23a5bef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/256e9da26147</guid>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[spotipy]]></category>
            <dc:creator><![CDATA[followCrom]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 12:59:38 GMT</pubDate>
            <atom:updated>2024-03-07T09:06:34.816Z</atom:updated>
            <content:encoded><![CDATA[<h3>Do The Data Dance? (pt. 2)</h3><h3>Part 2: Training a Model to Predict Popularity.</h3><figure><img alt="An algorithm understanding what makes music popular" src="https://cdn-images-1.medium.com/max/1024/1*fK_t-bNj89EfmbaITzLelg.png" /></figure><p>The algorithm behind Spotify’s popularity score is a mystery to many musicians. In an attempt to discover what influences it ,🕵️ I trained a machine learning model to take a song’s audio features (tempo, key, loudness, etc.) as inputs, and predict its popularity (a value between 0 and 100).</p><p>Previously, I had carried out <a href="https://medium.com/@followcrom/do-the-data-dance-934fd7bb8738">EDA on Spotify’s 2021 dataset</a>. It contains information for almost 600k tracks, including numerical values for several audio features, like danceability, energy, key, loudness, tempo, valence, and more. The below heatmap visualizes a song’s popularity in relation to its audio features. Troublingly, little correlation exists between popularity and <em>any</em> of the audio features. 😟</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*TZCbdaq_0mRma0vLDuJynA.jpeg" /></figure><p>The loudness correlation coefficient shows the strongest linear relationship with popularity, but at 0.32, even that is weak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*k4NGUDLsGRMayBeFc7Cczw.jpeg" /></figure><p>Spotify say, “Popularity is calculated by algorithm and is based on the total number of plays the track has had and how recent those plays are. Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past.”</p><p>With that in mind, I introduced a new feature into my analysis: the release year of each track. In the plot below we see the average popularity of songs (blue) aligning closely with the release density per year (red). This parallel trend suggests that Spotify’s algorithm places a significant weight on the recency of a track when determining its popularity score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*kAmC0Pat8oWzMINBhZ23BA.jpeg" /></figure><p>After some feature engineering, I had a robust training dataset with more than 340,000 rows across 82 distinct columns, and a validation set with over 100,000 rows.</p><p>As my target is a continuous value, I choose Root Mean Squared Error (RMSE) as the evaluation metric. After experimenting with various liner models, Ridge regression got closest to the target variable, with a <strong>RMSE of 15.1</strong>. Ultimately, the lowest RMSE I could achieve was using a Random Forest Regressor: an <strong>RMSE of 13.6</strong>. That means, on average, my model’s predictions are about <strong>13.6% away from the actual values</strong>. Not very good ☹.</p><p>We can see how the Random Forest model is weighing each feature by running `feature_importances_`.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*0khcIqSG1MJKblEwCUOmig.jpeg" /></figure><p>Acousticness seems to be influencing the model despite its low correlation with popularity. Let’s not get too concerned though, as Lak Lakshmanan notes in <strong>Why feature weights in a machine learning model are meaningless</strong>, <em>“Feature importance is the importance within the specific model, and often does not translate to importance in real-life.”</em></p><h3>Predicting Popularity for Individual Tracks</h3><p>With my model trained on data from over 300k tracks, I wanted to evaluate it by making predictions for individual songs. The below function takes a track’s URI and returns its relevant audio features. (Please note: you’ll need a Spotify Developer account to generate user credentials for the authentication. For more on this, see the <a href="https://spotipy.readthedocs.io/en/2.22.0/#authorization-code-flow">Spotipy documentation</a>.)</p><pre>def get_single_input(uri):<br>    sp = spotipy.Spotify(auth_manager=SpotifyOAuth())<br><br>    trackid = sp.track(uri)<br>    track_info = json.dumps(trackid)<br>    tf_load = json.loads(track_info)<br><br>    rel_year = tf_load[&quot;album&quot;][&quot;release_date&quot;].split(&quot;-&quot;)[0]<br>    name = tf_load[&#39;name&#39;]<br>    artist = tf_load[&#39;artists&#39;][0][&#39;name&#39;]<br>    ex_check = tf_load[&quot;explicit&quot;]<br>    if ex_check == False:<br>        explicit = 0<br>    else:<br>        explicit = 1<br>    target_value = tf_load[&quot;popularity&quot;]<br><br>    features = sp.audio_features(uri)<br><br>    for feature in features:<br>        af_info = json.dumps(feature)<br><br>    af_load = json.loads(af_info)<br><br>    new_input = {&#39;track&#39;: name,<br>                 &#39;duration_ms&#39;: af_load[&quot;duration_ms&quot;],<br>                 &#39;explicit&#39;: explicit,<br>                 &#39;danceability&#39;: af_load[&quot;danceability&quot;],<br>                 &#39;energy&#39;: af_load[&quot;energy&quot;],<br>                 &#39;key&#39;: af_load[&quot;key&quot;],<br>                 &#39;loudness&#39;: af_load[&quot;loudness&quot;],<br>                 &#39;mode&#39;: af_load[&quot;mode&quot;],<br>                 &#39;speechiness&#39;: af_load[&quot;speechiness&quot;],<br>                 &#39;acousticness&#39;: af_load[&quot;acousticness&quot;],<br>                 &#39;instrumentalness&#39;: af_load[&quot;instrumentalness&quot;],<br>                 &#39;liveness&#39;: af_load[&quot;liveness&quot;],<br>                 &#39;valence&#39;: af_load[&quot;valence&quot;],<br>                 &#39;tempo&#39;: af_load[&quot;tempo&quot;],<br>                 &#39;time_signature&#39;: af_load[&quot;time_signature&quot;],<br>                 &#39;year&#39;: rel_year<br>                 }<br><br>    return new_input, target_value, name, artist</pre><p>We can streamline the prediction process using the predict_input<strong> </strong>function below. It requires two parameters: the model (I’ll use a Ridge and a Random Forest Regressor) and a single track’s data (single_input). First, it converts the input data into a DataFrame and applies encoding transformations to the categorical columns. It then selects the relevant columns to form the input feature set (X_input), feeds this data to the provided model, and makes a prediction rounded to the nearest integer:</p><pre>def predict_input(model, single_input):<br>    input_df = pd.DataFrame([single_input])<br>    input_df[encoded_cols] = encoder.transform(input_df[categorical_cols])<br>    X_input = input_df[numeric_cols + encoded_cols]<br>    pred = round(model.predict(X_input)[0])<br>    return pred</pre><p>Below are four examples of how the models performed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*iK0MuqfSbEESFCYP9RaqZQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*BHoTbvcglNEpzi6xJYfViA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*TxRPIeJ4R7Di0AghDuy-4w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*Ns9pYHdGGOiYym19aUJG1w.jpeg" /></figure><h3>Summary</h3><p>The results reveal a stark reality: they are, unfortunately, too imprecise to be of much use! 😲 For me though, this was more of a learning exercise than a serious tool for gauging popularity. I did learn that Spotify favor more recent tracks, and was intrigued by the correlation between loudness and popularity. There are, however, myriad other factors not captured in our dataset, like marketing and promotion, lyrical appeal, social media influence, etc. Perhaps AI music generators hold the key to unraveling the mystery! 🔮</p><h3>More on this topic:</h3><ul><li><a href="https://medium.com/@followcrom/do-the-data-dance-934fd7bb8738">Do the Data Dance Part 1: What makes a song popular?</a></li><li><a href="https://theconversation.com/can-big-data-really-predict-what-makes-a-song-popular-189052">Can big data really predict what makes a song popular?</a></li><li><a href="https://towardsdatascience.com/why-feature-weights-in-a-machine-learning-model-are-meaningless-b0cd22a4c159">Why feature weights in a machine learning model are meaningless</a></li></ul><h3>Useful links:</h3><ul><li><a href="https://www.kaggle.com/datasets/lehaknarnauli/spotify-datasets">Spotify 2021 dataset on Kaggle</a></li><li><a href="https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-features">Audio Features documentation</a></li><li><a href="https://spotipy.readthedocs.io/en/2.22.0/">SpotiPy documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=256e9da26147" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do The Data Dance? (pt. 1)]]></title>
            <link>https://medium.com/@followcrom/do-the-data-dance-934fd7bb8738?source=rss-a0b23a5bef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/934fd7bb8738</guid>
            <category><![CDATA[plotly-express]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[polar-chart]]></category>
            <dc:creator><![CDATA[followCrom]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 13:07:04 GMT</pubDate>
            <atom:updated>2024-03-07T09:02:28.697Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Part 1: What Makes a Song Popular?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DOeRQUY1VnaAKApN4OruQ.png" /><figcaption>Doing the Data Dance</figcaption></figure><p>Having spent over a decade as a nightclub DJ, I’ve often wondered 🤔: What makes a song a hit? How much do certain audio features - like tempo, key, or loudness - contribute to a song’s popularity?</p><p>To help me answer this question, I’m going to use <a href="https://www.kaggle.com/datasets/lehaknarnauli/spotify-datasets">Spotify’s 2021 dataset</a>. It contains information for almost 600k tracks, including numerical values for several audio features, like danceability, energy, key, loudness, tempo, valence, and more.</p><p>I’ll combine these with one further feature from the dataset - a <strong>popularity score </strong>between 0 and 100 (100 being the most popular). According to Spotify, “The popularity score is based on the total number of plays the track has had and how recent those plays are.”</p><p>First, let’s see what the popularity distribution is across the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*Bq2XobnBVmAL0ftvco4NLQ.jpeg" /></figure><p>The above plot is heavily skewed towards the right. This suggests that a large number of songs have low popularity, while only a very small number achieve high popularity.</p><p>Spotify have said, “Songs being played a lot now have a higher popularity than songs that were played a lot in the past”. Let’s see how closely popularity and release date correlate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*4peuOnErV_bDm0TntJSWhQ.jpeg" /></figure><p>As we might have guessed, there is a clear correlation between a song’s release date and its popularity. But what about the audio features? The heatmap below reveals that loudness has the strongest correlation with popularity, yet with a coefficient of just 0.3, this is still relatively weak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*5DAkUWR-87qdHuOv_3mpOw.jpeg" /></figure><p>Let’s create three separate DataFrames for comparison:<br>1, 100 most popular tracks<br>2, 100 least popular tracks<br>3, all tracks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*zMc5u0Y8EtZ9VI5yeh0D1g.jpeg" /></figure><p>The values I’ll plot will be the mean measurements of the numeric columns. Don’t include `popularity`, as that value has not been scaled, making it incompatible with the other measurements.</p><pre>top_features = top_100_df.mean().tolist()[1:]<br>bottom_features = bottom_100_df.mean().tolist()[1:]<br>all_features = numerics_df.mean().tolist()[1:]</pre><p>Now I’ll combine the three dfs into one polar plot.</p><pre>labels = list(bottom_100_df)[1:]<br><br>angles = np.linspace(0, 2*np.pi, len(labels), endpoint=False)<br>fig = plt.figure(figsize = (12,12))<br><br>ax = fig.add_subplot(221, polar=True)<br>ax.plot(angles, top_features, &#39;o-&#39;, linewidth=2, label = &quot;Top 100 tracks&quot;, color= &#39;blue&#39;)<br>ax.fill(angles, top_features, alpha=0.25, facecolor=&#39;blue&#39;)<br>ax.set_thetagrids(angles * 180/np.pi, labels, fontsize = 13, fontstyle=&#39;italic&#39;)<br><br>ax.set_rlabel_position(275)<br>plt.yticks([0.1 , 0.2 , 0.3 , 0.4, 0.5,  0.6, 0.7, 0.8, 0.9], [&quot;0.1&quot;,&#39;0.2&#39;, &quot;0.3&quot;, &quot;0.4&quot;, &quot;0.5&quot;, &quot;0.6&quot;, &quot;0.7&quot;, &quot;0.8&quot;, &quot;0.9&quot;  ], size=12)<br>plt.ylim(0,0.8)<br><br>ax.plot(angles, bottom_features, &#39;o-&#39;, linewidth=2, label = &quot;Bottom 100 tracks&quot;, color= &#39;orange&#39;)<br>ax.fill(angles, bottom_features, alpha=0.25, facecolor=&#39;red&#39;)<br><br>ax.plot(angles, all_features, &#39;o-&#39;, linewidth=2, label = &quot;All tracks&quot;, color= &#39;green&#39;)<br>ax.fill(angles, all_features, alpha=0.15, facecolor=&#39;green&#39;)<br><br>ax.set_title(&quot;How do a track&#39;s audio features affect popularity?&quot;, fontsize=15, fontweight=&#39;bold&#39;)<br>ax.grid(True)<br><br>plt.legend(loc=&#39;best&#39;, bbox_to_anchor=(0.0, 0.0))<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*_DvnnJyRoXpq1PzpuSOD1w.jpeg" /></figure><p>Explicitness seems to be more common among popular tracks (the blue plot), but we should be cautious before concluding that explicit songs are more popular. A closer look at the 100 most popular tracks reveals they are all from between 2013 and 2021. This aligns with our understanding of Spotify’s popularity algorithm, which favours recent releases, and newer tracks tend to contain more explicit content.</p><h3>Animating a Polar Plot with Plotly Express</h3><p>To visualize the changes over time, I’ll plot the average values for each year. This time I’ll use Plotly Express, so we can animate the plot.</p><h3>One more step before we animate</h3><p>Animation requires converting the data from its current wide format to a long format, allowing us to use one column as an animation frame, and the other columns as measured variables. This can be done using <a href="https://pandas.pydata.org/docs/reference/api/pandas.melt.html">pandas.melt()</a>.</p><pre>plot_data = pd.melt(top_100_2_df, id_vars=&#39;year&#39;, var_name=&#39;attribute&#39;, value_name=&#39;attribute_value&#39;)<br><br>fig_pol_2 = px.line_polar(plot_data,<br>                   r=&#39;attribute_value&#39;, <br>                    theta=&#39;attribute&#39;,<br>                    line_close=True,<br>                    animation_frame=&#39;year&#39;,<br>                    title=&quot;How do a track&#39;s audio features effect popularity?&quot;,<br>                          template=&quot;plotly_dark&quot;<br>             )<br>fig_pol_2.update_layout(<br>    autosize=True,<br>    polar = dict(<br>      radialaxis_angle = -45),<br>    font=dict(<br>        family=&quot;Verdana&quot;,<br>        size=14)<br>)<br>fig_pol_2.update_polars(radialaxis=dict(visible=True,range=[0, 1]))<br><br>fig_pol_2.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*tFphGOJu81uVFEsAQL1UmQ.jpeg" /></figure><p>Despite quite dramatic variances year on year, it seems that in general people prefer danceable, high-energy songs in a major key. After all my years DJing, this tallies with my experience. However, let’s not forget that people’s musical tastes are wide and varied, and Spotify’s popularity algorithm should not be considered the ultimate arbiter of taste!</p><p><strong>Find out more:</strong><br><a href="https://medium.com/@followcrom/predicting-spotifys-popularity-score-256e9da26147">Part 2: Training a Model to Predict Popularity</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=934fd7bb8738" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>