Ferramentas do usuário

Ferramentas do site


projetos:musichacking:inicio

Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

Link para esta página de comparações

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/02/18 19:58]
phil [Próximo Encontro]
Linha 23: Linha 23:
  
 === MusicHacking #25 : Protoplug === === MusicHacking #25 : Protoplug ===
 +
 +
 +**Quando :** Domingo, dia 18, fev.  15:00 Horas
 +
  
 Protoplug (http://www.osar.fr/protoplug/) 'e um plugin tipo VST que pode ser utilizada em qualquer DAW como Ableton, FL Studio etc.   Protoplug (http://www.osar.fr/protoplug/) 'e um plugin tipo VST que pode ser utilizada em qualquer DAW como Ableton, FL Studio etc.  
Linha 33: Linha 37:
  
  
-**Quando :** Domingodia 18fev.  15:00 Horas+Codigo pra notas randomicos : 
 + 
 +<code> 
 + 
 +--[[ 
 +name: croissant 
 +description: MIDI processor VST/AU for Protoplug.  
 +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 "include/protoplug" 
 + 
 +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, smax, midiBuf) 
 + blockEvents = {}  
 + for ev in midiBuf:eachEvent() do 
 + if ev:isNoteOn() then 
 + local root = ev:getNote()  
 + local note = root + scale:choose() 
 + off_buffer[root] = note 
 + play(ev:getChannel(),note,ev:getVel()) 
 + elseif ev:isNoteOff() then 
 + local note = off_buffer[ev:getNote()] 
 + if not note == nil then 
 + play_off(ev:getChannel(),note) 
 + end 
 + end   
 + end 
 + -- fill midi buffer with prepared notes 
 + midiBuf:clear() 
 + if #blockEvents>0 then 
 + for _,e in ipairs(blockEvents) do 
 + midiBuf:addEvent(e) 
 + end  
 + end 
 +end 
 + 
 +function play(chan,note,vel) 
 + local newEv = midi.Event.noteOn(chan,note,vel) 
 + table.insert(blockEvents, newEv) 
 +end 
 +  
 + 
 +function play_off(chan,note) 
 + local newEv = midi.Event.noteOff(chan,note) 
 + table.insert(blockEvents, newEv) 
 +end
  
 +</code>
 ===== Encontros Passados ===== ===== Encontros Passados =====
  
projetos/musichacking/inicio.txt · Última modificação: 2023/11/13 23:30 por phil