| Author | Message | 
 
| ullyssen 
 
 
 Joined: Sep 22, 2017
 Posts: 4
 Location: everywhere
 
 | 
|  Posted: Fri Sep 22, 2017 4:57 am    Post subject:
Extreme level peak from SqrOsc oscillator |    |   
| 
 |  
| Hi! 
 I need some strange artifact to be removed from ChucK output.
 
 I created the following code: simple function to control square oscillator:
 
 
  	  | Code: |  	  | fun void sqrG(int tone, int time, int silence)
 {
 SqrOsc o => ADSR e => dac;
 tone => o.freq;
 e.set(0::samp,2::samp,0.5,1::samp);
 e.keyOn();
 time::ms => now;
 e.keyOff();
 silence::ms => now;
 }
 
 | 
 
 Every time this function is executed, resulting square signal contains extreme level peak right at the beginning, as shown on this screenshot from Audition editor:
 
 
   
 Interesting is that all other oscillator types (SinOsc, TriOsc, SawOsc) don't produce this artifact.
 |  | 
| Back to top |  | 
 
|  | 
 
| gabbagabi 
 
  
 Joined: Nov 29, 2008
 Posts: 652
 Location: Berlin by n8
 Audio files: 23
 
 | 
|  Posted: Fri Sep 22, 2017 8:17 am    Post subject: |    |   
| 
 |  
| hi, what ur using to measure?
 may a soundcard oszilloskope?
 if so soundcards often have caps on there inputs that could provoke this behaviour on square waves.
 |  | 
| Back to top |  | 
 
|  | 
 
| ullyssen 
 
 
 Joined: Sep 22, 2017
 Posts: 4
 Location: everywhere
 
 | 
|  Posted: Fri Sep 22, 2017 9:13 am    Post subject: |    |   
| 
 |  
|  	  | g.gabba wrote: |  	  | hi, what ur using to measure?
 may a soundcard oszilloskope?
 if so soundcards often have caps on there inputs that could provoke this behaviour on square waves.
 | 
 
 No, output was directly recorded to WAV file and analysed in Audtion CS6 editor.
 |  | 
| Back to top |  | 
 
|  | 
 
| blue hell Site Admin
 
  
 Joined: Apr 03, 2004
 Posts: 24489
 Location: The Netherlands, Enschede
 Audio files: 298
 G2 patch files: 320
 
 | 
|  Posted: Fri Sep 22, 2017 9:20 am    Post subject: |    |   
| 
 |  
| It looks like the  anti-aliasing behaves a bit strange directly after initialization ... it might be easiest to apply some startup envelope to mask the effect ... _________________
 Jan
 also .. could someone please turn down the thermostat a bit.
 
  |  | 
| Back to top |  | 
 
|  | 
 
| ullyssen 
 
 
 Joined: Sep 22, 2017
 Posts: 4
 Location: everywhere
 
 | 
|  Posted: Fri Sep 22, 2017 9:54 am    Post subject: |    |   
| 
 |  
|  	  | Blue Hell wrote: |  	  | It looks like the  anti-aliasing behaves a bit strange directly after initialization ... it might be easiest to apply some startup envelope to mask the effect ... | 
 
 Could you provide me with some code example?
 |  | 
| Back to top |  | 
 
|  | 
 
| blue hell Site Admin
 
  
 Joined: Apr 03, 2004
 Posts: 24489
 Location: The Netherlands, Enschede
 Audio files: 298
 G2 patch files: 320
 
 | 
|  Posted: Fri Sep 22, 2017 9:59 am    Post subject: |    |   
| 
 |  
| Sorry, I'm not able to do so ... but I could interpret your image   
 Maybe Antimon can come up with something? (when he is not too busy preparing for two shows to run ...)
 _________________
 Jan
 also .. could someone please turn down the thermostat a bit.
 
  |  | 
| Back to top |  | 
 
|  | 
 
| ullyssen 
 
 
 Joined: Sep 22, 2017
 Posts: 4
 Location: everywhere
 
 | 
|  Posted: Fri Sep 22, 2017 1:09 pm    Post subject: |    |   
| 
 |  
| I've changed the code, so 
 
  	  | Code: |  	  | SqrOsc o => ADSR e => dac; | 
 
 became
 
 
 
  	  | Code: |  	  | SqrOsc o => Dyno limiter1 => ADSR e => Dyno limiter2 => dac; | 
 
 and then I've activated both limiter instances.
 Yet this peak still emerges.
 |  | 
| Back to top |  | 
 
|  | 
 
| Grumble 
 
  
 Joined: Nov 23, 2015
 Posts: 1319
 Location: Netherlands
 Audio files: 30
 
 | 
|  Posted: Mon Sep 25, 2017 3:09 am    Post subject: |    |   
| 
 |  
| What strikes me as strange is that ringing occurs BEFORE a step of the signal as well as AFTER the step. 
  _________________
 my synth
 |  | 
| Back to top |  | 
 
|  | 
 
| blue hell Site Admin
 
  
 Joined: Apr 03, 2004
 Posts: 24489
 Location: The Netherlands, Enschede
 Audio files: 298
 G2 patch files: 320
 
 | 
|  Posted: Mon Sep 25, 2017 5:15 am    Post subject: |    |   
| 
 |  
| Heh, ringing before means that it is not ringing but bandlimiting instead being in  effect. _________________
 Jan
 also .. could someone please turn down the thermostat a bit.
 
  |  | 
| Back to top |  | 
 
|  | 
 
| blue hell Site Admin
 
  
 Joined: Apr 03, 2004
 Posts: 24489
 Location: The Netherlands, Enschede
 Audio files: 298
 G2 patch files: 320
 
 | 
|  Posted: Mon Sep 25, 2017 5:17 am    Post subject: |    |   
| 
 |  
| You can  think of it being a square wave approximated by sines. _________________
 Jan
 also .. could someone please turn down the thermostat a bit.
 
  |  | 
| Back to top |  | 
 
|  | 
 
|  |