Csound Csound-dev Csound-tekno Search About

mixing the lemets of a signal array

Date2015-08-30 17:15
Frompeiman khosravi
Subjectmixing the lemets of a signal array
AttachmentsNone  None  
Following up on my earlier array question, is there a simple way of mixing the audio channels represented in a signal array into a single channel? So for instance, I'd like a soundfile with an arbitrary number of channels to be mixed down to mono:

instr 2
asig[] diskin2 "$FILE", 100
aMonoMix asig ;something like this??
out aMonoMix
endin

​Perhaps a UDO? but I can't quite imagine how that would work with a signal array.

Many Thanks
Peiman
 ​


Date2015-08-30 17:26
Fromjpff
SubjectRe: mixing the lemets of a signal array
Use add mapped over the array


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-30 17:37
Frompeiman khosravi
SubjectRe: mixing the lemets of a signal array
AttachmentsNone  None  
Doesn't maparray only support krate arrays?

Thanks
P



On 30 August 2015 at 17:26, jpff <jpff@codemist.co.uk> wrote:
Use add mapped over the array


------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-30 18:00
Fromjpff
SubjectRe: mixing the lemets of a signal array
yes -- my mistake.  Could add a case to sumarray ....  Actually rater weak 
ona-rate array operations.  sumarray isan obvious one and I can see the 
need.  Time for a discussion?
==John




------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-30 18:30
FromSteven Yi
SubjectRe: mixing the lemets of a signal array
I just tried this and it seems to work:




sr  = 44100
ksmps = 1
nchnls  = 2
0dbfs = 1

opcode mix_to_mono, a, a[]
asigs[] xin
aout = 0
kindx = 0

until (kindx >= lenarray(asigs)) do
  aout += asigs[kindx]
  kindx += 1
od

xout aout

endop

instr 1
asigs[] init 3
asigs[0] = vco2:a(0.25, 440)
asigs[1] = vco2:a(0.25, 880)
asigs[2] = vco2:a(0.25, 1320)

aout = mix_to_mono(asigs)

outs aout, aout

endin



i1 0 1.0



On Sun, Aug 30, 2015 at 12:15 PM, peiman khosravi
 wrote:
> Following up on my earlier array question, is there a simple way of mixing
> the audio channels represented in a signal array into a single channel? So
> for instance, I'd like a soundfile with an arbitrary number of channels to
> be mixed down to mono:
>
> instr 2
> asig[] diskin2 "$FILE", 100
> aMonoMix asig ;something like this??
> out aMonoMix
> endin
>
> Perhaps a UDO? but I can't quite imagine how that would work with a signal
> array.
>
> Many Thanks
> Peiman
>
>
> www.peimankhosravi.co.uk || RSS Feed || Concert News
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-30 18:41
Fromjoachim heintz
SubjectRe: mixing the lemets of a signal array
very nice code, steven.  i tried something similar with a recursive udo, 
but your code is much smarter.  much to learn from it!
best -
	joachim

Am 30.08.2015 um 19:30 schrieb Steven Yi:
> I just tried this and it seems to work:
>
> 
> 
>
> sr  = 44100
> ksmps = 1
> nchnls  = 2
> 0dbfs = 1
>
> opcode mix_to_mono, a, a[]
> asigs[] xin
> aout = 0
> kindx = 0
>
> until (kindx >= lenarray(asigs)) do
>    aout += asigs[kindx]
>    kindx += 1
> od
>
> xout aout
>
> endop
>
> instr 1
> asigs[] init 3
> asigs[0] = vco2:a(0.25, 440)
> asigs[1] = vco2:a(0.25, 880)
> asigs[2] = vco2:a(0.25, 1320)
>
> aout = mix_to_mono(asigs)
>
> outs aout, aout
>
> endin
>
> 
> 
> i1 0 1.0
> 
> 
>
> On Sun, Aug 30, 2015 at 12:15 PM, peiman khosravi
>  wrote:
>> Following up on my earlier array question, is there a simple way of mixing
>> the audio channels represented in a signal array into a single channel? So
>> for instance, I'd like a soundfile with an arbitrary number of channels to
>> be mixed down to mono:
>>
>> instr 2
>> asig[] diskin2 "$FILE", 100
>> aMonoMix asig ;something like this??
>> out aMonoMix
>> endin
>>
>> Perhaps a UDO? but I can't quite imagine how that would work with a signal
>> array.
>>
>> Many Thanks
>> Peiman
>>
>>
>> www.peimankhosravi.co.uk || RSS Feed || Concert News
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Csound-users mailing list
>> Csound-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-users
>> Send bugs reports to
>>          https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-30 18:48
Frompeiman khosravi
SubjectRe: mixing the lemets of a signal array
AttachmentsNone  None  
Wow that's very nice Steven. I need to study it now.

Thanks
Peiman


On 30 August 2015 at 18:41, joachim heintz <jh@joachimheintz.de> wrote:
very nice code, steven.  i tried something similar with a recursive udo,
but your code is much smarter.  much to learn from it!
best -
        joachim

Am 30.08.2015 um 19:30 schrieb Steven Yi:
> I just tried this and it seems to work:
>
> <CsoundSynthesizer>
> <CsInstruments>
>
> sr  = 44100
> ksmps = 1
> nchnls  = 2
> 0dbfs = 1
>
> opcode mix_to_mono, a, a[]
> asigs[] xin
> aout = 0
> kindx = 0
>
> until (kindx >= lenarray(asigs)) do
>    aout += asigs[kindx]
>    kindx += 1
> od
>
> xout aout
>
> endop
>
> instr 1
> asigs[] init 3
> asigs[0] = vco2:a(0.25, 440)
> asigs[1] = vco2:a(0.25, 880)
> asigs[2] = vco2:a(0.25, 1320)
>
> aout = mix_to_mono(asigs)
>
> outs aout, aout
>
> endin
>
> </CsInstruments>
> <CsScore>
> i1 0 1.0
> </CsScore>
> </CsoundSynthesizer>
>
> On Sun, Aug 30, 2015 at 12:15 PM, peiman khosravi
> <peimankhosravi@gmail.com> wrote:
>> Following up on my earlier array question, is there a simple way of mixing
>> the audio channels represented in a signal array into a single channel? So
>> for instance, I'd like a soundfile with an arbitrary number of channels to
>> be mixed down to mono:
>>
>> instr 2
>> asig[] diskin2 "$FILE", 100
>> aMonoMix asig ;something like this??
>> out aMonoMix
>> endin
>>
>> Perhaps a UDO? but I can't quite imagine how that would work with a signal
>> array.
>>
>> Many Thanks
>> Peiman
>>
>>
>> www.peimankhosravi.co.uk || RSS Feed || Concert News
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Csound-users mailing list
>> Csound-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-users
>> Send bugs reports to
>>          https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here