diff --git a/csound-sampler.cabal b/csound-sampler.cabal
--- a/csound-sampler.cabal
+++ b/csound-sampler.cabal
@@ -1,5 +1,5 @@
 name:                csound-sampler
-version:             0.0.6.3
+version:             0.0.6.4
 license:             BSD3
 license-file:        LICENSE
 author:              Anton Kholomiov
@@ -25,7 +25,7 @@
 library
   Ghc-Options:    -Wall
   Hs-Source-Dirs:      src/
-  build-depends:       base >= 4, base < 5, transformers >= 0.3, csound-expression >= 4.8.3
+  build-depends:       base >= 4, base < 5, transformers >= 0.3, csound-expression >= 4.9.0
   exposed-modules:     
     Csound.Sam
     Csound.Sam.Core
diff --git a/src/Csound/Sam.hs b/src/Csound/Sam.hs
--- a/src/Csound/Sam.hs
+++ b/src/Csound/Sam.hs
@@ -3,7 +3,7 @@
 module Csound.Sam (
 	Sample, Sam, Bpm, runSam, 
 	-- * Lifters
-	mapBpm, bindSam, bindBpm, liftSam,
+	mapBpm, bindSam, bindBpm, liftSam, mapBpm2, bindBpm2, withBpm,
 	-- * Constructors
 	sig1, sig2, infSig1, infSig2, fromSig1, fromSig2, ToSam(..), limSam,
 	-- ** Stereo
diff --git a/src/Csound/Sam/Core.hs b/src/Csound/Sam/Core.hs
--- a/src/Csound/Sam/Core.hs
+++ b/src/Csound/Sam/Core.hs
@@ -2,7 +2,7 @@
 {-# Language DeriveFunctor, TypeSynonymInstances, FlexibleInstances #-}
 module Csound.Sam.Core (
 	Sam, runSam, Sample(..), S(..), Dur(..), Bpm,
-	liftSam, mapBpm, bindSam, bindBpm
+	liftSam, mapBpm, mapBpm2, bindSam, bindBpm, bindBpm2, withBpm
 ) where
 
 import Control.Applicative
@@ -17,6 +17,9 @@
 instance RenderCsd Sam where
     renderCsdBy opt sample = renderCsdBy opt (runSam (120 * 4) sample)
 
+instance RenderCsd (Source Sam) where
+	renderCsdBy opt sample = renderCsdBy opt (lift1 (runSam (120 * 4)) sample)	
+
 runSam :: Bpm -> Sam -> SE Sig2
 runSam bpm x = fmap samSig $ runReaderT (unSam x) bpm
 
@@ -69,19 +72,31 @@
 	lift $ fmap (\x -> a{ samSig = x}) $ samSig a
 
 -- | Transforms the sample with BPM.
-mapBpm :: (Bpm -> Sig2 -> Sig2) -> Sam -> Sam
-mapBpm f (Sam ra) = Sam $ do
-	bpm <- ask
-	a <- ra
-	return $ a { samSig = f bpm $ samSig a }
+mapBpm :: (Bpm -> a -> b) -> Sample a -> Sample b
+mapBpm f a = Sam $ do
+	bpm <- ask	
+	unSam $ fmap (f bpm) a
 
+-- | Transforms the sample with BPM.
+mapBpm2 :: (Bpm -> a -> b -> c) -> Sample a -> Sample b -> Sample c
+mapBpm2 f a b = Sam $ do
+	bpm <- ask	
+	unSam $ liftA2 (f bpm) a b	
+
 -- | Lifts bind on stereo signals to samples.
-bindSam :: (Sig2 -> SE Sig2) -> Sam -> Sam
+bindSam :: (a -> SE b) -> Sample a -> Sample b
 bindSam f = liftSam . fmap f
 
 -- | Lifts bind on stereo signals to samples with BPM.
-bindBpm :: (Bpm -> Sig2 -> SE Sig2) -> Sam -> Sam
-bindBpm f (Sam ra) = Sam $ do
+bindBpm :: (Bpm -> a -> SE b) -> Sample a -> Sample b
+bindBpm f a = liftSam $ mapBpm f a
+
+-- | Lifts bind on stereo signals to samples with BPM.
+bindBpm2 :: (Bpm -> a -> b -> SE c) -> Sample a -> Sample b -> Sample c
+bindBpm2 f a b = liftSam $ mapBpm2 f a b
+
+
+withBpm :: (Bpm -> Sample a) -> Sample a
+withBpm x = Sam $ do
 	bpm <- ask
-	a <- ra
-	lift $ fmap (\x -> a{ samSig = x}) $ f bpm $ samSig a
+	unSam $ x bpm
diff --git a/src/Csound/Sam/Trig.hs b/src/Csound/Sam/Trig.hs
--- a/src/Csound/Sam/Trig.hs
+++ b/src/Csound/Sam/Trig.hs
@@ -2,6 +2,9 @@
 	-- * Char sampler
 	samCharTrig, samCharTap, samCharPush, samCharToggle, samCharGroup, samCharCycle,
 
+	-- ** Synchronized with number of beats
+	samSyncCharTrig, samSyncCharPush, samSyncCharToggle, samSyncCharTap, samSyncCharGroup, samSyncCharCycle,
+
 	-- * Midi sampler
 	samMidiTrig, samMidiTap, samMidiPush, samMidiToggle, samMidiGroup,
 
@@ -15,7 +18,7 @@
 
 import Csound.Base
 import qualified Csound.Sam.Core as S
-import Csound.Sam.Core(Sam, bindSam)
+import Csound.Sam.Core(Sam, bindSam, mapBpm, mapBpm2)
 
 ------------------------------------------------------
 
@@ -57,6 +60,56 @@
 samCharCycle initVal start stop as = case initVal of
 	Nothing -> fmap (charCycle Nothing start stop) (sequenceA as)
 	Just v0 -> liftA2 (\v xs -> charCycle (Just v) start stop xs) v0 (sequenceA as)
+
+
+------------------------------------------------------
+-- synchronised
+
+syncBeats bpm beats = sig $ bpm / beats
+
+-- | Triggers the sample with any char from the first string
+-- and stops the sample with any char from the second string.
+-- The first argument is the number of beats for syncronization.
+samSyncCharTrig :: D -> Maybe Sam -> String -> String -> Sam -> Sam
+samSyncCharTrig beats initVal starts stops x = case initVal of
+	Nothing -> mapBpm (\bpm a -> syncCharTrig (syncBeats bpm beats) Nothing starts stops a) x
+	Just v0 -> mapBpm2 (\bpm v sigs -> syncCharTrig (syncBeats bpm beats) (Just v) starts stops sigs) v0 x
+
+-- | Plays a sample while the key is pressed.
+-- The first argument is the number of beats for syncronization.
+samSyncCharPush :: D -> Maybe Sam -> Char -> Sam -> Sam
+samSyncCharPush beats initVal ch x = case initVal of
+	Nothing -> mapBpm (\bpm a -> syncCharPush (syncBeats bpm beats) Nothing ch a) x
+	Just v0 -> mapBpm2 (\bpm v sigs -> syncCharPush (syncBeats bpm beats) (Just v) ch sigs) v0 x
+
+-- | Toggles the sample when the key is pressed.
+-- The first argument is the number of beats for syncronization.
+samSyncCharToggle :: D -> Maybe Sam -> Char -> Sam -> Sam
+samSyncCharToggle beats initVal ch x = case initVal of
+	Nothing -> mapBpm (\bpm a -> syncCharToggle (syncBeats bpm beats) Nothing ch a) x
+	Just v0 -> mapBpm2 (\bpm v sigs -> syncCharToggle (syncBeats bpm beats) (Just v) ch sigs) v0 x
+
+-- | Char trigger with fixed note limiting by length in second.
+-- It's useful optimization. It's good to use for drum notes and short sounds.
+-- The first argument is the number of beats for syncronization.
+samSyncCharTap :: D -> D -> String -> Sam -> Sam
+samSyncCharTap beats stop starts = mapBpm (\bpm x -> syncCharTap (syncBeats bpm beats) stop starts x)
+
+-- | Plays one of the sample from the list when corresponding char is pressed.
+-- The last string is for stopping the samples.
+samSyncCharGroup :: D -> Maybe Sam -> [(Char, Sam)] -> String -> Sam
+samSyncCharGroup beats initVal as stop = case initVal of
+	Nothing -> mapBpm (\bpm xs -> syncCharGroup (syncBeats bpm beats) Nothing (zip starts xs) stop) (sequenceA sams)
+	Just v0 -> mapBpm2 (\bpm v xs -> syncCharGroup (syncBeats bpm beats) (Just v) (zip starts xs) stop) v0 (sequenceA sams)
+	where (starts, sams) = unzip as
+
+-- | Plays samples in sequence when key is pressed. The last string is 
+-- for stopping the sequence.
+-- The first argument is the number of beats for syncronization.
+samSyncCharCycle :: D -> Maybe Sam -> Char -> String -> [Sam] -> Sam
+samSyncCharCycle beats initVal start stop as = case initVal of
+	Nothing -> mapBpm (\bpm -> syncCharCycle (syncBeats bpm beats) Nothing start stop) (sequenceA as)
+	Just v0 -> mapBpm2 (\bpm v xs -> syncCharCycle (syncBeats bpm beats) (Just v) start stop xs) v0 (sequenceA as)
 
 ------------------------------------------------------
 
diff --git a/src/Csound/Sam/Ui.hs b/src/Csound/Sam/Ui.hs
--- a/src/Csound/Sam/Ui.hs
+++ b/src/Csound/Sam/Ui.hs
@@ -1,3 +1,4 @@
+{-# Language FlexibleContexts #-}
 -- | Graphical widgets for playing samples
 module Csound.Sam.Ui(
 	freeSim, hfreeSim, freeSimWith, hfreeSimWith,
