Aqui você vê as diferenças entre duas revisões dessa página.
Ambos lados da revisão anterior Revisão anterior Próxima revisão | Revisão anterior Próxima revisão Ambos lados da revisão seguinte | ||
projetos:musichacking:inicio [2018/02/17 16:29] phil |
projetos:musichacking:inicio [2018/07/11 01:49] phil [Próximo Encontro] |
||
---|---|---|---|
Linha 21: | Linha 21: | ||
===== Próximo Encontro ===== | ===== Próximo Encontro ===== | ||
+ | |||
+ | === MusicHacking #26 : Encontro Geral === | ||
+ | |||
+ | **Quando :** Domingo, dia 15, julho. | ||
+ | |||
+ | Encontro geral pra quem gosto de musica, musica eletrônica, | ||
+ | |||
+ | Vem conhecer quem fazer musica no Calango. | ||
+ | |||
+ | |||
+ | ===== Encontros Passados ===== | ||
=== MusicHacking #25 : Protoplug === | === MusicHacking #25 : Protoplug === | ||
+ | |||
+ | |||
Protoplug (http:// | Protoplug (http:// | ||
Linha 33: | Linha 46: | ||
- | **Quando | + | Codigo pra notas randomicos |
+ | |||
+ | < | ||
+ | |||
+ | --[[ | ||
+ | name: croissant | ||
+ | description: | ||
+ | I'm going to create a library that emulates the functionality I use from Sonic-Pi for generative / algorithmic music. | ||
+ | Starting with the ring (cyclic array) data-structure. | ||
+ | author: [email protected] | ||
+ | --]] | ||
+ | |||
+ | require " | ||
+ | |||
+ | local blockEvents = {} | ||
+ | |||
+ | |||
+ | |||
+ | function ring(ns) | ||
+ | local count = 0 | ||
+ | for _ in pairs(ns) do count = count + 1 end | ||
+ | return { | ||
+ | notes = ns, | ||
+ | noItems = count, | ||
+ | current = 0, | ||
+ | choose = function(self) | ||
+ | r = math.random(self.noItems) | ||
+ | x = self.notes[r] | ||
+ | return x | ||
+ | end, | ||
+ | tick = function(self) | ||
+ | if (self.current > self.noItems-1) then | ||
+ | self.current = 0 | ||
+ | end | ||
+ | self.current = self.current + 1 | ||
+ | return self.notes[self.current] | ||
+ | end | ||
+ | } | ||
+ | end | ||
+ | |||
+ | local scale = ring({0, 3, 7, 11, 12, 17}) | ||
+ | local off_buffer = {} | ||
+ | |||
+ | function plugin.processBlock(samples, | ||
+ | blockEvents = {} | ||
+ | for ev in midiBuf: | ||
+ | if ev: | ||
+ | local root = ev: | ||
+ | local note = root + scale: | ||
+ | off_buffer[root] = note | ||
+ | play(ev: | ||
+ | elseif ev: | ||
+ | local note = off_buffer[ev: | ||
+ | if not note == nil then | ||
+ | play_off(ev: | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | -- fill midi buffer with prepared notes | ||
+ | midiBuf:clear() | ||
+ | if # | ||
+ | for _,e in ipairs(blockEvents) do | ||
+ | midiBuf: | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | |||
+ | function play(chan, | ||
+ | local newEv = midi.Event.noteOn(chan, | ||
+ | table.insert(blockEvents, | ||
+ | end | ||
+ | |||
+ | |||
+ | function play_off(chan, | ||
+ | local newEv = midi.Event.noteOff(chan, | ||
+ | table.insert(blockEvents, | ||
+ | end | ||
+ | |||
+ | </ | ||
- | ===== Encontros Passados ===== | ||
=== MusicHacking #24 : web_audio === | === MusicHacking #24 : web_audio === |