WCCC_MakeATool

WCCC_MakeATool

Sonifying Stats Again

PassScoreCount

For the 8th Prompt Of Mathober by @fractalkitty : Counting,PassUnCount :https://blog.illestpreacha.com/mathober2023counting takes Live Python Web Data Scraping and SonicPi Sonification to Sort and Count NCAA Assist Leaders who also turn the ball over. Then some tweaking and layering was done.

For the WCCC Prompt by @sableraph: Make a Tool, PassScoreCount takes PassUnCount and do a sonification tool that not only takes in the NCAA Assist Leaders with their Assists mades but also compare that to the NCAA Scoring Leaders and their Field Goals made.

You can alter the sound by adding what multipliers to the values and time, which makes also makes it a nice soundtrack by sonification tool.

Poem

Wanting to Make the Pass
But it didn't Make it Through
Try and Try Again
But The Results Don’t Seem to Blend
As the Dribbles Go Fast
And the Squeaks can be Heard From the Shoes
What Pass Selection Do You Choose,
To Finally Make it Through

Audio - Sped Up Version (1.7x) + Filters

IllestPreacha · PassScoreCount.MP3

Audio - With Modifiers

IllestPreacha · PassScoreCount2

Code

Python - WebScraping and Data Sorting

import sys
import pandas as pd

pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)

                                #APG Component

#turning the cbssports NCAA Assist Page(Only First Page) into a Data Frame
NCAA_APG = pd.read_html('https://www.cbssports.com/college-basketball/stats/player/assists-turnovers/all-conf/all-pos/leaders/?sortdir=descending&sortcol=apg')

#NCAA APG list into DataFrame
NCAA_APG_DF = NCAA_APG[0] 

# get the names of the columns
NCAA_APG_DF.columns

#players that have a higher A/TO than 3
NCAA_APG_Eff = NCAA_APG_DF.loc[(NCAA_APG_DF['A/TO  Assists Per Turnover'] < 3)]

#players that have a lower A/TO than 3
NCAA_APG_Not_Eff = NCAA_APG_DF.loc[(NCAA_APG_DF['A/TO  Assists Per Turnover'] > 3)]


#sorting it based on the assist turnover
NCAA_APG_Eff.sort_values(by=['A/TO  Assists Per Turnover', 'APG  Assists Per Game'], ascending=True)


                                    #PPG Component

#turning the cbssports NCAA Points Page (Only first Page) into a Data Frame
NCAA_PPG = pd.read_html('https://www.cbssports.com/college-basketball/stats/player/scoring/all-conf/all-pos/leaders/?sortcol=ppg&sortdir=descending')

#NCAA PPG list into DataFrame
NCAA_PPG_DF = NCAA_PPG[0] 

# get the names of the columns
NCAA_PPG_DF.columns

#players that have a higher A/TO than 3
NCAA_PPG_Eff = NCAA_PPG_DF.loc[(NCAA_PPG_DF['FG%  Field Goal Percentage'] > 45)]

#players that have a lower A/TO than 3
NCAA_PPG_Not_Eff = NCAA_PPG_DF.loc[(NCAA_PPG_DF['FG%  Field Goal Percentage'] < 45)]

NCAA_PPG_Eff.sort_values(by=['FG%  Field Goal Percentage', 'PPG  Points Per Game'], ascending=False)

Python Code - Timer that Speaks to SonicPi

import time
import random as rd
import math

#osc module to communicate with sonic
from pythonosc import osc_message_builder
from pythonosc import udp_client

#input adjusters to modify the eventual sound
value = int(input("Enter multiplier: "))
value2 = int(input("Enter another multiplier: "))
value3 = value2 / value #just adding more adjustable components

def ncaa(t): #take in the value t
     print('\n' + str(NCAA_APG_Eff['AST  Total Assists'].iloc[t]))    #print the turnover amount per every two seconds
     print('\n' + str(NCAA_PPG_Eff['FGM  Field Goals Made'].iloc[t]))    #print the FGM amount per every two seconds 

def countdown(t):
    original_input = t;

    while t:
        mins, secs = divmod(t, 60)
        timer = '{:02d}:{:02d}'.format(mins, secs)
        print(timer, end="\r")
        time.sleep(1 * value2)

        if t % 1 == 0:
           ncaa(t)
        #calculating the amount of field goals made - the amount of assist made and getting the absolute
        #sends an a , b ,c 
        sender = udp_client.SimpleUDPClient('127.0.0.1', 4560)
        sender.send_message('/pattern1',value * [abs(int(NCAA_PPG_Eff['FGM  Field Goals Made'].iloc[t]) - int(NCAA_APG_Eff['AST  Total Assists'].iloc[t])),int(NCAA_APG_Eff['AST  Total Assists'].iloc[t]) * value3,int(NCAA_PPG_Eff['FGM  Field Goals Made'].iloc[t])])
        t -= 1

        #loops the timer
        if t == 0:
            t = original_input



# input time in seconds
#since both frames have over 27 we will  a 27second timer that puts the variables together
t = input("Enter the time in seconds: ")

# function call
countdown(int(t))

SonicPi

live_loop :phase1 do
  use_random_seed Time.now.to_i

  use_real_time
  a, b, c, d = sync "/osc*/pattern1"
  with_fx :flanger, mix: rrand(0.1,0.9) do

    #conditionals for the fg made vs assist made
    #then allowing for any of the 3 variables to be ponts

    if (a > 40)
      with_fx [:ixi_techno,:whammy].choose do
        use_synth :piano
        play [a,b/2,c/2].tick, sustain: dice(3)
      end

    end

    if (a < 40 and a > 30)
      with_fx [:flanger,:ping_pong].choose do
        use_synth :beep
        play [a,b/2,c/2].tick, sustain: dice(2), decay: rrand(0.2,0.6)
      end
    end


    if (a < 30 and a > 20)
      with_fx :echo do
        use_synth :saw
        play [a,b/2,c/2].tick
      end

    end

    if (a < 20 and a > 10)
      with_fx :vowel, voice: dice(3) + 1 do
        use_synth :bnoise
        play [a,b/2,c/2].tick
      end
    end


    if (a < 10)
      with_fx :distortion do
        use_synth :prophet
        play [a,b/2,c/2].tick, decay: a / 2
      end
    end

  end
end