pNote
  = xpElem "note" $ wNote
    ppitch -- Pitch
    pdur   -- Duration
    pvoice -- Voice
    ptype  -- Type
  where ppitch = xpElem "pitch" (wPitch pstep poct palter)   :: PU MXPitch      
        pstep  = selNodeAndPickle "step"                     -- Pitch Step       
        poct   = selNodeAndPickle "octave"                   -- Pitch Octave     
        palter = xpOption $ selNodeAndPickle "alter"         -- Ptich Maybe Alter    
        
        pdur   = selNodeAndPickle "duration"                 -- Duration
                 
        pvoice = selNodeAndPickle "voice"                    -- Voice

        ptype  = selNodeAndPickle "type"                     -- Note Type (eg quarter)    
          
        -- Wrap functions
        wNote a b c d = xpWrap (uncurry4 MXNote, \(MXNote pitch dur voice notetype) -> (pitch,dur,voice,notetype)) $ xp4Tuple a b c d  
        wPitch a b c = xpWrap (uncurry3 MXPitch, \(MXPitch step oct alt) -> (step, oct, alt)) $ xpTriple a b c

----------------------------------------------------------------------------------------------------                      
-- Helper functions
----------------------------------------------------------------------------------------------------
pNote
  = xpElem "note" $ wNote
    ppitch -- Pitch
    pdur   -- Duration
    pvoice -- Voice
    ptype  -- Type
  where ppitch = xpElem "pitch" (wPitch pstep poct palter)   :: PU MXPitch      
        pstep  = selNodeAndPickle "step"                     -- Pitch Step       
        poct   = selNodeAndPickle "octave"                   -- Pitch Octave     
        palter = xpOption $ selNodeAndPickle "alter"         -- Ptich Maybe Alter    
        
        pdur   = selNodeAndPickle "duration"                 -- Duration
                 
        pvoice = selNodeAndPickle "voice"                    -- Voice

        ptype  = selNodeAndPickle "type"                     -- Note Type (eg quarter)    
          
        -- Wrap functions
        wNote a b c d = xpWrap (uncurry4 MXNote, \(MXNote pitch dur voice notetype) -> (pitch,dur,voice,notetype)) $ xp4Tuple a b c d  
        wPitch a b c = xpWrap (uncurry3 MXPitch, \(MXPitch step oct alt) -> (step, oct, alt)) $ xpTriple a b c

----------------------------------------------------------------------------------------------------                      
-- Helper functions
----------------------------------------------------------------------------------------------------
pNote
  = xpElem "note" $ wNote
    ppitch -- Pitch
    pdur   -- Duration
    pvoice -- Voice
    ptype  -- Type
  where ppitch = xpElem "pitch" (wPitch pstep poct palter)   :: PU MXPitch      
        pstep  = selNodeAndPickle "step"                     -- Pitch Step       
        poct   = selNodeAndPickle "octave"                   -- Pitch Octave     
        palter = xpOption $ selNodeAndPickle "alter"         -- Ptich Maybe Alter    
        
        pdur   = selNodeAndPickle "duration"                 -- Duration
                 
        pvoice = selNodeAndPickle "voice"                    -- Voice

        ptype  = selNodeAndPickle "type"                     -- Note Type (eg quarter)    
          
        -- Wrap functions
        wNote a b c d = xpWrap (uncurry4 MXNote, \(MXNote pitch dur voice notetype) -> (pitch,dur,voice,notetype)) $ xp4Tuple a b c d  
        wPitch a b c = xpWrap (uncurry3 MXPitch, \(MXPitch step oct alt) -> (step, oct, alt)) $ xpTriple a b c

----------------------------------------------------------------------------------------------------                      
-- Helper functions
----------------------------------------------------------------------------------------------------