Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-07 Thread Gonzalo Odiard
Yes, is included on version 7.
The sound is different. You can compare with version 6, and volume high.
I think the problem now is different, I don't know if is saturation or the
samples quality.

Gonzalo


On Tue, May 7, 2013 at 5:59 AM, Simon Schampijer wrote:

> On 05/03/2013 02:42 PM, Gonzalo Odiard wrote:
>
>> Hi Daniel,
>> Already released MusicKeyboard with this change, and waiting confirmation
>> to release TamTam activities.
>>
>> Gonzalo
>>
>
> Is that in version 7? I still hear cracking sounds when using the
> keyboard. Or maybe those are other cracking sounds then the ones talked
> about in this thread.
>
> Regards,
>Simon
>
>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-07 Thread Simon Schampijer

On 05/03/2013 02:42 PM, Gonzalo Odiard wrote:

Hi Daniel,
Already released MusicKeyboard with this change, and waiting confirmation
to release TamTam activities.

Gonzalo


Is that in version 7? I still hear cracking sounds when using the 
keyboard. Or maybe those are other cracking sounds then the ones talked 
about in this thread.


Regards,
   Simon


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-03 Thread Gonzalo Odiard
Hi Daniel,
Already released MusicKeyboard with this change, and waiting confirmation
to release TamTam activities.

Gonzalo


On Thu, May 2, 2013 at 11:11 AM, Daniel Drake  wrote:

> On Thu, May 2, 2013 at 7:44 AM, Gonzalo Odiard  wrote:
> > Thanks Daniel.
> > Two questions:
> > when was the change done? I mean, what sugar version should we mark as
> > compatible
> > with a activity with this change?
>
> I don't think it affects sugar version compatibility.
>
> > The second is, if you already have the binaries compiled for every xo,
> > if you can send me the binaries, I don't need do it again.
>
> Would be best if you could compile them.
>
> Thanks
> Daniel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-02 Thread Gonzalo Odiard
Ok


On Thu, May 2, 2013 at 11:11 AM, Daniel Drake  wrote:

> On Thu, May 2, 2013 at 7:44 AM, Gonzalo Odiard  wrote:
> > Thanks Daniel.
> > Two questions:
> > when was the change done? I mean, what sugar version should we mark as
> > compatible
> > with a activity with this change?
>
> I don't think it affects sugar version compatibility.
>
> > The second is, if you already have the binaries compiled for every xo,
> > if you can send me the binaries, I don't need do it again.
>
> Would be best if you could compile them.
>
> Thanks
> Daniel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-02 Thread Daniel Drake
On Thu, May 2, 2013 at 7:44 AM, Gonzalo Odiard  wrote:
> Thanks Daniel.
> Two questions:
> when was the change done? I mean, what sugar version should we mark as
> compatible
> with a activity with this change?

I don't think it affects sugar version compatibility.

> The second is, if you already have the binaries compiled for every xo,
> if you can send me the binaries, I don't need do it again.

Would be best if you could compile them.

Thanks
Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-02 Thread Gonzalo Odiard
Thanks Daniel.
Two questions:
when was the change done? I mean, what sugar version should we mark as
compatible
with a activity with this change?

The second is, if you already have the binaries compiled for every xo,
if you can send me the binaries, I don't need do it again.

Gonzalo


On Wed, May 1, 2013 at 12:25 PM, Daniel Drake  wrote:

> TamTam sound is crackly on some setups (e.g. XO-1.5 and newer with
> dmix running at 48000Hz).
>
> Clooper seems to implement its own ALSA sample rate resampling,
> as well as upsampling of the period rate to overcome any differences
> in csound period size and ALSA period size. This code is the cause of
> the crackles.
>
> Switch to csound's internal ALSA backend, which works well, and does
> not have these problems. Tested on XO-1, XO-1.5, XO-1.75 and XO-4.
> ---
>  common/Config.py|   5 -
>  common/Resources/tamtamorc.csd  |   2 +-
>  common/Util/CSoundClient.py |   4 +-
>  common/Util/Clooper/Makefile|   4 +-
>  common/Util/Clooper/aclient.cpp | 127 +++--
>  common/Util/Clooper/audio.cpp   | 237
> 
>  6 files changed, 17 insertions(+), 362 deletions(-)
>  delete mode 100644 common/Util/Clooper/audio.cpp
>
> v2: totally remove dependency on ALSA header and library
>
> diff --git a/common/Config.py b/common/Config.py
> index b1c1318..bb9c3ff 100644
> --- a/common/Config.py
> +++ b/common/Config.py
> @@ -55,13 +55,8 @@ for i in (INSTANCE_DIR, DATA_DIR, SNDS_INFO_DIR,
> TMP_DIR):
>  PLUGIN_DEBUG = os.getenv("CSOUND_LOGFILE", "")
>  PLUGIN_VERBOSE = DEBUG
>  PLUGIN_UNIVORC = join(FILES_DIR, "tamtamorc.csd")
> -PLUGIN_KSMPS = 64
>  PLUGIN_RATE = 16000
>
> -## PLUGIN ALSA PARAMETERS:
> -PLUGIN_PERIOD = 1024
> -PLUGIN_NPERIODS = 2
> -
>  try:
>  from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton
>  HAVE_TOOLBOX = True
> diff --git a/common/Resources/tamtamorc.csd
> b/common/Resources/tamtamorc.csd
> index f0a63f1..3adf81b 100644
> --- a/common/Resources/tamtamorc.csd
> +++ b/common/Resources/tamtamorc.csd
> @@ -1,6 +1,6 @@
>  
>  
> --n -m0 -W -s -d
> +-n -odac -m0 -W -s -d
>  
>  
>  sr=16000
> diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py
> index 3cf6794..c082137 100644
> --- a/common/Util/CSoundClient.py
> +++ b/common/Util/CSoundClient.py
> @@ -47,9 +47,7 @@ class _CSoundClientPlugin:
>
>  def __init__(self):
>  sc_initialize( Config.PLUGIN_UNIVORC, Config.PLUGIN_DEBUG,
> -Config.PLUGIN_PERIOD, Config.PLUGIN_NPERIODS,
> -Config.PLUGIN_VERBOSE,
> -Config.PLUGIN_KSMPS, Config.PLUGIN_RATE)
> +Config.PLUGIN_VERBOSE, Config.PLUGIN_RATE)
>  self.on = False
>  #self.masterVolume = 100.0
>  self.periods_per_buffer = 2
> diff --git a/common/Util/Clooper/Makefile b/common/Util/Clooper/Makefile
> index 0f28366..4fddb2e 100644
> --- a/common/Util/Clooper/Makefile
> +++ b/common/Util/Clooper/Makefile
> @@ -15,7 +15,7 @@ LIB_NAME = $(CSOUND_ARCH)_$(CSOUND_VERSION)
>  CXXFLAGS = $(shell python-config --cflags) \
>-Wall -Werror -fPIC -O2 -finline
>  LDFLAGS+=  $(python-config --libs) \
> -  -lasound -lcsound
> +  -lcsound
>
>  all : aclient.so
> rm -rf $(LIB_NAME)
> @@ -23,7 +23,7 @@ all : aclient.so
> mv aclient.so $(LIB_NAME)/
> touch $(LIB_NAME)/__init__.py
>
> -aclient.so : aclient.cpp audio.cpp
> +aclient.so : aclient.cpp
> g++ $(CXXFLAGS) -shared -o $@ $< $(LDFLAGS)
>
>  clean :
> diff --git a/common/Util/Clooper/aclient.cpp
> b/common/Util/Clooper/aclient.cpp
> index f238c36..e68b8cb 100644
> --- a/common/Util/Clooper/aclient.cpp
> +++ b/common/Util/Clooper/aclient.cpp
> @@ -12,20 +12,8 @@
>  #include 
>
>  #include 
> -#include 
>
> -static double pytime(const struct timeval * tv)
> -{
> -struct timeval t;
> -if (!tv)
> -{
> -tv = &t;
> -gettimeofday(&t, NULL);
> -}
> -return (double) tv->tv_sec + (double) tv->tv_usec / 100.0;
> -}
>  #include "log.cpp"
> -#include "audio.cpp"
>
>
>  int VERBOSE = 3;
> @@ -510,52 +498,31 @@ struct TamTamSound
>  MYFLT tick_total;
>
>  /** the upsampling ratio from csound */
> -unsigned int csound_ksmps;
> -snd_pcm_uframes_t csound_frame_rate;
> -snd_pcm_uframes_t csound_period_size;
> -snd_pcm_uframes_t period0;
> -unsigned int period_per_buffer; //should be 2
> -int up_ratio;  //if the hardware only supports a small integer
> multiple of our effective samplerate, do a real-time conversion
> +int csound_frame_rate;
> +long csound_period_size;
>
>  log_t * ll;
> -SystemStuff * sys_stuff;
>
> -TamTamSound(log_t * ll, char * orc, snd_pcm_uframes_t period0,
> unsigned int ppb, int ksmps, int framerate )
> +TamTamSound(log_t * ll, char * orc, int framerate )
>  : ThreadID(NULL), PERF_STATUS(STOP), csound(NULL),
>  music(),
>

[Sugar-devel] [PATCH TamTam 1/2 v2] Output to ALSA directly from csound

2013-05-01 Thread Daniel Drake
TamTam sound is crackly on some setups (e.g. XO-1.5 and newer with
dmix running at 48000Hz).

Clooper seems to implement its own ALSA sample rate resampling,
as well as upsampling of the period rate to overcome any differences
in csound period size and ALSA period size. This code is the cause of
the crackles.

Switch to csound's internal ALSA backend, which works well, and does
not have these problems. Tested on XO-1, XO-1.5, XO-1.75 and XO-4.
---
 common/Config.py|   5 -
 common/Resources/tamtamorc.csd  |   2 +-
 common/Util/CSoundClient.py |   4 +-
 common/Util/Clooper/Makefile|   4 +-
 common/Util/Clooper/aclient.cpp | 127 +++--
 common/Util/Clooper/audio.cpp   | 237 
 6 files changed, 17 insertions(+), 362 deletions(-)
 delete mode 100644 common/Util/Clooper/audio.cpp

v2: totally remove dependency on ALSA header and library

diff --git a/common/Config.py b/common/Config.py
index b1c1318..bb9c3ff 100644
--- a/common/Config.py
+++ b/common/Config.py
@@ -55,13 +55,8 @@ for i in (INSTANCE_DIR, DATA_DIR, SNDS_INFO_DIR, TMP_DIR):
 PLUGIN_DEBUG = os.getenv("CSOUND_LOGFILE", "")
 PLUGIN_VERBOSE = DEBUG
 PLUGIN_UNIVORC = join(FILES_DIR, "tamtamorc.csd")
-PLUGIN_KSMPS = 64
 PLUGIN_RATE = 16000
 
-## PLUGIN ALSA PARAMETERS:
-PLUGIN_PERIOD = 1024
-PLUGIN_NPERIODS = 2
-
 try:
 from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton
 HAVE_TOOLBOX = True
diff --git a/common/Resources/tamtamorc.csd b/common/Resources/tamtamorc.csd
index f0a63f1..3adf81b 100644
--- a/common/Resources/tamtamorc.csd
+++ b/common/Resources/tamtamorc.csd
@@ -1,6 +1,6 @@
 
 
--n -m0 -W -s -d
+-n -odac -m0 -W -s -d
 
 
 sr=16000
diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py
index 3cf6794..c082137 100644
--- a/common/Util/CSoundClient.py
+++ b/common/Util/CSoundClient.py
@@ -47,9 +47,7 @@ class _CSoundClientPlugin:
 
 def __init__(self):
 sc_initialize( Config.PLUGIN_UNIVORC, Config.PLUGIN_DEBUG,
-Config.PLUGIN_PERIOD, Config.PLUGIN_NPERIODS,
-Config.PLUGIN_VERBOSE,
-Config.PLUGIN_KSMPS, Config.PLUGIN_RATE)
+Config.PLUGIN_VERBOSE, Config.PLUGIN_RATE)
 self.on = False
 #self.masterVolume = 100.0
 self.periods_per_buffer = 2
diff --git a/common/Util/Clooper/Makefile b/common/Util/Clooper/Makefile
index 0f28366..4fddb2e 100644
--- a/common/Util/Clooper/Makefile
+++ b/common/Util/Clooper/Makefile
@@ -15,7 +15,7 @@ LIB_NAME = $(CSOUND_ARCH)_$(CSOUND_VERSION)
 CXXFLAGS = $(shell python-config --cflags) \
   -Wall -Werror -fPIC -O2 -finline 
 LDFLAGS+=  $(python-config --libs) \
-  -lasound -lcsound
+  -lcsound
 
 all : aclient.so
rm -rf $(LIB_NAME)
@@ -23,7 +23,7 @@ all : aclient.so
mv aclient.so $(LIB_NAME)/
touch $(LIB_NAME)/__init__.py
 
-aclient.so : aclient.cpp audio.cpp
+aclient.so : aclient.cpp
g++ $(CXXFLAGS) -shared -o $@ $< $(LDFLAGS)
 
 clean :
diff --git a/common/Util/Clooper/aclient.cpp b/common/Util/Clooper/aclient.cpp
index f238c36..e68b8cb 100644
--- a/common/Util/Clooper/aclient.cpp
+++ b/common/Util/Clooper/aclient.cpp
@@ -12,20 +12,8 @@
 #include 
 
 #include 
-#include 
 
-static double pytime(const struct timeval * tv)
-{
-struct timeval t;
-if (!tv)
-{
-tv = &t;
-gettimeofday(&t, NULL);
-}
-return (double) tv->tv_sec + (double) tv->tv_usec / 100.0;
-}
 #include "log.cpp"
-#include "audio.cpp"
 
 
 int VERBOSE = 3;
@@ -510,52 +498,31 @@ struct TamTamSound
 MYFLT tick_total;
 
 /** the upsampling ratio from csound */
-unsigned int csound_ksmps;
-snd_pcm_uframes_t csound_frame_rate;
-snd_pcm_uframes_t csound_period_size;
-snd_pcm_uframes_t period0;
-unsigned int period_per_buffer; //should be 2
-int up_ratio;  //if the hardware only supports a small integer multiple of 
our effective samplerate, do a real-time conversion
+int csound_frame_rate;
+long csound_period_size;
 
 log_t * ll;
-SystemStuff * sys_stuff;
 
-TamTamSound(log_t * ll, char * orc, snd_pcm_uframes_t period0, unsigned 
int ppb, int ksmps, int framerate )
+TamTamSound(log_t * ll, char * orc, int framerate )
 : ThreadID(NULL), PERF_STATUS(STOP), csound(NULL),
 music(),
 ticks_per_period(0.0),
 tick_adjustment(0.0), 
 tick_total(0.0),
-csound_ksmps(ksmps),//must agree with the 
orchestra file
 csound_frame_rate(framerate),   //must agree with the 
orchestra file
-period0(period0),
-period_per_buffer(ppb),
-up_ratio(1),
-ll( ll ),
-sys_stuff(NULL)
+ll( ll )
 {
-sys_stuff = new SystemStuff(ll);
-if (0 > sys_stuff->open(csound_frame_rate, 4, period0, 
period_per_buffer))
-{
-return;
-}
-sys_stu