justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.

Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: I'm writing a synth in C using portaudio, I am generating sounds via both mathematical functions and hardcoded waveforms, it is great fun! However I get a lot of clicks and pops while playing it (I have midi support), any tips to remedy that?
Asked by Anastasis (94.67.83.x) on November 23 2023, 3:26pm
Reply on November 24 2023, 8:17pm:
    Is it in the generated output or is it due to audio device underruns? If the latter, make sure nothing you're doing spends too much time -- if you're generating 10ms of audio, you shouldn't go above 10ms of CPU time (or ideally, nowhere near 10ms of CPU time). And if you have to take a lock, make sure no other thread holds that lock for very long.

  • Posted by Anastasis (94.67.83.x) on November 24 2023, 9:19pm:
    It's not underruns, I have very simple sample generation so it's pretty fast, it's actually in the generated output. I tried smoothening every value change possible to remove and sudden "voltage" changes in the wave but I still get clicks and pops

  • Posted by Gio (94.65.207.x) on November 25 2023, 1:16pm:
    @Anastasis: maybe when you use Pa_OpenStream you could try to test framesPerBuffer with paFramesPerBufferUnspecified and also you could check PaStreamFlags like paDitherOff, paClipOff to see if it makes any difference.

  • Posted by Justin on November 25 2023, 9:44pm:
    You definitely need to ramp things when you turn something on or off (or adjust the volume of a signal) in response to an event... any discontinuity will be a click!

    Your Name:   -- Site Owner's Name:  (for human-verification)


[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2024 Justin Frankel. | RSS