Kofi / Illestpreacha
Code is Poetry & Data is Poetry

Follow

Code is Poetry & Data is Poetry

Follow
WCCChallenge: SingleHue

WCCChallenge: SingleHue

WhichHueAreYou

Kofi / Illestpreacha's photo
Kofi / Illestpreacha
·Feb 17, 2023·

6 min read

Table of contents

WhichHueAreYou

For this week's Creative Code challenge by @sableRalph : Single Hue I decided to make a Choose your Own Hue Poetic Story using Twine.

To Play go Here

WhichHueAreYou

What you see and hear are all derived from single hues. The question remains: Which Hue Are You?

With the audiovisual assets coded in SonicPi(Audio), Hydra(Visuals) and LivecodeLab(Visuals)

The interactive Story includes:

  • A Hue for each branch

    • The sounds heard in the branches contain numbers from the actual colours. By using https://www.colorhexa.com/, I was able to grab a dataset of numbers to represent that particular as seen in the spreadsheet below that is used in my Colorscape Project

Hues

  • Salmon

Sonic Pi Code

require 'csv'

#naming the Dataset DipInCode and going to read the file
Dip = CSV.parse(File.read("C:/Colorscape/DipInCode/SonicPi_CodeBase/Model/DipInCode_FirstService.csv"), headers: true)

#Getting the Ingredients

#Dip[foodname][column].to_f , need to.f as it is to float

#.abs to fix the negative numbers when not needed

Salmon = Dip[2] #Chelsea Salmon is a color and  the sounds in this piece shall be only made by
#values found in the sheet
#Dip[foodname][column].to_f , need to.f as it is to float
#0s and other ratios might have to be switch out to give flow to that track and make it run

with_fx :flanger do
  with_fx :reverb do
    live_loop :Salmon1 do
      use_bpm Salmon["Red"].to_f
      sample [:bass_trance_c,:elec_pop,:ambi_choir].choose, rate: dice(Salmon["Yellow"].to_f/Salmon["Hue"].to_f)  if spread(Salmon["Green%"].to_f,Salmon["Red%"].to_f).tick
      sample [:glitch_perc5,:elec_blip2].choose, rate: rrand(Salmon["y2"].to_f,Salmon["Red"].to_f/Salmon["Green"].to_f)  if spread(Salmon["H-Lab1"].to_f,Salmon["CIE-L"].to_f).tick
      sleep Salmon["Value"].to_f / Salmon["Saturation"].to_f
    end
  end
end

with_fx :flanger do
  with_fx :reverb do
    live_loop :Salmon2 do
      use_bpm Salmon["Blue"].to_f
      sample [:bd_fat,:ambi_piano].choose, rate: dice(Salmon["Yellow"].to_f/Salmon["Hue"].to_f)  if spread(Salmon["Green%"].to_f,Salmon["Red%"].to_f).tick
      sample [:drum_bass_soft,:guit_em9].choose, rate: rrand(Salmon["y2"].to_f,Salmon["Red"].to_f/Salmon["Green"].to_f)  if spread(Salmon["H-Lab1"].to_f,Salmon["CIE-L"].to_f).tick
      sleep Salmon["Value"].to_f / Salmon["Saturation"].to_f
    end
  end
end

with_fx :distortion do
  live_loop :Salmon3 do
    use_bpm Salmon["Green"].to_f
    with_fx :reverb do
      sample [:tabla_ghe3,:elec_pop,:sn_zome].choose, rate: Salmon["H-Lab2"].to_f
      sample :elec_ping, rate: Salmon["CIE-A"].to_f
      sleep [Salmon["Cyan"].to_f + 0.001,Salmon["Key"].to_f].choose
    end
  end
end
/**
    @author illestpreacha remixed of the name game
    @title  Coordinates: x, y
    @desc   Use of coord.x and coord.y
    */

    const density = 'salmon salmon salmon salmon salmon salmon'
    const density1 = 'nomlas nomlas nomlas  nomlas nomlas nomlas nomlas'



    export var settings = {
        backgroundColor : 'black',
        color           : 'salmon',
        fontSize        : Math.random(10,800),
        cellWidth         : 8,
        fontWeight      : 'bold', 
        lineHeight        : 0.3,
        fps                : 3

    }


    export function main(coord, context, cursor, buffer) {
        // To generate an output return a single character
        // or an object with a “char” field, for example {char: 'x'}

        // Shortcuts for frame, cols and coord (x, y)
        const {cols, frame } = context
        const {x, y} = coord

        // -1 for even lines, 1 for odd lines
        const sign = ( y * 45.5 * x - context.frame % 80)/3 % frame * 8

         var dice = Math.random(0,15) 

        if(dice % 14 > 8)
            {
                const index = (cols + y + x * sign + frame) % density.length / 7
                return density[index]
            }
        else
            {
                const index = (cols + y + x * sign + frame) % density1.length / 7
                return density1[index]
            }

    }
  • Cucumber

SonicPi Code

require 'csv'

#naming the Dataset DipInCode and going to read the file
Dip = CSV.parse(File.read("C:/Colorscape/DipInCode/SonicPi_CodeBase/Model/DipInCode_FirstService.csv"), headers: true)

#Getting the Ingredients

#Dip[foodname][column].to_f , need to.f as it is to float

#.abs to fix the negative numbers when not needed

Cucumber = Dip[38] #Chelsea Cucumber is a color and  the sounds in this piece shall be only made by
#values found in the sheet
#Dip[foodname][column].to_f , need to.f as it is to float
#0s and other ratios might have to be switch out to give flow to that track and make it run

with_fx :flanger do
  with_fx :reverb do
    live_loop :Cucumber1 do
      use_bpm Cucumber["Red"].to_f
      sample [:bass_trance_c,:elec_pop,:ambi_choir].choose, rate: dice(Cucumber["Yellow"].to_f/Cucumber["Hue"].to_f)  if spread(Cucumber["Green%"].to_f,Cucumber["Red%"].to_f).tick
      sample [:glitch_perc5,:elec_blip2].choose, rate: rrand(Cucumber["y2"].to_f,Cucumber["Red"].to_f/Cucumber["Green"].to_f)  if spread(Cucumber["H-Lab1"].to_f,Cucumber["CIE-L"].to_f).tick
      sleep Cucumber["Value"].to_f / Cucumber["Saturation"].to_f
    end
  end
end

with_fx :flanger do
  with_fx :reverb do
    live_loop :Cucumber2 do
      use_bpm Cucumber["Blue"].to_f
      sample [:bd_fat,:ambi_piano].choose, rate: dice(Cucumber["Yellow"].to_f/Cucumber["Hue"].to_f)  if spread(Cucumber["Green%"].to_f,Cucumber["Red%"].to_f).tick
      sample [:drum_bass_soft,:guit_em9].choose, rate: rrand(Cucumber["y2"].to_f,Cucumber["Red"].to_f/Cucumber["Green"].to_f)  if spread(Cucumber["H-Lab1"].to_f,Cucumber["CIE-L"].to_f).tick
      sleep Cucumber["Value"].to_f / Cucumber["Saturation"].to_f
    end
  end
end

with_fx :distortion do
  live_loop :Cucumber3 do
    use_bpm Cucumber["Green"].to_f
    with_fx :reverb do
      sample [:tabla_ghe3,:elec_pop,:sn_zome].choose, rate: Cucumber["H-Lab2"].to_f
      sample :elec_ping, rate: Cucumber["CIE-A"].to_f
      sleep [Cucumber["Cyan"].to_f,Cucumber["Key"].to_f].choose
    end
  end
end

play.ertdfgcvb code

/**
@author illestpreacha
@title  Name game - miniremix
@desc   What’s your name?
*/

// The default backround color and font attributes can be altered
// by exporting a ‘settings’ object (see the manual for details).
export var settings = {
    backgroundColor : 'black',
    color           : '#72a64c',
    fontSize        : '3em',
    lineHeight        : 0.90 ,
    fontWeight      : 'bold',
    fps                : 78,



}

const TAU = Math.PI * 2

export function main(coord, context, cursor, buffer) {

    const {cols, frame } = context
    const {x, y} = coord

    const a = context.frame * 0.05 * settings.lineHeight
    const f = Math.sqrt((1 - Math.cos(a)) * 10) + 1
    const g = Math.ceil(a / TAU) % 10 + 1
    const i = coord.index % (coord.y * Math.floor(g + 1)) % (f % context.cols)
    // NOTE: If the function returns ‘undefined’ or ‘null’
    // a space character will be inserted.
    // In some cases ‘i’ may be greater than 2:
    // JavaScript array out of bounds results in ‘undefined’.

    return 'Cucumber'[i +2]
}
  • #3e021b

SonicPi Code - Pre Edit

#numbers are found within the colors
with_fx :flanger do
  live_loop :drums do
    use_bpm 93.8
    sample :tabla_dhec , rate: 2
    sample :ambi_drone, beat_stretch: 0.401
    sleep [0.491,0.255,1.147].choose
  end
end


with_fx :gverb do
  live_loop :layer do
    use_bpm 97
    sample :bd_boom if spread(2,10709).reverse.tick
    sample :guit_e_fifths , rate: [1.174,12.5,1.34].choose
    sleep [2.206,1.1147,1.1142,1.324].choose
  end
end
  • #4C6304

SonicPi Code - Pre Edit

#spreadsheet version of color
with_fx :ping_pong do
  with_fx :ixi_techno, mix: "x" do
    with_fx :vowel,voice: dice("Z"),mix: rrand("x","x * x") do
      use_bpm "Red"
      live_loop :scaled_sample2 do
        sample :guit_e_fifths, beat_stretch: "Z", rpitch: (scale ["x","y" + "x","Z" * "Z","Blue"].
          reverse, :shang).tick if spread("H-Lab2","CIE-A").tick
        sample :drum_bass_soft, beat_stretch: "Blue", amp: dice("X"),
          rpitch: (scale ["Mangeta","blue - (Green - Yellow)",,"Green - Yellow","Blue","Green% - Red% - Blue","Blue"].
                   tick, :egyptian).tick if spread("X","Y").tick
        sleep ["x","Z"/"Blue%","Blue%"/"Z"].choose
      end
    end
  end
end


with_fx :distortion do
  with_fx :reverb do
    with_fx :whammy, mix: "Cyan"/"Red%" do
      use_bpm "Green"
      live_loop :scaled_sample3 do
        sample :guit_em9, beat_stretch: "Blue", rpitch: (scale ["Z","Blue","x"*"Blue"].reverse, :egyptian).tick if spread("H-Lab2","CIE-A").tick
        sleep ["Z","Blue" * "x","Blue"].choose
      end
    end
  end
end
  • Greyish Awkward Flows

LivecodeLab Code

ringDetail = 45 - sin(wave)
ambientLight 255

9 times with i
    rotate (time / 5) + i
    ringDetail times
        rotate 0, 0, (2 * pi) / ringDetail
    move 0.7, 0.1, 0.2
            ball 1, 0.3 + (1 / ringDetail)
        box (ringDetail + wave(0.5)/5)/12,sin(0.3)/4,1/cos(0.5)
  • Blue

LivecodeLab Code



background blue
scale 1.5 - wave(0.3)
animationStyle paintOver
rotate frame / 100
v = (frame / 2) % 255
fill 0, 0, 255 - v, 50
stroke 0, 0, 255 - v
scale 1 - (v / 255)
box
line 40
box time % 5, sin(time)
  • Aqua

LivecodeLab Code

simpleGradient aqua, color(0,255,155),color(0,255,200)
ringDetail = 32 + time % 10
ambientLight 255

9 times with i
    rotate (time / 5) + i
    ringDetail times
        rotate 0, 0, (2 * pi) / ringDetail
    move 0.7, 0.1, 0.2
    fill color(0,255,200)
            box 1, 0.3 + (1 / ringDetail)
        fill aqua
        ball (ringDetail + wave(0.5)/5)/12,sin(0.3)/4,1/cos(0.5)
 
Share this