Csound Csound-dev Csound-tekno Search About

[Csnd] Pitch troubles with grain opcode

Date2023-05-31 19:28
FromMaximilian Marcoll
Subject[Csnd] Pitch troubles with grain opcode
Hi Everyone!

I ran into a little problem concerning the grain opcode in class today and I could not figure out what was going on,
maybe you can help:

Whenever the pitch in the example below is not exactly the base frequency as calculated via 

sr / ftlen(<soundfiletable>)

I’m getting aliases or similar artefacts.

I can’t seem to figure out what I’m doing wrong. 
Any hint would be much appreciated!

Cheers

Max



<CsoundSynthesizer>
<CsInstruments>

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

instr 1 


    insnd = 1 
    ibasfreq = sr / ftlen(insnd)  

    kPitchoff = p4

    kAmp = 0.5 
    kPitch = ibasfreq 
    kDens = 15 
    kAmpoff = 0.0 
    kGrainDur = 0.5
    igfn = insnd 
    iwfn = 2 
    imgdur = 0.8 

    asig grain kAmp, kPitch, kDens, kAmpoff, kPitchoff, kGrainDur, igfn, iwfn, imgdur 

    out asig

endin


</CsInstruments> 
<CsScore>

f1  0   524288   1 "instrument.aif" 0 0 0; read soundfile with Gen01 into f-table
f2  0   16384   20 6 1       ;Gaussian window 

i1 0 5 0 
i1 5 5 .01

   
</CsScore>
</CsoundSynthesizer>

________________________________

Prof. Maximilian Marcoll
Studio Director
Studio for Electroacoustic Music (SEAM)
University of Music Franz Liszt Weimar
Bauhaus University Weimar













Date2023-06-01 01:59
FromST Music
SubjectRe: [Csnd] Pitch troubles with grain opcode
I think without the source audio you're using it's hard to know what issue you may be having as grain settings don't affect all audio similarly. The window and xdens values, for example, can have a large effect. And your expectations are unknown.

Perhaps you could also upload the instrument.aif file somewhere and a link to it.


On Wed, May 31, 2023, 2:38 p.m. Maximilian Marcoll <maximilian.marcoll@hfm-weimar.de> wrote:
Hi Everyone!

I ran into a little problem concerning the grain opcode in class today and I could not figure out what was going on,
maybe you can help:

Whenever the pitch in the example below is not exactly the base frequency as calculated via 

sr / ftlen(<soundfiletable>)

I’m getting aliases or similar artefacts.

I can’t seem to figure out what I’m doing wrong. 
Any hint would be much appreciated!

Cheers

Max



<CsoundSynthesizer>
<CsInstruments>

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

instr 1 


    insnd = 1 
    ibasfreq = sr / ftlen(insnd)  

    kPitchoff = p4

    kAmp = 0.5 
    kPitch = ibasfreq 
    kDens = 15 
    kAmpoff = 0.0 
    kGrainDur = 0.5
    igfn = insnd 
    iwfn = 2 
    imgdur = 0.8 

    asig grain kAmp, kPitch, kDens, kAmpoff, kPitchoff, kGrainDur, igfn, iwfn, imgdur 

    out asig

endin


</CsInstruments> 
<CsScore>

f1  0   524288   1 "instrument.aif" 0 0 0; read soundfile with Gen01 into f-table
f2  0   16384   20 6 1       ;Gaussian window 

i1 0 5 0 
i1 5 5 .01

   
</CsScore>
</CsoundSynthesizer>

________________________________

Prof. Maximilian Marcoll
Studio Director
Studio for Electroacoustic Music (SEAM)
University of Music Franz Liszt Weimar
Bauhaus University Weimar












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

Date2023-06-01 07:57
FromMaximilian Marcoll
SubjectRe: [Csnd] Pitch troubles with grain opcode
hi!

Of Course, sorry!

The file is accessible here:




Cheers

M


________________________________

Prof. Maximilian Marcoll
Studio Director
Studio for Electroacoustic Music (SEAM)
University of Music Franz Liszt Weimar
Bauhaus University Weimar







On 1. Jun 2023, at 02:59, ST Music <stunes6556@GMAIL.COM> wrote:

I think without the source audio you're using it's hard to know what issue you may be having as grain settings don't affect all audio similarly. The window and xdens values, for example, can have a large effect. And your expectations are unknown.

Perhaps you could also upload the instrument.aif file somewhere and a link to it.


On Wed, May 31, 2023, 2:38 p.m. Maximilian Marcoll <maximilian.marcoll@hfm-weimar.de> wrote:
Hi Everyone!

I ran into a little problem concerning the grain opcode in class today and I could not figure out what was going on,
maybe you can help:

Whenever the pitch in the example below is not exactly the base frequency as calculated via 

sr / ftlen(<soundfiletable>)

I’m getting aliases or similar artefacts.

I can’t seem to figure out what I’m doing wrong. 
Any hint would be much appreciated!

Cheers

Max



<CsoundSynthesizer>
<CsInstruments>

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

instr 1 


    insnd = 1 
    ibasfreq = sr / ftlen(insnd)  

    kPitchoff = p4

    kAmp = 0.5 
    kPitch = ibasfreq 
    kDens = 15 
    kAmpoff = 0.0 
    kGrainDur = 0.5
    igfn = insnd 
    iwfn = 2 
    imgdur = 0.8 

    asig grain kAmp, kPitch, kDens, kAmpoff, kPitchoff, kGrainDur, igfn, iwfn, imgdur 

    out asig

endin


</CsInstruments> 
<CsScore>

f1  0   524288   1 "instrument.aif" 0 0 0; read soundfile with Gen01 into f-table
f2  0   16384   20 6 1       ;Gaussian window 

i1 0 5 0 
i1 5 5 .01

   
</CsScore>
</CsoundSynthesizer>

________________________________

Prof. Maximilian Marcoll
Studio Director
Studio for Electroacoustic Music (SEAM)
University of Music Franz Liszt Weimar
Bauhaus University Weimar












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


Date2023-06-01 08:35
Fromjoachim heintz
SubjectRe: [Csnd] Pitch troubles with grain opcode
hi max -

i only have my laptop speakers right now, but your example sounds 
correct to me.  it adds some random pitch deviations (upwards).

did you expect a transposition?  this would be the kpitch parameter.

cheers -
	joachim


On 01/06/2023 08:57, Maximilian Marcoll wrote:
> hi!
> 
> Of Course, sorry!
> 
> The file is accessible here:
> 
> 
> https://www.dropbox.com/s/tpb2ii7o5w3ricu/instrument.aif?dl=1 
> 
> 
> 
> Cheers
> 
> M
> 
> 
> ________________________________
> 
> Prof. Maximilian Marcoll
> Studio Director
> Studio for Electroacoustic Music (SEAM)
> University of Music/Franz Liszt/Weimar
> Bauhaus University Weimar
> 
> http://seam.hfm-weimar.de/ 
> 
> 
> 
> 
> 
> 
>> On 1. Jun 2023, at 02:59, ST Music > > wrote:
>>
>> I think without the source audio you're using it's hard to know what 
>> issue you may be having as grain settings don't affect all audio 
>> similarly. The window and xdens values, for example, can have a large 
>> effect. And your expectations are unknown.
>>
>> Perhaps you could also upload the instrument.aif file somewhere and a 
>> link to it.
>>
>>
>> On Wed, May 31, 2023, 2:38 p.m. Maximilian Marcoll 
>> > > wrote:
>>
>>     Hi Everyone!
>>
>>     I ran into a little problem concerning the grain opcode in class
>>     today and I could not figure out what was going on,
>>     maybe you can help:
>>
>>     Whenever the pitch in the example below is not exactly the base
>>     frequency as calculated via
>>
>>     sr / ftlen()
>>
>>     I’m getting aliases or similar artefacts.
>>
>>     I can’t seem to figure out what I’m doing wrong.
>>     Any hint would be much appreciated!
>>
>>     Cheers
>>
>>     Max
>>
>>
>>
>>     
>>     
>>
>>     sr = 44100
>>     ksmps = 32
>>     nchnls = 1
>>     0dbfs = 1
>>
>>     instr 1
>>
>>
>>         insnd = 1
>>         ibasfreq = sr / ftlen(insnd)
>>
>>         kPitchoff = p4
>>
>>         kAmp = 0.5
>>         kPitch = ibasfreq
>>         kDens = 15
>>         kAmpoff = 0.0
>>         kGrainDur = 0.5
>>         igfn = insnd
>>         iwfn = 2
>>         imgdur = 0.8
>>
>>         asig grain kAmp, kPitch, kDens, kAmpoff, kPitchoff, kGrainDur,
>>     igfn, iwfn, imgdur
>>
>>         out asig
>>
>>     endin
>>
>>
>>     
>>     
>>
>>     f1  0   524288   1 "instrument.aif" 0 0 0; read soundfile with
>>     Gen01 into f-table
>>     f2  0   16384   20 6 1       ;Gaussian window
>>
>>     i1 0 5 0
>>     i1 5 5 .01
>>
>>     
>>     
>>
>>     ________________________________
>>
>>     Prof. Maximilian Marcoll
>>     Studio Director
>>     Studio for Electroacoustic Music (SEAM)
>>     University of Music/Franz Liszt/Weimar
>>     Bauhaus University Weimar
>>
>>     http://seam.hfm-weimar.de/ 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>     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