Re: [haskell art] alsa-seq example

2015-05-22 Thread Miguel Negrão
hi Thielmann,

On 22-05-2015 12:01, Henning Thielemann wrote:
 
 On Fri, 22 May 2015, Miguel Negrão wrote:
 
 Does anyone have some example code of how to use alsa-seq to get midi events
 from a midi controller.
 
 This should help:
https://hackage.haskell.org/package/alsa-seq-0.6.0.5/src/examples/dump.hs
 

Running the code in that file doesn't produce any output after waiting
for an event: when I move the sliders. I have the controller connected
and it appears in the list-ports.hs example. I'm I supposed to change
something in the code to point to the port of my controller ?

Is portmidi perhaps easier to use ? I did get that working, but it
doesn't seem to have any callback interface, it seems I have to poll it,
and it is a bit low level too.

It would be nice to have higher level MIDI device layer similar to
SuperCollider.

thanks,
Miguel

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/3kWhGohFFF4Zx404LSnRKl

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] alsa-seq example

2015-05-22 Thread Henning Thielemann

On Fri, 22 May 2015, Miguel Negrão wrote:

 Does anyone have some example code of how to use alsa-seq to get midi events
 from a midi controller.

This should help:
   https://hackage.haskell.org/package/alsa-seq-0.6.0.5/src/examples/dump.hs
-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/7J8abgRYlyLDdaIJRhD0ps

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] alsa-seq example

2015-05-22 Thread Henning Thielemann


On Fri, 22 May 2015, Miguel Negrão wrote:

 On 22-05-2015 12:01, Henning Thielemann wrote:

 On Fri, 22 May 2015, Miguel Negrão wrote:

 Does anyone have some example code of how to use alsa-seq to get midi events
 from a midi controller.

 This should help:
https://hackage.haskell.org/package/alsa-seq-0.6.0.5/src/examples/dump.hs


 Running the code in that file doesn't produce any output after waiting
 for an event: when I move the sliders. I have the controller connected
 and it appears in the list-ports.hs example. I'm I supposed to change
 something in the code to point to the port of my controller ?

Have you connected the controller to the dump example using 'aconnect' or 
'patchage' or the like?

E.g. I have to run:

$ aconnect 'SAMSON Graphite 49' Haskell-Dump


 Is portmidi perhaps easier to use ? I did get that working, but it
 doesn't seem to have any callback interface, it seems I have to poll it,
 and it is a bit low level too.

I have no experience with PortMidi. JACK and the Haskell jack package are 
an alternative.

 It would be nice to have higher level MIDI device layer similar to
 SuperCollider.

There is the midi-alsa package that maps alsa-seq events to events from 
the 'midi' package. Do you consider this higher level? There is also the 
reactive-balsa package that provides functional reactive programming of 
ALSA via tha reactive-banana framework.
-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/KNUwMta2GVsvncKbRnTBz

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe


Re: [haskell art] alsa-seq example

2015-05-22 Thread Miguel Negrão
On 22-05-2015 12:35, Henning Thielemann wrote:
 Running the code in that file doesn't produce any output after waiting
 for an event: when I move the sliders. I have the controller connected
 and it appears in the list-ports.hs example. I'm I supposed to change
 something in the code to point to the port of my controller ?
 
 Have you connected the controller to the dump example using 'aconnect' or 
 'patchage' or the like?
 
 E.g. I have to run:
 
 $ aconnect 'SAMSON Graphite 49' Haskell-Dump

Ah, no I didn't do that (I have no idea of how alsa midi works, I only ever 
used MIDI from inside SuperCollider). Ok, after doing aconnect 'nanoKONTROL' 
Haskell-Dump I get input, so it seems to be working. Great !! I would prefer 
not to have to connect the nano to the program externally via bash, I suppose 
this can be done from inside the program also ? Would copying from these 
functions from reactive-balsa be the way to go ?

connect :: [String] - [String] - ReaderT Handle IO ()
connect fromNames toNames = do
   _ - connectFrom = parseAddresses fromNames
   _ - connectTo   = parseAddresses toNames
   return ()

connectFrom, connectTo :: Addr.T - ReaderT Handle IO Connect.T
connectFrom from = Reader.ReaderT $ \h -
   Connect.createFrom (sequ h) (portPublic h) from
connectTo   to   = Reader.ReaderT $ \h -
   Connect.createTo   (sequ h) (portPublic h) to

 There is the midi-alsa package that maps alsa-seq events to events from 
 the 'midi' package. Do you consider this higher level? There is also the 
 reactive-balsa package that provides functional reactive programming of 
 ALSA via tha reactive-banana framework.

My next step after having MIDI working was going to be connecting it to 
reactive-banana so reactive-balsa looks to be exactly I was hoping for !!! 
Unfortunatelly it doesn't build currently[1] with the nix package manager 
(reactive-banana 0.7 vs 0.8, etc), so I will have to work a bit to get it to 
build... 

Thanks !!
Miguel

[1]http://hydra.cryp.to/build/865748/nixlog/2

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/2gPhGHtnRMayFWTAHKFVqD

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe