Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Frequency based implementation of AudioOut

2 posters

Go down  Message [Page 1 of 1]

1Frequency based implementation of AudioOut Empty Frequency based implementation of AudioOut Fri Jan 08, 2021 10:23 pm

acebrian



In order to remove the annoying audible clicks, I have rewritten the AudioOut to detect the input frequency and to generate a pure sine wave cycle.

The code is heavely based on Frequenciometer.

Attached patch and Arduino Mega example.

BTW, SimulIDE cannot compile INO files with a .h in the same folder. To solve it I have created a pseudo-library:

arduino-1.8.13/libraries/pitches/pitches.h

Best regards.
Attachments
Frequency based implementation of AudioOut Attachmentaudio_out.zip
Patch and example
You don't have permission to download attachments.
(7 Kb) Downloaded 4 times

arcachofo

arcachofo

Interesting solution, I will have a look.


BTW, SimulIDE cannot compile INO files with a .h in the same folder. To solve it I have created a pseudo-library:
As far as I know, simulide can compile ino files with .h in the folder.

arcachofo

arcachofo

About Audio Component:

Watching your code inspired me a solution that is working for me (without frequency generation).
Commited to rev 14.

acebrian



Cracking sound removed but there is still a pause approximately once per second on continuous tone generation.

In "Piano_button.ino" example, try to hold down one button some seconds. Same behavior in buzzer mode.

arcachofo wrote:About Audio Component:

Watching your code inspired me a solution that is working for me (without frequency generation).
Commited to rev 14.

arcachofo

arcachofo

Cracking sound removed but there is still a pause approximately once per second on continuous tone generation.

In "Piano_button.ino" example, try to hold down one button some seconds. Same behavior in buzzer mode.
I don't experience pauses.

Is the simulation running at 100%.
If not then it is possible that the stream is interrupted.

acebrian



In my computer the simulation real speed is about 93-94% and load is 100%.

I think that to reach a real speed of 100% is necessary a better computer.

arcachofo wrote:
Cracking sound removed but there is still a pause approximately once per second on continuous tone generation.

In "Piano_button.ino" example, try to hold down one button some seconds. Same behavior in buzzer mode.
I don't experience pauses.

Is the simulation running at 100%.
If not then it is possible that the stream is interrupted.

acebrian



Confirmed, if I compensate the event delay to match my simulation real speed in AudioOut module:

Simulator::self()->addEvent( 25*0.94e6, this ); // 25 us

Then the continuous sound works right.

acebrian wrote:In my computer the simulation real speed is about 93-94% and load is 100%.

I think that to reach a real speed of 100% is necessary a better computer.

arcachofo wrote:
Cracking sound removed but there is still a pause approximately once per second on continuous tone generation.

In "Piano_button.ino" example, try to hold down one button some seconds. Same behavior in buzzer mode.
I don't experience pauses.

Is the simulation running at 100%.
If not then it is possible that the stream is interrupted.

acebrian



Recompiling SimulIDE for Release instead of Debug improves performance a lot.

With Release executable I get simulation real speed near 100% and load 46%.

Of course, with this performance continuous sound generation works right without any patch.

acebrian wrote:Confirmed, if I compensate the event delay to match my simulation real speed in AudioOut module:

   Simulator::self()->addEvent( 25*0.94e6, this ); // 25 us

Then the continuous sound works right.

acebrian wrote:In my computer the simulation real speed is about 93-94% and load is 100%.

I think that to reach a real speed of 100% is necessary a better computer.

arcachofo wrote:
Cracking sound removed but there is still a pause approximately once per second on continuous tone generation.

In "Piano_button.ino" example, try to hold down one button some seconds. Same behavior in buzzer mode.
I don't experience pauses.

Is the simulation running at 100%.
If not then it is possible that the stream is interrupted.

arcachofo

arcachofo

Confirmed, if I compensate the event delay to match my simulation real speed in AudioOut module:

Simulator::self()->addEvent( 25*0.94e6, this ); // 25 us

Then the continuous sound works right.
Cool !!
Yes, that is the proper solution.
I will get the actual simulation speed and compensate for it.

cheers

arcachofo

arcachofo

The audio pauses at low simulation speeds should be solved in rev 18.

acebrian



Now audio works perfectly.

arcachofo wrote:The audio pauses at low simulation speeds should be solved in rev 18.

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum