From 7f5889ee2997b1ab4d90895a43d0bfbdfab46686 Mon Sep 17 00:00:00 2001 From: Domenico Cipriani Date: Wed, 23 Oct 2024 10:22:51 +0200 Subject: [PATCH] fix bug on Rhythm ,add new methods to create jungle rhythms --- src/Coypu/Integer.extension.st | 41 ++++++++++++++++++++++++++++++++++ src/Coypu/Rhythm.class.st | 11 ++++----- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/Coypu/Integer.extension.st b/src/Coypu/Integer.extension.st index 0eeb48f..618faf8 100644 --- a/src/Coypu/Integer.extension.st +++ b/src/Coypu/Integer.extension.st @@ -277,6 +277,47 @@ Integer >> into: anArray [ ^ anArray fullScale asArray wrap: self ] +{ #category : '*Coypu' } +Integer >> jungleKick [ + " create an array of self size of jungle kick rhythm. " + + | pattern announcement | + announcement := RhythmAnnouncement new rhythm: + self asString , ' jungleRim'. + PerformanceRecorder uniqueInstance announce: announcement. + pattern := '00145145' hexBeat gates. + + ^ pattern +] + +{ #category : '*Coypu' } +Integer >> jungleRim [ + " create an array of self size of jungle rim rhythm. " + + | pattern announcement | + announcement := RhythmAnnouncement new rhythm: + self asString , ' jungleRim'. + PerformanceRecorder uniqueInstance announce: announcement. + pattern := '88000000' hexBeat gates. + + ^ pattern +] + +{ #category : '*Coypu' } +Integer >> jungleSnare [ + " create an array of self size of jungle snare rhythm. " + + | pattern announcement | + announcement := RhythmAnnouncement new rhythm: + self asString , ' jungleSnare'. + PerformanceRecorder uniqueInstance announce: announcement. + pattern := '00820820' hexBeat gates. + + ^ pattern + + "implement shifting to the left" +] + { #category : '*Coypu' } Integer >> melodyFrom: aScale [ diff --git a/src/Coypu/Rhythm.class.st b/src/Coypu/Rhythm.class.st index fd870ba..840c993 100644 --- a/src/Coypu/Rhythm.class.st +++ b/src/Coypu/Rhythm.class.st @@ -3,7 +3,7 @@ The Rhythm class contains an Array with allRhythmNames and convenience methods " Class { #name : 'Rhythm', - #superclass : 'Object', + #superclass : 'Array', #type : 'variable', #classInstVars : [ 'allRhythmNames' @@ -15,13 +15,14 @@ Class { { #category : 'accessing' } Rhythm class >> allRhythmNames [ - "return all the possible Rhythms obtainable sending messages to integers" | rhythmList | - rhythmList := #( #adowa '#aksak #banda #bomba #bossa #breves #semibreves #claveSon #downbeats #gahu #quavers' #semiquavers #rumba #shiko #sikyi #soukous #tresillo #trueAksak #tumbao #upbeats ). - -^ rhythmList + rhythmList := #( #adowa '#aksak #banda #bomba #bossa #breves #semibreves #claveSon #downbeats #gahu #quavers' + #semiquavers #randomTrigs #rumba #shiko #sikyi #soukous #tresillo + #trueAksak #tumbao #upbeats ). + + ^ rhythmList ] { #category : 'accessing' }