Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digital playback: reduce initial click #23

Open
stefandrissen opened this issue Oct 1, 2023 · 2 comments
Open

Digital playback: reduce initial click #23

stefandrissen opened this issue Oct 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@stefandrissen
Copy link
Owner

stefandrissen commented Oct 1, 2023

When playing back samples, the amplitude varies from a middle point, the middle point is half maximum volume.
Initially, all devices are at "volume" 0, so as soon as playback starts volume jumps from 0 to half maximum volume, resulting in a click.

To reduce the click I tried gradually increasing volume from 0 to half maximum volume in the @buffer.init routines - but this does not seem to be helping and is even making things worse when playing a second mod, watch the ramped click between mod 1 and 2 of EFTPOTRM:

image

@stefandrissen
Copy link
Owner Author

I seem to be doing something a bit silly when initially filling the buffers. There are two buffers, each populated with sample data for two channels:

buffer 1:

  • channel 1: 00...77
  • channel 2: 00...77

buffer 2:

  • channel 1: 00...77
  • channel 2: 00...77

When using SAA1099 there are not two discrete channels, the sample data is interleaved for both, channel 2, channel 5, channel 2, channel 5, etc.

Also buffer 2 is played after buffer 1, so there is an additional ramp.

@stefandrissen stefandrissen added the enhancement New feature or request label Dec 2, 2023
@AntonyDTA
Copy link

I already commented that it couldn't be solved, but then I had some ideas and it seems to be quite a bit better. I gradually reduced the most time-consuming part of the program to only one OUT instruction, which is only 16T (375000Hz) in the border. Volume now changes from &00 to &88 in 192 levels before envelope control is turned on.
Here is a short break in amplitude, it seems that turning on the envelope first mutes the sound and immediately sets it back to maximum (%001=max.amplitude).
I haven't tested it on a real Sam.

Not everything is visible in the 44100 Hz file, it's just a rough check.
RstSAA_pwm12
RstSAA_Env_03_pwm12.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants