Skip to content

Commit

Permalink
Fixed examples
Browse files Browse the repository at this point in the history
Fixed old examples
  • Loading branch information
amiika committed Dec 3, 2022
1 parent 0b3e71e commit ddd7e9b
Show file tree
Hide file tree
Showing 51 changed files with 220 additions and 447 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/tests
/examples/atom
/examples/ignore
43 changes: 43 additions & 0 deletions examples/avril14th.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
load "~/ziffers/ziffers.rb"

# Avril 14th by Aphex Twin
# Created automatically from MIDI file using: https://github.com/amiika/ziffers-musescore

ziff "
/ synth: :piano, sustain: 2.0, decay: 0.6
| [: q 2 _ 5 ^ 0 e r s 0 _ 5 | q. _ 5 e 5 ^ 4 3 2 0 :] | [: q ^ 2 _ 5 ^ 0 e r s 0 _ 5 | \
| w 5 :] | [: q. _ 2 s 2 4 q. 4 e 2 | q. _ 2 s 2 4 q. 5 e 4 :] | q. _ 2 s 2 4 q. 4 e 2 | \
| q. _ 2 s 2 4 q. 5 e 4 | e r e _ 5 6 ^ 0 2 q. _ 6 | e r e _ 5 6 ^ 0 2 _ 6 q 5 | \
| e r e _ 5 6 ^ 0 2 q. _ 6 | e r e _ 5 6 ^ 0 e. 2 s _ 6 6 e. 5 | [: q 2 _ 5 ^ 0 e r s 0 _ 5 | \
| q. _ 5 e 5 ^ 4 3 2 0 :] | [: q ^ 2 _ 5 ^ 0 e r s 0 _ 5 | q. 5 e 5 ^ 4 3 2 0 :] | q. 2 s 2 1 q. 2 s 2 2 | \
| s 4 5 e 4 h 2 q 4 | q. 2 s 2 1 q. 0 s 0 2 | s 4 5 e _ 5 q ^ 2 _ 5 ^ 0 | s r e. ^ 2 q 2 h _ 1 | \
| s ^ 4 5 e 4 r ^ 2 q 2 _ 4 | s 2 e. ^^ 0 e _ 5 s r _ 1 q ^ 1 s 1 e _ 5 s ^ 2 | \
| s ^ 4 5 e _ 5 s 5 e. ^ 2 q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 ^ 0 _ 2 | w _ 2 |
| [: w r | w r :] | [: w r | \
| w r :] | [: w r | w r :] | w r | \
| w r | w r | w r | \
| w r | w r | [: w r | \
| w r :] | [: w r | w r :] | h __ 3 13 | \
| h __ 2 03 | h ___ 5 4^1 | h __ 0 _30 | h r e. ^ 2 2 s 2 r | \
| s r s r e r s ^^ 4 e 4 s r h r | w r | \
| q __ 1 r h r | w r |
"
4 changes: 3 additions & 1 deletion examples/canone.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

require "~/ziffers/ziffers.rb"
load "~/ziffers/ziffers.rb"

use_bpm 120

a = zparse "| q. _ 0 e 0 q 1 e 2 2 | C q _ 3 3 2 e 2 2 | q _ 1 h 4 q 3 | e r s _ 4 3 e 2 s 3 2 h 1 | q. _ 0 e 0 q 1 e 2 2 | w _ 3 |", C: {cue: :foo }

Expand Down
7 changes: 7 additions & 0 deletions examples/cowbell_synth_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load "~/ziffers/ziffers.rb"

use_bpm 200

live_loop :te do
zplay "q 4 4 3 e 4 5 0 1 2 1 2 3 4 5 q 2 2 3 e 4 5 [q 6 6 5 4,e 6 4 5 3 4 2 3 2,e (0..8)~]", sample: :drum_cowbell, rate_based: true
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

load "~/ziffers/ziffers.rb"

seq = [->n{n+2},->n{n-2},->n{n+rrand_i(-8,1)},->n{n/2}].ring.reflect

1.upto(50) do |m|
Expand Down
27 changes: 0 additions & 27 deletions examples/deprecated/jig_trance.rb

This file was deleted.

13 changes: 0 additions & 13 deletions examples/deprecated/kungssangen.rb

This file was deleted.

20 changes: 0 additions & 20 deletions examples/deprecated/single_synth_random_song.rb

This file was deleted.

24 changes: 0 additions & 24 deletions examples/deprecated/sync_example.rb

This file was deleted.

16 changes: 0 additions & 16 deletions examples/deprecated/trance_samples_example.rb

This file was deleted.

11 changes: 0 additions & 11 deletions examples/deprecated/zdrum_example.rb

This file was deleted.

79 changes: 0 additions & 79 deletions examples/deprecated/ziffers_markov.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def fibonacci
Enumerator.new do |y|
a = b = 1
loop do
while true
y << a
a, b = b, a + b
end
Expand All @@ -15,5 +15,5 @@ def fibonacci
enum = fibonacci

live_loop :fibonacci_chords do
zplay enum.next.to_s, duration: 0.5
zplay enum, duration: 0.5, parse_chord: true
end
15 changes: 15 additions & 0 deletions examples/ievan_polka.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load "~/ziffers/ziffers.rb"

use_bpm 300

ievanpolka = \
"[:q 0 e 0 0 q 0 1 | q 2 0 0 2 | <(q1 _ 6 6 ^1 |q2 0 h0) (q. 4 e3 q 2 1|q 2 0 h0)> :]"\
"[:q 4 e 4 4 q 3 2 | q 1 _ 6 6 ^1 | <(q3 e3 3 q2 1|q2 0 0 2) (q3 e 3 3 q 2 1|q 2 0 h0)> :]"

n = zparse ievanpolka, key:"g", scale:"minor"
notes = zparams(n, :note)
durations = zparams(n, :beats)

with_synth :mod_tri do
play_pattern_timed notes, durations, release: 0.1
end
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/markov_chain.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load "~/ziffers/ziffers.rb"

use_bpm 30
use_bpm 90

barrios = "| s 0 _4 #4 1 4 _4 0 _4 #4 1 4 _4 | s _6 _4 #4 1 4 _4 _6 _4 #4 1 4 _4 | s 1 _4 4 _6 3 _6 1 _4 4 _6 3 _4 | \
| s _0 _4 3 0 #1 _4 _0 _4 3 0 #1 _4 | s _#5 _4 3 0 #1 _4 _#5 _4 3 0 #1 _4 | s _5 _#3 #1 0 1 _#3 _5 _#3 #1 0 1 _#3 | \
Expand Down
8 changes: 8 additions & 0 deletions examples/moonlight_loop.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load "~/ziffers/ziffers.rb"

use_synth :piano
use_bpm 100

zloop :moonlight, "h 07 [: (-3 0 2) :4] -16 [: (-3 0 2) :4] -25 [: (-2 0 2) :] -43 [: (-2 b1 3) :] -34 (-3 #-1 3) (-3 0 2) -34 (-3 0 #1) (-4 -1 1)",
key: :cs4, scale: :minor, release: 4, sustain: 3, decay: 1,
chord_key: :cs2
7 changes: 7 additions & 0 deletions examples/multiplying_lambda_loop.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load "~/ziffers/ziffers.rb"

use_bpm 200

z1 "q1 e3 q4", seed: 1, rules: {
/([a-z])*([1-9]*)/=> ->(i,m){ m[1]+(m[2].to_i*2%7).to_s }
}
2 changes: 1 addition & 1 deletion examples/musical_dice_game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Musical dice game: https://en.wikipedia.org/wiki/Musikalisches_W%C3%BCrfelspiel
# Very random version of musical dice game

use_bpm 18
use_bpm 100
use_synth :piano
use_random_seed 987654365787

Expand Down
2 changes: 1 addition & 1 deletion examples/musical_dice_game_piece.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Musical dice game: https://opus-infinity.org/dice_games/mozart_waltz/
# Still work in progress

use_bpm 18
use_bpm 100
use_synth :piano
use_random_seed 52335

Expand Down
7 changes: 0 additions & 7 deletions examples/not_tested/adjust_sleep_in_cycles.rb

This file was deleted.

5 changes: 0 additions & 5 deletions examples/not_tested/arpeggios_example.rb

This file was deleted.

Loading

0 comments on commit ddd7e9b

Please sign in to comment.