Skip to content

Fix onset click#319

Open
Allan-xmos wants to merge 3 commits into
xmos:developfrom
Allan-xmos:feature/fix_onset_click
Open

Fix onset click#319
Allan-xmos wants to merge 3 commits into
xmos:developfrom
Allan-xmos:feature/fix_onset_click

Conversation

@Allan-xmos

Copy link
Copy Markdown
Contributor

Wait for data on the port that isn't 0 or 1, send 55 while waiting

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the StandardPdmRxService::ThreadEntry() startup behavior to reduce audible onset artifacts by ignoring obviously invalid initial PDM reads and emitting a known fill pattern until valid-looking data arrives.

Changes:

  • Add a pre-start loop that reads the PDM port, fills outgoing blocks with 0x55 pattern data, and waits for “good” reads before switching to real samples.
  • Begin streaming blocks immediately during startup (with the fill pattern) while waiting for valid port data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


s_chan_out_word(this->c_pdm_blocks.end_a, reinterpret_cast<uint32_t>(ready_block));
}
if (data == 0x00000000 || data == 0xFFFFFFFF) {
Comment on lines +484 to +491
if(!phase){
this->phase = this->num_phases;
uint32_t* ready_block = this->blocks[0];
this->blocks[0] = this->blocks[1];
this->blocks[1] = ready_block;

s_chan_out_word(this->c_pdm_blocks.end_a, reinterpret_cast<uint32_t>(ready_block));
}
Comment on lines +479 to +482
// During boot, the PDM port may read all 0s or all 1s.
// Output 0x55 (zero) to the buffer until we get a valid frame.
uint32_t data = port_in(this->p_pdm_mics);
this->blocks[0][--phase] = 0x55555555;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

this->blocks[0] = this->blocks[1];
this->blocks[1] = ready_block;

s_chan_out_word(this->c_pdm_blocks.end_a, reinterpret_cast<uint32_t>(ready_block));
S[:,P:] = sig_in
return S

def boot_logic(self, pdm_signal: np.ndarray) -> np.ndarray:
Q = self.DecimationFactor
N_pcm = SAMPS_IN // self.DecimationFactor

pdm_signal = self.boot_logic(pdm_signal)
Comment on lines +89 to +92
CHANS, SAMPS_IN = pdm_signal.shape
BOOT_WORD = np.uint32(0x55555555)
spw = 32 // CHANS # PDM samples per channel packed per interleaved word
total_words = SAMPS_IN // spw
Comment on lines +479 to +481
// During boot, the PDM port may read all 0s or all 1s.
// Output 0x55 (zero) to the buffer until we get a valid frame.
uint32_t data = port_in(this->p_pdm_mics);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants