- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello! Could you help me in my project? My project is a music generator using DE1 module. similar to this music box http://www.fpga4fun.com/musicbox3.html. When I pushed KEY0 push button, it will play Joy to the World. When I pushed KEY1, it will play Merry Xmas tune. Please help me as soon as possible. Thank you very much!!!!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As the link you included suggests you need to create ROM images, one for each tune you wish to play, containing all the samples and timing required by each tune. Your logic will then, based on a key press, replay the chosen samples (from the appropriate ROM) to the DAC on the DE1. You may well need to cascade a number of M4K memory blocks for the longer tunes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks a_x_h_75 for ur feedback. hmm my problem is i dont know how to create rom files. i have seen this code from this site utilizing only some codes I can understand. this is in russian http://marsohod.org/index.php/projects/6-playmusic http://marsohod.org/index.php/play-pmv . can i implement this in the DE1 board? please help me i am new to this. many thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I post a vhdl implementation of a rom. It's a non synchronous rom, so it behaves like a combinational circuit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
bertulus. thanks for the file! :-) now my problem is how i can relate the musical notes of Rudolf song to the verilog code. the beat of the notes e.g. quarter, half note and the tune of the notes of the song e.g. do ,re mi...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fpga4fun design uses a pwm signal to generate the tones. Each tone has frequency ( or period ) and a duration. You may write 2 roms, one for the period of each tone and the other for the lenght ( in pwm periods ) of the note. You read at same time both tables and get the all the information need to play this note. When finishes you increment a register and read the next value on table until end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oh. so you mean that the music.mif file is the one that dictates the notes of the song, e..g. do la fa mi re sol la...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. You get the notes from 2 tables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks! However im not sure what is the corresponding note the address and register are pertaining? If you could elaborate further. i have attached the screenshot of the .mif file. thank u
https://www.alteraforum.com/forum/attachment.php?attachmentid=7926- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regarding to the rom contents, for example if the 1st note is la ( 440Hz ) and system clock is 50MHz, you may store as first value in the rom table:
50MHz/440Hz = 113636 It's a huge value, you'll need many bits. You may slow down 50MHz so you get a smaller divisor number. If you generate a tick of 1MHz this divisor factor is: 1MHz/440Hz = 2273 ( this will be the first value on rom table ). In the second table you store the duration. For example, if the note lenght is 250ms and the note period: 1/440Hz=2,27ms The duration is 110 clock periods ( you put this as first value in the duration's table ). And so on.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alright, I'll chime (horrible pun!) in.
Have you considered a microcontroller? Not that I'm particularly partial to them but I've seen a couple of questions on this forum that would be much easier solved if you'd go with an AVR or PIC. Just think that for certain problems an FPGA is overkill :-) -Mux- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks bertulus. Sorry for the late reply, Mux. An Fpga application/project in music is required in my course. I can do it using arduino but in fpga it is difficult. if anybody can give me a less difficult code to understand. Thanks.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page