Csound Csound-dev Csound-tekno Search About

[Cs-dev] Csound Android Crackle

Date2014-10-01 01:17
From"T.rev"
Subject[Cs-dev] Csound Android Crackle
I am attempting to build a step sequencer app using the Csound android
library. In doing this, the main requirement is for many instruments to be
played simultaneously. Ideally, I would love to use Csound for this because
many aspects of it fit my needs.

Except I have encountered a problem in some preliminary testing. I attempted
to play a simple beat (Kick, snare, hat) and when run through my PC it
sounds fine. Then when I run it through my android device, it fails at
playing two instruments at once and produces the dreaded crackle.
I could simply be missing something obvious so please forgive my ignorance
on the subject as I am new to audio processing and have not spent a
significant amount of time researching native audio processing libraries.

I have tried removing kr (setting it to default) and added ksmps = 64 (as
suggested by Steven Yi). This made no difference.
Thanks in Advance

Here is the csd :



-odac


sr     = 44100
kr     = 4410
nchnls =     2


instr 1; hihat


  ilen init p3
  iamp init p4


  kcutfreq  expon     10000, 0.1, 2500
  aamp      expon     iamp,  0.1,   10
  arand     rand      aamp
  alp1      butterlp  arand,kcutfreq
  alp2      butterlp  alp1,kcutfreq
  ahp1      butterhp  alp2,3500
  asigpre   butterhp  ahp1,3500
  asig      linen    (asigpre+arand/2),0,ilen, .05  


  outs asig, asig
endin


instr 2; snare
  icps0  = 147
  iamp   = p4*0.7


  icps1  =  2.0 * icps0
  
  kcps   port icps0, 0.007, icps1
  kcpsx  =  kcps * 1.5
  
  kfmd   port   0.0, 0.01, 0.7
  aenv1  expon  1.0, 0.03, 0.5
  kenv2  port   1.0, 0.008, 0.0
  aenv2  interp kenv2
  aenv3  expon  1.0, 0.025, 0.5
  
  a_     oscili 1.0, kcps, 1
  a1     oscili 1.0, kcps * (1.0 + a_*kfmd), 1
  a_     oscili 1.0, kcpsx, 1
  a2     oscili 1.0, kcpsx * (1.0 + a_*kfmd), 1
  
  a3     unirand 2.0
  a3     =  a3 - 1.0
  a3     butterbp a3, 5000, 7500
  a3     =  a3 * aenv2
  
  a0     =  a1 + a2*aenv3 + a3*1.0
  a0     =  a0 * aenv1


  outs a0*iamp, a0*iamp
endin


instr 3; kick
  iamp      = p4


  k1  expon    120, .2, 50    
  k2  expon    500, .4, 200
  a1  oscil    iamp, k1, 1
  a2  reson    a1, k2, 50
  a3  butterlp  a2+a1,k1,1
  a4  butterlp  a3,   k1,1
  a5  butterlp  a4,2500,1
  a6  butterhp  a5,50
  a7  butterhp  a6,50
  a8  linen    a7,0.01,p3, .2  
  
  outs a8,a8
endin


f1 0 65536 10 1


i1 0      0.25 10000
i1 0.25   0.25 10000
i1 0.5    0.25 10000
i1 0.75   0.25 10000
i1 1      0.25 10000
i1 1.25   0.25 10000
i1 1.5    0.25 10000
i1 1.75   0.25 10000
i1 2      0.25 10000
i1 2.25   0.25 10000
i1 2.5    0.25 10000
i1 2.75   0.25 10000
i1 3      0.25 10000
i1 3.25   0.25 10000
i1 3.5    0.25 10000
i1 3.75   0.25 10000


i2 0.5 1 10000   
i2 1.5 1 10000   
i2 2.5 1 10000   
i2 3.5 1 10000   


i3 0      0.25  100
i3 0.375  0.25  100
i3 0.75   0.25  100
i3 1.25   0.25  100
i3 2      0.25  100
i3 2.375  0.25  100
i3 2.75   0.25  100
i3 3.25   0.25  100
i3 3.75   0.25  100





--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-Android-Crackle-tp5737748.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-10-01 08:43
FromMichael Gogins
SubjectRe: [Cs-dev] Csound Android Crackle
AttachmentsNone  None  

Choice of parameters is critical. Try these:

sr = 48000
ksmps = 960

-b1920
-B3840

In addition, Android audio architecture so far is bad and only a fraction of the kperiod is actually usable by Csound. Rendering to file is much more efficient.

We hope Android will be improved. ..

Regards,

Mike

On Oct 1, 2014 9:09 AM, "T.rev" <trevor_lewis@live.com> wrote:
I am attempting to build a step sequencer app using the Csound android
library. In doing this, the main requirement is for many instruments to be
played simultaneously. Ideally, I would love to use Csound for this because
many aspects of it fit my needs.

Except I have encountered a problem in some preliminary testing. I attempted
to play a simple beat (Kick, snare, hat) and when run through my PC it
sounds fine. Then when I run it through my android device, it fails at
playing two instruments at once and produces the dreaded crackle.
I could simply be missing something obvious so please forgive my ignorance
on the subject as I am new to audio processing and have not spent a
significant amount of time researching native audio processing libraries.

I have tried removing kr (setting it to default) and added ksmps = 64 (as
suggested by Steven Yi). This made no difference.
Thanks in Advance

Here is the csd :

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr     = 44100
kr     = 4410
nchnls =     2


instr 1; hihat


  ilen init p3
  iamp init p4


  kcutfreq  expon     10000, 0.1, 2500
  aamp      expon     iamp,  0.1,   10
  arand     rand      aamp
  alp1      butterlp  arand,kcutfreq
  alp2      butterlp  alp1,kcutfreq
  ahp1      butterhp  alp2,3500
  asigpre   butterhp  ahp1,3500
  asig      linen    (asigpre+arand/2),0,ilen, .05


  outs asig, asig
endin


instr 2; snare
  icps0  = 147
  iamp   = p4*0.7


  icps1  =  2.0 * icps0

  kcps   port icps0, 0.007, icps1
  kcpsx  =  kcps * 1.5

  kfmd   port   0.0, 0.01, 0.7
  aenv1  expon  1.0, 0.03, 0.5
  kenv2  port   1.0, 0.008, 0.0
  aenv2  interp kenv2
  aenv3  expon  1.0, 0.025, 0.5

  a_     oscili 1.0, kcps, 1
  a1     oscili 1.0, kcps * (1.0 + a_*kfmd), 1
  a_     oscili 1.0, kcpsx, 1
  a2     oscili 1.0, kcpsx * (1.0 + a_*kfmd), 1

  a3     unirand 2.0
  a3     =  a3 - 1.0
  a3     butterbp a3, 5000, 7500
  a3     =  a3 * aenv2

  a0     =  a1 + a2*aenv3 + a3*1.0
  a0     =  a0 * aenv1


  outs a0*iamp, a0*iamp
endin


instr 3; kick
  iamp      = p4


  k1  expon    120, .2, 50
  k2  expon    500, .4, 200
  a1  oscil    iamp, k1, 1
  a2  reson    a1, k2, 50
  a3  butterlp  a2+a1,k1,1
  a4  butterlp  a3,   k1,1
  a5  butterlp  a4,2500,1
  a6  butterhp  a5,50
  a7  butterhp  a6,50
  a8  linen    a7,0.01,p3, .2

  outs a8,a8
endin
</CsInstruments>
<CsScore>
f1 0 65536 10 1


i1 0      0.25 10000
i1 0.25   0.25 10000
i1 0.5    0.25 10000
i1 0.75   0.25 10000
i1 1      0.25 10000
i1 1.25   0.25 10000
i1 1.5    0.25 10000
i1 1.75   0.25 10000
i1 2      0.25 10000
i1 2.25   0.25 10000
i1 2.5    0.25 10000
i1 2.75   0.25 10000
i1 3      0.25 10000
i1 3.25   0.25 10000
i1 3.5    0.25 10000
i1 3.75   0.25 10000


i2 0.5 1 10000
i2 1.5 1 10000
i2 2.5 1 10000
i2 3.5 1 10000


i3 0      0.25  100
i3 0.375  0.25  100
i3 0.75   0.25  100
i3 1.25   0.25  100
i3 2      0.25  100
i3 2.375  0.25  100
i3 2.75   0.25  100
i3 3.25   0.25  100
i3 3.75   0.25  100
</CsScore>
</CsoundSynthesizer>



--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-Android-Crackle-tp5737748.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel