Skip to content

Commit

Permalink
corrije study14
Browse files Browse the repository at this point in the history
  • Loading branch information
diegovdc committed Nov 30, 2018
1 parent 55e51d3 commit 02dbd94
Show file tree
Hide file tree
Showing 3 changed files with 408 additions and 404 deletions.
8 changes: 5 additions & 3 deletions convergence.sc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@
)
}),

instruments1 = this.getInstruments(instruments),
instruments_ = this.getInstruments(instruments),

player_ = this.getPlayer(player, canon, instruments_),

data = (melody: melody, cp: cp, voices: voices, instruments: instruments_, player: player);

data = (melody: melody, cp: cp, voices: voices);
player = this.getPlayer(player, canon, instruments1);
^(
canon: canon,
data: data,
Expand Down
16 changes: 10 additions & 6 deletions helpers.sc
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
+Can {
//~melody ::[Float] -> [Float] -> [(dur, note)]
//melody ::[Float] -> [Float] -> [(dur, note)]
*melody {|durs, notes|
^[durs.size, notes.size].minItem.collect({|i|
(dur: durs[i], note: notes[i])
})
}

//~convvoices :: ([Float], [Float], [Float]) -> [(tempo, transp, amp)]
//convvoices :: ([Float], [Float], [Float]) -> [(tempo, transp, amp)]
*convoices { | tempos, transps, amps = ([])|
^[tempos.size, transps.size].minItem.collect({|i|
(tempo: tempos[i], transp: transps[i], amp: amps[i] ? 1)
})
}

//~makeDivVoices :: ([Float], [Float]) ->[(transp: Float, amp: Float)]
//divoices :: ([Float], [Float]) ->[(transp: Float, amp: Float)]
*divoices { |transps, amps = ([])|
^transps.collect({|transp, i|
(transp: transp, amp: amps[i] ? 1)
})
}

//~makeDivTempos :: ([Float], [Float], Boolean) ->[(tempo: Float, percentage: Float)]
//divtempos :: ([Float], [Float], Boolean) ->[(tempo: Float, percentage: Float)]
*divtempos { | tempos, percentageForTempo, normalize= false|
var percentages = if(normalize, {percentageForTempo.normalizeSum*100}, {percentageForTempo});

Expand All @@ -29,10 +29,14 @@
});
}

//~mergeCanons :: Canon -> Canon -> Canon
//mergeCanons :: Canon -> Canon -> Canon
*mergeCanons {|a, b|
var canon = a.canon ++ b.canon;
var player = this.getPlayer(a.data.player, canon, a.data.instruments);
^(
canon: a.canon ++ b.canon,
canon: canon,
player: player,
play: {player.play},
data: (
voices: a.data.voices ++ b.data.voices,
cp: [a.data.cp, b.data.cp].minItem,//for now we keep only the first cp, for the visualizer purposes, it does not affect the cp in the canons that will sound
Expand Down
Loading

0 comments on commit 02dbd94

Please sign in to comment.