Quantcast

[Csnd] samples out of range using the api

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Csnd] samples out of range using the api

neithanmo
Hi csounders.

I have a trouble when using the csound API.
I using the same csd file(demos from here http://freaknet.org/martin/audio/csound/ ) in both cases.. when using csound directly I dont need to do change  on the file. and I dont get samples out of range, for example this :

...
<CsInstruments>

sr=44100
kr=4410
ksmps=10
nchnls=2
instr 2
ipch    =    cpspch(p5)

imult    =    ((p6+1) / p6) * .5
iseed    =    (rnd(100)+100)/200


    k2    expseg    .0625, 15, .0625, 113, 3.75, 113, .03125, 15, .0625
    k3    linseg    1, 240, 1, 16, 0
    k1    phasor    p7 * k2
    k1    tablei    256 * k1 , 100, 0, 0, 1
    krand    randi    30000, p7 * 5, iseed
    krand    =    (krand + 30000) / 60000
    a1    oscil    p4 * imult * k1 * k3, ipch * p6, 1
    outs    a1 * sqrt(krand), a1 * (sqrt(1-krand))

    ...

but using the API taking samples from spout buffer, I get samples out of range, then I need to do:
                        
                             outs    a1 * sqrt(krand)*.0001, a1 * (sqrt(1-krand))*.0001

And it salve the problem, the same for any csd file from the demos, using them for testing my aplication.
so, when does csound perform  a scaling on the samples? in the spout buffer or on the hardware buffer?
another thing, when using csound directly I set -odac option. but when test my app I turn csound to silent using -n option.
Is necesary to do change to the csd file when using the api?

(below the full csd file)
Thanks
 
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] samples out of range using the api

rorywalsh
Make sure you scale everything by 0dbfs(). Use this function:
Then divide the output of your spout buffer by the value it returns. 

On 21 February 2017 at 14:25, Natanael Mojica <[hidden email]> wrote:
Hi csounders.

I have a trouble when using the csound API.
I using the same csd file(demos from here http://freaknet.org/martin/audio/csound/ ) in both cases.. when using csound directly I dont need to do change  on the file. and I dont get samples out of range, for example this :

...
<CsInstruments>

sr=44100
kr=4410
ksmps=10
nchnls=2
instr 2
ipch    =    cpspch(p5)

imult    =    ((p6+1) / p6) * .5
iseed    =    (rnd(100)+100)/200


    k2    expseg    .0625, 15, .0625, 113, 3.75, 113, .03125, 15, .0625
    k3    linseg    1, 240, 1, 16, 0
    k1    phasor    p7 * k2
    k1    tablei    256 * k1 , 100, 0, 0, 1
    krand    randi    30000, p7 * 5, iseed
    krand    =    (krand + 30000) / 60000
    a1    oscil    p4 * imult * k1 * k3, ipch * p6, 1
    outs    a1 * sqrt(krand), a1 * (sqrt(1-krand))

    ...

but using the API taking samples from spout buffer, I get samples out of range, then I need to do:
                        
                             outs    a1 * sqrt(krand)*.0001, a1 * (sqrt(1-krand))*.0001

And it salve the problem, the same for any csd file from the demos, using them for testing my aplication.
so, when does csound perform  a scaling on the samples? in the spout buffer or on the hardware buffer?
another thing, when using csound directly I set -odac option. but when test my app I turn csound to silent using -n option.
Is necesary to do change to the csd file when using the api?

(below the full csd file)
Thanks
 
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] samples out of range using the api

neithanmo
Thanks Roy..
I Will try it. 

On Feb 21, 2017 8:53 AM, "Rory Walsh" <[hidden email]> wrote:
Make sure you scale everything by 0dbfs(). Use this function:
Then divide the output of your spout buffer by the value it returns. 

On 21 February 2017 at 14:25, Natanael Mojica <[hidden email]> wrote:
Hi csounders.

I have a trouble when using the csound API.
I using the same csd file(demos from here http://freaknet.org/martin/audio/csound/ ) in both cases.. when using csound directly I dont need to do change  on the file. and I dont get samples out of range, for example this :

...
<CsInstruments>

sr=44100
kr=4410
ksmps=10
nchnls=2
instr 2
ipch    =    cpspch(p5)

imult    =    ((p6+1) / p6) * .5
iseed    =    (rnd(100)+100)/200


    k2    expseg    .0625, 15, .0625, 113, 3.75, 113, .03125, 15, .0625
    k3    linseg    1, 240, 1, 16, 0
    k1    phasor    p7 * k2
    k1    tablei    256 * k1 , 100, 0, 0, 1
    krand    randi    30000, p7 * 5, iseed
    krand    =    (krand + 30000) / 60000
    a1    oscil    p4 * imult * k1 * k3, ipch * p6, 1
    outs    a1 * sqrt(krand), a1 * (sqrt(1-krand))

    ...

but using the API taking samples from spout buffer, I get samples out of range, then I need to do:
                        
                             outs    a1 * sqrt(krand)*.0001, a1 * (sqrt(1-krand))*.0001

And it salve the problem, the same for any csd file from the demos, using them for testing my aplication.
so, when does csound perform  a scaling on the samples? in the spout buffer or on the hardware buffer?
another thing, when using csound directly I set -odac option. but when test my app I turn csound to silent using -n option.
Is necesary to do change to the csd file when using the api?

(below the full csd file)
Thanks
 
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Loading...