8-note Polyphonic Generation Example Project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Hi,

I've created a project based on some forum discussions regarding generating a polyphonic system.

Here is a project that can generate and mix up to 8 musical notes simultaneously.

It uses only one 8-bit VDAC and op-amp.  It does however use 9 DMA channels with 9 TDs.

Although the project can invoke specific musical notes (A0, C#1, E1, A1, C#2, E2, A2, C#3) by UART command   It can generate many musical notes from C0 (16.35 Hz) to C9 (15804.26 Hz) .  It can also generate frequencies in-between the musical notes if you want.

The project uses a UART @ 115.2Kbps 8N1 to signal which notes to turn ON or OFF.

  • '1' - note 1 ON at 110 Hz (A2)
  • '!' - note 1 OFF.
  • '2' - note 2 ON at 138.591 Hz (C#3)
  • '@' - note 2 OFF
  • '3' - note 3 ON at 164.814 Hz (E3)
  • '#' - note 3 OFF.
  • '4' - note 4 ON at 220.0 Hz (A3)
  • '$' - note 4 OFF
  • ... I hope you can see the pattern here ...
  • 'O' - ALL notes OFF.

If all notes are turned on you should get A major chord across 2 2/3 octaves.

There is API calls where you can enter your own note frequencies and will try to scale them as best as possible.

The UART can be replaced with switches if you want.

The code may not be elegant (or bug free).  However it is a proof of concept.

This project is a starting point for your projects.   Enjoy!

Requirements:

  • PSoC5LP
  • CY8CKIT-059.

This project can be adapted to other kits and PSoCs such as the PSoC3.

Here are some scope plots of the output.

Fig 1 - 220Hz

Len_CONSULTRON_1-1630497989825.png

Fig 2 - 110Hz + 220Hz

Len_CONSULTRON_0-1630497926642.png

Fig 3 - FFT of 110Hz + 220Hz + 440Hz (500Hz span)

Len_CONSULTRON_2-1630498050317.png

 

Len
"Engineering is an Art. The Art of Compromise."
2 Replies
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

To all,

I have a "compressed" version of the project.  I little less readable but more compact implementation.

Enjoy!

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Len,

Thanks for sharing the example project with the community.

Best Regards,
Vasanth

0 Likes