Connect with us

Melody generator

Discussion in 'Electronics Homework Help' started by xNihex, Dec 28, 2019.

Scroll to continue with content
  1. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    Best regards,
    I need help to create a melody generator using pic16f1939 microcontroller. To be more precise, I need a code that would do this function.
    Thanks everyone.
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,511
    1,960
    Nov 17, 2011
    We will not do your homework for you. What you can expect is support to find a solution in your own way.
    Start by telling or showing us what you have achieved so far and where you are stuck.
     
  3. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    I have this record in the notes. Would anyone be able to read and digitally record the duration of individual notes and breaks.Or should someone help me with this because I am a music amateur..

    Screenshot_1.png
     
  4. bertus

    bertus

    207
    70
    Nov 8, 2019
    Last edited: Jan 7, 2020
  5. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    I don't know read this but
    thank you for the guidance
     
  6. bertus

    bertus

    207
    70
    Nov 8, 2019
    Hello,

    There are two pieces that are repeated, I marked the start and end with think red arrows.
    I also annotated what is played the first and secomd time:

    Music_score_annotated.png

    Bertus
     
  7. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    Thank you for the explanation.
     
  8. bertus

    bertus

    207
    70
    Nov 8, 2019
    Last edited: Jan 7, 2020
  9. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    Hello,
    Can you read the first part of my example?
     
  10. mrgrtt123

    mrgrtt123

    8
    7
    Jan 6, 2020
    If this is school work, you should probably pay attention to your class and ask the professor if you are having a hard time reading the samples. There are a lot of tutorials online that you can check to get more ideas regarding this project.
     
    xNihex, bertus and Harald Kapp like this.
  11. bertus

    bertus

    207
    70
    Nov 8, 2019
    Hello,

    Looking at the pic you mention, it has only 28k of flash on board:
    https://www.microchip.com/wwwproducts/en/PIC16F1939
    How would you program a melody in the pic?
    You would need information on the pitch and duration of the notes to be played.
    You will need to find a way to "store" your melody.

    Bertus
     
  12. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    I know about that Bertus, butI have no idea how to do it.
    Btw I just started working with pic microcontroller.
    In fact, I'm also an amateur in programming.. :)
     
  13. bertus

    bertus

    207
    70
    Nov 8, 2019
    Last edited: Jan 8, 2020
  14. Harald Kapp

    Harald Kapp Moderator Moderator

    9,511
    1,960
    Nov 17, 2011
    There is at least one library to generate sound snippets (tones) of defined frequency and duration from a pic µc and a discussion on the topic here.
    You'll have to translate the notes of the sheet into a set of frequency/duration pairs (e.g. in the form of an array) and loop through them in your program, calling each tone for the specified duration (duration being a function of the Tempo and the Note Value)
     
    bertus likes this.
  15. xNihex

    xNihex

    7
    0
    Dec 28, 2019
    Thank you all
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-