ruby lofi

Db72880856cc021700ea827e9133757a?s=47 yeaman
November 19, 2019

ruby lofi

A talk about a project I worked on. Also an encouragement for the audience to take on a programming project.

Db72880856cc021700ea827e9133757a?s=128

yeaman

November 19, 2019
Tweet

Transcript

  1. ruby lofi

  2. hello, my name is zach

  3. i made this thing called ruby lofi

  4. a project

  5. this is about that but also about u u and

    ur projects
  6. projects

  7. do u have a project?

  8. not “work” for fun for “joy” to use ruby

  9. choose ur own adventure

  10. code style tests be ur own boss RELAX and HAVE

    FUN
  11. how 2 get started?

  12. inspiration

  13. 2 scenarios u have an idea or u don’t

  14. scenario 1 idea

  15. is it a good* idea?

  16. *good = ?

  17. not “work” for fun for “joy” to use ruby

  18. think small odds of success go up as complexity and

    size go down
  19. maybe think “this should take a couple weeks/months”

  20. maybe avoid “this should take a couple years”

  21. but it’s ur choice

  22. what if u don’t have an idea?

  23. scenario 2 no idea

  24. ask ppl for ideas

  25. “do u have a problem I can solve?” “do u

    have an idea I can bring 2 life?”
  26. maybe this yields nothing …then what?

  27. random words > gems let the universe guide u

  28. so now you have an idea …what’s next?

  29. getting started

  30. confession: i did not “make” ruby lofi

  31. ruby2d 4 graphics ruby-audio 4 wavs beats 4 sequencing

  32. …on the shoulders of giants…

  33. do some research

  34. not just gems but concepts

  35. ex: normalize algorithm

  36. ??

  37. stackoverflow

  38. 2 concepts in ruby lofi

  39. digital audio

  40. digital audio is not mysterious

  41. it’s just numbers

  42. [0.0, 0.23, 0.37, 0.44, 0.31, 0.18, -0.05, -0.21, -0.36, -0.50,

    -0.39, -0.18, 0.0]
  43. three concepts: frequency amplitude sample rate

  44. frequency

  45. 1 Hertz is 1 cycle per second

  46. [0.0, 0.23, 0.37, 0.44, 0.31, 0.18, -0.05, -0.21, -0.36, -0.50,

    -0.39, -0.18, 0.0]
  47. A = 440

  48. amplitude

  49. power!!

  50. [0.0, 0.23, 0.37, 0.44, 0.31, 0.18, -0.05, -0.21, -0.36, -0.50,

    -0.39, -0.18, 0.0]
  51. too much power == clipping

  52. frequency vs amplitude is count vs strength of sound waves

  53. sample rate

  54. samples per second

  55. POP QUIZ: what is standard “cd quality” sample rate?

  56. 44100 samples per second

  57. [0.0, 0.23, 0.37, 0.44, 0.31, 0.18, -0.05, -0.21, -0.36, -0.50,

    -0.39, -0.18, 0.0]
  58. sample rate != frequency sample rate != amplitude 44100 samples

    per second of a 440 Hz tone
  59. computer audio is just manipulating arrays of numbers that represent

    sound wave frequency and amplitude at a certain sample rate
  60. i = 0 while i < samples.count do percent_fade =

    i / samples.count.to_f samples[i] = samples[i] * percent_fade i += 1 end
  61. now ur an audio expert

  62. graphics

  63. what do u need to make graphics?

  64. 3 things

  65. render basic elements lines rectangles circles triangles text

  66. a coordinate system x and y for 2d x, y,

    and z for 3d
  67. update loop handle input redraw window

  68. with these things we can make a graphical interface

  69. ex: make a button rectangle for clickable area rectangle for

    border text for label click handler
  70. x, y = event.x, event.y b = Button.new label: “click

    me” if b.x < x && b.x + b.width > x && b.y < y && b.y + b.height > y puts “clicked button!” else puts “am lonely” end
  71. now u are a graphics master

  72. now back to our projects

  73. making progress

  74. so you’re making something

  75. but then it gets difficult

  76. the “easy” stuff is done

  77. maybe u start to flail

  78. - - - - - - - - - -

    - ->
  79. ex: ruby lofi “it’s about audio”

  80. so why did I spend WAY more time building overly

    complicated UI elements?
  81. i lost focus

  82. i have no answers but 1 suggestion

  83. stop work show what u have ask 4 feedback

  84. stay happy find “joy”

  85. demo

  86. making a beat stitching beats

  87. things 2 remember

  88. wavs only

  89. always “build” before playing/saving!

  90. keyboard right/left (and shift + right/left) 2 adjust selection

  91. shift + click 2 reset selection endpoint (but keep start)

  92. challenge

  93. 1. get “sox” (see website)

  94. 2. git clone https:// github.com/robobluebird/ruby- lofi

  95. 3. cd ruby-lofi unzip sounds.zip cd .. don’t forget this!

  96. 4. ruby ruby-lofi/app.rb

  97. now make a beat!

  98. contest

  99. submit to schroza@gmail.com OR tweet to #rubyconf #lofi

  100. top 3 (decided by me) win an Arduino Nano

  101. if u want to try but need help just ask!

  102. thank u for ur attention

  103. ©2018 General Dynamics. All rights reserved. We’re Hiring!!! • https://gdmissionsystems.com/about-us/major-locations/pittsburgh

    103 14 November 2019