Csound Csound-dev Csound-tekno Search About

[Csnd] local sample rate

Date2025-04-17 13:54
FromParham Izadyar
Subject[Csnd] local sample rate
hello everyone -

finally i managed to install csound 7 and im trying to use oversample opcode, i read the link:

https://github.com/csound/manual/blob/csound7/opcodes/oversample.xml

but unfortunately i dont really understand how should i set the inputs, so i wrote this:


sr = 48000

opcode oversr, 0,0
  oversample(4*sr)
endop

instr 1
oversr
aSound poscil 0.2, 42000
outall aSound
endin   


but it wont do anything. perhaps i set the input wrong? there is no error but local sample rate is not set either. so can anyone help ?

thank you -
parham 

Csound mailing list
Csound@listserv.heanet.ie
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

Date2025-04-17 14:30
FromParham Izadyar
SubjectRe: [Csnd] local sample rate
i also tried this:

sr = 48000

opcode oversr, 0,0

oversample(4)

aSound poscil 0.2, 42000

outall aSound

endop


instr 1

oversr

endin


it does something but not what i'm expecting. it should be 4*48000 = 192000. and i should not hear a sound. but i do. so please help me understand it. thank you


On Thu, Apr 17, 2025 at 4:24 PM Parham Izadyar <parhamizadyar93@gmail.com> wrote:
hello everyone -

finally i managed to install csound 7 and im trying to use oversample opcode, i read the link:

https://github.com/csound/manual/blob/csound7/opcodes/oversample.xml

but unfortunately i dont really understand how should i set the inputs, so i wrote this:


sr = 48000

opcode oversr, 0,0
  oversample(4*sr)
endop

instr 1
oversr
aSound poscil 0.2, 42000
outall aSound
endin   


but it wont do anything. perhaps i set the input wrong? there is no error but local sample rate is not set either. so can anyone help ?

thank you -
parham

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2025-04-17 21:45
FromVictor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] [EXTERNAL] [Csnd] local sample rate
The oversample opcode controls the local sampling rate of a UDO. 

In your tests, you were doing things that should never be done, for
example use an opcode of the out family in a UDO, that’s bound to
be problematic particularly when you have diverging sampling rates.

With UDOs, you use xin/xout to transfer data in/out of it. The oversample
opcode then sets the local sampling rate and adds sr converters for 
each one of the input and output signals.

All normal UDO rules apply here, the only difference is that it runs
at a higher sampling rate.

Here is an example of local sampling rate. We have an opcode
with three input signals, which are upsampled to twice the 
outside sampling rate, and one output signal, which is
downsampled to half the local sampling rate,

opcode SVF,a,akk
oversample 2
a1,kcf,kq xin
alow, ahigh, aband svfilter a1, kcf, kq
  xout alow
endop

The opcode is then used as normal, e.g.

instr 1
a1 vco2 p4, p5
kcf expseg 4000, p3, 1000
kq = 5
a2 SVF a1, kcf, kq
   out a2
endin

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 17 Apr 2025, at 14:30, Parham Izadyar  wrote:
> 
> *Warning*
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> i also tried this: 
> 
> sr = 48000
> opcode oversr, 0,0
> oversample(4)
> aSound poscil 0.2, 42000
> outall aSound
> endop
> 
> instr 1
> oversr
> endin
> 
> it does something but not what i'm expecting. it should be 4*48000 = 192000. and i should not hear a sound. but i do. so please help me understand it. thank you
> 
> On Thu, Apr 17, 2025 at 4:24 PM Parham Izadyar  wrote:
> hello everyone -
> 
> finally i managed to install csound 7 and im trying to use oversample opcode, i read the link:
> 
> https://github.com/csound/manual/blob/csound7/opcodes/oversample.xml
> 
> but unfortunately i dont really understand how should i set the inputs, so i wrote this:
> 
> 
> sr = 48000
> 
> opcode oversr, 0,0
>   oversample(4*sr)
> endop
> 
> instr 1
> oversr
> aSound poscil 0.2, 42000
> outall aSound
> endin   
> 
> 
> but it wont do anything. perhaps i set the input wrong? there is no error but local sample rate is not set either. so can anyone help ?
> 
> thank you -
> parham 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> 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 Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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

Date2025-04-18 15:29
FromParham Izadyar
SubjectRe: [Csnd] [EXTERNAL] [Csnd] local sample rate
thank you dear victor - that makes sense, now i understand how to use it.

On Fri, Apr 18, 2025 at 12:15 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
The oversample opcode controls the local sampling rate of a UDO.

In your tests, you were doing things that should never be done, for
example use an opcode of the out family in a UDO, that’s bound to
be problematic particularly when you have diverging sampling rates.

With UDOs, you use xin/xout to transfer data in/out of it. The oversample
opcode then sets the local sampling rate and adds sr converters for
each one of the input and output signals.

All normal UDO rules apply here, the only difference is that it runs
at a higher sampling rate.

Here is an example of local sampling rate. We have an opcode
with three input signals, which are upsampled to twice the
outside sampling rate, and one output signal, which is
downsampled to half the local sampling rate,

opcode SVF,a,akk
oversample 2
a1,kcf,kq xin
alow, ahigh, aband svfilter a1, kcf, kq
  xout alow
endop

The opcode is then used as normal, e.g.

instr 1
a1 vco2 p4, p5
kcf expseg 4000, p3, 1000
kq = 5
a2 SVF a1, kcf, kq
   out a2
endin

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 17 Apr 2025, at 14:30, Parham Izadyar <parhamizadyar93@GMAIL.COM> wrote:
>
> *Warning*
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> i also tried this:
>
> sr = 48000
> opcode oversr, 0,0
> oversample(4)
> aSound poscil 0.2, 42000
> outall aSound
> endop
>
> instr 1
> oversr
> endin
>
> it does something but not what i'm expecting. it should be 4*48000 = 192000. and i should not hear a sound. but i do. so please help me understand it. thank you
>
> On Thu, Apr 17, 2025 at 4:24 PM Parham Izadyar <parhamizadyar93@gmail.com> wrote:
> hello everyone -
>
> finally i managed to install csound 7 and im trying to use oversample opcode, i read the link:
>
> https://github.com/csound/manual/blob/csound7/opcodes/oversample.xml
>
> but unfortunately i dont really understand how should i set the inputs, so i wrote this:
>
>
> sr = 48000
>
> opcode oversr, 0,0
>   oversample(4*sr)
> endop
>
> instr 1
> oversr
> aSound poscil 0.2, 42000
> outall aSound
> endin   
>
>
> but it wont do anything. perhaps i set the input wrong? there is no error but local sample rate is not set either. so can anyone help ?
>
> thank you -
> parham
>
> Csound mailing list
> Csound@listserv.heanet.ie
> 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 Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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