Giter Site home page Giter Site logo

test's People

Contributors

rbnpi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

test's Issues

test markup 2

OK. Read up the markdown stuff now and will try and use in future. Also sorry about duplicating the help rather than just reference. Still a lot to learn about using github -:)
Tried another test

define :testing do
p=play 60,amp: 0.01, sustain: 2
control p, amp: 1
sleep 2
q=play 72,amp: 1,sustain: 2
control q,amp: 0.01
sleep 2
end

loop{testing} 

#I would expect the first note to switch to amp: 1 and the second to amp: 0.01
#but control statement has no effect

#In the second example below the note: change happens exactly as I would expect.
#The first note switched up an octave immediately and the second down an octave.


define :testing do
p=play 60,amp: 0.01, sustain: 2
control p, note: 72
sleep 2
q=play 72,amp: 1,sustain: 2
control q,note: 60
sleep 2
end

loop{testing} ```

Testing markup syntax

#scaleupdown is a function which plays a scale of a defined type starting on a defined note
#for a given number of octaves, first ascending then descending.
#an interesting feature is that it incorporates a crescendo an decrescendo as the scale plays
#It is also a good example for illustrating how Ruby operations on a one dimensional list or array
#can be carried out. eg use of .reverse, [1..-1] (to select all bu first element of an array)
#and linking arrays with the .zip method, so that they can be traversed together

define :scaleupdown do |n,type,octaves,v1,v2,dur|
  nt=scale(n,type,num_octaves: octaves)
  inc= (v2-v1).to_f/nt.length #calculate volume increment per note
  vt = [v1] #starting note volume
  nt.length.times do #build the volume array
    vt = vt + [vt[-1]+inc] #next element is last element + increment
  end
  dt = [dur]*nt.length #build note duration array: all elements identical
  nt.zip(dt,vt).each do |x,y,z| #zip three arrays so that they can be traversed together: current elements referred to as x,y and z

    play x,amp: z,attack: y/50,sustain: 0.9*y-y/50,release: 0.1*y
    sleep y
  end
  #now reverse the arrays, drop the first note values and play them again
  nt.reverse[1..-1].zip(dt.reverse[1..-1],vt.reverse[1..-1]).each do |x,y,z|
    play x,amp: z,attack: y/50,sustain: 0.9*y-y/50,release: 0.1*y
    sleep y
  end
end

q=0.1
use_synth :saw_s
in_thread do
  scaleupdown(:c3,:major,3,0.02,1,q) #c3 major, three octaves, cresc from amp 0.02 to 1, duration of each note 0.1
end
in_thread do
  scaleupdown(:e3,:minor,3,0.02,1,q) #e3 minor scale
end
scaleupdown(:g3,:major,3,0.02,1,q) #g3 major scale

test markup

OK.
I did :

p = play 60, amp: 0.01, sustain: 4

and then

control p, amp: 1, amp_slide: 3

I suspected that this would slide the amp up to 1 over 3 seconds, but couldn't detect any change

I then tried

control p, amp: 1 #which as you say would change it immediately.

I could detect no change when this was commented out., or when it was active

I then tried
control p, note: 72, note_slide 2

which slid the note up over 2 secs.

I don't understand why this does what I expect but never detect any amp changes.
also tried
control p, note: 72, note_slide: 2, amp: 1, amp: slide 2 #only the note slide works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.