Using a PCM5102A dac with typical performance of SNR 112dB, Dynamic Range 112dB, THD+N@-1dBFS -93dB.
The envelope is shaped as a raised cosine over 512 samples at Fs=48kHz.
reg signed [15:0] sine_table; always @(sound_index) begin case (sound_index) 7'b0000000: begin sine_table <= 16'b0000000000000000; end // 0: 0 // 7'b1001111: begin sine_table <= 16'b1111010111110110; end // 79: -2570
reg signed [15:0] shape; always @(envelope) begin case (envelope) 9'b 000000000 : begin shape <= 16'b0000000000000000; end // 0: 0 // 9'b 111111111 : begin shape <= 16'b0111111111111110; end // 511: 32766
reg signed [31:0] mult; // sine_table: signed 16bit, shape: signed 16-bit always @(sound_index) begin mult <= shape * sine_table; end
always @ (posedge clk_myown or negedge res_n) begin if ( res_n == 1'b0 ) daword <= 6'b00_0000; else begin daword <= daword + 6'b00_0001; if ( daword[4:0] == 5'b0_0000 ) // for each 32-bit, or for each L and R dadata <= {mult[30:0], 1'b0}; else dadata <= {dadata[30:0], 1'b0}; end end
The sidetone signal is analogue captured at Fs=48kHz.